Skip to main content
jvavra
Associate III
August 23, 2021
Question

How Is "system_stm32xxxx.c" File Included?

  • August 23, 2021
  • 6 replies
  • 1224 views

I'm having a brain fart and can't figure this out. I'm porting an existing project from the STM32F205 series to the STM32L496 series. So I replaced "system_stmf2xx.c" with "system_stml4xx.c" in my project workspace, but my compiler (IAR) isn't picking it up. It looks like the startup_stm32l496xx.s assembly file is making calls into the system file. So where is the startup file included?

This topic has been closed for replies.

6 replies

TDK
Super User
August 23, 2021

Is the error from the linker?

In STM32CubeIDE, you would need to ensure system_stml4xx.c is being compiled and passed to the linker. Should be something similar in IAR.

"If you feel a post has answered your question, please click ""Accept as Solution""."
jvavra
jvavraAuthor
Associate III
August 23, 2021

The error(s) are actually about variable types being undefined: u8, u16, etc. These are all defined in stm32l4xx.h, so I deduced that's not being included. That header gets called out in system_stm32l4xx.c. system_stm32l4xx.c should actually have about 30 header files under it in the project tree if it was being included properly. I have none.

TDK
Super User
August 23, 2021

It's going to be easier if you show the exact error message.

"If you feel a post has answered your question, please click ""Accept as Solution""."
jvavra
jvavraAuthor
Associate III
August 24, 2021

0693W00000DqFsnQAF.jpgHere's some of them.

Pavel A.
Super User
August 24, 2021

https://github.com/STMicroelectronics/cmsis_device_l4/blob/master/Include/stm32l4xx.h

As you see, stm32l4xx.h does not define types "u16", "u8" etc. It rather uses stdint.h.

Also, system_stml4xx.c does not include a lot of .h files.

https://github.com/STMicroelectronics/cmsis_device_l4/blob/master/Source/Templates/system_stm32l4xx.c

Confused? the messages come from compiling some other .c file, not system_stml4xx.c

TDK
Super User
August 24, 2021

Sure looks like the error messages are from "adjust_px5000.c" and not from a system startup file.

"If you feel a post has answered your question, please click ""Accept as Solution""."