How to use Available On chip RAM in LPC4367/LPC43XX

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

How to use Available On chip RAM in LPC4367/LPC43XX

Jump to solution
1,962 Views
gauravmore
Contributor III

Hi,

I am using LPC4367 tri core controller for our application development. I am facing issue related to on chip RAM availability. Total SRAM available in LPC4367 as per data sheet is 154KB which is used for 3 different cores (M4 / M0App/ M0Sub).

Refer the below screen shot which shows the bifurcation of 154KB RAM

gauravmore_0-1629952495813.png

Now, considering the above information we can see that for Core M4 is assigned 40KB RAM for Core M0App I have assigned 32KB RAM and for Core M0Sub core is assigned 16KB (RAMM0Sub16) RAM. After compilation of tri core project I get following result for individual core.

M0App Core:

MCU Setting:

gauravmore_4-1629953285938.png

Memory Utilization after compilation:

gauravmore_1-1629952862754.png

Above is the Memory utilization of M0App core after implementation of the application code. We can observe that RamLoc32 is utilized around 91 %. But the other memory location like RamAHB32 / RAMAHB16 / RamAhbETB16 are not utilized. As per the MCU setting show above for M0App Core project it is allocating only 32KB rest is unused.

M0Sub Core:

MCU Setting:

gauravmore_6-1629953517501.png

Memory utilization after compilation:

gauravmore_2-1629952923883.png

Above is the Memory utilization of M4 core after implementation of the application code. We can observe that RamM0sub16 is utilized around 54%.  per the MCU setting show above for M0App Core project it is allocating only 16KB rest is unused.

But in this what if the memory goes beyond 16KB then whether it uses the other 2KB RAM? Please confirm. 

M4Core :

MCU Setting:

gauravmore_5-1629953459818.png

Memory Utilization after compilation:

gauravmore_3-1629952985925.png

Above is the Memory utilization of M4 core after implementation of the application code. We can observe that RamLoc40 is utilized around 94 %. But the other memory location like RamAHB32 / RAMAHB16 / RamAhbETB16 are not utilized. As per the MCU setting show above for M0App Core project it is allocating only 40KB rest is unused.

Over all the problem statement is as per the MCU setting of the respective core he RAM allocated to the respective core is less however as per the data sheet it says that over all 154 KB RAM is available and can be used for the three cores. But after doing the MCU setting I checked and found that only the above mentioned RAM is allocated  (M4 -40Kb, M0App-32KB and M0Sub-16KB).

How to use the other memory locations using MCU setting or only by  __DATA(bank) Attribute?

Do we need to modify linker script in order to used the unused RAM memory ?

Since this is very critical for us w.r.t to our application side please suggest the proper method.

BR,

Gaurav More

Labels (3)
0 Kudos
1 Solution
1,935 Views
converse
Senior Contributor V

"Discarded Input Sections" are sections that are present in the code but have discarded by the linker because they are unused - there is no reference to it in the code. To resolve this, you need to place a reference to the data in your code, or decorate the declaration with __attribute__((used))

e.g.

__DATA(RAM3) __attribute__((used)) char M4_Buffer[1024];

This tells the linker that M4_buffer is used, and therefore will not be discarded. Alternatively, you could just wite

main() {
...
*M4_buffer = 0 ;
...
}

(reference the data!) 

View solution in original post

0 Kudos
5 Replies
1,956 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello gauravmore,

How about refer to "17.13.2 Placing data into different RAM blocks using Macros" of MCUXpresso IDE User Guide.

 

 

BR

Alice

0 Kudos
1,941 Views
gauravmore
Contributor III

Hi Alice,

As per your input I made following modification, Following is the MCU setting of the M4 Core

gauravmore_1-1630392957181.png

As per the setting you can see that RamAHB32 - RAM3 - 32KB. so to allocate the buffer to this RAM3 bank I wrote below line,

 __DATA(RAM3) char M4_Buffer[1024]; 

after compilation I do not find any change in the memory region

gauravmore_2-1630393156045.png

 But after checking the MAP file I found the RAM3 location  with 0x400 size but that is under  "Discarded input sections" if the .Map file.

gauravmore_3-1630393320899.png

So you can see that the size with respect to the data in RAM3 is visible but no the variable. Over all I am Not able to allocate the Buffer in RAM memory.

There are some query regarding this issue,

1. What is the Discarded input sections? 

2. If the memory configuration is done in MCU setting then why it is not allocation the buffer to the RAM location?

3.  Is there any setting in the MCU xpresso  IDE regarding the above issue?

Also find the attached code for Reference.

BR

Gaurav More

0 Kudos
1,936 Views
converse
Senior Contributor V

"Discarded Input Sections" are sections that are present in the code but have discarded by the linker because they are unused - there is no reference to it in the code. To resolve this, you need to place a reference to the data in your code, or decorate the declaration with __attribute__((used))

e.g.

__DATA(RAM3) __attribute__((used)) char M4_Buffer[1024];

This tells the linker that M4_buffer is used, and therefore will not be discarded. Alternatively, you could just wite

main() {
...
*M4_buffer = 0 ;
...
}

(reference the data!) 

0 Kudos
1,928 Views
gauravmore
Contributor III

Hi Converse,

Thanks for the reply, 

Noted you point and modified the same now it is clear and able to get the buffer allocated to the require memory location. 

Thanks for the solution.

BR,

Gaurav More

 

 

0 Kudos
1,950 Views
gauravmore
Contributor III

Hi Alice,

Thanks for the reply. 

I will check by implementing it at my side, since it think it is the only way, but then if assign back to back memory location but still it is not executing as per our expectation.

BR,

Gaurav More

0 Kudos