Retrieve the Start and End address of segments in PRM file

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

Retrieve the Start and End address of segments in PRM file

2,044 Views
mikoran
Contributor II

Hi..

I have this problem that I cannot retrieve the Start and End address of segment

Let's say I have this in my PRM file:

SEGMENTS

RAM_F8 = READ_WRITE 0xF81100 TO 0xF81FFF ALIGN 2[1:1];

RAM_F9 = READ_WRITE 0xF91000 TO 0xF91FFF ALIGN 2[1:1];

...

RAM_FD = READ_WRITE  0xFD1000 TO 0xFD1FFF ALIGN 2[1:1];

END

PLACEMENT

XGATE_STRING_RAM, XGATE_CONST_RAM, XGATE_CODE_RAM, XGATE_DATA

INTO RAM_FD;

END

How will I be able to retrieve the start and end address of XGATE_DATA?

I have tried this:

extern T_s8 __SEG_START_XGATE_DATA[];

extern T_s8 __SEG_END_XGATE_DATA[];

#define XGateRamStart __SEG_START_XGATE_DATA

#define XGateRamEnd __SEG_END_XGATE_DATA

But this does not seem to work. The values I retrieve for __SEG_START_XGATE_DATA and __SEG_END_XGATE_DATA are 0.

Please if you have an idea how to do it. Thanks

Labels (1)
0 Kudos
5 Replies

598 Views
CompilerGuru
NXP Employee
NXP Employee
I tried the code snippet you posted, and it worked for me.
The only case I could imagine to get 0 for both is when the section XGATE_DATA is not used, but in this case I also get a link time warning.

Daniel

BTW. Use __SEG_START_XGATE_DATA and not __SEG_START_XGATE_DATA[0],
the latter refers to the content of the first byte in
XGATE_DATA.

0 Kudos

598 Views
mikoran
Contributor II

I tried to use "extern T_s8 __SEG_START_XGATE_DATA;" instead of extern T_s8 __SEG_START_XGATE_DATA[];

and find this in my MAP file:

- VARIABLES:
     S12XAccessViolation                                   36CC       C      12       7   .common    
     XGAccessViolation                                       36D8       C      12       7   .common    
     S12XStackBoundsViolation                          36E4       6       6       3   .common    
     XGStackBoundsViolation                              36EA       7       7       4   .common    
     __SEG_START_XGATE_DATA                   29F2       1       1       1   .bss       
     __SEG_END_XGATE_DATA                       29F3       1       1       1   .bss       
- LABELS:
     __SEG_START_SSTACK                            2002       0       0       9                
     __SEG_START_XGATE_CODE_FLASH          0       0       0       4              
     __SEG_END_XGATE_VECTORS          E089DC       0       0       4  

 

My previous project build results to this:

- VARIABLES:
     S12XAccessViolation                             36CC       C      12       7   .common    
     XGAccessViolation                                 36D8       C      12       7   .common    
     S12XStackBoundsViolation                    36E4       6       6       3   .common    
     XGStackBoundsViolation                        36EA       7       7       4   .common    
- LABELS:
     __SEG_START_SSTACK                        2002       0       0       9                
     __SEG_START_XGATE_DATA                      0       0       0       4                
     __SEG_END_XGATE_DATA                           0       0       0       4                
     __SEG_START_XGATE_CODE_FLASH        0       0       0       4              
     __SEG_END_XGATE_VECTORS        E089DC       0       0       4  

0 Kudos

598 Views
CompilerGuru
NXP Employee
NXP Employee
As I said before, it was OK before. I would expect the outcome of your expected case to be the result of
"T_s8 __SEG_START_XGATE_DATA;" (no extern) which is not what you want, basically it did define two variables for  __SEG_START_XGATE_DATA, they wont have a zero address, but have nothing at all to do with the XGATE_DATA section.

Do you have some variables in XGATE_DATA?
Do you get any warnings when linking?

Daniel

0 Kudos

598 Views
mikoran
Contributor II
No I dont have variables in XGATE_DATA yet. I just wanted to retrieve the start and end address so that I can use it in configuring the MPU. I wanted to assign a descriptor in this address.  Is this possible?
 
Thanks Daniel
0 Kudos

598 Views
CrasyCat
Specialist III
Hello

__SEG_START_XGATE_DATA  and __SEG_END_XGATE_DATA will return 0 if there is no data allocated in the section XGATE_DATA.

As soon as you have 1 variable allocated there, the start and end address will be initialized properly.
 
CrasyCat
0 Kudos