Need Guidance to Create a Simple STM32N6 NPU Project Using CubeIDE (and CubeMX)
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:
- Create a new FSBL project by selecting my DK
- Chose not to initialize default peripherals
- Selected X-CUBE-AI 10.0 core and template application from the Middleware section
- Selected a MobileNetV2-based tflite model and Neural-ART runtime.
- Analyzed using "n6-allmems-O3" and generated code. Everything is OK so far.
- 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.
