Compiling code for STM32U5 in Keil uVision - Page 1
Forum section: electronics / general

author: CurtisSeizert
author_rank: Regular Contributor
timestamp: February 20, 2024, 03:15:18 pm
content: I am having an issue compiling code for the STM32U575 in uVision for which it seems there should be an easy fix I am not aware of. The linker is throwing the error:.\Objects\NVM_RevB.axf: Error: L6218E: Undefined symbol SECURE_SystemCoreClockUpdate (referred from system_stm32u5xx_ns.o).The full output is below:Code:Tool Versions:IDE-Version: µVision V5.39.0.0Tool Versions:Toolchain: MDK-Lite Version: 5.39.0.0Toolchain Path: C:\Keil_v5\ARM\ARMCLANG\BinC Compiler: ArmClang.exe V6.21Assembler: Armasm.exe V6.21Linker/Locator: ArmLink.exe V6.21Library Manager: ArmAr.exe V6.21Hex Converter: FromElf.exe V6.21CPU DLL:Dialog DLL:Target DLL: STLink\ST-LINKIII-KEIL_SWO.dll V3.2.0.0Dialog DLL: TCM.DLL V1.56.4.0Output:*** Using Compiler 'V6.21', folder: 'C:\Keil_v5\ARM\ARMCLANG\Bin'Build target 'Target 1'compiling ad403x.c...compiling gpio.c...compiling startup_stm32u575xx.c...compiling ad5686.c...compiling delay.c...compiling uart.c...compiling it.c...compiling system_stm32u5xx_ns.c...compiling dac.c...compiling adc.c...compiling main.c...compiling sys_cfg.c...compiling ospi.c...compiling spi.c...compiling tim.c...linking....\Objects\NVM_RevB.axf: Error: L6218E: Undefined symbol SECURE_SystemCoreClockUpdate (referred from system_stm32u5xx_ns.o).Not enough information to list image symbols.Not enough information to list load addresses in the image map.Finished: 2 information, 0 warning and 1 error messages.".\Objects\NVM_RevB.axf" - 1 Error(s), 0 Warning(s).Software Packages used:Package Vendor: ARMhttps://www.keil.com/pack/ARM.CMSIS.6.0.0.packARM::CMSIS@6.0.0CMSIS (Common Microcontroller Software Interface Standard)* Component: CORE Version: 6.0.0Package Vendor: Keilhttps://www.keil.com/pack/Keil.STM32U5xx_DFP.2.2.0.packKeil::STM32U5xx_DFP@2.2.0STMicroelectronics STM32U5 Series Device Support* Component: Startup Variant: Source C Version: 1.0.0Collection of Component include folders:./RTE/_Target_1Collection of Component Files used:* Component: ARM::CMSIS:CORE@6.0.0Include file: CMSIS/Core/Include/tz_context.h* Component: Keil::Device:Startup&Source C@1.0.0Include file: Drivers/CMSIS/Device/ST/STM32U5xx/Include/stm32u5xx.hSource file: MDK/Device/Source/startup_stm32u575xx.cSource file: Drivers/CMSIS/Device/ST/STM32U5xx/Source/Templates/system_stm32u5xx_ns.cInclude file: Drivers/CMSIS/Device/ST/STM32U5xx/Include/partition_stm32u5xx.hTarget not created.Build Time Elapsed: 00:00:01The function SECURE_SystemCoreClockUpdate() is defined in system_stm32u5xx_s.c, but that is not added to the project with the usual device startup code you get when you select modules from the runtime environment. I have tried using both the source C and source ASM for the Device module with no difference between the two. I have also tried adding this file manually, but this turned into a bit of a wild goose chase of undefined symbols when it was time to link the object files. I am following the general procedure I have used successfully with Cortex M4 MCUs, like the STM32F446, but it seems like the ironically named TrustZone feature in M33 makes things a bit more complicated. Is there something I am missing?

author: CurtisSeizert
author_rank: Regular Contributor
timestamp: February 20, 2024, 05:24:28 pm
content: I figured it out. I just needed to disable TrustZone in the options for Target 1 instead of using the default non-secure mode for the software model.