define objects to segments in PRM file

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

define objects to segments in PRM file

2,547 次查看
mikoran
Contributor II
how can we temporarily assigned an object to segments in PRM file so that we could retrieve the starting and end addresses of a segment in PRM using __SEG_START and __SEG_END
 
tnx
标签 (1)
0 项奖励
回复
3 回复数

1,272 次查看
CrasyCat
Specialist III
Hello
 
It depends on the type of the object you wish to place there.
 
If it is a variable, variable definition should be done as follows:
#pragma DATA_SEG MyDataSegment
int myVar;
#pragma DATA:smileyfrustrated:EG DEFAULT.
You can then retrieve the segment start & end address using __SEG_START_MyDataSegment and __SEG_END_MyDataSegment .
 
If it is a constant, constant definition should be done as follows:
#pragma CONST_SEG MyConstSegment
conts int myVar= 10;
#pragma CONST_SEG DEFAULT.
You can then retrieve the segment start & end address using __SEG_START_MyConstSegment and __SEG_END_MyConstSegment.
 
If it is a function, function implementation should be done as follows:
#pragma CODE_SEG MyCodeSegment
void foo(void) {
}
#pragma CODE_SEG DEFAULT.
You can then retrieve the segment start & end address using __SEG_START_MyCodeSegment and __SEG_END_MyCodeSegment.
 .
 
CrasyCat
0 项奖励
回复

1,272 次查看
mikoran
Contributor II
I tried it but it doesnt work. Still I got zero as the value for start and end address..
0 项奖励
回复

1,272 次查看
CompilerGuru
NXP Employee
NXP Employee
What's the difference in this issue compared to
http://forums.freescale.com/freescale/board/message?board.id=16BITCOMM&message.id=6209
?

In that issue you did not actually place anything in those sections, and therefore the linker did not allocate it and therefore you got 0. Did you now allocate something?

Anyway, please provide much more details, otherwise I don't think it is possible to help much, we just would guess what your problem is, and we probably guess incorrectly.

Also have a look at the startup code, there the end address of the stack is taken with this method, there it does work. So you can check what you do differently.

Daniel
0 项奖励
回复