GCC Question

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

GCC Question

431 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Vsh3r on Wed Jun 16 21:46:52 MST 2010
Hi,

I'm using GCC to compile the blinky.c project. 

When I compile the project I get the following errors... can someone give me some ideas...

$ arm-elf-gcc *.c
/var/folders/M3/M3ZMF1R+HgmJJ9L0NdTRKk+++TI/-Tmp-//ccp57olU.o: In function `main':
blinky_main.c:(.text+0xe4): undefined reference to `SystemCoreClock'
/var/folders/M3/M3ZMF1R+HgmJJ9L0NdTRKk+++TI/-Tmp-//ccOipiYg.o: In function `Reset_Handler':
What file contains the definition for what SystemCoreClock is for the LPC1114?  I thought it would be located in timer32.h but it isn't.  I know the clock runs at 48 MHz.

Vsh3r
0 Kudos
6 Replies

390 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lyncas on Tue May 29 09:12:05 MST 2012
I ran into this SystemCoreClock reference problem when creating a new project  in the LPCXpresso IDE.

I opened the "blinky" example project and compared the project settings in C/C++ General ---> Paths and Symbols until my new project matched "blinky" settings

This successfully fixed the linker errors in the project.
0 Kudos

390 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Vsh3r on Fri Jun 18 10:01:25 MST 2010
Well, can someone send me the command line arguments for gcc to compile the blinky project then?

Thanks.
0 Kudos

390 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Jun 17 22:54:40 MST 2010
It is generated when you build the project.
0 Kudos

390 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Vsh3r on Thu Jun 17 21:27:04 MST 2010
Hi,

I don't see a .ld file included with blinky...

The files that I have included with blinky are...

config.h       
LPC11xx.h        core_cm0.h       
blinky_main.c        cr_startup_lpc11.c    system_LPC11xx.c
blinky_main.s        cr_startup_lpc11.s    system_LPC11xx.h
clkconfig.c        gpio.c            timer32.c
clkconfig.h        gpio.h            timer32.h
clkconfig.s        gpio.s            timer32.s

Can you post the .ld file here so that I can take a look at it?

Thanks.
0 Kudos

390 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Thu Jun 17 00:14:00 MST 2010
It looks like you are trying to build this yourself.

These are defined in the linker script that is auto-generated by Red Suite when you build. As you are trying to do it 'manually', you will need to create your own linker script. To start with, look at the linker scripts (*.ld) in the blinky example, and use it as a template for creating your own linker script.
0 Kudos

390 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Vsh3r on Wed Jun 16 23:15:22 MST 2010
The SystemCoreClock is located in system_LPC11xx.c I just copied this file over to my directory and recompiled everything and got past this error.

I'm still getting the following errors...

/var/folders/M3/M3ZMF1R+HgmJJ9L0NdTRKk+++TI/-Tmp-//ccJNSOO0.o: In function `Reset_Handler':
cr_startup_lpc11.c:(.text+0xc0): undefined reference to `_data'
cr_startup_lpc11.c:(.text+0xc8): undefined reference to `_bss'
cr_startup_lpc11.c:(.text+0xcc): undefined reference to `_ebss'


Here is what the function looks like inside cr_startup_lpc11.c

//*****************************************************************************                                
//                                                                                                             
// The following are constructs created by the linker, indicating where the                                    
// the "data" and "bss" segments reside in memory.  The initializers for the                                   
// for the "data" segment resides immediately following the "text" segment.                                    
//                                                                                                             
//*****************************************************************************                                
extern unsigned char _etext;
extern unsigned char _data;
extern unsigned char _edata;
extern unsigned char _bss;
extern unsigned char _ebss;

void Reset_Handler(void)
{
//...
}
0 Kudos