Home arrow Support arrow Forums

Luminary Micro Forums

usfee

Fresh Boarder
Click here to see the profile of this user

2007/02/02 20:34

Porting RealView to GCC

I am tyring to port my entry code into the GCC toolchain as the RealView license turns to a pumpkin on the 7th. This is my first experience with the GCC tools and I have run into an issue with compiling my code. I believe there is an problem with the standard C library during the linking stage??? My output is below, any help would be greatly appreciated.



-------- begin (mode: ROM_RUN) --------
arm-none-eabi-gcc (CodeSourcery Sourcery G++ 2006q3-27) 4.1.1
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Linking: main.elf
arm-none-eabi-gcc -mthumb -mcpu=cortex-m3 -mthumb-interwork -I. -gdwarf-2 -DROM_
RUN -Dgcc -DGCC_ARMCM3_LM3S102 -D__WinARM__ -D__WINARMSUBMDL_lm3s811__ -O2 -ffu
nction-sections -fdata-sections -Wall -Wcast-align -Wimplicit -Wpointer-arith -
Wswitch -Wredundant-decls -Wreturn-type -Wshadow -Wunused -Wa,-adhlns=arp.lst -
I./ -Wcast-qual -MD -MP -MF .dep/main.elf.d arp.o iax.o icmp.o enc28j60.o dis
play.o ipmain.o dhcp.o uvision.o md5.o startup_gcc.o --output main.elf -
nostartfiles -Wl,-Map=main.map,--cref,--gc-sections -lc -lm -lc -lgcc -L../..
/ -lluminary -T../lm3s811-ROM.ld
c:/program files/codesourcery/sourcery g++/bin/../lib/gcc/arm-none-eabi/4.1.1/..
/../../../arm-none-eabi/lib/thumb/thumb2libc.a(makebuf.o): In function `__smake
buf':
makebuf.c:(.text+0x6e): undefined reference to `isatty'
c:/program files/codesourcery/sourcery g++/bin/../lib/gcc/arm-none-eabi/4.1.1/..
/../../../arm-none-eabi/lib/thumb/thumb2libc.a(sbrkr.o): In function `_sbrk_r':

sbrkr.c:(.text+0xe): undefined reference to `_sbrk'
c:/program files/codesourcery/sourcery g++/bin/../lib/gcc/arm-none-eabi/4.1.1/..
/../../../arm-none-eabi/lib/thumb/thumb2libc.a(writer.o): In function `_write_r
':
writer.c:(.text+0x12): undefined reference to `_write'
c:/program files/codesourcery/sourcery g++/bin/../lib/gcc/arm-none-eabi/4.1.1/..
/../../../arm-none-eabi/lib/thumb/thumb2libc.a(closer.o): In function `_close_r
':
closer.c:(.text+0xe): undefined reference to `_close'
c:/program files/codesourcery/sourcery g++/bin/../lib/gcc/arm-none-eabi/4.1.1/..
/../../../arm-none-eabi/lib/thumb/thumb2libc.a(fstatr.o): In function `_fstat_r
':
fstatr.c:(.text+0x10): undefined reference to `_fstat'
c:/program files/codesourcery/sourcery g++/bin/../lib/gcc/arm-none-eabi/4.1.1/..
/../../../arm-none-eabi/lib/thumb/thumb2libc.a(lseekr.o): In function `_lseek_r
':
lseekr.c:(.text+0x12): undefined reference to `_lseek'
c:/program files/codesourcery/sourcery g++/bin/../lib/gcc/arm-none-eabi/4.1.1/..
/../../../arm-none-eabi/lib/thumb/thumb2libc.a(readr.o): In function `_read_r':

readr.c:(.text+0x12): undefined reference to `_read'
collect2: ld returned 1 exit status
make: *** [main.elf] Error 1

login or register to reply

orinem

Expert Boarder
Click here to see the profile of this user

2007/02/03 01:18

Re:Porting RealView to GCC

You need to link in libnosys.a. Use a copy of lm3s8xx-rom.ld from the 2006q3 directories and change as follows:

/*STARTUP(armv7m-crt0.o)*/
GROUP(-lc -lnosys)
OUTPUT_ARCH(arm)
ENTRY(ResetISR)

rather than:

STARTUP(armv7m-crt0.o)
GROUP(-lc -lrdimon -lgcc)
OUTPUT_ARCH(arm)
ENTRY(_start)

You may need -lgcc, I didn't. You'll need to fix the startup code as well. Here are the relevant sections from my startup_gcc.c:

Code:

  //***************************************************************************** // // Reserve space for the system stack. // //***************************************************************************** #ifndef STACK_SIZE #define STACK_SIZE                              256 #endif static unsigned long pulStack[STACK_SIZE]; //***************************************************************************** // // The minimal vector table for a Cortex M3.  Note that the proper constructs // must be placed on this to ensure that it ends up at physical address // 0x0000.0000. // //***************************************************************************** __attribute__ ((section(".isr_vector"))) void (* const g_pfnVectors[])(void) = {     (void (*)(void))((unsigned long)pulStack sizeof(pulStack)),                                             // The initial stack pointer     ResetISR,                               // The reset handler // Rest of ISR omitted... };  //***************************************************************************** // // 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 long __data_load; extern unsigned long __data_start; extern unsigned long _edata; extern unsigned long __bss_start__; extern unsigned long __bss_end__; //***************************************************************************** // // This is the code that gets called when the processor first starts execution // following a reset event.  Only the absolutely necessary set is performed, // after which the application supplied entry() routine is called.  Any fancy // actions (such as making decisions based on the reset cause register, and // resetting the bits in that register) are left solely in the hands of the // application. // //***************************************************************************** int main(void); void ResetISR(void) {     unsigned long *pulSrc, *pulDest;     //     // Copy the data segment initializers from flash to SRAM.     //     pulSrc = &__data_load;     for(pulDest = &__data_startpulDest < &_edata; )     {         *pulDest++ = *pulSrc++;     }     //     // Zero fill the bss segment.     //     for(pulDest = &__bss_start__pulDest < &__bss_end__; )     {         *pulDest++ = 0;     }     //     // Call the application's entry point.     //     main(); }



At least that's what worked for me when I had similar problems. My program starts at main(), that can obviously be changed in the above. I think that's all I needed to do...

Orin.

login or register to reply

fordp

Senior Boarder
Click here to see the profile of this user

2007/11/22 17:36

Re:Porting RealView to GCC

I am having similar problems to this when adding files to the this :-

http://www.freertos.org/portLM3Sxxxx_Eclipse.html

project.

On the Code Sourcery site I found this page :-
https://support.codesourcery.com/GNUToolchain/kbentry57

This seems to relate to the line in the makefile :-

LDSCRIPT=standalone.ld

It sort of implies another linker script should be used.

I cannot make sense of either the solution in this thread or the one on the codesourcery site.

It seems to me there is some conflict between the driver lib and the code sourcery libs.

Can you give me any help ???

These up front problems on project waste a lot of time and from my experience rarely relate to user error, but just a badly set up tool chain.

How does driverlib, gnulib and newlib relate ??

I know gnulib is less than ideal for deep embedded.

I also understand that full versions of printf are usually overkill in space, speed and stack.

I am keeping my fingers crossed. If I can get over this hurdle and my evaluation kits I have ordered, turn up soon, I will remain more than happy with Luminary Micro !!

login or register to reply

englere

Gold Boarder
Click here to see the profile of this user

2007/11/26 15:37

Re:Porting RealView to GCC

try this article:

https://support.codesourcery.com/GNUToolchain/kbentry16

login or register to reply