SAM7X breakpoints

Hi!

Im running yagarto toolchain + eclipse + openocd on SAM7X256EK. Everything worked nice for a week or so. But after that breakpoints cease to function. And as always, I did not do anything:-)

My configuration file:


#define our ports

telnet_port 4444

gdb_port 3333

#commands specific to the Amontec JTAGKey

interface ft2232

ft2232_device_desc “USBdebugA”

ft2232_layout usbjtag

jtag_speed 1

jtag_nsrst_delay 500

jtag_ntrst_delay 500

#reset_config [combination] [trst_type] [srst_type]

reset_config srst_only srst_pulls_trst

#jtag_device

jtag_device 4 0x1 0xf 0xe

#daemon_startup <‘attach’|‘reset’>

daemon_startup reset

#target <reset_mode> <jtag#> [variant]

target arm7tdmi little run_and_init 0 arm7tdmi_r4

#run_and_halt_time <target#> <time_in_ms>

run_and_halt_time 0 30


and gdb commands:


target remote localhost:3333

monitor reset

monitor sleep 500

monitor soft_reset_halt

monitor poll

monitor wait_halt

monitor arm7_9 sw_bkpts enable

monitor arm7_9 fast_memory_access enable

monitor mww 0xffffff00 0x01

load

tbreak main

continue


But it just does not stop on breakpoints. Only if I insert breakpoint to main.c. Any other breakpoint is no good. And right after startup (beginning of the main.c where init and stuff is) it does no accept bkpts either… Im confused.

thank you in advance,

Madis

Hi,

could you run with logging enabled (-d -l ), and send the log to Dominic Rath gmx de?

A few questions regarding your application:

  • where do you link it (RAM or Flash?)

  • is it using interrupts

  • what size is it currently?

Regards,

Dominic

Hi,

I sent the log file to your email

I link to RAM

all the interrupts are disabled

Size is 10k approx

Thanks,

Madis

Hi,

your code gets loaded to address 0x0 - there’s only RAM at that location if the REMAP command is active. Because REMAP acts as a toggle command, you could be writing to flash or ROM (depends on GPNVM Bit 2) after issuing the write to 0xffffff00, if there’s some code in your flash that already does the remapping.

Do you have code in your flash? Could you try erasing the flash, and see if setting breakpoints works then? Alternatively, you could try without the write to 0xffffff00 and see if it works. I couldn’t find a way of determining which memory is currently mapped at 0x0, but then I didn’t work with the SAM7X a lot yet.

Best regards,

Dominic

Hi!

Flash is emty. I used samba to blank it and to program GPNVM bits to force booting from flash (flash is filled with 0xffffffff as sould). So loading to ram seems to be ok. I agree that remap bit. I disabled it, but the result is pretty similar, Im afraid. And if I use hw breakpoints, everything seems to be better, except Im limited to 2 bkpts.

Br, Madis

Sounds like a problem with your initialisation code or early after starting the main function.

Does your program actually run or are you trapped in a Fault Handler ?

What info do you get from a “halt” command and what are the register and stack contents.

Regards,

Magnus

Hi!

Yes, I had different problems all together. Still few of them remaining.

The worst problem was that jtag speed parameter was too high. I tested everything (loading, connecting, breakpoints) with telnet. I had to use 40 as jtag_speed (homemade USB interface) while using fast_memory_access. After reaching 40, openocd stopped complaining about this and that while loading/reading.

As telnet interface proved: sw_bkpts are functional. As setting bp in telnet requires specifying if the bp is in arm or thumb mode made me a bit sucpicious bout eclipse debugger. And yes, it seems to be that eclipse debugger stops only on kind of ARM aligned breakpoints (every second line in assembly output). After I comilied everything in ARM (and reducing jtag speed) my board seems to work (bkpts, remap toggling and everything). Does somebody else have experience about thumb breakpoints with eclipse? Hw bkpts seem to work for both, arm and thumb (but limited to 2 bkps only, which is a bit annoying).

BR, Madis