How do I use the memory meant for CM0 in CM4?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
antrc_3264986
Level 3
Level 3

I am using a PSoC 6. I have a CM4 system defined that is running out of memory (stack overflow). I want to neglect the CM0 processor use of memory and use the memory saved in CM4 processor. How do I do this?

At compile time code:167508 sram:128152 is reported. There is only 9K more memory for the CM4 system. I have a screen buffer for a 600x800 display. I have the buffer as Booleans, so the actual buffer is 600x100. However, font data and other FreeRTOS task requirements is using all of the memory resource (i.e. 288K bytes). I have only 10K defined as heap. That is the minimum setting I can use.

It would be nice to fine more memory borrowing it from the unused CM0. It this possible?

0 Likes
1 Solution
Yeshwanth_KT
Employee
Employee
50 replies posted 25 replies posted 10 likes received

Hi Andrew,

It is possible to relocate the memory assigned for CM0 and CM4 by default. CM4's memory location starts after CM0's memory location. Change the "size" of SRAM for CM0 in the linker script to the desired value. Change the start of the CM4's SRAM to the end of CM0's memory, finally change the "size" of SRAM for CM4.

Example:

(Before)

For ARM GCC -

ram               (rwx)   : ORIGIN = 0x08000000, LENGTH = 0x24000                              (CM0)

ram               (rwx)   : ORIGIN = 0x08024000, LENGTH = 0x23800                              (CM4)

(After)

For ARM GCC -

ram               (rwx)   : ORIGIN = 0x08000000, LENGTH = 0x10000                              (CM0)

ram               (rwx)   : ORIGIN = 0x08010000, LENGTH = 0x37800                              (CM4)

Regards,

Yeshwanth

View solution in original post

0 Likes
2 Replies
Yeshwanth_KT
Employee
Employee
50 replies posted 25 replies posted 10 likes received

Hi Andrew,

It is possible to relocate the memory assigned for CM0 and CM4 by default. CM4's memory location starts after CM0's memory location. Change the "size" of SRAM for CM0 in the linker script to the desired value. Change the start of the CM4's SRAM to the end of CM0's memory, finally change the "size" of SRAM for CM4.

Example:

(Before)

For ARM GCC -

ram               (rwx)   : ORIGIN = 0x08000000, LENGTH = 0x24000                              (CM0)

ram               (rwx)   : ORIGIN = 0x08024000, LENGTH = 0x23800                              (CM4)

(After)

For ARM GCC -

ram               (rwx)   : ORIGIN = 0x08000000, LENGTH = 0x10000                              (CM0)

ram               (rwx)   : ORIGIN = 0x08010000, LENGTH = 0x37800                              (CM4)

Regards,

Yeshwanth

0 Likes

Thanks

0 Likes