public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* RE: [ECOS] --entry= (slightly off topic)
@ 2001-09-20 15:18 Fabrice Gautier
  2001-09-20 16:14 ` Trenton D. Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Fabrice Gautier @ 2001-09-20 15:18 UTC (permalink / raw)
  To: 'Trenton D. Adams', 'eCos Discussion'

I think you have it right, but setting the entry point does'nt influence the
memory map. It just set some value in the elf headers.

What is the result of objdump -f on the resulting elf file? It should
display the start adress (ake entry-point)


> -----Original Message-----
> From: Trenton D. Adams [ mailto:tadams@theone.dnsalias.com ]
> Sent: Thursday, September 20, 2001 3:08 PM
> To: 'eCos Discussion'
> Subject: [ECOS] --entry= (slightly off topic)
> 
> 
> I'm doing the following.  stack_manager.s doesn't have any 
> entry points,
> and I don't know how to make one.  So, I figured I'd just pass
> --entry=0x0 to the linker which should create the entry at 0.
>  arm-elf-gcc.exe -nostdlib -nostartfiles -O1 -Wl,--entry=0x0
> stack_manager.s bootcode-J3-rev4.c
> 
> stack_manager.s 
> 
> However, it ends up like this.
> 00008000 <Prepare_To_Flash-0xc>:
>     8000:       e3a0d201        mov     sp, #268435456  ; 0x10000000
>     8004:       e38ddc96        orr     sp, sp, #38400  ; 0x9600
>     8008:       ebffffff        bl      800c <Prepare_To_Flash>
> 
> 8000 is the default entry point, and that's not what I want.  I want
> 0x00000000.
> 
> So, how do I either:
> - create an entry point in stack_manager.s
> - specify an entry point on the command line
> ???
> 
> I tried a 
> start:
> label before the first instruction in the .s file, but that 
> didn't work.
> 
> Trenton D. Adams
> Extreme Engineering
> #17, 6025 - 12 St. SE
> Calgary, Alberta, Canada
> T2H 2K1
> 
> Phone: 403 640 9494 ext-208
> Fax: 403 640 9599
> 
> http://www.extremeeng.com
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] --entry= (slightly off topic)
  2001-09-20 15:18 [ECOS] --entry= (slightly off topic) Fabrice Gautier
@ 2001-09-20 16:14 ` Trenton D. Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Trenton D. Adams @ 2001-09-20 16:14 UTC (permalink / raw)
  To: 'Fabrice Gautier', 'eCos Discussion'

I get 

a.out:     file format elf32-littlearm
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00008000



-----Original Message-----
From: Fabrice Gautier [ mailto:Fabrice_Gautier@sdesigns.com ] 
Sent: Thursday, September 20, 2001 4:26 PM
To: 'Trenton D. Adams'; 'eCos Discussion'
Subject: RE: [ECOS] --entry= (slightly off topic)


I think you have it right, but setting the entry point does'nt influence
the
memory map. It just set some value in the elf headers.

What is the result of objdump -f on the resulting elf file? It should
display the start adress (ake entry-point)


