-
-
Notifications
You must be signed in to change notification settings - Fork 781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Data written to flash on LPC11C24 gets corrupted #99
Comments
This may have been broken by my refactoring of the LPC code. Can you check if you have the same problem with v1.6-rc0. I unfortunately don't have any LPC11C24 to test with. |
The first 512 bytes of the address space are mapped to boot ROM by default. Once you write the SYSMEMREMAP register (address 0x40048000) to have a value of 2, those 512 bytes are mapped to flash and all sections will match. The LPC bootloader automatically does this upon detecting valid user code, but the bootloader cannot run while you are holding the chip in reset with a debugger. See section 3.5.1 of the manual. In gdb, you can In summary, this is not a bug with the LPC refactoring. |
That doesn't explain why my code were hardfaulting. When the bootloader is mapped in, it should run before anything gets to the entry point of my code. Unfortunately I put the project I were evaluating LPC11C for on hold, so I never got around to retesting, and right now I'm on vacation so I won't be able to for a while either. |
Is there a verdict on this issue? |
Well, I never got back to that project, so I haven't concluded with anything. |
I am currently developing for LPC824, LPC1549, and LPC11U68 with the Black Magic Probe, and I have not experienced this issue. I do observe section mismatches, as described in zyp's initial report, until the SYSMEMREMAP register is set. |
Should the Black Magic Probe code set the remap register when flashing the firmware? Or would that have some other negative impact? |
I think the choice of whether to set the remap register should be left to the user. I set it in my gdbinit file most of the time, but every once in a while I disable that in order to step through the ROM bootloader with the debugger. Note that the address of the register differs between different LPC product lines. |
So I think we should include this in the wiki so that people can find it. I think this should be added at least to the FAQ section. Can you provide us with the needed line for .gdbinit and the exact chip you are using? The text should then probably include some information about how to find the register for a similar LPC chip if it does not work for the user. |
For the LPC8xx/LPC11xx, the relevant lines are
The exact chip I'm using is the LPC824 and the name of the register in question is "SYSMEMREMAP". |
Thank you! I have added an item to the FAQ. Feel free to improve the wiki. Thank you very much for the help and your contribution. |
I'm getting started with LPC11C24 here, and flash writes seems to get corrupted.
I'd expect .vectors to mismatch, due to the signature generation, but not the other sections. Since .init_array contains an invalid address, the processor hardfaults during startup code.
The text was updated successfully, but these errors were encountered: