2025-06-20 3:22 AM
Hi,
I am trying to deploy a model onto the N6 disco board with modelzoo's github repo.
I have trained my model and am now trying to deploy it to the board via running stm32ai_main.py.
I get the following error log that I have not been able to solve on my own. I have cloned the repo with the recursive flag set as I have seen on this forum:
PS C:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services> c:; cd 'c:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services'; & 'c:\Users\Haris\AppData\Local\Programs\Python\Python310\python.exe' 'c:\Users\Haris\.vscode\extensions\ms-python.debugpy-2025.8.0-win32-x64\bundled\libs\debugpy\launcher' '56023' '--' 'c:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\object_detection\stm32ai_main.py'
1 physical GPUs, 1 logical GPUs
[INFO] : Setting upper memory limit to 16GBytes on gpu[0]
[INFO] : Running `deployment` operation mode
[INFO] : Using provided class names from dataset.class_names
[INFO] : ClearML config check
[INFO] : The random seed for this simulation is 127
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
[INFO] : Generating C header file for Getting Started...
loading model.. model_path="C:/Users/Haris/Desktop/zooooo/stm32ai-modelzoo-services/src/experiments_outputs/2025_06_20_11_02_18/quantized_models/quantized_model.tflite"
loading conf file.. "C:/Users/Haris/Desktop/zooooo/stm32ai-modelzoo-services/application_code/image_classification/STM32N6/stmaic_STM32N6570-DK.conf" config="None"
"Debug" configuration is used
[INFO] : Selected board : "STM32N6570-DK Getting Started Image Classification (STM32CubeIDE)" (stm32_cube_ide/Debug/stm32n6)
[INFO] : Compiling the model and generating optimized C code + Lib/Inc files: C:/Users/Haris/Desktop/zooooo/stm32ai-modelzoo-services/src/experiments_outputs/2025_06_20_11_02_18/quantized_models/quantized_model.tflite
[INFO] : Establishing a connection to STM32Cube.AI Developer Cloud to launch the model benchmark on STM32 target...
[INFO] : To create an account, go to https://stedgeai-dc.st.com/home. Enter your credentials:
Username: *****@*****.gr
Password:
[INFO] : Successfully connected!
[INFO] : Optimized C code + Lib/Inc files generation done.
[INFO] : Building the STM32 c-project..
deploying the c-project.. "STM32N6570-DK Getting Started Image Classification (STM32CubeIDE)" (stm32_cube_ide/Debug/stm32n6)
updating.. Debug
-> s:copying file.. "network.c" to C:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\application_code\image_classification\STM32N6\Model\STM32N6570-DK\network.c
-> s:copying file.. "network_ecblobs.h" to C:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\application_code\image_classification\STM32N6\Model\STM32N6570-DK\network_ecblobs.h
-> s:copying file.. "network_atonbuf.xSPI2.raw" to C:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\application_code\image_classification\STM32N6\Model\STM32N6570-DK\network_atonbuf.xSPI2.raw
-> s:removing dir.. C:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\application_code\image_classification\STM32N6\Middlewares\AI_Runtime\Inc
-> s:copying dir.. "Inc" to C:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\application_code\image_classification\STM32N6\Middlewares\AI_Runtime\Inc
-> u:copying file.. "app_config.h" to C:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\application_code\image_classification\STM32N6\Application\STM32N6570-DK\Inc\app_config.h
all the files are not be updated, 5/7!
-> ['ARMCortexM55', 'll_aton']
-> updating cproject file "C:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\application_code\image_classification\STM32N6\Application\STM32N6570-DK\STM32CubeIDE" with "NetworkRuntime1000_CM55_GCC.a"
building.. Debug
[returned code = 13 - FAILED]
$ cwd: C:/Users/Haris/Desktop/zooooo/stm32ai-modelzoo-services/application_code/image_classification/STM32N6/Application/STM32N6570-DK/STM32CubeIDE
$ args: stm32cubeide --launcher.suppressErrors -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import C:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\application_code\image_classification\STM32N6\Application\STM32N6570-DK\STM32CubeIDE -data C:\Users\Haris\AppData\Local\Temp\tmpx7ccxe6f -cleanBuild "STM32N6570-DK_GettingStarted_ImageClassification/Debug"
Create.
Opening 'STM32N6570-DK_GettingStarted_ImageClassification'.
11:44:35 **** Clean-only build of configuration Debug for project STM32N6570-DK_GettingStarted_ImageClassification ****
make -j8 clean
make: *** No rule to make target 'clean'. Stop.
"make -j8 clean" terminated with exit code 2. Build might be incomplete.
11:44:35 Build Failed. 1 errors, 0 warnings. (took 209ms)
11:44:35 **** Clean-only build of configuration Debug for project STM32N6570-DK_GettingStarted_ImageClassification ****
make -j8 clean
make: *** No rule to make target 'clean'. Stop.
"make -j8 clean" terminated with exit code 2. Build might be incomplete.
11:44:35 Build Failed. 1 errors, 0 warnings. (took 125ms)
Stm32cubeide:
An error has occurred. See the log file
C:\Users\Haris\AppData\Local\Temp\tmpx7ccxe6f\.metadata\.log.
flashing.. Debug STM32N6570-DK
[returned code = 1 - FAILED]
$ cwd: C:/Users/Haris/Desktop/zooooo/stm32ai-modelzoo-services/application_code/image_classification/STM32N6/Application/STM32N6570-DK/STM32CubeIDE
$ args: STM32_SigningTool_CLI -s -bin Debug/STM32N6570-DK_GettingStarted_ImageClassification.bin -nk -t ssbl -hv 2.3 -o Debug/STM32N6570-DK_GettingStarted_ImageClassification_signed.bin
'STM32_SigningTool_CLI' is not recognized as an internal or external command,
operable program or batch file.
[returned code = 1 - FAILED]
$ cwd: C:/Users/Haris/Desktop/zooooo/stm32ai-modelzoo-services/application_code/image_classification/STM32N6/Application/STM32N6570-DK/STM32CubeIDE
$ args: STM32_Programmer_CLI -c port=swd mode=HOTPLUG sn=005000243333511831363730 --extload C:\ST\STM32CubeIDE_1.16.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.400.202404281720\tools\bin\ExternalLoader/MX66UW1G45G_STM32N6570-DK.stldr -w Debug/STM32N6570-DK_GettingStarted_ImageClassification_signed.bin 0x70100000
-------------------------------------------------------------------
STM32CubeProgrammer v2.17.0
-------------------------------------------------------------------
Warning: The external loader file does not exist:
C:\ST\STM32CubeIDE_1.16.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.400.202404281720\tools\bin\ExternalLoader/MX66UW1G45G_STM32N6570-DK.stldr
[returned code = 1 - FAILED]
$ cwd: C:/Users/Haris/Desktop/zooooo/stm32ai-modelzoo-services/application_code/image_classification/STM32N6/Application/STM32N6570-DK/STM32CubeIDE
$ args: STM32_Programmer_CLI -c port=swd mode=HOTPLUG sn=005000243333511831363730 --extload C:\ST\STM32CubeIDE_1.16.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.400.202404281720\tools\bin\ExternalLoader/MX66UW1G45G_STM32N6570-DK.stldr -w ../../../Model/STM32N6570-DK/network_atonbuf.xSPI2.bin 0x70380000
-------------------------------------------------------------------
STM32CubeProgrammer v2.17.0
-------------------------------------------------------------------
Warning: The external loader file does not exist:
C:\ST\STM32CubeIDE_1.16.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.400.202404281720\tools\bin\ExternalLoader/MX66UW1G45G_STM32N6570-DK.stldr
[returned code = 1 - FAILED]
$ cwd: C:/Users/Haris/Desktop/zooooo/stm32ai-modelzoo-services/application_code/image_classification/STM32N6/Application/STM32N6570-DK/STM32CubeIDE
$ args: STM32_Programmer_CLI -c port=swd mode=HOTPLUG sn=005000243333511831363730 mode=HOTPLUG --extload C:\ST\STM32CubeIDE_1.16.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.400.202404281720\tools\bin\ExternalLoader/MX66UW1G45G_STM32N6570-DK.stldr -w ../../../Binary/ai_fsbl.hex
-------------------------------------------------------------------
STM32CubeProgrammer v2.17.0
-------------------------------------------------------------------
Warning: The external loader file does not exist:
C:\ST\STM32CubeIDE_1.16.1\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.cubeprogrammer.win32_2.1.400.202404281720\tools\bin\ExternalLoader/MX66UW1G45G_STM32N6570-DK.stldr
[INFO] deployment complete
[INFO] : Please on STM32N6570-DK toggle the boot switches to the left and power cycle the board.
Thanks
2025-06-20 4:49 AM
Hello @dogg,
Can you try to deploy your model not using the cloud, but doing it locally.
It may have changed (I will ask) but it was not supported before for the N6.
Also please make sure to use the last version of X Cube AI / St Edge AI Core (10.1.0 or 2.1.0)
With something like this in the yaml:
tools:
stedgeai:
version: 10.1.0
optimization: balanced
on_cloud: False # Not Available For STM32N6
path_to_stedgeai: C:/Users/<XXXXX>/STM32Cube/Repository/Packs/STMicroelectronics/X-CUBE-AI/<*.*.*>/Utilities/windows/stedgeai.exe
path_to_cubeIDE: C:/ST/STM32CubeIDE_<*.*.*>/STM32CubeIDE/stm32cubeide.exe
Also, I see this in your error message:
'STM32_SigningTool_CLI' is not recognized as an internal or external command,
The STM32_SigningTool_CLI is installed when you install STM32CubeProgrammer, so I believe that you should have it. Could you open a terminal and type STM32_SigningTool_CLI.exe to see if you have it?
Have a good day,
Julian
2025-06-22 12:53 AM - edited 2025-06-22 1:14 AM
Hi,
I gave that a try and I get this log now:
Error executing job with overrides: []
Traceback (most recent call last):
File "c:\Users\Haris\AppData\Local\Programs\Python\Python310\lib\site-packages\clearml\binding\hydra_bind.py", line 230, in _patched_task_function
return task_function(a_config, *a_args, **a_kwargs)
File "c:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\object_detection\stm32ai_main.py", line 221, in main
process_mode(cfg)
File "c:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\object_detection\stm32ai_main.py", line 94, in process_mode
deploy(cfg)
File "c:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\object_detection\deployment\deploy.py", line 118, in deploy
stm32ai_deploy_stm32n6(target=board,
File "c:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\common\deployment\common_deploy.py", line 493, in stm32ai_deploy_stm32n6
_stmaic_local_call(session)
File "c:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\common\deployment\common_deploy.py", line 442, in _stmaic_local_call
stmaic.compile(session=session, options=opt, target=session._board_config)
File "c:\Users\Haris\Desktop\zooooo\stm32ai-modelzoo-services\common\stm32ai_local\compile.py", line 211, in cmd_compile
raise Exception('Error during compilation')
Exception: Error during compilation
This is what my tools struct look like:
tools:
stedgeai:
version: 10.1.0
optimization: balanced
on_cloud: False
path_to_stedgeai: C:/Users/Haris/STM32Cube/Repository/Packs/STMicroelectronics/X-CUBE-AI/10.1.0/Utilities/windows/stedgeai.exe
path_to_cubeIDE: C:/ST/STM32CubeIDE_1.16.1/STM32CubeIDE/stm32cubeide.exe
general:
project_name: COCO_2017_person_Demo
model_type: st_yolo_lc_v1
model_path: C:/Users/Haris/Desktop/zooooo/stm32ai-modelzoo-services/src/experiments_outputs/2025_06_20_11_02_18/quantized_models/quantized_model.tflite
logs_dir: logs
saved_models_dir: saved_models
gpu_memory_limit: 16
num_threads_tflite: 4
global_seed: 127
2025-06-23 4:26 AM - edited 2025-06-23 6:12 AM
The signing in tool exists here: C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin
and here is what my .yaml file looks like:
general:
project_name: COCO_2017_person_Demo
model_type: st_yolo_lc_v1
#choices=[st_ssd_mobilenet_v1, ssd_mobilenet_v2_fpnlite, tiny_yolo_v2, st_yolo_lc_v1,
# st_yolo_x, yolo_v8, yolo_v5u]
model_path: C:/Users/Haris/Desktop/zooooo/stm32ai-modelzoo-services/src/experiments_outputs/2025_06_23_13_51_06/quantized_models/quantized_model.tflite
logs_dir: logs
saved_models_dir: saved_models
gpu_memory_limit: 16
num_threads_tflite: 4
global_seed: 127
operation_mode: deployment
#choices=['training' , 'evaluation', 'deployment', 'quantization', 'benchmarking',
# 'chain_tqeb','chain_tqe','chain_eqe','chain_qb','chain_eqeb','chain_qd ']
dataset:
name: water
class_names: ['human']
training_path: C:/Users/Haris/Desktop/stm32ai-modelzoo/object_detection/src/water/train
validation_path: C:/Users/Haris/Desktop/stm32ai-modelzoo/object_detection/src/water/valid
validation_split: 0.2 # Training/validation sets split ratio.
test_path:
quantization_path: C:/Users/Haris/Desktop/stm32ai-modelzoo/object_detection/src/water/quant
quantization_split: # Quantization split ratio.
seed: 123 # Random generator seed used when splitting a dataset.
preprocessing:
rescaling: { scale: 1/127.5, offset: -1 }
resizing:
aspect_ratio: fit
interpolation: nearest
color_mode: rgb
data_augmentation:
########## For tiny_yolo_v2 and st_yolo_lc_v1 only ###########
random_periodic_resizing:
period: 10
image_sizes: [(192, 192), (224, 224), (256, 256), (288, 288), (320, 320), (352, 352),
(384, 384), (416, 416), (448, 448), (480, 480), (512, 512),
(544, 544), (576, 576), (608, 608)]
random_flip:
mode: horizontal
random_crop:
crop_center_x: (0.25, 0.75)
crop_center_y: (0.25, 0.75)
crop_width: (0.5, 0.9)
crop_height: (0.5, 0.9)
change_rate: 0.9
random_contrast:
factor: 0.4
random_brightness:
factor: 0.3
training:
model:
# alpha: 0.35
input_shape: (192, 192, 3)
# pretrained_weights: imagenet
dropout:
batch_size: 64
epochs: 4
optimizer:
Adam:
learning_rate: 0.005
callbacks:
ReduceLROnPlateau:
monitor: val_map
patience: 10
factor: 0.25
ModelCheckpoint:
monitor: val_map
EarlyStopping:
monitor: val_map
patience: 20
postprocessing:
confidence_thresh: 0.001
NMS_thresh: 0.5
IoU_eval_thresh: 0.4
plot_metrics: False # Plot precision versus recall curves. Default is False.
max_detection_boxes: 100
quantization:
quantizer: TFlite_converter
quantization_type: PTQ
quantization_input_type: uint8
quantization_output_type: float
granularity: per_channel #per_tensor
optimize: False #can be True if per_tensor
export_dir: quantized_models
benchmarking:
board: STM32N6570-DK
tools:
stedgeai:
version: 10.1.0
optimization: balanced
on_cloud: False
path_to_stedgeai: C:/Users/Haris/STM32Cube/Repository/Packs/STMicroelectronics/X-CUBE-AI/10.1.0/Utilities/windows/stedgeai.exe
path_to_cubeIDE: C:/ST/STM32CubeIDE_1.18.1/STM32CubeIDE/stm32cubeide.exe
deployment:
c_project_path: ../application_code/object_detection/STM32N6/
IDE: GCC
verbosity: 1
hardware_setup:
serie: STM32N6
board: STM32N6570-DK #STM32H747I-DISCO, STM32N6570-DK
mlflow:
uri: ./src/experiments_outputs/mlruns
hydra:
run:
dir: ./src/experiments_outputs/${now:%Y_%m_%d_%H_%M_%S}
thanks
2025-06-24 12:11 AM
It turns out that if I use this command instead of running the script from vscode, the compilation works fine which does not make sense because vscode is using the same interpreter...
& "C:\Users\Haris\AppData\Local\Programs\Python\Python310\python.exe" stm32ai_main.py
Anyway, I now get a failed to erase memory error:
-------------------------------------------------------------------
STM32CubeProgrammer v2.19.0
-------------------------------------------------------------------
ST-LINK SN : 005000243333511831363730
ST-LINK FW : V3J15M6
Board : STM32N6570-DK
Voltage : 3.28V
SWD freq : 8000 KHz
Connect mode: Hot Plug
Reset mode : Software reset
Device ID : 0x486
Connection to AP 0 requested and failed, Connection established with AP 1
Revision ID : Rev B
Device name : STM32N6xx
Device type : MCU
Device CPU : Cortex-M55
BL Version : --
Opening and parsing file: STM32N6570-DK_GettingStarted_ObjectDetection_signed.bin
Memory Programming ...
File : STM32N6570-DK_GettingStarted_ObjectDetection_signed.bin
Size : 259.19 KB
Address : 0x70100000
Erasing memory corresponding to sector 0:
Erasing external memory sectors [16 20]
Error: failed to erase memory
Error: failed to erase memory
Board programming failed: "Error: failed to erase memory"
thanks
2025-06-24 12:59 AM
I had the boot switches in the wrong position. The correct position for flashing the firmware is both switches to the right. Then toggle them to the left after a power cycle for the program to start.