cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX Cube AI shows less memory than MCU has.

RMais
Associate II

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:

0693W00000BcwCeQAJ.pngThe 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?

1 ACCEPTED SOLUTION

Accepted Solutions
fauvarque.daniel
ST Employee

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


In order 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.

View solution in original post

6 REPLIES 6
DWeb_2
Associate III

What does your linker script look like?

I didn't even generate the code yet. I'm still configuring the cubemx.

fauvarque.daniel
ST Employee

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


In order 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.

Hello,

Are there any tutorials or guide to use the external RAM with STM32Cube.AI as you mention? (network + activation buffer)

Regards,

Bastien

fauvarque.daniel
ST Employee

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


In order 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! I couldn't find where did this advanced settings window came from. Now I can reach it thanks again!