AnsweredAssumed Answered

Flash data at absolute address in KDS 3.0 not initialized

Question asked by Diego Colombo on Jan 11, 2016
Latest reply on Jan 12, 2016 by Alice_Yang

Hi to all the community

 

I'm using a  MKV31F256 in KDS 3.0 with Processor Expert

i got an unexpected behavior placing some parameters at programming time in a sector of Flash memory

especially compared to what i used to have in CW 10.5:

 

 

In a .c file i declared

__attribute__((section (".MyParamSector")))const unsigned int  MyFlash2K [512]={40,3400,4570,21,38.....

 

In this way in KDS,at debug, the declared array MyFlash2K[512] is placed at correct address 0x3F800 but the Memory viewer shows that

the unsigned Int values are all =0xFFFFFFFF,instead of 0x28,0xD48...

 

in CW 10.5 i had the needed result simply with

unsigned int  __attribute__((section (".MyParamSector"))) MyFlash2K [512]={40,3400,4570,21,38.....

 

 

 

I modified the ProcessorExpert.ld file to reserve the last 2 flash sectors for my non volatile parameters,

then i deflagged the "Generate linker file " option in the PE Build Options:

 

MEMORY {

  m_interrupts          (RX)  : ORIGIN = 0x00000000, LENGTH = 0x00000400

  m_flash_config        (RX)  : ORIGIN = 0x00000400, LENGTH = 0x00000010

  m_interrupts_ram      (RW)  : ORIGIN = 0x1FFFC000, LENGTH = 0x00000400

  m_text                (RX)  : ORIGIN = 0x00000410, LENGTH = 0x0003EBF0/*reduced by 2 x 0x800 to make room for my  sectors*/

  m_data                (RW)  : ORIGIN = 0x1FFFC400, LENGTH = 0x00003C00

  m_data_2              (RW)  : ORIGIN = 0x20000000, LENGTH = 0x00008000

  MyTableSector       (RX)  : ORIGIN = 0x0003F000, LENGTH = 0x00000800

  MyFlashSector         (RX)  : ORIGIN = 0x0003F800, LENGTH = 0x00000800

}

 

 

/* Define output sections */

SECTIONS

{

    .my_block0 0x0003F000 : /* placing my named section at given address: */

  {

    KEEP(*(.MyTable_Sector)) /* keep my variable even if not referenced */

  } > MyTableSector

}

 

 

SECTIONS

{

  .my_block1 0x0003F800 :   /* placing my named section at given address: */

  {

    KEEP(*(.MyParamSector)) /* keep my variable even if not referenced */

  } > MyFlashSector

}

 

There is something missing or wrong.

May i have some help,please?

Thank you

Diego

Outcomes