cancel
Showing results for 
Search instead for 
Did you mean: 

STM32N6 VENC + NPU + Camera linker script

devjalx
Associate II

Hi all,

I am currently trying to merge the STM32N6 VENC_SDCARD Project with my Codebase that is based on the STM32 Modelzoo Object Detection (https://github.com/AlexGraefe/STM32N6CameraEvaluation). However, naively copy-pasting the code does not work. For most resolutions, the generated h264 streams are wrong and for the others, the code crashes at weird places e.g., when leaving a function. As the only difference between my code and the VENC_SDCARD example is the linker script, I was wondering if wrong memory allocations might be the reason for this. The heap in the object detection example is placed on AXISRAM1, which might too small. However, I am unable to place the heap onto other parts of the RAM (internal or external), without the program crashing directly upon startup.

Copying the linker script provided by VENC_SDCARD also does not work as then, I run into compilation errors stating the code uses too much RAM (as buffers for images are placed in different regions).

Moreover, I noticed that the linker script provided by the Modelzoo, which I use (appended), says: AXISRAM1_S (xrw) : ORIGIN = 0x34000400. However, the reference manual states that AXISRAM1 should start at 0x34064000. 

To summarize, I am heavily confused on how to write a linker script for the N6, especially when it comes to fully utilizing all available RAMs for different peripherals.

Do you have any resources or guidance on how a general purpose linker script for the N6 that supports as many functionalities as possible (NPU, VENC, external RAM, Camera, space for CPU-heavy tasks) should look like?

Best regards,

Alex

 

2 REPLIES 2
MOBEJ
ST Employee

Hello @devjalx , 

You can use the DCMIPP application example for STM32N6570-DK on GitHub:

https://github.com/STMicroelectronics/STM32CubeN6/tree/main/Projects/STM32N6570-DK/Applications/DCMIPP

It shows how to configure the OV5640 camera in continuous and serial mode at 800x480,.
Please read the README files carefully before compiling to help you succeed with your project.

Br

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

thank you for the answer.

I already have a running DCMIPP example based on the object detection example. The problem is that the examples ST provided are not interoperable, i.e., simply copying code from one example to the other to merge different features does not work and the reasons are that the linker files, system setups etc. are completely different between examples and the examples do not explain why certain settings are made the way they are.

For example, the project, you referred to, states:

MEMORY
{

ROM (xrw) : ORIGIN = 0x34180400, LENGTH = 255K
RAM (xrw) : ORIGIN = 0x341C0000, LENGTH = 256K

}

the VENC_SD_CARD Example states:

MEMORY
{

ROM (xr) : ORIGIN = 0x34000400, LENGTH = 256K
RAM (rw) : ORIGIN = 0x341B7000, LENGTH = 2340K
DTCM (rw) : ORIGIN = 0x30000000, LENGTH = 128K

}

And the object detection example states:

MEMORY
{

AXISRAM1_S (xrw) : ORIGIN = 0x34000400, LENGTH = 1647K

}

From the reference manual, I can understand where these memory regions lie in the RAM, but I cannot understand why all these projects need different memory regions and also, where these offsets from the starting addresses of AXISRAM1, AXISRAM2 etc. come from. Moreover, swapping linker scripts between examples either leads to compilation errors as the code uses too much memory, or the code crashing directly upon startup.

That is, why I am asking for some guidance on assigning memory regions of the N6 to .data, .bss etc., because I need to understand what is going on under the hood to advance in my projects.