Issue building SBSFU with latest STM32CubeIDE 1.9.0 : here is the solution
Hello SBSFU users !
The latest release of STM32CubeIDE 1.9.0 is introducing GNU Tools version 10.3 as toolchain. This new toolchain creates an issue in the SBSFU final build.
A new release of X-CUBE-SBSFU is coming in around one month to fix this but, in the meanwhile, I would like to share with you the changes needed to be able to use this version of STM32CubeIDE.
First, the issue is related the the ability to call services in the secure engine. So, if you do not need this feature, just remove it.
Here is how to do this.
1- Open Properties of your user application
2- in C/C++ Build/Settings/MCU GCC Linker/Miscellaneous, remove the content of Additional objects. Something like "./../../2_Images_SBSFU/STM32CubeIDE/Debug/se_interface_app.o"
3- Also remove in your code any call to SE_*. The common service implemented is usually SE_APP_GetActiveFwInfo
That's it.
Now, if you use the SE service, here is what you need to do. The following is the description of the changes done in the SBSFU provided in the STM32WL firmware package. So, you can also get this package for reference.
Principle is to generate a specific .ld file containing the service name and associated address.
1) In SBSFU project, you need to create a postbuild.sh ...SBSSU/STM32CubeIDE/postbuild.sh containing the following
#!/bin/bash -
echo "Extract SE interface symbols"
arm-none-eabi-nm $1 > nm.txt
case "$(uname -s)" in
Linux*|Darwin*)
tr -d '\015' <../se_interface.txt >../se_interface_unix.txt
grep -F -f ../se_interface_unix.txt nm.txt > symbol.list
rm ../se_interface_unix.txt
;;
*)
grep -F -f ../se_interface.txt nm.txt > symbol.list
;;
esac
wc -l symbol.list
cat symbol.list | awk '{split($0,a,/[ \r]/); print a[3]" = 0x"a[1]";"}' > se_interface_app.ld
rm nm.txt
rm symbol.list2) Add the call to this postbuild.
in Properties/C/C++ build/Settings/Build Steps/Post-built steps
Replace the old command by this new one:
"../postbuild.sh" "${BuildArtifactFileName}"This will create the se_interface_app.ld in the debug directory
When building SBSFU you should see something like this in the build console. The 1 means only 1 symbol created. This is the number of services of Secure Engine you use.
Extract SE interface symbols
1 symbol.list
3) Edit the .ld file of your application and just before the INCLUDE mapping_fwimg.ld add following line
INCLUDE se_interface_app.ld4) Last point. You need to give to linker the directory where to find this ld file
in Properties/C build/Settings/MCU GCC Linker/Library/Library search path, add following line
../../../2_Images_SBSFU/STM32CubeIDE/DebugYou may need to adapt the path to your own project to find the path to SBSFU
Then your application should link.
I hope this will help
Best regards
Jocelyn
