2
votes

I installed a simple arduino sketch from Arduino IDE to Intel Galileo Gen 2 board.

How do I stop and uninstall the sketch?

I used reset and reboot button, unplugged power supply but not much help.

2

2 Answers

2
votes

Just upload a blank program.

void setup() {

}

void loop() {

}

In your Arduino IDE, copy above code and press upload button. This will stop previously executing sketch.

Make sure you are connected to Intel board via micro USB and appropriate serial port is selected tool

1
votes

Sketches are run by the clloader command.

From its source:

Clloader will look for /sketch/sketch.elf and run it if found. Output from the sketch will be redirected back to /dev/ttyGS0

If clloader is HUPed while running a sketch it will terminate the sketch and wait for a command. If the sketch terminates the loader will revert back to waiting for a remote command.

This leads to an alternative approach:

  1. Delete or rename /sketch/sketch.elf
  2. Send the HUP signal to the clloader process (or you could also just restart the board)

Here's an example for clarity.

First, verify the sketch process is running.

root@galileo:/sketch# ps | grep sketch  
  ...
  230 root     18488 S    /sketch/sketch.elf /dev/pts/0
  ...

Find the clloader process id, rename the sketch executable, and HUP the loader.

root@galileo:/sketch# ps | grep clloader
  229 root      2268 S    /opt/cln/galileo/clloader --escape --binary --zmod
  ...
root@galileo:/sketch# mv sketch.elf sketch.bak
root@galileo:/sketch# kill -HUP 229

Sketch process is no longer running at this point. To restart the sketch...

root@galileo:/sketch# mv sketch.bak sketch.elf
root@galileo:/sketch# kill -HUP 229
root@galileo:/sketch# ps | grep sketch
  ...
  256 root     18488 R    /sketch/sketch.elf /dev/pts/0
  ...

Note that the clloader process id changes once the script is restarted.

root@galileo:/sketch# ps | grep clloader
  255 root      2268 S    /opt/cln/galileo/clloader --escape --binary --zmod
  ...