> -----Original Message-----
> From: Trenton D. Adams [ mailto:tadams@theone.dnsalias.com ]
> Sent: Thursday, September 20, 2001 3:08 PM
> To: 'eCos Discussion'
> Subject: [ECOS] --entry= (slightly off topic)
> 
> 
> I'm doing the following.  stack_manager.s doesn't have any 
> entry points,
> and I don't know how to make one.  So, I figured I'd just pass
> --entry=0x0 to the linker which should create the entry at 0.
>  arm-elf-gcc.exe -nostdlib -nostartfiles -O1 -Wl,--entry=0x0
> stack_manager.s bootcode-J3-rev4.c
> 
> stack_manager.s 
> 
> However, it ends up like this.
> 00008000 <Prepare_To_Flash-0xc>:
>     8000:       e3a0d201        mov     sp, #268435456  ; 0x10000000
>     8004:       e38ddc96        orr     sp, sp, #38400  ; 0x9600
>     8008:       ebffffff        bl      800c <Prepare_To_Flash>
> 
> 8000 is the default entry point, and that's not what I want.  I want
> 0x00000000.
> 
> So, how do I either:
> - create an entry point in stack_manager.s
> - specify an entry point on the command line
> ???
> 
> I tried a 
> start:
> label before the first instruction in the .s file, but that 
> didn't work.
> 
> Trenton D. Adams
> Extreme Engineering
> #17, 6025 - 12 St. SE
> Calgary, Alberta, Canada
> T2H 2K1
> 
> Phone: 403 640 9494 ext-208
> Fax: 403 640 9599
> 
> http://www.extremeeng.com
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] --entry= (slightly off topic)
  2001-09-20 16:23   ` Gary Thomas
@ 2001-09-21  8:22     ` Trenton D. Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Trenton D. Adams @ 2001-09-21  8:22 UTC (permalink / raw)
  To: 'Gary Thomas'
  Cc: 'Fabrice Gautier', 'eCos Discussion'

> 
> On Fri, 2001-09-21 at 08:14, Trenton D. Adams wrote:
> > I don't want an object in ELF format at the end.  I use 
> objcopy to copy
> > to binary format.  This is going to be the boot code that's 
> loaded into
> > the board for flashing it with RedBoot or something like that.
> > 
> > In this case do I want a linker script?  I'm not remapping 
> any memory or
> > anything like that.
> > 
> 
> Look at the build rules for RedBoot - we do exactly this all the time.
> An image is created, destined for either RAM or ROM and then "munged"
> into the most appropriate format.  Binary is the most common case as 
> this is exactly what you want to go into the ROM [image].
> 

I assume you're talking about the ROM ldi file?  I should change the rom
origin to be 0x00000000 since that's what it is in boot strap mode
right?

#include <cyg/infra/cyg_type.inc>

MEMORY
{
    ram : ORIGIN = 0, LENGTH = 0xfd7000
    sram : ORIGIN = 0x60000000, LENGTH = 0x9c00
    rom : ORIGIN = 0xe0000000, LENGTH = 0x800000
}

