Confusion between Data_seg and code_seg

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

Confusion between Data_seg and code_seg

跳至解决方案
1,557 次查看
vihaanred
Contributor III

Hi,

 

I have seen the following code and i have doubts

 

the prm file is having the following statements

 

test.prm

 

/*  commands */

PARAMETERS     INTO  PAGE_E0

/*end of prm file */

 

where the PARAMETERS is a sections having some constants and placed into the flash memory page_e0.

 

i have seen the PARAMETERS in the test.c file as

 

#pragma DATA_SEG __GPAGE_SEG    PARAMETERS    

/* PARAMETERS CONSTANTS */

#Pragma DATA_SEG DEFAULT

 

my doubt is PARAMETERS is a constant and located in the flash memory. What is th meaning of declaring it as DATA_SEG? Am i correct in assuming that the statement is not required. (May be the idea is to copy the variables from flash to ram but the statement is not required).

 

Thanks and regards,

VIhaan

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

Hi vihaan,

from my understanding, you define const data in PARAMETERS section which is paged Flash memory. Correct?

if it's true, we need to use key word CONST_SEG instead of DATA_SEG. for example:

#pragma CONST_SEG __GPAGE_SEG    PARAMETERS    

/* PARAMETERS CONSTANTS */

#Pragma CONST_SEG DEFAULT

can this help you to solve the problem?


Have a great day,
Zhang Jun

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

在原帖中查看解决方案

0 项奖励
回复
2 回复数
1,341 次查看
vihaanred
Contributor III

yes it is correct i think it is a mistake to keep DATA_SEG

0 项奖励
回复
1,342 次查看
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi vihaan,

from my understanding, you define const data in PARAMETERS section which is paged Flash memory. Correct?

if it's true, we need to use key word CONST_SEG instead of DATA_SEG. for example:

#pragma CONST_SEG __GPAGE_SEG    PARAMETERS    

/* PARAMETERS CONSTANTS */

#Pragma CONST_SEG DEFAULT

can this help you to solve the problem?


Have a great day,
Zhang Jun

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

0 项奖励
回复