how to set s32k1xx_flash.ld to set the needed memory for saving data

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

how to set s32k1xx_flash.ld to set the needed memory for saving data

跳至解决方案
2,562 次查看
jinshuaixu
Contributor V

           l want to set 4k pflash bytes to save data, and set 4k dflash to save data. For example ,there are

"uint8_t p_flash_data1[1024]" and "uint8_t p_flash_data1[3072]",now l want to set "app_data" to save p_flash_data1[512] and p_flash_data2 [512] .who can tell me how to change the"s32k1xx_flash.id" ,thank you for you response.

          below is the "s32k1xx_flash.id" code.

MEMORY
{
/* Flash */
m_interrupts (RX) : ORIGIN = 0x00000000, LENGTH = 0x00000400
m_flash_config (RX) : ORIGIN = 0x00000400, LENGTH = 0x00000010
m_text (RX) : ORIGIN = 0x00000410, LENGTH = 0x00008000-0x410

app_data (RW) : ORIGIN = 0X00008000, LENGTH = 0X1000; /* I add 4k bytes memory to save data */
ccp_data (RW) : ORIGIN = 0x10000000, LENGTH = 0X1000; /* I add 4k bytes memory to save ccp data */

/* SRAM_L */
m_data (RW) : ORIGIN = 0x1FFF8000, LENGTH = 0x00008000
/* SRAM_U */
m_data_2 (RW) : ORIGIN = 0x20000000, LENGTH = 0x00007000
}

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,727 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

You don't have to have data_app, data_app1, data_app2 if you put them all into one section (app_data).

I do not understand what do you intend to do with the pragma.

Regards,

Daniel

 

在原帖中查看解决方案

0 项奖励
回复
4 回复数
1,727 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

In c. file create your array:

__attribute__ ((section(".data_app"))) uint8_t p_flash_data1[1024] = {1,2,3,4,5};‍

Then in the linker file put .data_app into app_data section.
Write it just after m_text section.

…
} > m_text

.data_app :
{       
  . = ALIGN(4);      
  KEEP  (*(.data_app))      
  . = ALIGN(4); 
} > app_data‍‍‍‍‍‍‍‍‍

Similarly for ccp_data memory section.

Regards,
Daniel

0 项奖励
回复
1,727 次查看
jinshuaixu
Contributor V

  Daniel, l am very thank for you response firstly.

              if l have "uint8 p_flash_data1[1024]" and "uint8  uint16 p_flash_data2[128]" and "uint32 p_flash_data3[256]" now,l want save it in "app_data" memory,please check my code to response my setting is right or wrong ,thank you,Daniel.

     below is the code,p_flash_data1[1024] memory is 0x00008000 to 0x000083ff,

                 p_flash_data4 to p_flash_data259 memory is 0x00008400 to 0x000084ff,

                 p_flash_data2[128] memory is 0x00008500 to 0x000086ff,

                 p_flash_data3[128] memory is 0x00008700 to 0x00008aff

          in link file , below code setting is to trouble ,whether is any simple setting,for example,if use "#pragme" to set        it,please give me the way to set it. thank you

           __attribute__ ((section(".data_app"))) uint8_t p_flash_data4 ;
          _attribute__ ((section(".data_app"))) uint8_t p_flash_data5 ;
          ...
          _attribute__ ((section(".data_app"))) uint8_t p_flash_data259 ;

in  .c file


__attribute__ ((section(".data_app"))) uint8_t p_flash_data4 ;
__attribute__ ((section(".data_app"))) uint8_t p_flash_data5 ;

__attribute__ ((section(".data_app"))) uint8_t p_flash_data259 ;

__attribute__ ((section(".data_app2"))) uint16_t p_flash_data3[100] = {1,2,3,4,5};

in link file


.data_app1 :
{       
  . = ALIGN(2);      
  KEEP  (*(.data_app1))      
  . = ALIGN(2); 
} > app_data
.data_app2 :
{       
  . = ALIGN(4);      
  KEEP  (*(.data_app2))      
  . = ALIGN(4); 
} > app_data

0 项奖励
回复
1,728 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hi,

You don't have to have data_app, data_app1, data_app2 if you put them all into one section (app_data).

I do not understand what do you intend to do with the pragma.

Regards,

Daniel

 

0 项奖励
回复
1,727 次查看
jinshuaixu
Contributor V

              Daniel, l am very thank for you response firstly.

              if l have "uint8 p_flash_data1[1024]" and "uint16 p_flash_data2[100]" and "uint32 p_flash_data1[100]" now,l want save it in "app_data" memory,please check my code to response my setting is right or wrong ,thank you,Daniel.

in  .c file



__attribute__ ((section(".data_app"))) uint16_t p_flash_data3[100] = {1,2,3,4,5};

in link file

.data_app :
{       
  . = ALIGN(4);      
  KEEP  (*(.data_app))      
  . = ALIGN(4); 
} > app_data
0 项奖励
回复