GCC compiling- help needed

Hi guys !

I am a rookie in gcc.So please help me out.

I have arm-elf-gcc 4.1.1 installed on Ubuntu and I have to cross compile for ARM7TDMI-S core based LPC2368 processor.

I have the C runtime file crt0.S, the startup.S,processor's header file and I have also modified the ROM.ld.

So, what I remember , the process will be :

  1. Convert C source code to object file.
  2. Link all the object files to create an executable.
  3. Convert the executable to intel hex format.

But I am unable to link as I have a few doubts. Question 1 : crt0.S is not getting converted to crt0.o and startup.s to startup.o. How to do it ? Question 2 : How to link ROM.ld with other files ?

Thanks a lot.

Reply to
nik
Loading thread data ...

Best bet is just to start with a project that is already working. You could start with the LPC2368/Eclipse demo in the FreeRTOS.org download which has a standard makefile (although I have only tested on Windoze so you may find some case problems in the include paths). Alternatively look in the files section of the LPC2000 Yahoo group.

--
Regards,
Richard.

+ http://www.FreeRTOS.org & http://www.FreeRTOS.org/shop
17 official architecture ports, more than 6000 downloads per month.

+ http://www.SafeRTOS.com
Certified by TÜV as meeting the requirements for safety related systems.
Reply to
FreeRTOS.org

The GNU assembler, 'gas', is part of the gcc setup and will convert assembly sources to object files. However, the main 'gcc' command knows how to invoke all of the compiler components and I usually find it easier to use gcc to invoke gas rather than invoke gas directly. So just pretend that those files are C source files and compile them using "gcc -c -o crt0.o crt0.S" (along with any other compiler flags you need, etc.).

I assume that's a linker script ("put the code starting at address 0x800000, followed by the constant strings, and put the readwrite data at 0xC000000", that kind of thing). Take a look at the man and info pages for the GNU linker for details, but basically, you use the linker's -T flag to tell it to use that linker script: arm-elf-ld -m blahblah -T ROM.ld obj1.o obj2.o obj3.o -o result.elf or, if you're invoking the linker via the 'gcc' command, arm-elf-gcc ... -Wl,-T,ROM.ld ... (the -W... flag is a way to tell gcc to pass extra flags to one of the phases it runs, even if the 'gcc' command itself doesn't understand about linker scripts).

Hope this helps.

--
   Wim Lewis , Seattle, WA, USA. PGP keyID 27F772C1
  "We learn from history that we do not learn from history." -Hegel
Reply to
Wim Lewis

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.