[coldfire-gnu-discuss] Debugging code in Flash with SG++ Lite
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coldfire-gnu-discuss] Debugging code in Flash with SG++ Lite



Hi,

I wish to debug a trivial program (attached) running in MCF52223. Executing and debugging from internal RAM works flawlessly, unfortunately that is not the way forward (32 KiB is not meant to hold code). Code is supposed to execute from internal Flash and this is a problem for gdb:

Program received signal SIGTRAP, Trace/breakpoint trap.
0x0000000a in __cs3_interrupt_vector_coldfire ()

This is what I do:

1. Compile the program and export a binary

$ m68k-elf-gcc -g -mcpu=52223 -Tm52223evb-80-rom.ld main.c -o main.elf
$ m68k-elf-objcopy main.elf -O symbolsrec main.s19

2. Flash the binary using CFFlasher. Peek at binary in Flash - it looks like valid machine code.

3. Connect with GDB and try to run it:

$ m68k-elf-gdb main.elf
(gdb) target remote | m68k-elf-sprite pe: m52223evb-80
Remote debugging using | m68k-elf-sprite pe: m52223evb-80
m68k-elf-sprite: Opening P&E USBMultilink port 1 (USB1 : USB-ML-CF Rev C (PE6015852))
m68k-elf-sprite: Target reset
0x00000000 in __cs3_interrupt_vector_coldfire ()
(gdb) hbreak main.c:6
Hardware assisted breakpoint 1 at 0x59a: file main.c, line 6.
(gdb) continue
Continuing.

Program received signal SIGTRAP, Trace/breakpoint trap.
0x0000000a in __cs3_interrupt_vector_coldfire ()

I'm confused. The 52223 is not supposed to execute anything on address 0xa. On reset, ColdFire loads the stack pointer from address 0x0 (=0x20008000), then the program counter from address 0x4 (=0x00000418) and finally executes the instruction at PC. Address 0xa is not in the menu, so why does it generate a SIGTRAP? Debugging from Flash should not be so complicated - am I missing something?

Hardware is standard: M52223EVB and P&E Multilink. Toolchain is Sourcery G++ Lite 4.4-215 on Windows XP (using cygwin).

--
Kind regards,
Tarmo Kuuse
int main() 
{
	int i = 0;
	while (i < 10000) 
	{
		i++;
	}
}