RAM and ROM section from map file

cancel
Showing results for 
Search instead for 
Did you mean: 

RAM and ROM section from map file

2,158 Views
sindhujabala
Contributor I

I would like to calculate RAM and ROM size from .map file. I have use MPC5744p, z4 core for S32ds compilation.

There are sections like .text, .rodata, .sdata, .sbss, .COMMON.

What is .sdata section holds and where it will be used either for RAM or ROM?

From NXP document it is found that .rodata and .text section will come for ROM section calculation.

And .sbss(initialized data), .COMMON.(uninitialized Global variable) will come for RAM section.

Kindly confirm the understanding.

Can Linker pdf for MPC5744P S32ds Power PC architecture be shared?

0 Kudos
3 Replies

549 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

yes, .sbss .COMMON goes into RAM - as you can see in linker file:

.data :AT (__DATA_ROM)
{
. = ALIGN(4);
__DATA_RAM = .;
__data_start__ = .; /* Create a global symbol at data start. */
*(.data)
*(.data.*)
*(.sdata)
*(.sdata.*)
*(.sdata2)
*(.sdata2.*)
. = ALIGN(4);
__data_end__ = .; /* Define a global symbol at data end. */
} > m_data

all sections above ends in m_data which is allocated in the RAM. 

sdata/sdata2 section is used for "small data" addressing. It is Power PC feature - basically this feature allows you to address 32 bit data by something like segment + offset using particular GP register. 

Hope it helps. 

Jiri

0 Kudos

549 Views
sindhujabala
Contributor I

Hi Jiri,

Thanks for your reply.

But in Linker File 5744P_flash.ld it is given as

.sdata :

{

*(.sdata)

*(.sdata.*)

} > m_data AT>m_text

So are you sure it will be considered only in RAM Section?

Can Linker pdf for MPC5744P S32ds Power PC architecture be shared?

Regards,

Sindhuja Bala

0 Kudos

549 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

the linker script file is standard GNU Linker file. You can look at this pdf - https://www.eecs.umich.edu/courses/eecs373/readings/Linker.pdf  

The part of your linker file doesn't look as the standard one. Anyway - your sdata section ends in RAM (if m_data base is in the RAM) and is mirrored to FLASH (if m_text is in Flash memory range).  You can check the base address of m_data and m_text section in your linker file:

MEMORY
{

flash_rchw : org = 0x00FA0000, len = 0x4
cpu0_reset_vec : org = 0x00FA0004, len = 0x4

m_text : org = 0x1000000, len = 2560K
m_vectors_ram : org = 0x40000000, len = 0xC00
m_data : org = (0x40000000+0xC00), len = 384K-0xC00
}

Details about memory map you can find in Reference manual:

https://www.nxp.com/docs/en/reference-manual/MPC5744PRM.pdf?fsrch=1&sr=4&pageNum=1 

Jiri

0 Kudos