I'm developing an application for the LPC54606 which uses a secondary bootloader. I have the bootloader set up in the memory editor to occupy flash addresses 0x0 - 0x7FFF, and the application uses the rest of the flash after 0x8000.
The code works fine if I combine the two binary files using a hex editor. But if I try to debug either the bootloader or the application, the debugger erases all flash regions, and then only programs the flash region for the project I'm debugging. So it will either be missing the bootloader or the application, and the program will be broken. I confirmed this using the Memory window in the IDE, everything outside of the region being debugged gets reset to 0xFFFFFFFF. Is there a way to avoid erasing the flash outside of the assigned flash region for the project?
I'm using a PEMicro debugger if that is relevant.
Solved! Go to Solution.
I am sorry for the delayed response.
Maybe this article could help you to program both of your files
How to Flash Two or More Binary Files Using MCUXpresso IDE
Refer to the Linkserver configuration. Let me know your comments.
All the best,
Diego
Thank you for reaching out!
I understand that you are on development phase and that you are debugging your bootloader and application, and simply merging them into a single binary for convenient programming. But I still I want your help to understand better the scenario.
It sounds like you are using the MCUXpresso IDE, is this true? If not , which IDE? Yet, I do not quite understand how to replicate it or the debug operation your are triggering, let me explain more about what I understand as debug operation on IDE.
You said that the debug operation deletes whole flash, or at least both bootlaoder and app. This sounds like a tipical and default setup, whenever you want to program a flash, the debug script will simply erase all flash contenst before writting the new image. In more detail, general IDE Debug operation tipically involves erasing, then programming the flash, and finally putting a breakpoint to halt into main(). However, debuggers allow you to do only an attach operation to halt the MCU excecution, does that helps as a workarround for you? I mean you will still need to see where the MCU halts, or set a breakpoint.
Regards,
Diego
I was aware that you could do a debug attach operation that doesn't program the flash, which is useful for testing code that is already on the chip. But my main issue is that I want to be able to make incremental changes to my bootloader or application and quickly test them by debugging. Combining the .bin files then flashing with ISP works, but it takes a lot of effort. I was hoping there is a way to simply overwrite only the affected flash pages for each part of code. Or is there perhaps a way for the debug script to always flash both the bootloader and application binaries?
I am sorry for the delayed response.
Maybe this article could help you to program both of your files
How to Flash Two or More Binary Files Using MCUXpresso IDE
Refer to the Linkserver configuration. Let me know your comments.
All the best,
Diego