cancel
Showing results for 
Search instead for 
Did you mean: 

Automatic Validation on target compilation problem

DenDanne
Associate II

Hello. I have made with ST Edge AI Developer Cloud a model and downloaded the whole project for STM32CubeIDE.

 

When I do Validate on desktop it works fine and I get expected results.

But Validate on target gives me a compilation error.

 

DenDanne_0-1730889104446.png

 

Building project 
Generating project 
Temporary project loaded 
Temporary AI configuration done 
Generating temporary project code 
Building project 
C:/ST/STM32CubeIDE_1.16.1/STM32CubeIDE/plugins/com.st.stm32cube.ide.mcu.externaltools.gnu-tools-for-stm32.12.3.rel1.win32_1.0.200.202406191623/tools/bin/arm-none-eabi-gcc -c -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard  -DDEBUG -DUSE_HAL_DRIVER -DSTM32G491xx -D  -IDrivers/CMSIS/Device/ST/STM32G4xx/Include -IDrivers/CMSIS/Include -IDrivers/STM32G4xx_HAL_Driver/Inc/Legacy -IDrivers/STM32G4xx_HAL_Driver/Inc -IInc -IMiddlewares/ST/AI/Inc -O3  -Wall -fdata-sections -ffunction-sections Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal.c -o Debug/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal.o 
<command-line>: error: macro names must be identifiers 
In file included from Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_rcc.h:27, 
                 from Inc/stm32g4xx_hal_conf.h:212, 
                 from Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal.h:29, 
                 from Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal.c:35: 
Drivers/STM32G4xx_HAL_Driver/Inc/stm32g4xx_hal_def.h:29:10: fatal error: stm32g4xx.h: No such file or directory 
   29 | #include "stm32g4xx.h" 
      |          ^~~~~~~~~~~~~ 
compilation terminated. 
make: *** [Makefile:75: Debug/Drivers/STM32G4xx_HAL_Driver/Src/stm32g4xx_hal.o] Error 1 
Automatic build and run failed

 

So it does not compile successfully with the no such file or directory for stm32g4xx.h
I have made zero changes to the downloaded project from Developer cloud. And when I try and compile the project myself, it does so successfully. 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello,

Validation process expects your board to be in "Waiting (State 1)" state but it seems that it failed to "Error (State 4)" state.

Interestingly, with the .elf file in your project, it hangs on my board (NUCLEO-G474RE). However, while re-generating and compiling your project (with this tweak) on my side, it performs correctly on the target.

Could you please give it a shot by:
- Opening your project in STM32CubeMX

- Go to "X-CUBE-AI"

- select your network ("network" tab)

- Go to Advanced Settings 

hamitiya_1-1731490741881.png

- Go to "Memory Pools" tab

- Remove "POOL_0_RAM" by clicking "delete" and click on "insert". You should have a new pool named "pool1".

After that, you can either retry a "Validation on target" or generate your project and flash it with STM32CubeProgrammer.

 

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.

View solution in original post

8 REPLIES 8
hamitiya
ST Employee

Hello,

Is it possible to share your version of STM32CubeMX and maybe your project ?

It looks like it does not include automatically the HAL from your target.  

 

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.

 

Hi Yanis,

I have STM32CubeIDE 1.16.1.

Attached is the project that I downloaded from AI Cloud, untouched.

 

Thanks.

 

>>It looks like it does not include automatically the HAL from your target.

Failure on the Include Paths most likely, double check what's passed in, and the Environment Variables

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Hi,

Since you answered with STM32CubeIDE version, are you using STM32CubeMX embedded in STM32CubeIDE ? If yes, could you please install STM32CubeMX directly and try the same action with the standalone tool ? You can open the IOC file directly in STM32CubeMX.

STM32CubeMX - STM32Cube initialization code generator - STMicroelectronics

 

As @Tesla DeLorean said, it might be a include path or missing files. However, since it is from the automatic validation on target action, user does not have any action to do to include these files. We were aware of issues when code generation was performed with STM32CubeMX inside STM32CubeIDE, that's why my proposal is to perform it with the standalone tool.

As a second action, you could switch your application from "SystemPerformance" to "Validation", generate a project, compile/flash and do "Validation on target" without automatic compilation.

 

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.

Hi again. Thanks for your input.

I tried it with latest MX version and there it compiles successfully.

 

