We want to use the Program Once Field FLASH 0 memory block in the MKL27Z256VFM4 for our product serial number and other production and backup calibration data. We are just building and testing our end of line tester for our product. We have found the Program Once Field FLASH 0 memory block is already used. This means all our pre-production boards can't get their serial number programmed there.
Looking into how this happened, the linker file reads:
/* MAIN TEXT SECTION */
.text : ALIGN(4)
__vectors_start__ = ABSOLUTE(.) ;
/* Global Section Table */
. = ALIGN(4) ;
__section_table_start = .;
__data_section_table = .;
__data_section_table_end = .;
__bss_section_table = .;
__bss_section_table_end = .;
__section_table_end = . ;
/* End of Global Section Table */
Here is the manual's description of the Program Once Field:
This looks like the initialization data to copy into R/W memory is stored, starting at 0x0000C0 (The last vector's address is 0x0000BC).
This brings up a second problem. Our first 64 bytes of initialization data is from the first iteration of firmware burned into the device, not the final production code. I don't know if this explains some mysterious bug that cropped up during development, but switching to a new target WOULD fix it.
Shouldn't the default linker script skip over the write once region so initialization data can be updated?
Unless I misunderstand the problem, I have a batch of pre-production units I can't validate.
What is the best way to fix the linker script?
Sr. Hardware Engineer
The easiest way would be to extend the vector table (in the source code, not the linker) so that it is fills that entire space. Make sure you initialise the extended area with 0xff as that is the unprogrammed state.