EmbDev.net

Forum: ARM programming with GCC/GNU tools OpenOCD/gdb init - question about memory setup


Author: Dan Miller (gorlash)
Posted on:

Rate this post
0 useful
not useful
I've tested the startup scripts from Yagarto's STR9Test application; it
works quite well on my comStick test device.  However, I have a couple
of questions regarding the implementation, that I hope someone can
clarify here:

1. If I just load the .elf file into insight, it starts as I would
expect, at address 0, the reset vector.  That's what I want, because I
want to trace through our startup code.  However, if I run the
str912_rom.gdb script from STR9Test, insight starts me at the first
instruction in main(), having already executed my startup code!  Why is
this happening?  There's no explicit breakpoint command in the gdb
script, this appears to be some indirect behavior.  Can some explain?

2. the script executes the following commands:
# Set SRAM size to 96 KB
monitor mww 0x5C002034 0x0197
monitor mdw 0x5C002034

and some other scripts that I've seen set up more registers and
settings beyond that.  However, my startup.s script already configures
all the required registers.  Why is this done again in the gdb script??
Do I actually have to do this?

Thanks for all the help you've all given me here!!

Author: Spencer Oliver (ntfreak)
Posted on:

Rate this post
0 useful
not useful
Dan Miller wrote:
> I've tested the startup scripts from Yagarto's STR9Test application; it
> works quite well on my comStick test device.  However, I have a couple
> of questions regarding the implementation, that I hope someone can
> clarify here:
>
> 1. If I just load the .elf file into insight, it starts as I would
> expect, at address 0, the reset vector.  That's what I want, because I
> want to trace through our startup code.  However, if I run the
> str912_rom.gdb script from STR9Test, insight starts me at the first
> instruction in main(), having already executed my startup code!  Why is
> this happening?  There's no explicit breakpoint command in the gdb
> script, this appears to be some indirect behavior.  Can some explain?
>

The gdb str912_rom.gdb has the following lines:
break main
continue

this is setting a breakpoint and running your target as instructed to.
if you want to step through the startup code then replace the continue
with a step. remove the breakpoint aswell if not required.

> 2. the script executes the following commands:
> # Set SRAM size to 96 KB
> monitor mww 0x5C002034 0x0197
> monitor mdw 0x5C002034
>
> and some other scripts that I've seen set up more registers and
> settings beyond that.  However, my startup.s script already configures
> all the required registers.  Why is this done again in the gdb script??
> Do I actually have to do this?

These are not required, some people do it if they ram debug.
as at reset the str9 does not know about the flash or the ram size.

Cheers
Spen

Author: Dan Miller (gorlash)
Posted on:

Rate this post
0 useful
not useful
Spencer Oliver wrote:
> The gdb str912_rom.gdb has the following lines:
> break main
> continue

Oh, for heaven's sake!!  I read that file several times, and never saw
"break main" ... duh...
Sorry for pointless question!!

>
> this is setting a breakpoint and running your target as instructed to.
> if you want to step through the startup code then replace the continue
> with a step. remove the breakpoint aswell if not required.
>
>> 2. the script executes the following commands:
>> # Set SRAM size to 96 KB
>> monitor mww 0x5C002034 0x0197
>> monitor mdw 0x5C002034
>>
> These are not required, some people do it if they ram debug.
> as at reset the str9 does not know about the flash or the ram size.

Thank you for that clarification, Spen!!
I appreciate the help...

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.