AnsweredAssumed Answered

How do you assign FLASH memory to value

Question asked by Terry Biberdorf on Jul 18, 2017
Latest reply on Jul 19, 2017 by LPCX presso support

I would like to assign a FLASH memory location to a value.

 

Previously under KDS I was able to make a linker section and then assign a variable to that value.

snippet from linker file:

  .macaddr : AT(0x0007FFF0)
  {
      KEEP(*(.macaddr))
  } > m_text
 

then in my code, I create a variable macaddr_data[16] and used __attribute__ ((section(".macaddr"))) to instruct the linker to place the variable into my assigned section.

unsigned char __attribute__ ((section(".macaddr"))) macaddr_data[16] = MAC_INITIALIZER;

 

Now under MCUXpresso, I created a section called macaddr to my memory location.

 

 

then in my code I use the following assignment:

__attribute__ ((section(".macaddr")))  unsigned char macaddr_data[16] = {0x00, 0x21, 0x6f, 0xFF, 0xBE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};

 

I do not receive any compiler/linker warnings or errors, when I analyze the .map file I so see my section .macaddr present, but when I run my code my initialized value of {0x00, 0x21, 0x6f, 0xFF, 0xBE, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF} is not there and I don't understand why.

 

Can  someone please provide me the correct syntax to perform this operation?

Thanks

Outcomes