Author Topic: Compiling code for STM32U5 in Keil uVision  (Read 384 times)

0 Members and 1 Guest are viewing this topic.

Offline CurtisSeizertTopic starter

  • Regular Contributor
  • *
  • Posts: 139
  • Country: us
Compiling code for STM32U5 in Keil uVision
« on: February 20, 2024, 03:15:18 pm »
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: [Select]
Tool Versions:

IDE-Version: µVision V5.39.0.0
 
Tool Versions:
Toolchain:       MDK-Lite  Version: 5.39.0.0
Toolchain Path:  C:\Keil_v5\ARM\ARMCLANG\Bin
C Compiler:      ArmClang.exe V6.21
Assembler:       Armasm.exe V6.21
Linker/Locator:  ArmLink.exe V6.21
Library Manager: ArmAr.exe V6.21
Hex Converter:   FromElf.exe V6.21
CPU DLL:         
Dialog DLL:     
Target DLL:      STLink\ST-LINKIII-KEIL_SWO.dll V3.2.0.0
Dialog DLL:      TCM.DLL V1.56.4.0
 
Output:

*** 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: ARM
                [url]https://www.keil.com/pack/ARM.CMSIS.6.0.0.pack[/url]
                ARM::CMSIS@6.0.0
                CMSIS (Common Microcontroller Software Interface Standard)
   * Component: CORE Version: 6.0.0

Package Vendor: Keil
                [url]https://www.keil.com/pack/Keil.STM32U5xx_DFP.2.2.0.pack[/url]
                Keil::STM32U5xx_DFP@2.2.0
                STMicroelectronics STM32U5 Series Device Support
   * Component: Startup Variant: Source C Version: 1.0.0

Collection of Component include folders:

  ./RTE/_Target_1

Collection of Component Files used:


   * Component: ARM::CMSIS:CORE@6.0.0
      Include file:  CMSIS/Core/Include/tz_context.h

   * Component: Keil::Device:Startup&Source C@1.0.0
      Include file:  Drivers/CMSIS/Device/ST/STM32U5xx/Include/stm32u5xx.h
      Source file:   MDK/Device/Source/startup_stm32u575xx.c
      Source file:   Drivers/CMSIS/Device/ST/STM32U5xx/Source/Templates/system_stm32u5xx_ns.c
      Include file:  Drivers/CMSIS/Device/ST/STM32U5xx/Include/partition_stm32u5xx.h
Target not created.
Build Time Elapsed:  00:00:01

The 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?
 

Offline CurtisSeizertTopic starter

  • Regular Contributor
  • *
  • Posts: 139
  • Country: us
Re: Compiling code for STM32U5 in Keil uVision
« Reply #1 on: February 20, 2024, 05:24:28 pm »
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.
 
The following users thanked this post: audiotubes


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf