This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Stand-alone program
- To: ecos discuss <ecos-discuss at sources dot redhat dot com>
- Subject: Re: [ECOS] Stand-alone program
- From: Hugo Villeneuve <hvilleneuve at softacoustik dot com>
- Date: Fri, 26 Oct 2001 11:31:19 -0400
- Organization: SoftAcoustik Technologies Inc.
- Reply-To: hvilleneuve at softacoustik dot com
Hi,
If my understanding is correct, the only purpose of adding a
'.global __gccmain' line to a file is to make that label '__gccmain'
available to the linker. Normally, when running the "arm-elf-gcc -c
main.c" command, main.c is first compiled and then assembled and the
'__gccmain' variable should be exported to the linker with the
'.global' assembly directive. Why I still have any errors there?
By the way, my startup assembly file looks like this:
.text
.code 32
.globl _start
_start:
# Do initialization stuff here
BAL __gccmain
BAL _start
With which assembly directive can I specify that the label
'__gccmain' is defined externally to this file?
Thanks, Hugo Villeneuve.
10-26-2001 11:03:25, Grant Edwards <grante@visi.com> wrote:
>On Fri, Oct 26, 2001 at 09:08:28AM -0400, Hugo Villeneuve wrote:
>
>> I have successfully installed ecos and all the binutils, gcc and
>> gdb stuff for the arm-elf target. How strange it may sounds, I just
>> want to know how I can compile a simple application, not using any
>> built-in libraries of gcc. I mean, I want to create my own crt.s (C
>> runtime startup) assembly file, and then call my main function from
>> this crt.s file.
>>
>> My crt.s assembly file assembles great with arm-elf-as, but I
>> have a small error when compiling my main.c file (the main function
of
>> which do nothing but return a success exit code):
>>
>> command used:
>> arm-elf-gcc -c -Wa,-marm7tdmi,-mapcs-32 main.c -o main.o
>> output:
>> main.o: In function `main':
>> main.o(.text+0xc): undefined reference to `__gccmain'
>
>Add a __gccmain to your startup file. It doesn't need to do
>anything, just return. Mine looks like this:
>
> .global __gccmain
>__gccmain:
> mov pc,lr
>
>
>--
>Grant Edwards
>grante@visi.com
>
--------------------------------------
Hugo Villeneuve
Hardware/Firmware Developer
SoftAcoustik Inc.
(418) 521-1515
hvilleneuve@softacoustik.com
http://www.softacoustik.com
--------------------------------------