I have modified LPC21ISP code to read the flash memory of NXP controllers using serial communication. And i store the data into hex file.
But the hex file data doesnt match with the memory when read using flashmagic tool.
I have done uu-decoding of the data the i receive, before storing it to the hex file.
Also, the uu-encoded string that is transmitted while programming the flash memory, doesnt match with the uu-encoded data that i receive back.
I suspect that the address that i am trying to read the first code byte is wrong (0x0000).
I also tried reading the entire flash and look for pattern match with original hex file. But no pattern match.
If some one can possibly tell me where am i going wrong or where should i check?
PS: serial code, uu-decoding code working fine. uu-decoding code tested with hard coded data, works well.
The flash magic knows how to process those 512 bytes (I also want to figure that out and implement it in my code), hence the read data matches exactly with the hex file that was programmed into flash.
...without first checking the current vector table mapping in use. How do i figure current vector table mapping. Is there any document or any link explaining this? would mapping be different (to different memory locations) for different controllers (of NXP, LPC series)?
Yes, the user manual for the different NXP processors contains information about how to remap the interrupt vector table. With that information, it's possible to turn off the interrupts, change back to a neutral mapping, read the first block of data and then map back to the original mapping again.
The flash magic knows how to process those 512 bytes, hence the read data matches exactly with the hex file that was programmed into flash. I need to figure out how to process these 512 bytes so that they match with first 512 bytes in the original hex file. Also, lpc21isp code mentions Avoid compare first 64 bytes. Because first 64 bytes are re-mapped to flash boot sector, and the compare result may not be correct.
But the flash magic always reads data correctly, thus matching the original hex file. How does flash magic achieve this? any idea?
"How does flash magic achieve this? any idea?"
I have already told you that. The user manual for the relevant NXP chip does mention explicitly how to control the interrupt vector remapping.
And I did write: "With that information, it's possible to turn off the interrupts, change back to a neutral mapping, read the first block of data and then map back to the original mapping again."
So where are you stuck? Have you downloaded the user manual? Have you located the relevant chapter? Is there some sentences there that you don't understand?