EmbDev.net

Forum: ARM programming with GCC/GNU tools Arm Flash programming, OpenOCD, GDB ?


von gahelton (Guest)


Rate this post
useful
not useful
I have some questions concerning programming the flash (for the purposes 
of debugging) for ARM microcontrollers. First, I am completely new, so 
please be gentle. I've spend quite a bit of time researching, but in 
many cases, more questions arise than answers.

My setup is as follows:
Eclipse Helios edition
Olimex ARM-USB-TINY debugger
Olimex LPC2103 eval board
Yagarto (GCC Build 4.5.1) I think
OpenOCD R204
GDB 7.1

The Olimex install CD was used to get a basic setup, but a new Yagarto 
install was performed to get the latest GCC build. Likewise an update of 
Eclipse was performed. Test software compiles fine.

Now comes debugging. Generally, I would like to debug in flash, so I 
need to upload the program into flash and execute. I've looked at the 
configuration files (*.cfg) that came on the Olimex CD, and many, many 
others from lots of sources. Problem is, there seems to be lots of ways 
to accomplish this (too many in fact).

First, there doesn't seem to be any commands in the config files from 
Olimex that programs flash. Looking through various websites and forums, 
there seems to be methods for letting GDB perform the flash programming, 
or OpenOCD.

For GDB, some commands in the config file for allowing GDB flash 
programming appear to be (partial):


Code:
#daemon configuration
telnet_port 4444
gdb_port 3333

#==============================
#setup gdb to program flash
gdb_memory_map enable
gdb_flash_program enable
gdb_breakpoint_override hard
#==============================



But there also seems be be a "source" GDB command that needs to be added 
somewhere in here as well. It looks like the "source" command calls 
another script file. Are the actual flash programming commands in this 
seperate script file ? Are these just OpenOCD "flash write_image" 
commands or what ? I've never seen the contents of this second script 
file.

There also appears to be a way to add the flash programming commands 
within the configuration file. If the "init" command is added after the 
configuration, then the flash programming commands (OpenOCD type 
commands like "flash write_image") could follow the init command to 
program flash. I say "appears" because I've never actually seen a 
complete config file like this.

Could someone please describe some of the flash programming/debugging 
options. I'm not interested in 1000 different ways of doing the same 
task - just a few good ones.

Thanks

von mksuth (Guest)


Rate this post
useful
not useful
I have the exact same question. Did you ever make any progress with 
this?

von Martin T. (mthomas) (Moderator)


Rate this post
useful
not useful
gahelton wrote:
(also in reply to the previous message)

> I have some questions concerning programming the flash (for the purposes
> of debugging) for ARM microcontrollers. First, I am completely new, so
> please be gentle. I've spend quite a bit of time researching, but in
> many cases, more questions arise than answers.
>
> My setup is as follows:
> Eclipse Helios edition
> Olimex ARM-USB-TINY debugger
> Olimex LPC2103 eval board
> Yagarto (GCC Build 4.5.1) I think
> OpenOCD R204
> GDB 7.1

I'm also using the gdb-hardware-debugging plugin. Depending on the 
version of Eclipse an additional file has to be downloaded - I have seen 
this issue with Helios (Eclipse bug 326176). Another option might be the 
Zylin plugin which offers similar functions (I have not used it so far 
so can not comment on it).

Maybe Eclipse ganymede couly be used for tests first to avoid possible 
problems with helios.

> The Olimex install CD was used to get a basic setup, but a new Yagarto
> install was performed to get the latest GCC build. Likewise an update of
> Eclipse was performed. Test software compiles fine.
>
> Now comes debugging. Generally, I would like to debug in flash, so I
> need to upload the program into flash and execute. I've looked at the
> configuration files (*.cfg) that came on the Olimex CD, and many, many
> others from lots of sources. Problem is, there seems to be lots of ways
> to accomplish this (too many in fact).

There are some config files bundled with OpenOCD ("target-library"). 
Usually from inside Eclipse there is not need for special commands to 
write the internal flash. In the OpenOCD config-files just the 
"flash-bank" has to be defined. See the configuration files that come 
with OpenOCD. gdb's load command can be used to program the flash-memory 
since OpenOCD supports gdb's vflash interface. The is a checkbox "load" 
in the configuration dialogs of the hardware-debugging plugin.

> First, there doesn't seem to be any commands in the config files from
> Olimex that programs flash. Looking through various websites and forums,
> there seems to be methods for letting GDB perform the flash programming,
> or OpenOCD.
>
> For GDB, some commands in the config file for allowing GDB flash
> programming appear to be (partial):
>
>
> Code:
> #daemon configuration
> telnet_port 4444
> gdb_port 3333
>
> #==============================
> #setup gdb to program flash
> gdb_memory_map enable
> gdb_flash_program enable
these should be default.

> gdb_breakpoint_override hard
> #==============================
I did not need this option.
Please read the OpenOCD-manual. There is a section about OpenOCD and 
gdb.

> But there also seems be be a "source" GDB command that needs to be added
> somewhere in here as well. It looks like the "source" command calls
> another script file.

The source command "tells" gdb path and name of the elf file. There is a 
field in the gdb hardware-debugging plugin dialogs to set the binary 
file. This should work with the "load-checkbox" but for gdb's 
"verify_sections" the source-command was also needed during my tests 
with Helios. I have made an entry in the Eclipse bugzilla (#332470) for 
this but so far no reaction.

> Are the actual flash programming commands in this
> seperate script file ? Are these just OpenOCD "flash write_image"
> commands or what ? I've never seen the contents of this second script
> file.

write_image is useful for stand-alone programming without gdb. But 
should not be needed with gdb.

> There also appears to be a way to add the flash programming commands
> within the configuration file. If the "init" command is added after the
> configuration, then the flash programming commands (OpenOCD type
> commands like "flash write_image") could follow the init command to
> program flash. I say "appears" because I've never actually seen a
> complete config file like this.

As far as I know init is needed anyway to leave the "init-sequence" and 
enter "command mode".

> Could someone please describe some of the flash programming/debugging
> options. I'm not interested in 1000 different ways of doing the same
> task - just a few good ones.

- install gdb-hardware debugging plugin
- create debug configuration for the plugin
- select binary in dialog (elf-file)
- check at least reset and load boxed in the dialog
- launch debug configuration

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.