Undefined reference to 'SystemCoreClock' in uart.c

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Undefined reference to 'SystemCoreClock' in uart.c

3,832 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ALX34 on Tue May 29 09:24:15 MST 2012
Hello everybody,
I try to use uart.c from examples.LPC17xx.zip
But when I use UARTInit I got Undefined reference to 'SystemCoreClock' error and i don't know why .:mad:

Is there anyone can help me ??

Thanks.
0 Kudos
Reply
6 Replies

2,797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Wed May 30 08:32:22 MST 2012
There is a much simpler solution than adding own linker scripts...

- Import CMSIS project into workspace.
- Choose new project -> "LPCXpresso C project".
- In the final step of the wizard point to the CMSIS project where it sais "CMSIS library to link project to".
- Copy uart.c, uart.h and type.h to the new project.
- Add location of uart.h and type.h to the search path.
- Build the project.

Or, even simpler, just edit the main.c of the UART example.

Regards,
0 Kudos
Reply

2,797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lyncas on Wed May 30 06:08:52 MST 2012

Quote: ALX34

Yes I made my own project and I included uart.c (+ uart.h) and the CMSIS project.

When I said "until I use UARTInit function" I mean when I call other function from uart.c like UARTSend I got no problem but when I call UARTInit I got this error.
However I use it like in main.c of uart project.



If you made your own project,  read this thread,  I posted a linker setting that you should check to fix the SystemCoreClock problem

http://knowledgebase.nxp.com/showthread.php?t=463
0 Kudos
Reply

2,797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ALX34 on Wed May 30 01:03:08 MST 2012
Thanks for your fast reply,

Yes I made my own project and I included uart.c (+ uart.h) and the CMSIS project.

When I said "until I use UARTInit function" I mean when I call other function from uart.c like UARTSend I got no problem but when I call UARTInit I got this error.
However I use it like in main.c of uart project.
0 Kudos
Reply

2,797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Wed May 30 00:19:27 MST 2012
Hi,

What do you mean by "until I use UARTInit function"?
The UART project is an example project, file "main.c" calls this function on startup. Do you mean you made your own project in which you want to use functions from uart.c?

SystemCoreClock is defined in files system_LPC17xx.c / system_LPC17xx.h (from the CMSIS project) which needs to be included when compiling. The UART example has all settings correct by default and should compile right away.

Regards,
0 Kudos
Reply

2,797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by ALX34 on Wed May 30 00:00:50 MST 2012
Yes I linked the CMSISv1p30_LPC17xx library and the compilation worked well until I use UARTInit function.
0 Kudos
Reply

2,797 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by atomicdog on Tue May 29 11:47:55 MST 2012
Do you have the cmsis library linked in?
0 Kudos
Reply