cancel
Showing results for 
Search instead for 
Did you mean: 

Porting to STM32F429VIT6 from STM32F413H

Ahmed
Associate III

Porting to STM32F429VIT6 from STM32F413H

Changed made so far:

1) Choosing the example from the same STM32 family as starting point if possible

STM32F413H Discovery example chosen:

2) Editing the used IDE configuration files to rename what needs to be renamed to adapt to your target: This step is not usually manadatory

3) Adapt the mapping to your flash (files in Linker_Common). Use documentation to understand underlying constraints (sector size, write protect size, etc ...)

The linker script has been updated to for the 2Mbyte flash on the STM32F429xx Dual Bank from the 1.5 Mbyte Single Bank

4) Adapt the USART port used for interfacing with secure boot and application (header file located in target directory of SBSFU and example application)

The USART port has been changed to USART3 which is part of the JTAG connector. Tested with an application firmware and it works fine)

5) Adapt the clocking to your target: use STM32CubeMX to generate your clocking and copy paste the generated function

a. I am not sure where I will update the clocking information, which file do I modify?

6) Adapt the LED output or remove it

Led pins has been changed to match custom board

7) Adapt the push button GPIO used to force the firmware update

GPIO pin adapted to match custom board

😎 Deactivate all secure protections to start debugging

In the integration guide it mentions this in section 3.1

Flash configuration: NUCLEO-L432KC gives an example of single-bank Flash interface whereas NUCLEO-L476RG is dual-bank based (in file sfu_low_level.c)

I was not able to find anything related to flash bank in that file.

There is information regarding flash bank in sfu_low_level_flash_int.h however the STM32F413 is single bank and comparing to the STM32L476 example which is dual bank, the code is very different.

I tried adapting the code to dual bank however the STM32CubeExpansion_SBSFU_V2.4.0\Drivers\STM32L4xx_HAL_Driver\Inc\stm32f4xx_hal_flash is different and there is no mention of dual bank memory.

b. The target/sfu_low_level_security.h refers to memory address directly does that require changing?

I get nothing on the uart coms terminal (completely empty) and I cannot debug the SBSFU (step through the code) from the STM Cube IDE.

c. Any help at all will be much appreciated. I am new to the STM32 platform, however the company I am working for are very much interested in the STM32 MCU’s and are looking to integrate into all the lines products. 

3 REPLIES 3
Jocelyn RICARD
ST Employee

Hello Mahme,

"I am not sure where I will update the clocking information, which file do I modify?"

Clocking setup is located in main.c file in SystemClock_Config function.

This is important to set the right clocking. STM32CubeMX is the good tool for that. It generates the clocking you need and then just need to copy paste this SystemClock_Config function.

Regarding flash driver adaptation. You just need to find an example of flash driver for your target chip.

For instance, you have an example in the STM32 F4 Cube FW: STM32Cube_FW_F4_V1.25.2\Projects\STM32F429ZI-Nucleo\Examples\FLASH\FLASH_EraseProgram that you can look at. But please don't use L4 family as example. Flash driver is not the same.

"The target/sfu_low_level_security.h refers to memory address directly does that require changing?

I get nothing on the uart coms terminal (completely empty) and I cannot debug the SBSFU (step through the code) from the STM Cube IDE."

Yes, this file contains the MPU configuration that needs to be adapted when you change the mapping.

But as you refer to uart issue I guess you were talking about sfu_low_level.h

This is the file to adapt to use available uart on your board.

To avoid loosing time, I would suggest using STM32CubeMX to make a simple project to activate uart and test it.

This once its ok, just take same configuration an put it in SBSFU.

Hope this will help

Best regards

Jocelyn

Thank you for getting back.

I made some progress. After implementing all of the above points. I get this on the comms window.

======================================================================

=       (C) COPYRIGHT 2017 STMicroelectronics         =

=                                  =

=       Secure Boot and Secure Firmware Update        =

======================================================================

= [SBOOT] STATE: WARNING: SECURE ENGINE INITIALIZATION WITH FACTORY DEFAULT VALUES!

========= End of Execution ==========

Then processor reboots and message repeats.

I tried debugging by stepping through the code however, it steps through the code very strangely I think its due to the missing secure engine code the debugger gets confused.

Fails at SFU_BOOT_Init(); in sfu_boot.c and e_ret_code = SFU_BOOT_INIT_FAIL is returned.

EDIT : Update

I think the issue was related to my custom board, I have been more successful with the STM32 NUCLEO board.

0693W000005CUQmQAO.png@Jocelyn RICARD​ Thank you for your help. I was wondering if you can provide me with bit more help with the sfu_low_level_security.h Currently MPU does not work and i have it disabled (Memfault).

Jocelyn RICARD
ST Employee

Hello Ahmed,

MPU needs to be adapted to your mapping change.

So, you first need to analyse the stating point with MPU setting, understanding what part are protected and then translate this to your new mapping.

You have a short description in the integration guide but this is very short ...

What is important to understand is that when you define a MPU region, the size should be power of 2, and then you can apply selectively the settings of this region to each 1/8th of this region using a bitmap called SREG. If bit is 1 the corresponding address range is excluded.

Then, on target, you can have a look to the debug registers when fault is triggered to get the faulty address.

I hope this will help

Best regards

Jocelyn