How to place a buffer in OCRAM region of memory on NXP MIMXRT1062 processor #69886
-
Zephyr 3.5.0 I have an project where the application runs completely from RAM. The processor provides 3 distinct regions ITCM, DTCM and OCRAM. The OCRAM is best for DMA operation and by default occupies 768k out of 1024k. I will be receiving large amounts of DATA from LPSPI using DMA so placing these buffers would be perfect for OCRAM. I also would like to allocate 2 buffers which I alternate between to avoid race conditions between receiving and the processing, though I doubt this matters to the implementation. How can I annotate a memory buffer so that it will automatically be placed in the OCRAM region? @DerekSnell perhaps you can suggest a solution? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @asteriskSF , In the devicetree, add the property Also, if using those macros, be sure to Hope that helps |
Beta Was this translation helpful? Give feedback.
-
It appears the OCRAM already has the memory region labels added: zephyr/dts/arm/nxp/nxp_rt10xx.dtsi has: and zephyr/dts/arm/nxp/nxp_rt1060.dtsi has: so I made driver declaration like this: and it was placed in OCRAM! That was actually pretty painless, thanks @DerekSnell ! |
Beta Was this translation helpful? Give feedback.
Hi @asteriskSF ,
One way to do this is to follow the api_ext test.
In the devicetree, add the property
zephyr,memory-region
to the memory node you want data placed in, like in app.overlay. And then in your declaration, add the attributeZ_GENERIC_SECTION(LINKER_DT_NODE_REGION_NAME(DT_NODELABEL(<node_label_name>)))
, one example of this is in the memc test.Also, if using those macros, be sure to
#include <zephyr/linker/devicetree_regions.h>
. I learned that leasson the hard way :)Hope that helps