define objects to segments in PRM file

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

define objects to segments in PRM file

1,746 Views
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
Labels (1)
0 Kudos
3 Replies

471 Views
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 Kudos

471 Views
mikoran
Contributor II
I tried it but it doesnt work. Still I got zero as the value for start and end address..
0 Kudos

471 Views
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 Kudos