Skip to main content
Associate
April 12, 2026
Solved

implement multi-model scheduling with FreeRTOS using STM32Cube.AI ?

  • April 12, 2026
  • 1 reply
  • 183 views

Hi all,

I’m currently working on an Edge AI project using the NUCLEO-N657X0-q and I've run into a roadblock regarding multi-model deployment.

I need to run 2 or 3 models on this MCU, scheduled via FreeRTOS. While I can get a single model working fine with STM32Cube.AI Studio, I’m struggling to find a detailed workflow for managing multiple instances.

Specific questions:

  • API Naming: How to properly configure Cube.AI to generate unique prefixes for multiple models to avoid link-time conflicts?

  • Memory/Buffer Sharing: Is there a standard way to share a single activation buffer between models to save RAM, given they are called sequentially via FreeRTOS?

  • Task Scheduling: Any known issues or best practices for calling stai_network_run() within a FreeRTOS task? (e.g. stack size or re-entrancy).

I’ve checked the ST Edge AI Core docs but couldn't find a concrete example for this multi-model + RTOS use case. If anyone has a reference project or can point me to the right Application Note, I’d really appreciate it.

Thanks!

Best answer by hamitiya

Hello  @Jason32 

When working with multiple networks / multiple instances, you need to specify a "model name". 

ST Edge AI Core API uses stai_<network_name>_run() methods, which can be specified in STM32Cube AI Studio.

In the "Right Panel", scroll to "Advanced Settings" and in "Common Options", edit "network" by a string which is friendly to you (example: img_detect_1). 

All the code generated (sources and headers) will be with this name:

network.c -> img_detect_1.c

network_data.c -> img_detect_1_data.c

etc...

To share a single activation buffer, allocation needs to be the greater one. If you are working with a contiguous memory region, and working with 3 models, you need to allocate a memory region which is the maximum of the 3.

 

 

Best regards,

Yanis

1 reply

hamitiya
hamitiyaBest answer
ST Employee
April 13, 2026

Hello  @Jason32 

When working with multiple networks / multiple instances, you need to specify a "model name". 

ST Edge AI Core API uses stai_<network_name>_run() methods, which can be specified in STM32Cube AI Studio.

In the "Right Panel", scroll to "Advanced Settings" and in "Common Options", edit "network" by a string which is friendly to you (example: img_detect_1). 

All the code generated (sources and headers) will be with this name:

network.c -> img_detect_1.c

network_data.c -> img_detect_1_data.c

etc...

To share a single activation buffer, allocation needs to be the greater one. If you are working with a contiguous memory region, and working with 3 models, you need to allocate a memory region which is the maximum of the 3.

 

 

Best regards,

Yanis

​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.