Program Once Field FLASH 0 memory block not reserved in linker

Showing results for 
Search instead for 
Did you mean: 

Program Once Field FLASH 0 memory block not reserved in linker

Contributor I

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:


    .text : ALIGN(4)
        __vectors_start__ = ABSOLUTE(.) ;
        /* Global Section Table */
        . = ALIGN(4) ;
        __section_table_start = .;
        __data_section_table = .;
        LONG(    ADDR(.data));
        LONG(  SIZEOF(.data));
        __data_section_table_end = .;
        __bss_section_table = .;
        LONG(    ADDR(.bss));
        LONG(  SIZEOF(.bss));
        __bss_section_table_end = .;
        __section_table_end = . ;
        /* End of Global Section Table */


Here is the manual's description of the Program Once Field:

Screen Shot 2020-04-25 at 5.07.39 PM.png

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

Labels (1)
0 Kudos
1 Reply

1 View
Senior Contributor III

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.

0 Kudos