Program Once Field FLASH 0 memory block not reserved in linker

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Program Once Field FLASH 0 memory block not reserved in linker

520 Views
RobertRau1z
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:

ENTRY(ResetISR)

SECTIONS
{
     /* MAIN TEXT SECTION */
    .text : ALIGN(4)
    {
        FILL(0xff)
        __vectors_start__ = ABSOLUTE(.) ;
        KEEP(*(.isr_vector))
        /* Global Section Table */
        . = ALIGN(4) ;
        __section_table_start = .;
        __data_section_table = .;
        LONG(LOADADDR(.data));
        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 */

        *(.after_vectors*)

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?

Bob

Sr. Hardware Engineer

Labels (1)
0 Kudos
1 Reply

447 Views
converse
Senior Contributor V

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