Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ARami7
New Contributor I
961 Views

I dont want to upload arduino sketches, i want to open the sketch file directory and run it from ssh

Hi guys, im tired of uploading 1 sketch from arduino IDE to my sd card, and wait to boot my gen 2 for my code to run, can i please just have multiple sketch files in my sd card and run them from the console? example: cd /media/mmcblk0p1/testSketch1. " ? is this possible? i want to have multiple sketch files in my sd card ready for me to run from the console by invoking it's directory

11 Replies
Pedro_M_Intel
Employee
110 Views

Hello AdanChristo,

Yes, there is a way to upload several sketches to your Galileo and then start them whenever you like. Follow these steps to do so:

1. Upload your sketches and copy them into a different folder (uploaded sketches are found in /sketch) but do not change the sketch's name, if you need to identify them change the directory's name instead.

2. To start a specific sketch, stop clloader with the command systemctl stop clloader.service

3. Copy the sketch you want to start to the /sketch directory

4. Start clloader again with the command systemctl start clloader.service

Let me know if it works for you.

Peter.

ARami7
New Contributor I
110 Views

Currently in my SD card, i uploaded the 'Blink' example into my i g gen2 board, i ssh through wifi and typed this:

what am i doing wrong?

i also tried running the command in my sd card:

when i run this command, blinking stops momentarily, after half a second, my board keeps blinking.

Update:

i can move the 'sketch.elf' file into another directory.... or so it seems.. i use a command to create a new directory on my sd card and move 'sketches.elf' into new location, but wait! it not only does not get created, but my sketches.elf is gone!

*update:

figured out how to move 'sketch.elf' into 'sketches' directory, however.... when i delete sketch.elf file in '/sketch' and move 'sketch.elf' in '/sketches' i cant seem to activate the .elf file... tried both stop/start commands with no success...

ARami7
New Contributor I
110 Views

FTinetti
Honored Contributor I
110 Views

Hi,

I'm in trouble right now...

In the uclibc image (in the SD card) , the systemctl command does not exist...

I'm rrying to use the eglibc, but when I connect the Galileo USB to the laptop it is recognized as another device, not as a Galileo...

Maybe because I'm using a Gen 1 Galileo, maybe not, but in either case I'll have to solve my problem first, and later maybe coming back to this...

Fernando.

asss
Valued Contributor II
110 Views

Hi,

1. clloader works with /sketch/sketch.elf only. It will not work with other places.

So, systemctl [start|stop] clloader.service will call /sketch/sketch.elf only.

2. There is no problem to run sketch from a command line:

BR,

xbolshe

ARami7
New Contributor I
110 Views

hello, can you elaborate your command? how do i use it in my case? thanks

asss
Valued Contributor II
110 Views

Just type:

./sketch.elf /dev/ttyGS0

in the folder where you scketch is located.

BR,

xbolshe

FTinetti
Honored Contributor I
110 Views

Hi AdanChristo,

Starting with nothing loaded, i.e.

I load the Blink example. The LED starts blinking and in the /sketch directory:

systemctl does not work:

and I don't know why, I'm using the last (downloaded yesterday) egclibc yocto image...

Anyway, I'm able to stop the process with the killall command:

The first ps shows the sketch.elf is running and the second one shows it is not running anymore.

Now I rename the sketch.elf so that I remember what sketch is and start the sketch from the command line as suggested by xbolshe:

and the LED starts blinking again.

I stop this process running with ^C and load a second sketch, which actually does exactly the same as Blink and prints On/Off as the LED is HIGH/LOW respectively

and in the linux terminal:

i.e. the sketch.elf is the Blink2 sketch.

As before, I can stop the sketch, rename the file and restart the sketch with the new filename:

and

There is one side effect, though, which are the so called zombie processes, but I think they are not a problem so far...

HTH,

Fernando.

ARami7
New Contributor I
110 Views

u and xbolshe are good! thank you

** one last thing, instead of ^C to stop the process, what's another alternative? i ultimately want to automate launching programs but im having a hard time simulating ^C keystrokes, thanks

ARami7
New Contributor I
110 Views

FTinetti
Honored Contributor I
110 Views

AdanChristo wrote:

u and xbolshe are good! thank you

** one last thing, instead of ^C to stop the process, what's another alternative? i ultimately want to automate launching programs but im having a hard time simulating ^C keystrokes, thanks

You are welcome, it's good to see you are able to have your project going on.

You can use the killall command for stoping processes. Following the examples above:

./Blink.elf /dev/ttyGS0 &

(note the "&" at the end so that the process is started and you have the prompt at the terminal) you can use later

killall Blink.elf

and the sketch should stop running.

Fernando.

Reply