AnsweredAssumed Answered

Debug Fails When Application is Offset in Flash

Question asked by Bill Herring on Jan 16, 2019
Latest reply on Feb 22, 2019 by Bill Herring

Hi,

 

I have MCUXpresso 10.1.0 and an LPC Link 2 debug adaptor connected to my application hardware which is based upon an LPC1766 microcontroller. The debug connection is SWD.

 

My main application is located at an 0x3000 offset in flash in order to leave room for a boot application at 0x0000. This seems to cause a problem for MCUXpresso!

 

I am trying to migrate from an existing IAR Embedded Workbench tool that has absolutely no problem loading, running and debugging my main application at the offset. However MCUXpresso simply refuses to do so automatically. The failure is normally 'Wire ACK fault in DAP access' and at the same time it manages to find its way to the Hardware Fault vector routine.

 

If I change my code and memory map in order to run the application from a 0 offset in flash instead then the problem does not arise. So there is obviously nothing wrong with the probe or my hardware or my code. But I'd rather not fiddle around like this, changing everything, depending upon whether I'm building for debug or release!

 

Because running from offset 0 seems to work, I expected that if I first wrote my boot application to flash (i.e. at offset 0) then, when I requested a main debug, the boot would run and route to my main application as its designed to do. Unfortunately not - same failure which I've come to suspect is when the debug has no source to match what is running. So I tried adding my boot application source/symbols to the main debug which resulted in some success in that the 'Wire Ack fault' is eliminated but still the hard fault.

 

An interesting work around I've found is to simply copy the vector table from my compiled main application binary and write it to flash at 0 offset. This seems to be enough to get me to my main application 'main' without any fault. Again I don't really want to have to do this every time I compile and debug! However it does support the feeling that MCUXpresso is not itself coping with finding an offset application.

 

Can anyone help please? Am I missing something, doing something wrong? Or can MCUXpresso simply not do this?

Outcomes