J-Link: Write Program flash 0 IFR in MK64FN1M0VLL12

Hello, everyone!

We’re working with the NXP MK64FN1M0VLL12 MCU right now, and we’d like to write the MAC address to Program Flash 0 IFR during production. Is there a way to make that happen? A J-Link is what we’re using.

Thank you so much in advance.


You should be able to get this included in your binary by modifying your linker script and adding a volatile variable with a section attribute. For example, our linker script for putting some variables in a specific SRAM bank: https://github.com/newaetech/chipwhisperer/blob/mpsse/hardware/capture/chipwhisperer-lite/sam3u_fw/SAM3U_VendorExample/src/ASF/sam/utils/linker_scripts/sam3u/sam3u2/gcc/flash.ld

and the corresponding variable declarations: https://github.com/newaetech/naeusb/blob/main/naeusb_mpsse.c#L22. You should remove the (NOLOAD) part to make sure the variable actually gets inserted into flash.