How to RESET running code on Intel Galileo

I am working on Intel Galileo board(Linux running on board) and using arduino as development environment.

Now on getting a particular gpio pin(say digital pin 6) logic 1, I want to reset my code automatically. I want reset done by running sketch on its own(i.e. I don't have press RESET button).

I am not using SD card Image.

I am unable to interpret how it should be done.

I don't know anything about the Galileo but I don't think what you have in mind is a sensible strategy. There should be no need for a software reset.

If some condition is met the code should just run the appropriate function, or, perhaps return from the function to the higher level code or skip back to the beginning of the function. The key thing is to design the structure of your code so the appropriate response is possible.

If you need to do a full hardware reset, that is a different matter and, presumably, can be achieved with a switch as on an Arduino.

...R

If you want to reset it when a pin goes HIGH, connect the signal thru an inverter to the RESET pin.

Just add the following line to reset the sketch, without the inconvenience of a board reboot:

system("./opt/cln/galileo/galileo_sketch_reset_script.sh");