Hello, I'm trying to creating my first application using the MDK-ARM toolchain. I run one of the example files on this soft to blink a led using stm32f4xx_discovery and everything was ok but when I want to create a new project I get this error:
Build target 'Target 1' compiling main.c... main.c(5): warning: #1-D: last line of file ends without a newline linking... proba.axf: Error: L6218E: Undefined symbol SystemInit (referred from startup_stm32f4xx.o). Target not created
I don't get this error.
does anybody know what the problem is? thanks in advance :)
Yes - the error message tells you clearly:
Error: L6218E: Undefined symbol SystemInit (referred from startup_stm32f4xx.o).
You have used the symbol 'SystemInit in startup_stm32f4xx.o, but you have not provided any definition for that symbol.
"I run one of the example files on this soft to blink a led using stm32f4xx_discovery and everything was ok"
So look again carefully at that project, and see where it defined SystemInit ...
This is a piece of the code from the startUp code:
Reset_Handler PROC EXPORT Reset_Handler [WEAK] IMPORT SystemInit IMPORT __main LDR R0, =SystemInit BLX R0 LDR R0, =__main BX R0 ENDP
In the demonstation project, I've got the same code-the same definition of the "SystemInit", and it works...that's why I dont't know why it doesn't work in my own project.
I dont't know why it doesn't work in my own project
did you copy all settings in project options from the "demonstation project"?
Erik
Yes, I did
Yes, I did.
Are you sure that SystemInit is the correct name, so it shouldn't be _SystemInit?
C functions gets the _ prefix to make sure that C code names don't collide with assembler symbol names. And internal C library functions have an prefix _ directly in the source code and hence gets a __ prefix in the linking process, to make sure that internal CRTL library functions don't collide with user symbol names.
That is not a definition of "SystemInit" - that is a reference to "SystemInit".
As the error message tells you, you need a definition of "SystemInit" for that reference to work!
Sorry, I'm still a big newbie. Where can I find a definition of "SystemInit"?
If the sample program you looked at referenced a SystemInit without getting a linking error, then that sample program did include a source file or a library - or a project flag that implied that the linker should include a default library - that contained the actual implementation of a SystemInit function.
As Per says, if the working project contains that same reference to "SystemInit", and doesn't produce the same Linker error, then it must contain a definition of "SystemInit" somewhere - mustn't it?!
So, as I said originally, search in the working project to find where it defines "SystemInit" - and do likewise in your own!
Note that uVision has a 'Go To Definition' feature...
Hello, I'm trying to creating my first application using the MDK-ARM toolchain. I run one of the example files on this soft to blink a led using stm32f4xx_discovery ...
You're probably using the Blinky application.
Have you included the file system_stm32f4xx.c in our new project? Ah, look, there's SystemInit.