MPC56xx Linking const

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

MPC56xx Linking const

859 次查看
dermotmurphy
Contributor I

Hi,

 

I would like to link a const into a named section in flash on th eMPC5602.

 

I am trying this in the C file :

 

#pragma section sconst_type const_type ".NM_CONST" ".NM_CONST"

static const UINT8 NM_BIT_BYTE_POS[NM_NUM_BITS_IN_BYTE] =

{

    0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01

} ;

 

with this added to the LCF file:

MEMORY

{

    nm_const_flash:        org = 0x00030000,    len = 0x00000200

}

 

SECTIONS

{

.NM_CONST (CONST)   LOAD (ADDR(nm_const_flash))   : {}

}

 

However when I check the map file, the data is located in .rodata

 

How do I move the const array NM_BIT_BYTE_POS into the named section?

标签 (1)
0 项奖励
回复
1 回复

754 次查看
TICS_Fiona
NXP Employee
NXP Employee

Please see the code below for how to link your constants as expected:

in the C file :

#pragma section RW ".NM_CONST" ".NM_CONST"

__declspec(section ".NM_CONST" )

static const UINT8 NM_BIT_BYTE_POS[NM_NUM_BITS_IN_BYTE] =

{

    0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01

} ;

with this added to the LCF file:

SECTIONS

{

......

  GROUP:{

        .NM_CONST (CONST)                   LOAD (ADDR(nm_const_flash))           : {}

    }> nm_const_flash

......

}

Best Regards

Fiona

Technical Information & Commercial Support

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复