SECTIONS
{
    SECTIONS_BEGIN
    SECTION_rom_vectors (rom, 0xe0000000, LMA_EQ_VMA)
    SECTION_text (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_fini (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_rodata (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_rodata1 (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_fixup (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_gcc_except_table (rom, ALIGN (0x4), LMA_EQ_VMA)
    SECTION_mmu_tables (rom, ALIGN (0x4000), LMA_EQ_VMA)
    SECTION_fixed_vectors (ram, 0x20, LMA_EQ_VMA)
    SECTION_data (ram, 0x1000, FOLLOWING (.mmu_tables))
    SECTION_bss (ram, ALIGN (0x4), LMA_EQ_VMA)
    CYG_LABEL_DEFN(__heap1) = ALIGN (0x8);
    CYG_LABEL_DEFN(__sram) = 0x60000000;
    SECTIONS_END
}

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] --entry= (slightly off topic)
  2001-09-20 16:29 Fabrice Gautier
@ 2001-09-21  8:04 ` Trenton D. Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Trenton D. Adams @ 2001-09-21  8:04 UTC (permalink / raw)
  To: 'Fabrice Gautier', 'eCos Discussion'

I don't know why it wasn't working before, but it works now.  I must
have done something odd that caused it not to work.

Will the all the 0x8000s be removed with a linker script then?

-----Original Message-----
From: Fabrice Gautier [ mailto:Fabrice_Gautier@sdesigns.com ] 
Sent: Thursday, September 20, 2001 5:38 PM
To: 'Trenton D. Adams'; 'eCos Discussion'
Subject: RE: [ECOS] --entry= (slightly off topic)




> -----Original Message-----
> From: Trenton D. Adams [ mailto:tadams@theone.dnsalias.com ]
> Sent: Thursday, September 20, 2001 4:13 PM
> To: 'Fabrice Gautier'; 'eCos Discussion'
> Subject: RE: [ECOS] --entry= (slightly off topic)
> 
> 
> I get 
> 
> a.out:     file format elf32-littlearm
> architecture: arm, flags 0x00000112:
> EXEC_P, HAS_SYMS, D_PAGED
> start address 0x00008000
 

Uh... Let's see:

Case 1:

$ arm-elf-gcc -nostdlib -nostartfiles  test.c
/d/gnu-tools/H-i686-pc-cygwin/arm-elf/bin/ld: warning: cannot find entry
symbol
_start; defaulting to 00008000

$ arm-elf-objdump.exe -f a.out

a.out:     file format elf32-littlearm
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00008000

Case 2:

$ arm-elf-gcc -nostdlib -nostartfiles -Wl,--entry=0x0 test.c

$ arm-elf-objdump.exe -f a.out

a.out:     file format elf32-littlearm
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00000000

Looks like it works for me...

But in both case I get 
$ arm-elf-objdump.exe -h a.out

a.out:     file format elf32-littlearm

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000014  00008000  00008000  00008000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  00008114  00008114  00008114  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .sbss         00000000  00008114  00008114  00008114  2**0
                  CONTENTS
  3 .bss          00000000  00008114  00008114  00008114  2**0
                  ALLOC
  4 .stack        00000000  00080000  00080000  00008114  2**0
                  CONTENTS

And sure enough if you are doing a bootloader you need a custom linker
script to specify the memory map. You can take the eCos scripts as an
example or see the ld documentation
( http://www.redhat.com/docs/manuals/gnupro/GNUPro-Toolkit-00r1/5_ut/b_Us
ingl
d/ld.html)

Regards,

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] --entry= (slightly off topic)
@ 2001-09-20 16:29 Fabrice Gautier
  2001-09-21  8:04 ` Trenton D. Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Fabrice Gautier @ 2001-09-20 16:29 UTC (permalink / raw)
  To: 'Trenton D. Adams', 'eCos Discussion'

> -----Original Message-----
> From: Trenton D. Adams [ mailto:tadams@theone.dnsalias.com ]
> Sent: Thursday, September 20, 2001 4:13 PM
> To: 'Fabrice Gautier'; 'eCos Discussion'
> Subject: RE: [ECOS] --entry= (slightly off topic)
> 
> 
> I get 
> 
> a.out:     file format elf32-littlearm
> architecture: arm, flags 0x00000112:
> EXEC_P, HAS_SYMS, D_PAGED
> start address 0x00008000
 

Uh... Let's see:

Case 1:

$ arm-elf-gcc -nostdlib -nostartfiles  test.c
/d/gnu-tools/H-i686-pc-cygwin/arm-elf/bin/ld: warning: cannot find entry
symbol
_start; defaulting to 00008000

$ arm-elf-objdump.exe -f a.out

a.out:     file format elf32-littlearm
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00008000

Case 2:

$ arm-elf-gcc -nostdlib -nostartfiles -Wl,--entry=0x0 test.c

$ arm-elf-objdump.exe -f a.out

a.out:     file format elf32-littlearm
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00000000

Looks like it works for me...

But in both case I get 
$ arm-elf-objdump.exe -h a.out

a.out:     file format elf32-littlearm

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         00000014  00008000  00008000  00008000  2**2
                  CONTENTS, ALLOC, LOAD, READONLY, CODE
  1 .data         00000000  00008114  00008114  00008114  2**0
                  CONTENTS, ALLOC, LOAD, DATA
  2 .sbss         00000000  00008114  00008114  00008114  2**0
                  CONTENTS
  3 .bss          00000000  00008114  00008114  00008114  2**0
                  ALLOC
  4 .stack        00000000  00080000  00080000  00008114  2**0
                  CONTENTS

And sure enough if you are doing a bootloader you need a custom linker
script to specify the memory map. You can take the eCos scripts as an
example or see the ld documentation
( http://www.redhat.com/docs/manuals/gnupro/GNUPro-Toolkit-00r1/5_ut/b_Usingl
d/ld.html)

Regards,

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] --entry= (slightly off topic)
  2001-09-20 16:15 ` Trenton D. Adams
@ 2001-09-20 16:23   ` Gary Thomas
  2001-09-21  8:22     ` Trenton D. Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Gary Thomas @ 2001-09-20 16:23 UTC (permalink / raw)
  To: Trenton D. Adams; +Cc: 'Fabrice Gautier', 'eCos Discussion'

On Fri, 2001-09-21 at 08:14, Trenton D. Adams wrote:
> I don't want an object in ELF format at the end.  I use objcopy to copy
> to binary format.  This is going to be the boot code that's loaded into
> the board for flashing it with RedBoot or something like that.
> 
> In this case do I want a linker script?  I'm not remapping any memory or
> anything like that.
> 

Look at the build rules for RedBoot - we do exactly this all the time.
An image is created, destined for either RAM or ROM and then "munged"
into the most appropriate format.  Binary is the most common case as 
this is exactly what you want to go into the ROM [image].

> -----Original Message-----
> From: ecos-discuss-owner@sources.redhat.com
> [ mailto:ecos-discuss-owner@sources.redhat.com ] On Behalf Of Fabrice
> Gautier
> Sent: Thursday, September 20, 2001 4:31 PM
> To: 'Trenton D. Adams'; 'eCos Discussion'
> Subject: RE: [ECOS] --entry= (slightly off topic)
> 
> 
> > -----Original Message-----
> > From: Trenton D. Adams [ mailto:tadams@theone.dnsalias.com ]
> > Subject: [ECOS] --entry= (slightly off topic)
> > 
> > However, it ends up like this.
> > 00008000 <Prepare_To_Flash-0xc>:
> >     8000:       e3a0d201        mov     sp, #268435456  ; 0x10000000
> >     8004:       e38ddc96        orr     sp, sp, #38400  ; 0x9600
> >     8008:       ebffffff        bl      800c <Prepare_To_Flash>
> > 
> > 8000 is the default entry point, and that's not what I want.  I want
> > 0x00000000.
> 
> Maybe what you want is to use a linker script. Use :  -Ttarget.ld 
> 
> arm-elf-gcc.exe -Ttarget.ld -nostdlib -nostartfiles -O1 -Wl,--entry=0x0
> stack_manager.s bootcode-J3-rev4.c
> 
> Where target.ld is a linker script such as the one providd by eCos hal.
> 
>   Fabrice


^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] --entry= (slightly off topic)
  2001-09-20 15:23 Fabrice Gautier
@ 2001-09-20 16:15 ` Trenton D. Adams
  2001-09-20 16:23   ` Gary Thomas
  0 siblings, 1 reply; 9+ messages in thread
From: Trenton D. Adams @ 2001-09-20 16:15 UTC (permalink / raw)
  To: 'Fabrice Gautier', 'eCos Discussion'

I don't want an object in ELF format at the end.  I use objcopy to copy
to binary format.  This is going to be the boot code that's loaded into
the board for flashing it with RedBoot or something like that.

In this case do I want a linker script?  I'm not remapping any memory or
anything like that.

-----Original Message-----
From: ecos-discuss-owner@sources.redhat.com
[ mailto:ecos-discuss-owner@sources.redhat.com ] On Behalf Of Fabrice
Gautier
Sent: Thursday, September 20, 2001 4:31 PM
To: 'Trenton D. Adams'; 'eCos Discussion'
Subject: RE: [ECOS] --entry= (slightly off topic)


> -----Original Message-----
> From: Trenton D. Adams [ mailto:tadams@theone.dnsalias.com ]
> Subject: [ECOS] --entry= (slightly off topic)
> 
> However, it ends up like this.
> 00008000 <Prepare_To_Flash-0xc>:
>     8000:       e3a0d201        mov     sp, #268435456  ; 0x10000000
>     8004:       e38ddc96        orr     sp, sp, #38400  ; 0x9600
>     8008:       ebffffff        bl      800c <Prepare_To_Flash>
> 
> 8000 is the default entry point, and that's not what I want.  I want
> 0x00000000.

Maybe what you want is to use a linker script. Use :  -Ttarget.ld 

arm-elf-gcc.exe -Ttarget.ld -nostdlib -nostartfiles -O1 -Wl,--entry=0x0
stack_manager.s bootcode-J3-rev4.c

Where target.ld is a linker script such as the one providd by eCos hal.

  Fabrice

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [ECOS] --entry= (slightly off topic)
@ 2001-09-20 15:23 Fabrice Gautier
  2001-09-20 16:15 ` Trenton D. Adams
  0 siblings, 1 reply; 9+ messages in thread
From: Fabrice Gautier @ 2001-09-20 15:23 UTC (permalink / raw)
  To: 'Trenton D. Adams', 'eCos Discussion'

> -----Original Message-----
> From: Trenton D. Adams [ mailto:tadams@theone.dnsalias.com ]
> Subject: [ECOS] --entry= (slightly off topic)
> 
> However, it ends up like this.
> 00008000 <Prepare_To_Flash-0xc>:
>     8000:       e3a0d201        mov     sp, #268435456  ; 0x10000000
>     8004:       e38ddc96        orr     sp, sp, #38400  ; 0x9600
>     8008:       ebffffff        bl      800c <Prepare_To_Flash>
> 
> 8000 is the default entry point, and that's not what I want.  I want
> 0x00000000.

Maybe what you want is to use a linker script. Use :  -Ttarget.ld 

arm-elf-gcc.exe -Ttarget.ld -nostdlib -nostartfiles -O1 -Wl,--entry=0x0
stack_manager.s bootcode-J3-rev4.c

Where target.ld is a linker script such as the one providd by eCos hal.

  Fabrice

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [ECOS] --entry= (slightly off topic)
@ 2001-09-20 15:09 Trenton D. Adams
  0 siblings, 0 replies; 9+ messages in thread
From: Trenton D. Adams @ 2001-09-20 15:09 UTC (permalink / raw)
  To: 'eCos Discussion'

I'm doing the following.  stack_manager.s doesn't have any entry points,
and I don't know how to make one.  So, I figured I'd just pass
--entry=0x0 to the linker which should create the entry at 0.
 arm-elf-gcc.exe -nostdlib -nostartfiles -O1 -Wl,--entry=0x0
stack_manager.s bootcode-J3-rev4.c

stack_manager.s 

However, it ends up like this.
00008000 <Prepare_To_Flash-0xc>:
    8000:       e3a0d201        mov     sp, #268435456  ; 0x10000000
    8004:       e38ddc96        orr     sp, sp, #38400  ; 0x9600
    8008:       ebffffff        bl      800c <Prepare_To_Flash>

8000 is the default entry point, and that's not what I want.  I want
0x00000000.

So, how do I either:
- create an entry point in stack_manager.s
- specify an entry point on the command line
???

I tried a 
start:
label before the first instruction in the .s file, but that didn't work.

Trenton D. Adams
Extreme Engineering
#17, 6025 - 12 St. SE
Calgary, Alberta, Canada
T2H 2K1

Phone: 403 640 9494 ext-208
Fax: 403 640 9599

http://www.extremeeng.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2001-09-21  8:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-20 15:18 [ECOS] --entry= (slightly off topic) Fabrice Gautier
2001-09-20 16:14 ` Trenton D. Adams
  -- strict thread matches above, loose matches on Subject: below --
2001-09-20 16:29 Fabrice Gautier
2001-09-21  8:04 ` Trenton D. Adams
2001-09-20 15:23 Fabrice Gautier
2001-09-20 16:15 ` Trenton D. Adams
2001-09-20 16:23   ` Gary Thomas
2001-09-21  8:22     ` Trenton D. Adams
2001-09-20 15:09 Trenton D. Adams

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).