2021-06-09 03:03 AM
I have updated the startup scripts from the MOOC to work with the stm32l152re. However, when I build the user app and flash it onto the MCU I only get the text from the SBSFU in the terminal. It automatically wants to receive a new user firmware:
= [SBOOT] System Security Check successfully passed. Starting...
======================================================================
= (C) COPYRIGHT 2017 STMicroelectronics =
= =
= Secure Boot and Secure Firmware Update =
======================================================================
= [SBOOT] SECURE ENGINE INITIALIZATION SUCCESSFUL
= [SBOOT] STATE: CHECK STATUS ON RESET
INFO: A Reboot has been triggered by a Hardware reset!
INFO: Last execution detected error was: No error. Success.
= [SBOOT] STATE: CHECK NEW FIRMWARE TO DOWNLOAD
= [SBOOT] STATE: DOWNLOAD NEW USER FIRMWARE
File> Transfer> YMODEM> Send ........................................
I've built the application in the order that was suggested in the moocs:
I will add the build logs in the comments (otherwise the post will be too long.
When I build and debug the userapp through stm32cubeIDE, then the user app does run and I get the following screen in my tera term (which I hoped to get after flashing the binary combined with secoreBin and SBSFU:
======================================================================
= (C) COPYRIGHT 2017 STMicroelectronics =
= =
= User App #A =
======================================================================
=================== Main Menu ============================
Download a new Fw Image ------------------------------- 1
Test Protections -------------------------------------- 2
Test SE User Code ------------------------------------- 3
Multiple download ------------------------------------- 4
Validate a FW Image------------------------------------ 5
Selection :
2021-06-09 03:09 AM
SECoreBin build log:
11:52:54 **** Build of configuration Debug for project NUCLEO-L152RE_2_Images_SECoreBin ****
make all
"../../prebuild.sh" "../.."
prepareimage with windows executable
C:/STM32SecuWS/L4/STM32CubeExpansion_SBSFU_V2.4.0/Middlewares/ST/STM32_Secure_Engine/Utilities/KeysAndImages/win/prepareimage/prepareimage.exe conf ../../../Inc/se_crypto_config.h
SECBOOT_ECCDSA_WITH_AES128_CBC_SHA256 selected
C:/STM32SecuWS/L4/STM32CubeExpansion_SBSFU_V2.4.0/Middlewares/ST/STM32_Secure_Engine/Utilities/KeysAndImages/win/prepareimage/prepareimage.exe trans -a GNU -k ../../../Binary/OEM_KEY_COMPANY1_key_AES_CBC.bin -f SE_ReadKey_1 -v V7M
C:/STM32SecuWS/L4/STM32CubeExpansion_SBSFU_V2.4.0/Middlewares/ST/STM32_Secure_Engine/Utilities/KeysAndImages/win/prepareimage/prepareimage.exe trans -a GNU -k ../../../Binary/ECCKEY1.txt -f SE_ReadKey_1_Pub -v V7M
recopy postbuild.sh script with SECBOOT_ECCDSA_WITH_AES128_CBC_SHA256.sh script
...
arm-none-eabi-gcc -mcpu=cortex-m3 -g3 -c -x assembler-with-cpp -MMD -MP -MF"Application/SW4STM32/se_key.d" -MT"Application/SW4STM32/se_key.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Application/SW4STM32/se_key.o" "C:/STM32SecuWS/L4/STM32CubeExpansion_SBSFU_V2.4.0/Projects/NUCLEO-L152RE/Applications/2_Images/2_Images_SECoreBin/SW4STM32/se_key.s"
arm-none-eabi-gcc -o "SECoreBin.elf" @"objects.list" -l:libSTM32CryptographicV3.0.0_CM3_GCC.a -mcpu=cortex-m3 -T"../STM32L152RETx.ld" --specs=nosys.specs -Wl,-Map="NUCLEO-L152RE_2_Images_SECoreBin.map" -Wl,--gc-sections -static -L../../../../../../../../Middlewares/ST/STM32_Cryptographic/Fw_Crypto/STM32L1/Lib -Xlinker -L ../../../../Linker_Common/SW4STM32 --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
Finished building target: SECoreBin.elf
arm-none-eabi-size SECoreBin.elf
text data bss dec hex filename
18644 44 2604 21292 532c SECoreBin.elf
Finished building: default.size.stdout
arm-none-eabi-objdump -h -S SECoreBin.elf > "SECoreBin.list"
Finished building: SECoreBin.list
arm-none-eabi-objcopy -O binary SECoreBin.elf "SECoreBin.bin"
Finished building: SECoreBin.bin
11:53:05 Build Finished. 0 errors, 0 warnings. (took 11s.710ms)
SBSFU:
11:57:11 **** Build of configuration Debug for project NUCLEO-L152RE_2_Images_SBSFU ****
make all
arm-none-eabi-gcc "C:/STM32SecuWS/L4/STM32CubeExpansion_SBSFU_V2.4.0/Middlewares/ST/STM32_Secure_Engine/Core/se_interface_application.c" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32L152xE -DUSE_STM32L1XX_NUCLEO -DUSE_HAL_DRIVER -c -I../../../../../../../../Drivers/CMSIS/Device/ST/STM32L1xx/Include -I../../../../../../../../Drivers/STM32L1xx_HAL_Driver/Inc -I../../../../../../../../Drivers/BSP/STM32L1xx_Nucleo -I../../../Core/Inc -I../../../SBSFU/App -I../../../SBSFU/Target -I../../../../2_Images_SECoreBin/Inc -I../../../../Linker_Common/SW4STM32 -I../../../../../../../../Middlewares/ST/STM32_Secure_Engine/Core -I../../../../../../../../Middlewares/ST/STM32_Secure_Engine/Interface -I../../../../../../../../Drivers/CMSIS/Include -Os -ffunction-sections -Wall -Wno-format -Wno-strict-aliasing -fstack-usage -MMD -MP -MF"Middlewares/STM32_Secure_Engine/se_interface_application.d" -MT"Middlewares/STM32_Secure_Engine/se_interface_application.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Middlewares/STM32_Secure_Engine/se_interface_application.o"
...
arm-none-eabi-gcc -o "SBSFU.elf" @"objects.list" -mcpu=cortex-m3 -T"../STM32L152RETx.ld" --specs=nosys.specs -Wl,-Map="NUCLEO-L152RE_2_Images_SBSFU.map" -Wl,--gc-sections -static -Xlinker -L ../../../../Linker_Common/SW4STM32 --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
Finished building target: SBSFU.elf
arm-none-eabi-size SBSFU.elf
text data bss dec hex filename
52944 252 10500 63696 f8d0 SBSFU.elf
Finished building: default.size.stdout
arm-none-eabi-objdump -h -S SBSFU.elf > "SBSFU.list"
Finished building: SBSFU.list
arm-none-eabi-objcopy -O binary SBSFU.elf "SBSFU.bin"
Finished building: SBSFU.bin
arm-none-eabi-objcopy -O binary "SBSFU.elf" "SBSFU.bin"
arm-none-eabi-size "SBSFU.elf"
text data bss dec hex filename
52944 252 10500 63696 f8d0 SBSFU.elf
arm-none-eabi-objcopy -j .SE_IF_Code "SBSFU.elf" se_inter.elf > /dev/null 2>>1
arm-none-eabi-objcopy --extract-symbol se_inter.elf se_interface_app.elf
arm-none-eabi-objcopy -S --keep-symbols=../se_interface.txt se_interface_app.elf se_interface_app.o
11:57:39 Build Finished. 0 errors, 0 warnings. (took 28s.190ms)
2021-06-09 03:10 AM
UserApp:
11:58:02 **** Build of configuration Debug for project NUCLEO-L152RE_2_Images_UserApp ****
make all
arm-none-eabi-gcc "C:/STM32SecuWS/L4/STM32CubeExpansion_SBSFU_V2.4.0/Drivers/STM32L1xx_HAL_Driver/Src/stm32l1xx_hal.c" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32L152xE -DUSE_HAL_DRIVER -DUSE_STM32L1XX_NUCLEO -c -I../../../Inc -I"C:/STM32SecuWS/L4/STM32CubeExpansion_SBSFU_V2.4.0/Projects/NUCLEO-L152RE/Applications/2_Images/2_Images_UserApp/SW4STM32/NUCLEO-L152RE_2_Images_UserApp/Application/User" -I../../../../../../../../Drivers/CMSIS/Device/ST/STM32L1xx/Include -I../../../../../../../../Drivers/CMSIS/Include -I../../../../../../../../Drivers/STM32L1xx_HAL_Driver/Inc -I../../../../../../../../Drivers/BSP/STM32L1xx_Nucleo -I../../../../../../../../Drivers/BSP/Components/Common -I../../../../../../../../Utilities/Fonts -I../../../../../../../../Middlewares/ST/STM32_Secure_Engine/Core -I../../../../2_Images_SECoreBin/Inc -I../../../../2_Images_SBSFU/SBSFU/App -I../../../../Linker_Common/SW4STM32 -Os -ffunction-sections -Wall -Wno-format -Wno-strict-aliasing -fstack-usage -MMD -MP -MF"Drivers/STM32L1xx_HAL_Driver/stm32l1xx_hal.d" -MT"Drivers/STM32L1xx_HAL_Driver/stm32l1xx_hal.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Drivers/STM32L1xx_HAL_Driver/stm32l1xx_hal.o"
...
arm-none-eabi-gcc "C:/STM32SecuWS/L4/STM32CubeExpansion_SBSFU_V2.4.0/Projects/NUCLEO-L152RE/Applications/2_Images/2_Images_UserApp/SW4STM32/syscalls.c" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32L152xE -DUSE_HAL_DRIVER -DUSE_STM32L1XX_NUCLEO -c -I../../../Inc -I"C:/STM32SecuWS/L4/STM32CubeExpansion_SBSFU_V2.4.0/Projects/NUCLEO-L152RE/Applications/2_Images/2_Images_UserApp/SW4STM32/NUCLEO-L152RE_2_Images_UserApp/Application/User" -I../../../../../../../../Drivers/CMSIS/Device/ST/STM32L1xx/Include -I../../../../../../../../Drivers/CMSIS/Include -I../../../../../../../../Drivers/STM32L1xx_HAL_Driver/Inc -I../../../../../../../../Drivers/BSP/STM32L1xx_Nucleo -I../../../../../../../../Drivers/BSP/Components/Common -I../../../../../../../../Utilities/Fonts -I../../../../../../../../Middlewares/ST/STM32_Secure_Engine/Core -I../../../../2_Images_SECoreBin/Inc -I../../../../2_Images_SBSFU/SBSFU/App -I../../../../Linker_Common/SW4STM32 -Os -ffunction-sections -Wall -Wno-format -Wno-strict-aliasing -fstack-usage -MMD -MP -MF"Application/SW4STM32/syscalls.d" -MT"Application/SW4STM32/syscalls.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Application/SW4STM32/syscalls.o"
arm-none-eabi-gcc "C:/STM32SecuWS/L4/STM32CubeExpansion_SBSFU_V2.4.0/Projects/NUCLEO-L152RE/Applications/2_Images/2_Images_UserApp/Src/sfu_app_new_image.c" -mcpu=cortex-m3 -std=gnu11 -g3 -DSTM32L152xE -DUSE_HAL_DRIVER -DUSE_STM32L1XX_NUCLEO -c -I../../../Inc -I"C:/STM32SecuWS/L4/STM32CubeExpansion_SBSFU_V2.4.0/Projects/NUCLEO-L152RE/Applications/2_Images/2_Images_UserApp/SW4STM32/NUCLEO-L152RE_2_Images_UserApp/Application/User" -I../../../../../../../../Drivers/CMSIS/Device/ST/STM32L1xx/Include -I../../../../../../../../Drivers/CMSIS/Include -I../../../../../../../../Drivers/STM32L1xx_HAL_Driver/Inc -I../../../../../../../../Drivers/BSP/STM32L1xx_Nucleo -I../../../../../../../../Drivers/BSP/Components/Common -I../../../../../../../../Utilities/Fonts -I../../../../../../../../Middlewares/ST/STM32_Secure_Engine/Core -I../../../../2_Images_SECoreBin/Inc -I../../../../2_Images_SBSFU/SBSFU/App -I../../../../Linker_Common/SW4STM32 -Os -ffunction-sections -Wall -Wno-format -Wno-strict-aliasing -fstack-usage -MMD -MP -MF"Application/SFU_Services/sfu_app_new_image.d" -MT"Application/SFU_Services/sfu_app_new_image.o" --specs=nano.specs -mfloat-abi=soft -mthumb -o "Application/SFU_Services/sfu_app_new_image.o"
arm-none-eabi-gcc -z max-page-size=1 -o "UserApp.elf" @"objects.list" -l:se_interface_app.o -mcpu=cortex-m3 -T"../STM32L152RETx.ld" --specs=nosys.specs -Wl,-Map="NUCLEO-L152RE_2_Images_UserApp.map" -Wl,--gc-sections -static -L../../../../2_Images_SBSFU/SW4STM32/NUCLEO-L152RE_2_Images_SBSFU/Debug -Xlinker -L ../../../../Linker_Common/SW4STM32 --specs=nano.specs -mfloat-abi=soft -mthumb -Wl,--start-group -lc -lm -Wl,--end-group
Finished building target: UserApp.elf
arm-none-eabi-size UserApp.elf
text data bss dec hex filename
18208 144 5920 24272 5ed0 UserApp.elf
Finished building: default.size.stdout
arm-none-eabi-objdump -h -S UserApp.elf > "UserApp.list"
Finished building: UserApp.list
arm-none-eabi-objcopy -O binary UserApp.elf "UserApp.bin"
Finished building: UserApp.bin
arm-none-eabi-objcopy -O binary "UserApp.elf" "../../UserApp.bin"
arm-none-eabi-size "UserApp.elf"
text data bss dec hex filename
18208 144 5920 24272 5ed0 UserApp.elf
"../../../../2_Images_SECoreBin/SW4STM32/postbuild.sh" "../.." "./UserApp.elf" "../../UserApp.bin" "1" "1"
prepareimage with windows executable
11:58:31 Build Finished. 0 errors, 0 warnings. (took 28s.714ms)
2021-06-09 04:27 AM
Apparently there was a line of code in the sbsfu that requests the button to be pushed to download a new firmware and this button is not present in our design. removing this button check caused great results.