1 Reply Latest reply on Nov 3, 2014 2:06 PM by DiegoV_Intel

    Sketch switching


      I am making a small program that switches out /sketch/sketch.elf with previously compiled (and copied) sketches, in the end completely changing the active sketch (which is useful.)

      Sadly, though, it requires a person to hit the reset button on the board for the sketch change to take effect.

      Is there a way I can trigger a sketch reset of any sort without manually doing so? (Perhaps killing the sketch process and restarting it?)


      Also, I notice that the IDE copies over sketch.elf to /sketch/; Is there a way to make it copy the compiled .elf file to /home/root/sketches/{sketch name}.elf instead, and not have it trigger the reset?


      EDIT: I solved the underlined part of the question; I replaced

      "mv $target_download_name /sketch/sketch.elf; chmod +x /sketch/sketch.elf"

      in hardware/arduino/x86/tools/izmir/clupload_win.sh with

      "mv $target_download_name /home/root/sketches/$target_download_name; chmod +x /home/root/sketches/$target_download_name"

      and commented out the two commands above "# Execute the target download command".


      (Oh, and, hello from a new member =P)

        • 1. Re: Sketch switching

          Hi MuffinTastic,


          Two ways are coming to my mind. The first one is using a software reset so you don't have to push the reset button manually. You should use this command to reboot your board:




          The second way is killing the process and then restart it as you mentioned. To kill the process, you must know the PID of the process so you could use the following command:


          ps | grep /sketch/sketch.elf


          Then, with the known PID you can use the following command to kill it:


          kill -9 [PID]


          Let me know if this information is helpful for you.