How to put a big array in OCRAM?

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

How to put a big array in OCRAM?

Jump to solution
1,291 Views
simmania
Contributor IV

Hi,
I'm usingMCUXpresso with  MIMXRT1010-EVK hardware.

In my program I need a big array. The linker tries to put this in the SRAM_DTC (which I assume is the DTCM). But there is not enough room. While the SRAM_OC (which I assume is the OCRAM) is completely empty.
So, how to instruct the linker to put my big array in SRAM_OC?

Is there some tutorial about this kind of memory management stuff?

0 Kudos
Reply
1 Solution
1,286 Views
simmania
Contributor IV

Ok, I found it out.
So here is how I did it, in case other people may want to know:

In the Properties of the project, under C/C++ Build -> MCU settings, I could see that the OCRAM section has the alias 'RAM3'. (here you also can change the sizes of the RAM sections)

Then in the code you can do:

#include <cr_section_macros.h>

__DATA(RAM3) uint16_t buffer[BUFSIZE];

 

View solution in original post

0 Kudos
Reply
1 Reply
1,287 Views
simmania
Contributor IV

Ok, I found it out.
So here is how I did it, in case other people may want to know:

In the Properties of the project, under C/C++ Build -> MCU settings, I could see that the OCRAM section has the alias 'RAM3'. (here you also can change the sizes of the RAM sections)

Then in the code you can do:

#include <cr_section_macros.h>

__DATA(RAM3) uint16_t buffer[BUFSIZE];

 

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2001975%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EHow%20to%20put%20a%20big%20array%20in%20OCRAM%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2001975%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3CBR%20%2F%3EI'm%20usingMCUXpresso%20with%26nbsp%3B%20MIMXRT1010-EVK%20hardware.%3C%2FP%3E%3CP%3EIn%20my%20program%20I%20need%20a%20big%20array.%20The%20linker%20tries%20to%20put%20this%20in%20the%20%3CSPAN%3ESRAM_DTC%3C%2FSPAN%3E%20(which%20I%20assume%20is%20the%20DTCM).%20But%20there%20is%20not%20enough%20room.%20While%20the%20%3CSPAN%3ESRAM_OC%3C%2FSPAN%3E%20(which%20I%20assume%20is%20the%20OCRAM)%20is%20completely%20empty.%3CBR%20%2F%3ESo%2C%20how%20to%20instruct%20the%20linker%20to%20put%20my%20big%20array%20in%20SRAM_OC%3F%3C%2FP%3E%3CP%3EIs%20there%20some%20tutorial%20about%20this%20kind%20of%20memory%20management%20stuff%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2001988%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%20How%20to%20put%20a%20big%20array%20in%20OCRAM%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2001988%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EOk%2C%20I%20found%20it%20out.%3CBR%20%2F%3ESo%20here%20is%20how%20I%20did%20it%2C%20in%20case%20other%20people%20may%20want%20to%20know%3A%3C%2FP%3E%3CP%3EIn%20the%20Properties%20of%20the%20project%2C%20under%20C%2FC%2B%2B%20Build%20-%26gt%3B%20MCU%20settings%2C%20I%20could%20see%20that%20the%20OCRAM%20section%20has%20the%20alias%20'RAM3'.%20(here%20you%20also%20can%20change%20the%20sizes%20of%20the%20RAM%20sections)%3CBR%20%2F%3E%3CBR%20%2F%3EThen%20in%20the%20code%20you%20can%20do%3A%3C%2FP%3E%3CP%3E%3CSPAN%3E%23include%20%3CCR_SECTION_MACROS.H%3E%3C%2FCR_SECTION_MACROS.H%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E__DATA(RAM3)%20uint16_t%20buffer%5BBUFSIZE%5D%3B%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E