[coldfire-gnu-discuss] Debugging/Running program in internal Flash.
David Brown
david at westcontrol.com
Thu Feb 15 07:36:24 UTC 2007
Claude Sylvain wrote:
> Hello,
>
> I finally get the M52235 MCU internal FLASH programmed, using Flash
> Programmer tool.
>
> Before programming the FLASH, I checked that the program was running
> well in the M52235 MCU internal SRAM.
>
> I compiled again the same program using "m52235evb-rom.ld" instead of
> "m52235evb-ram.ld" as the linker script file. This is the only
> change I made to the make file.
>
> I called GDB using the same command sequence, except for the "load"
> command that is no more necessary (I think).
>
> From that point, the program fail to start, and GDB display the following
> message:
>
>
> ----------
>
> ..
> m68k-elf-sprite:Opening P&E USBMultilink port 1 (USB1 : USB-ML-CF Rev C
> (PE60123
> 45))
> m68k-elf-sprite:Target reset
> 0x00000000 in __interrupt_vector ()
> Breakpoint 1 at 0x512: file ./src/main.c, line 172.
> Note: automatically using hardware breakpoints for read-only addresses.
> Program received signal SIGTRAP, Trace/breakpoint trap.
> 0x00000004 in __interrupt_vector ()
> (gdb)
>
> ----------
>
> Later, I unplugged the USB Multilink from the target, and try to start it
> without the debugger by doing a POR (Power On Reset), without success.
>
> Since the program is running well in internal SRAM, it seems to me that
> something is wrong in the startup code.
>
> Furthermore ...
>
> Using the disassemble command of GDB, I take a look at the reset entry
> point (defined as __reset) and found something that looks like an
> endless loop. See the GDB output below:
>
>
> ----------
>
> (gdb) disassemble 0xcf0
> Dump of assembler code for function __reset:
> 0x00000cf0 <__reset+0>: linkw %fp,#0
> 0x00000cf4 <__reset+4>: halt
> 0x00000cf6 <__reset+6>: halt
> 0x00000cf8 <__reset+8>: bras 0xcf4 <__reset+4>
> End of assembler dump.
> (gdb)
>
> ----------
>
> Am I missing something, or there is really something wrong in the
> startup code ?
>
>
> Claude Sylvain
> Electro-Technica inc.
>
>
It looks to me that you are linking with CodeSourcery's bdm semi-hosting
library. This can be very handy when you have the debugger connected -
your code can access files on the host, for example. But if the
debugger is not attached, the program will fail at the first
semi-hosting access, as there is no debugger to talk to after a halt, so
when making flash versions, make sure you use the non-bdm version of the
library.
More information about the coldfire-gnu-discuss
mailing list