Kristoffer
Kristoffer

Reputation: 486

Get arm-none-eabi-gdb to load elf, continue, and then exit from commandline

I am working with a distributed embedded system, one that communicates over RF and are located far apart. For this reason I want to automate the flashing of new firmware on these while developing, they are all connected to a linux box and a stlink programmer that has a swd connection

What i am trying to do is to load the firmware by using the command in a bash script arm-none-eabi-gdb file.elf -ex "target extended-remote ip:3333" -ex "load" -ex "continue" -ex "quit" on every device, the problem with this is that i cannot have the program running while trying to quit gdb to restart it and connect to another one.

Any suggestions is much appreciated, i would preferably like one command for gdb that does load, continue and then exits completely. leaving the device running the new firmware.

Upvotes: 2

Views: 3757

Answers (1)

Kristoffer
Kristoffer

Reputation: 486

I found a solution to this. the "kill" command will reset the device, in this case it will then start without and attached debugger, which is fine since I can then later attach it if needed.

The final command became: arm-none-eabi-gdb $bin -q -ex "set confirm off" -ex "target extended-remote $ip:3333" -ex "load" -ex "kill" -ex "quit"

This will load the binary file in path $bin, onto the device with address $ip. the -q will remove version info, cleaning the terminal a bit. And the set confirmation off will remove the questions gdb asks sometimes.

Hope this is useful to anyone else!

Upvotes: 3

Related Questions