Download/run program?

Hello!

I would like to download a program to the target, run it, and let the target reenter debug mode after the program is done. For this I need three things:

  1. set registers (to pass parameters)

  2. resume execution on desired address

  3. let target execute instruction to go into debug mode.

While 2. is straight-forward, I can’t see how to do 1. and 3.

Any suggestions?

What’s the purpose of that program? The OpenOCD has an “algorithm” facility, that’s currently used for flash handling. This does exactly what you want, but it’s embedded in the OpenOCD code.

Depending on what you want to achieve, this may, or may not, be the right way.

Regards,

Dominic

Dominic:
What’s the purpose of that program?

Well, I did not want to disclose it before I have something working. But since you ask, the idea is to have a flash-program that runs completely on the target. So you do something like
load_binary spansion_algorithm 0x8100000
load_binary kernel 0x81001000
set r0 0x80000000  # address of the flash
resume erase
set r0 0x80000000  # address of the flash
set r1 0x81001000  # address of the contents which shall be flashed
resume flash_algorithm

With this, it would be possible to implement arbitrary flash algorithms without modifying openocd.

jw:
Hello!

I would like to download a program to the target, run it, and let the target reenter debug mode after the program is done. For this I need three things:

  1. set registers (to pass parameters)

  2. resume execution on desired address

  3. let target execute instruction to go into debug mode.

While 2. is straight-forward, I can’t see how to do 1. and 3.

Any suggestions?

maybe I’m silly, but isn’t this exactly the purpose of the gdb support? gdb is pretty easily scripted.