Building project 
Generating project 
Temporary project loaded 
Temporary AI configuration done 
Generating temporary project code 
Building project 
Create. 
Opening 'mxAI1071861028699'. 
10:59:41 **** Build of configuration Debug for project mxAI1071861028699 **** 
make -j16 all  
arm-none-eabi-gcc -mcpu=cortex-m4 -g3 -DDEBUG -c -x assembler-with-cpp -MMD -MP -MF"Startup/startup_stm32g491retx.d" -MT"Startup/startup_stm32g491retx.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Startup/startup_stm32g491retx.o" "../Startup/startup_stm32g491retx.s" 
arm-none-eabi-gcc "../Src/aiPbIO.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32G491xx -c -I../Inc -I../Middlewares/ST/AI/Inc -I../Drivers/STM32G4xx_HAL_Driver/Inc -I../Drivers/STM32G4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32G4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -Wall -fstack-usage -fcyclomatic-complexity -MMD -MP -MF"Src/aiPbIO.d" -MT"Src/aiPbIO.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Src/aiPbIO.o" 
arm-none-eabi-gcc "../Src/aiPbMemRWServices.c" -
.
.
continous compilation
.
.
Exec/report summary (validate) 
 ------------------------------------------------------------------------------------------------------------------------ 
 model file         :   C:\Users\danne\OneDrive\Skrivbord\ai2\NUCLEO-G491RE\sine_model1.tflite                            
 type               :   tflite                                                                                            
 c_name             :   network                                                                                           
 compression        :   lossless                                                                                          
 options            :   allocate-inputs, allocate-outputs, multi-heaps                                                    
 optimization       :   balanced                                                                                          
 target/series      :   stm32g4                                                                                           
 memory pool        :   C:\Users\danne\AppData\Local\Temp\mxAI_workspace11729533689007102031768400636249\mempools.json    
 workspace dir      :   C:\Users\danne\AppData\Local\Temp\mxAI_workspace11729533689007102031768400636249                  
 output dir         :   C:\Users\danne\.stm32cubemx\network_output                                                        
 vinput files       :   C:\Users\danne\OneDrive\Dokument\validation_data_no_header.csv                                    
 vinput files       :   C:\Users\danne\OneDrive\Dokument\y_test_output_no_header.csv                                      
 voutput files      :   C:\Users\danne\OneDrive\Dokument\y_test_output_no_header.csv                                      
 model_fmt          :   float                                                                                             
 model_name         :   sine_model1                                                                                       
 model_hash         :   0xcbda45f1585bf3d837013bae283118d6                                                                
 params #           :   321 items (1.25 KiB)                                                                              
 ------------------------------------------------------------------------------------------------------------------------ 
 input 1/1          :   'serving_default_keras_tensor_80', f32(1x1), 4 Bytes, activations                                 
 output 1/1         :   'gemm_2', f32(1x1), 4 Bytes, activations                                                          
 macc               :   353                                                                                               
 weights (ro)       :   1,284 B (1.25 KiB) (1 segment)                                                                    
 activations (rw)   :   128 B (128 B) (1 segment) *                                                                       
 ram (total)        :   128 B (128 B) = 128 + 0 + 0                                                                       
 ------------------------------------------------------------------------------------------------------------------------ 
 (*) 'input'/'output' buffers can be used from the activations buffer 
   
  Memory-pools summary (activations/ domain) 
  --------------- ---- ---------------------- ---------  
  name            id   used                   buffer#    
  --------------- ---- ---------------------- ---------  
  POOL_0_RAM      0    128 B (0.1%)           6          
  weights_array   1    1.25 KiB (128400.0%)   6          
  --------------- ---- ---------------------- --------- 
Running the TFlite model... 
INFO: Created TensorFlow Lite XNNPACK delegate for CPU. 
Running the STM AI c-model (AI RUNNER)...(name=network, mode=TARGET) 
 STM Proto-buffer protocol 3.1 (SERIAL:COM3:115200:connected) ['network'] 
  Summary 'network' - ['network'] 
  ---------------------------------------------------------------------- 
  inputs/ouputs      :   1/1 
  input_1            :   f32[1,1,1,1], 4 Bytes, activations 
  output_1           :   f32[1,1,1,1], 4 Bytes, activations 
  n_nodes            :   5 
  compile_datetime   :   Nov  7 2024 10:59:46 
  activations        :   128 
  weights            :   1284 
  macc               :   353 
  ---------------------------------------------------------------------- 
  tools              :   Legacy ST.AI 1.0.0 - Proto Buffer msg v3.1 
  runtime lib        :   9.1.0 compiled with GCC 11.3.1 
  capabilities       :   IO_ONLY, PER_LAYER, PER_LAYER_WITH_DATA 
  device             :   stm32 family - 0x479 - STM32G491 @170/170MHz 
                         fpu 
  ---------------------------------------------------------------------- 
INTERNAL ERROR: E801(HwIOError): Invalid state: 4 instead 1 
Validation ended

 

The warnings are about _close, _fstat, _isatty, _kill aren’t implemented.

I get INTERNAL ERROR which I don't understand, so still, Validate on target has problems. 

DenDanne_0-1730974150589.png

 

 

Hello.

No, unfortunately I was not able to solve it.

I am really surprised that there is no simple guide that can show step by step how to deploy a model. 

That really is something missing. 

Hello,

Validation process expects your board to be in "Waiting (State 1)" state but it seems that it failed to "Error (State 4)" state.

Interestingly, with the .elf file in your project, it hangs on my board (NUCLEO-G474RE). However, while re-generating and compiling your project (with this tweak) on my side, it performs correctly on the target.

Could you please give it a shot by:
- Opening your project in STM32CubeMX

- Go to "X-CUBE-AI"

- select your network ("network" tab)

- Go to Advanced Settings 

hamitiya_1-1731490741881.png

- Go to "Memory Pools" tab

- Remove "POOL_0_RAM" by clicking "delete" and click on "insert". You should have a new pool named "pool1".

After that, you can either retry a "Validation on target" or generate your project and flash it with STM32CubeProgrammer.

 

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.

Yes thanks it worked here too!