I've spent quite a while getting Eclipse on Mac OSX working. I started with the original makefile but have come up with, finally, a working native Eclipse build which does the same thing. It's quite nice having full Eclipse integration. (If anyone is interested in how you do that I'll write it up).
But I'm having issues with debugging. I have Jlink 4.78, Eclipse Kepler and a recent GCC toolchain. I'm running the JLinkGDBServer and have the commands suggested in nan-29.
The sequence goes like this. If the chip is already programmed with anything at all, the flash of the device fails with a block verification error much like this one
Resetting target
Downloading 2456 bytes @ address 0x00000000
Downloading 8 bytes @ address 0x00000998
Downloading 1092 bytes @ address 0x000009A0
ERROR: Programming failed @ address 0x000001F8 (block verification error)
Once that's happened, there appears to be no good way out of it, it'll happen every time until I run a script I have which erases the flash by hand (thank you Mr Mason), then, next time I debug, the flash will be successful ..
however after the flash the device tries to run the code but I end up in the hardfault handler pretty much instantly (and I'm not well-enough versed with this device to work out how I get there).
Finally if I kill the JLinkGDBServer again and run it again .. it will usually work that time.
So to recap, the programming of the flash fails with a block verification error; wiping the device manually makes the next flash work but the code doesn't run, fails with a HardFault, on the third and subsequent times, until I change the code, it mostly works.
Any ideas where these verification errors and HardFaults may be coming from? I feel that the Segger probably isn't waiting long enough before trying things and it's either writing whilst erasing or trying to run before things are ready, but I don't know how to insert things into an Eclipse debug download script to slow it down (if there is such a thing over JLinkGDBServer).
I can turn the download into an external process and made Debug just debug, but that's a bit of a shame, a full Eclipse solution seems quite close at this point and it would be great to finish it.