2021-07-06 04:34 AM
I'm trying to deploy a machine learning model to an STM32H743ZIT6 through cube-ai extension. The model is in .tflite format. When I try to analyze the model this is the result:
The tool states that the MCU has 512KB total available and the model exceeds it but on the datasheet I find 1024KB.
What's the reason?
Solved! Go to Solution.
2021-07-06 05:45 AM
STM32Cube.AI needs today contiguous memory to store the activation buffer.
On the STM32H743ZIT6 you have 1024KB of memory but 512KB of contiguous memory accessible through the CortexM7 of the STM32H7
For your network you'll need to use external RAM and put the activation buffer in external RAM.
Regards
Daniel
2021-07-06 05:05 AM
What does your linker script look like?
2021-07-06 05:38 AM
I didn't even generate the code yet. I'm still configuring the cubemx.
2021-07-06 05:45 AM
STM32Cube.AI needs today contiguous memory to store the activation buffer.
On the STM32H743ZIT6 you have 1024KB of memory but 512KB of contiguous memory accessible through the CortexM7 of the STM32H7
For your network you'll need to use external RAM and put the activation buffer in external RAM.
Regards
Daniel
2021-07-06 05:48 AM
Hello,
Are there any tutorials or guide to use the external RAM with STM32Cube.AI as you mention? (network + activation buffer)
Regards,
Bastien
2021-07-06 06:11 AM
If you use an ST discovery or evaluation board, the support of external memories is "automatic"
In the X-CUBE-AI window, click on the advanced settings wheel on the top right, it will show you the available memories on the board
Click on Use external RAM, choose the available RAM in the combo box then click on Use Activation buffer and just verify that the address is at the beginning of the external RAM.
When you generate the code the BSP code to initialize correctly the external RAM will be included automatically in the generated code.
If you have a non ST board with external RAM, you can do the same procedure in X-CUBE-AI but in that case choose Custom and set the address to use. It is up to you to then add the code to configure the access to the external RAM (using OctoSPI of FMC) and memory map the external RAM so that X-CUBE-AI code can directly read and write to it using a regular address.
Chapter "4.4 Advanced settings" of UM2526 Getting started with X-CUBE-AI Expansion Package for Artificial Intelligence (AI) gives you some screenshot on how to setup external memories for X-CUBE-AI
Regards
Daniel
2021-07-06 08:24 AM
Thank you! I couldn't find where did this advanced settings window came from. Now I can reach it thanks again!