cancel
Showing results for 
Search instead for 
Did you mean: 

Need Guidance to Create a Simple STM32N6 NPU Project Using CubeIDE (and CubeMX)

AM-adben
Associate II

Hello,

I need guidance to create a very simple AI project using CubeIDE (CubeMX) and Neural-ART runtime. I can use all the example projects successfully but failed to create one from scratch till now. I faced no challenge earlier when using H7 for my AI projects.

I am using STM32N6570-DK. I tried using different ways, but I either got strange compilation/linking errors or got stuck in the neverending "Generating code" screen.

Anyway, my latest attempt is as follows:

  1. Create a new FSBL project by selecting my DK
  2. Chose not to initialize default peripherals
  3. Selected X-CUBE-AI 10.0 core and template application from the Middleware section
  4. Selected a MobileNetV2-based tflite model and Neural-ART runtime.
  5. Analyzed using "n6-allmems-O3" and generated code. Everything is OK so far.
  6. Tried to build and got errors and warnings.

Errors and warnings:

RIF-related error/warning in app_x-cube-ai.c.

 

 

./X-CUBE-AI/App/app_x-cube-ai.c: In function 'MX_X_CUBE_AI_Init':
../X-CUBE-AI/App/app_x-cube-ai.c:100:5: warning: implicit declaration of function 'HAL_RIF_RISC_SetSlaveSecureAttributes' [-Wimplicit-function-declaration]
  100 |     HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_NPU, RIF_ATTRIBUTE_PRIV | RIF_ATTRIBUTE_SEC);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../X-CUBE-AI/App/app_x-cube-ai.c:100:43: error: 'RIF_RISC_PERIPH_INDEX_NPU' undeclared (first use in this function)
  100 |     HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_NPU, RIF_ATTRIBUTE_PRIV | RIF_ATTRIBUTE_SEC);
      |                                           ^~~~~~~~~~~~~~~~~~~~~~~~~
../X-CUBE-AI/App/app_x-cube-ai.c:100:43: note: each undeclared identifier is reported only once for each function it appears in
../X-CUBE-AI/App/app_x-cube-ai.c:100:70: error: 'RIF_ATTRIBUTE_PRIV' undeclared (first use in this function)
  100 |     HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_NPU, RIF_ATTRIBUTE_PRIV | RIF_ATTRIBUTE_SEC);
      |                                                                      ^~~~~~~~~~~~~~~~~~
../X-CUBE-AI/App/app_x-cube-ai.c:100:91: error: 'RIF_ATTRIBUTE_SEC' undeclared (first use in this function)
  100 |     HAL_RIF_RISC_SetSlaveSecureAttributes(RIF_RISC_PERIPH_INDEX_NPU, RIF_ATTRIBUTE_PRIV | RIF_ATTRIBUTE_SEC);
      |                                                                                           ^~~~~~~~~~~~~~~~~

 

 

 

NOTE:

This is just one of my many attempts to create a simple FSBL code to use the NPU. If I do not use "X-CUBE-AI template application", then I am getting XSPI-related errors and warnings.

 

I'd highly appreciate a very basic guide to creating a simple application using CubeIDE, X-XUBE-AI, and NPU.

I am also sharing my last attempt project code in zipped format.

2 REPLIES 2
edmond yun
Associate III

Hi,

 

Seems to be solved about the same or similar issue, how about using my project files ?

I created the code with CubeMx and built in CubeIDE.

hope to be done well for you.

https://drive.google.com/file/d/1etH_FyRxUyEPAl92u3qWFnIFeYOpCEMq/view?usp=drive_link

 

have a good day.

thanks.

Hello @edmond yun ,

Thank you very much for your contribution. Is that possible to compress your project and attach it to the conversation.

Thanks

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.
PS:
1 - This is NOT an online support (https://ols.st.com) but a collaborative space.
2 - Please be polite in your reply. Otherwise, it will be reported as inappropriate and you will be permanently blacklisted from my help.