STM32N6x7 Memory Allocation For ISP, NPU and VENC
Hi,
We're working on integrating the STM32N6 Getting Started Object Detection and the VENC SDCard examples and were wondering if we could ask some advice on memory allocation?
The Object Detection example defines AXISRAM1_S and I think uses this for the camera interface and ISP - if the RAM required by the VENC is added to this then AXISRAM1_S seems to be insufficient and the linker fails.
In the examples, the amount of SRAM available for the application seems to be limited by the position SRAM2 at 0x3418 0000 used by the FSBL then later for NN activations:
this states "STM32N6570-DK: 1MB of SRAM1 is reserved for the User App (see STM32N657xx.ld) and 1MB of SRAM2 is reserved for the network activations (see stm32n6-app2_STM32N6570-DK.mpool)."
More detail of the higher sections of memory is given in:
which sets out:
AXISRAM2 cpuRAM2 1024 K,
AXISRAM3 npuRAM3 448 K,
AXISRAM4 npuRAM4 448 K,
AXISRAM5 npuRAM5 448 K,
AXISRAM6 npuRAM6 448K
giving a total of 1024 K of CPU SRAM and 1792 K of NPU SRAM defined in the .mpool file.
I thought I'd ask advice on whether it's possible to use the VENC and have sufficient memory for meaningful NN inference and - if so - how SRAM should be allocated to make enough SRAM available for the VENC and NPU within the 4.2 MB of internal SRAM? This is the first time that I've done this so I thought that it was best to ask advice rather than guessing the best way forward.
https://github.com/svogl/STM32N6-GettingStarted-ObjectDetection/blob/main/Application/STM32N6570-DK/STM32CubeIDE/STM32N657xx.ld defines a region AXISRAM1_S which contains 1.023 MB of the STM32N6x7's 4.2 MB of internal RAM which tried increasing to 1.536 MB:
/* Memories definition */
MEMORY
{
AXISRAM1_S (xrw) : ORIGIN = 0x34000400, LENGTH = 1536K
PSRAM (xrw) : ORIGIN = 0x91000000, LENGTH = 16M
}The two examples are:
https://github.com/STMicroelectronics/STM32N6-GettingStarted-ObjectDetection
and the repository where where we're integrating them is:
https://github.com/svogl/STM32N6-GettingStarted-ObjectDetection - the integration is in a submodule on the following branch:
git clone https://github.com/svogl/STM32N6-GettingStarted-ObjectDetection
cd STM32N6-GettingStarted-ObjectDetection/
git checkout feature/video-enc
git submodule update --initIt's for an open source wildlife camera for conservation research and we'd like to both write encoded video to SD storage and analyse it via a CNN running on the NPU if possible:
https://new-homes-for-old-friends.cairnwater.com/quick-summary-new-homes-for-old-friends-belgium/
Wishing you all a great Christmas!
Many thanks,
Will
