Ask questions and find answers on STM32 security frameworks and tools, including cryptographic libraries, TrustZone, and the Secure Manager.
Most recent activity
Device - STM32H7B3I-DKBase Project : 2_Images_ExtFlashObjective:Load SFB from external flash, decrypt and store in Internal flash eventually launch SFB from internal flash.Setup:1) Firmware binary for our project may be greater than 1 MB, SFB would be stored into external flash of STM32H7B3I-DK which is received over WIFI.2) Option is we can directly run from external flash however it will be slow.Can someone guide what would be good approach to follow considering above constrains.Started with reducing the size of fimrware image and placing it in internal flash. Download area still would be external memory.mapping_fwing.ld__ICFEDIT_SLOT_Active_1_header__ = 0x08010000;__ICFEDIT_SLOT_Active_1_start__ = 0x08020000; __ICFEDIT_SLOT_Active_1_end__ = 0x081DFFFF;
..
Hi,First of all nice application note for getting started with SBSFU cheers :thumbs_up: Let me provide details of steps which I followed Device - STM32H7B3I-DKFollowed AN5056 - Integration guide for the X-CUBE-SBSFU. Under section 4.4 Development or production mode configuration enabled development flow @@ -59,11 +59,11 @@ extern "C" { #define SFU_DEBUG_MODE /*!< Comment this define to optimize memory footprint (debug mode removed) No more print on terminal during SBSFU execution */ -/*#define SFU_VERBOSE_DEBUG_MODE*/ /*!< Uncomment this define when in verbose Debug mode. +#define SFU_VERBOSE_DEBUG_MODE /*!< Uncomment this define when in verbose Debug mode. this switch activates more debug prints in the console (FSM state info...) */ -/*#define SFU_FWIMG_BLOCK_ON_ABNORMAL_ERRORS_MODE*/ /*!< You may uncomment this define when running development tests. +#define SFU_FWIMG_BLOCK_ON_ABNORMAL_ERRORS_MODE /*!< You may uncomment this define when running deve
I want to implement USART1 to the non-secure project of TFM_Appli in STM32L562 TF-M firmware package. I have add some code in secure project of TFM_Appli such as following:enum tfm_plat_err_t tfm_spm_hal_nvic_interrupt_target_state_cfg(void) { /* return nvic_interrupt_target_state_cfg();*/ HAL_GTZC_TZSC_ConfigPeriphAttributes(GTZC_PERIPH_USART1, GTZC_TZSC_PERIPH_NSEC); HAL_GPIO_ConfigPinAttributes(GPIOB, GPIO_PIN_6|GPIO_PIN_5, GPIO_PIN_NSEC); return TFM_PLAT_ERR_SUCCESS; } enum tfm_plat_err_t tfm_spm_hal_nvic_interrupt_enable(void) { /* return nvic_interrupt_enable();*/ HAL_GTZC_TZIC_EnableIT(GTZC_PERIPH_USART1); return TFM_PLAT_ERR_SUCCESS; }And add some code in non-secure project of TFM_Appli such as following:void MX_USART1_UART_Init(void) { /* USER CODE BEGIN USART1_Init 0 */ /* USER CODE END USART1_Init 0 */ /* USER CODE BEGIN USART1_Init 1 */ /* USER CODE END USART1_Init 1 */ huart1.Instance = USART1; huart1.Init.BaudRate = 1
Hi I am trying to get the the SBSFU v 2.5.0 package to work on NUCLEO-G071RB I am getting the following error after the compilation of the User App and during the preimage execution step (this is all occurring within CUBE-IDE): ----------------------------------------------Traceback (most recent call last): File "prepareimage.py", line 966, in <module> File "prepareimage.py", line 963, in args File "prepareimage.py", line 124, in do_encrypt File "keys.py", line 262, in load FileNotFoundError: [Errno 2] No such file or directory: '../../../../2_Images_SECoreBin/SW4STM32/../Binary/OEM_KEY_COMPANY1_key_AES_CBC.bin' ../../../../2_Images_SECoreBin/SW4STM32/postbuild.sh: line 74: prepareimage.exe: No error prepareimage.exe enc -k ../../../../2_Images_SECoreBin/SW4STM32/../Binary/OEM_KEY_COMPANY1_key_AES_CBC.bin -i ../../../../2_Images_SECoreBin/SW4STM32/../Binary/iv.bin ../../UserApp.bin ../../../Binary/UserApp.sfu :
I am using IAR Embedded Workbench 7.60 and configuring the XCube-SBSFU extension package for Nucleo-F411RE.I have done the Compilation in below order and the it is successful for Securebin & SBSFU project.SecurebinSBSFUUserAppWhen compiling the User App project, getting the below linker error for the following line in the .icf file .define root section aes_block_padding with alignment = 16{udata8 "Force Alignment";pad_to 16;};Error[Lc003]: expected "block", "memory", "movable", "overlay", "region", "sharing", or "symbol" I don't understand the issue here. For reference, attached the file
Hi,I'm running the project which is evaluating the SBSFU for the secure firmware upgrade, I have no problem to run SBSFU 2_Images example on Nucleo-H753ZI and execute the secure firmware upgrade, but one thing bug me is the way to unlock the chip.After the evaluation, I used ST-Link with STM32CubeProgrammer to unlock the Read Out Protection, but somehow can't re-program properly then figured out the root cause is the PCROP Protection in AREA1 is still locked.I reviewed the manual athttps://www.st.com/resource/en/reference_manual/dm00314099-stm32h742-stm32h743-753-and-stm32h750-value-line-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf followed the instruction of "Flash bank erase with automatic protection-removal sequence" at page 166, to unlock the PCROP, sometimes I can unlock it right away, but sometimes I have to do the same procedure couple and/or many times to unlock it.Is there any other proper way to unlock the PCROP?Thanks.James Shih
I am using STM32L562-DK for my development, I am using SBSFU.In bootloader, I want to use timer 7 as an interrupt. I am configuring it as followingTIM_HandleTypeDef htim7;void TIM7_IRQHandler(void){ /* USER CODE BEGIN TIM6_IRQn 0 */ /* USER CODE END TIM6_IRQn 0 */ HAL_TIM_IRQHandler(&htim7); /* USER CODE BEGIN TIM7_IRQn 1 */ /* USER CODE END TIM7_IRQn 1 */}void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim){ /* USER CODE BEGIN Callback 0 */ /* USER CODE END Callback 0 */ if (htim->Instance == TIM7) { printf("\r\n TIM7 Callback"); } /* USER CODE BEGIN Callback 1 */ /* USER CODE END Callback 1 */}HAL_StatusTypeDef Boot_StartWatchdgFeedTimer(void){ RCC_ClkInitTypeDef clkconfig; uint32_t uwTimclock = 0; uint32_t uwPrescalerValue = 0; uint32_t  
Assuming that the MCU has the Secure Services feature (Secure Boot), does the BOOT0 pin have any use? My understanding is that the application in the secure bootloader would decide its entry point rather than using the addresses specified by the BOOT0 pin.
I am using STM32L562E-DK board.I am using the SBSFU example. I want to use the ECDSA-256 cryptography scheme. When I am verifying private with key.c file it does not matchI have used following command to verify private.openssl ec -in root-ec-p256 -outform DER -out image_sign_pivate.derxxd -i image_sign_private.der stimage_sign_private.c.importOutput file is as followsunsigned char a_der[] = { 0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0xad, 0x91, 0xc2, 0x93, 0x4b, 0x72, 0x8b, 0xb1, 0xd7, 0x69, 0x5f, 0x33, 0x77, 0x56, 0x00, 0xd2, 0xd2, 0x93, 0x84, 0x66, 0xf3, 0xbb, 0x18, 0xe0, 0x22, 0x3b, 0xb6, 0x7c, 0x9e, 0xdb, 0x14, 0xe5, 0xa0, 0x0a, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0xa1, 0x44, 0x03, 0x42, 0x00, 0x04, 0xeb, 0x8f, 0x0e, 0xd7, 0x62, 0xb8, 0x97, 0xde, 0x46, 0x1c, 0xaa, 0x25, 0xb3, 0xe9, 0x02, 0x8a, 0xf1, 0x0a, 0x3b, 0x86, 0x2b, 0xc7, 0xdf, 0x8e, 0xd3, 0x72, 0xe6, 0x6c, 0xe5, 0xc6, 0x9a, 0xba, 0x51, 0x8e, 0x32, 0x4e, 0xb2,
Hi,When the TZ is enabled, the STM32U5 and STM32L5 has different action when the RDP is configured level 0.5.STM32U5 don't have "Secure Area1" and "Secure Area 2" in the option bytes, but STM32L5 have.Please advise stm32u5 whether has plan to recover this feature in your next revision.Thanks,QiZhang
Hi,Follow the instruction in the README.md, I can compile and load the code into the kit, and the code is working fine.Please share me some information how to debug "TFM_Appli secure" and "TFM_Appli non secure" project?Thanks,QiZhang
Following Error Occurs11:12:01 **** Incremental Build of configuration Debug for project STM32F769I_Discovery_2_Images_UserApp ****make -j8 all arm-none-eabi-gcc -z max-page-size=1 -o "UserApp.elf" @"objects.list" ../../../../2_Images_SBSFU/SW4STM32/STM32F769I_Discovery_2_Images_SBSFU/Debug/se_interface_app.o -mcpu=cortex-m7 -T"../STM32F769NIHx.ld" --specs=nosys.specs -Wl,-Map="UserApp.map" -Wl,--gc-sections -static -Xlinker -L ../../../../Linker_Common/SW4STM32 --specs=nano.specs -mfpu=fpv5-d16 -mfloat-abi=hard -mthumb -Wl,--start-group -lc -lm -Wl,--end-groupFinished building target: UserApp.elfarm-none-eabi-size UserApp.elf arm-none-eabi-objdump -h -S UserApp.elf > "UserApp.list"arm-none-eabi-objcopy -O binary UserApp.elf "UserApp.bin" text data bss dec hex filename 21536 208 6040 27784 6c88 UserApp.elfFinished building: defa
Hello, I have a simple application running on STM32L55 Secure World, but I would like to debug it step by step using an IDE.I am able to debug using the Keil IDE, but it seems the TZEN bit is zero. It must be about the defaults state of the STM32L55 which is TZEN is disabled.As TZEN is zero by default I assume I need to set the bit, but when I try to set this bit, getting a Hard-Fault. Question 1: can we set the TZEN bit during the Debugging session. (I may need proper RDP level during the debugging to set TZEN)Question 2: What RDP levels does Keil use? There is no UI to see RDP in Keil?I thought I might be missing something, and I found an example in STM32CubeL5: FreeRTOS_SecureIOToggle_TrustZoneThere are two projects, one is a tiny application in secure world, one is in FreeRTOS app running in non-secure world. I am running the debugging section on secure world application but the TZEN bit is also zero in this example so the secure app does not run in the secure state?Is it something
Hi all,I’m trying to find out when the Boot Hardware Key (BHK) is exactly written and locked (using the B-U585I-IOT02A discovery kit).The reference manual (RM0456, page 1513) just says that it is „written by a secure code during boot“.So I modified an example project where the TrustZone is enabled and assumed that it boots in secure mode and the key is written. I then tried to read out the key and to use it to encrypt data with the SAES module but this didn’t work. So I assume that the key wasn’t written yet. Is there anything else I have to do that the BHK is written during boot or do I have to generate the BHK with my own code? What is meant with secure boot exactly?Best regards,Kathrin
I am able to run "2-Image" sample application in NUCLEO-L073RZ board.I would like to use "1-image" application due to memory restriction.But example application for "1-image" is not provided for NUCLEO-L073RZ board.Could you please let me know the changes that i should make to create "1-image" binary.It will be helpful if any document available explaining the same.Thanks and Regards,Subin
I am using STM32L562E-DK for my development. I have ported SBSFU for it. I want to add watchdog functionality to it. Currently, I am initializing the watchdog (window) from the application and feeding it from Freerto's task in the application.Now, I want to init the watchdog in the bootloader and feed it from the application.For another interface (e.x. timer) we need to deinit the timer in the bootloader before jumping to the application if the same timer is used in the application. As watchdog doesn't have deinit functionality, is it possible to use watchdog from an application that is initialized in bootloader?@Frantz LEFRERE , Can you please help me regarding it?
Hello,I am trying to get familiar with X-CUBE-SBSFU. I am currently confused about the meaning of "-v, --version" flag for "prepareimage.py header" and "prepareimage.py pack" commands, e.g. from readme:python prepareimage.py pack -k OEM_KEY_COMPANY1_key.bin -r 28 -p 1 -v 2 -n nonce.bin -f UserApp.sfu -t UserApp.sign UserApp.sfbWhat is the version 2 supposed to signify in the snippet above and what effect does it have? Version of what? It only accepts integer values so it cannot have a version value of, e.g., "1.2.0"
Hello guys, how are you all?I'm currently developing using the X-NUCLE-SAFEA1 board integrated with an STM32WB55. I was executing the pairing example generating a randomic mac and cipher key. I stored successfully this keys into the STSafe, but my program failed to save in the MCU flash, and now these both keys are lost.Is it possible to reset these keys? I was reading the restricted datasheet and there it says that i need an admin c-mac to execute this operation. I didn't quite got it what this actually means.Thanks in advance,Matheus
The datasheet on STSAFE-A110 seems to clearly state that the chip provides symmetric encryption services, however the Cube expansion package and middleware in there does not appear to support that. Where can I get the examples of using this feature?
Hello,I am trying to generate the combined elf file with SBSFU and user app. The provided postbuild scripts use the following code to create the file:command=$programmertool" -ms "$elf" "$headerbin" "$sbsfuelfThere is a problem that the combined elf file is huge. For my own application it is 147M and for the example userApp 59M. Why is the file so big? How do I get a normal combination elf file? The combination bin-file is normal and works.
I can not even disable default polynom (in case of STM32L412K8Ux):For STM32G071 it allow me to disable default, but it force on some value (probably default) - it does not allow to enter our own.I would like to set 0x8005 polynom in cubeMX instead of editing code later.
I'm trying to configure a secure area (HDP) for a H735. To do so, I am following the steps described in AN5601 HDP secure area for STM32H7B3xx microcontrollers using the examples HDP_Appli and HDP_Boot for the STM32H735G-DK. The application note does not reference the H735 explicitly, but the steps seem to be the same according to the reference manual of the H735.As soon as I configure the secure area start and end the values do not get written into the option bytes. I already implemented these steps in code and it looks like the call to HAL_FLASH_OB_Launch fails with a OPTCHANGEERR. I already verified that at this point the security bit is set, both while following the steps manually using the Cube Programmer, as well as also while doing it from the application code itself. Before I set the secure area start and end values they are configured with start > end, hence no secure are should be active. In fact, I have always the initial values start = 0x0ff and end = 0x000, as I am unab
I am using STM32L562E-DK.I have ported SBSBFU for it. It is working fine. I want to store my custom data into internal flash and read it on bootup time in the bootloader.For testing I am flashing one binary of 16 byte which's content is "Hello World!" at 0x73000 using SBSFU_UPDATE.bat.If I read Data using STM32Cube programmer and read data at 0x73000, it shows "Hello World!". But If I read Data (16 bytes) using flash read API, it returns success but the data is 0x00(all zero).int test_Storage(){ uint32_t addr = 0x73000; uint8_t data[32]; int test_ret = 1; test_ret = TFM_Driver_FLASH0.ReadData(addr,data,sizeof(data)); if(test_ret != 0) { printf("\r\n Read Fail\r\n"); } else { printf("\r\n Read Successfull\r\n"); for(int i =0;i<16;i++) { printf("%02x ",data[i]); } printf("\r\n"); } return test_ret;}Also, I have changed the range in "low_
ST Community highlights – April to June 2026
Already have an account? Login
No account yet? Create an account
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.