EmbDev.net

Forum: ARM programming with GCC/GNU tools WinARM 20060531 prerelease - please test with Win98


von Martin Thomas (Guest)


Rate this post
useful
not useful
I have placed a test-version with gcc 4.1.1 in
http://www.siwawi.arubi.uni-kl.de/avr_projects/arm_projects/winarmtests/
(File WinARM_20060531_pre.zip)

In the gcc-Sources used to build the pex-win32 file has been replaced by
a version from the CVS (it has not been part of the official
4.1.1-release). This hopefully fixes the problems in Win9X. So far I
have not seen a side-effect on WinXP, so the patch should not break the
NTff compatibility.

So far the prerelease does not include any insight or command-line gdb.
This is still "work in progress".

Win9X-Users: please test and send feedback.
Feedback from non-Win9x-Users is of cause welcome too.

Martin Thomas

von Stefan (Guest)


Rate this post
useful
not useful
Martin, fine work!

Got this pre version running. No problem with gcc calling the assembler
like last time.

Now i have just one small problem with the final linker run, when i make
a binary for ROM. Building for RAM is OK. But not yet tested on the
target because  i have only little time until mid of next week and i can
not dig too far into this until then.

The error for the ROM build is:
===============================

> "make.exe" all

-------- begin --------
arm-elf-gcc (GCC) 4.1.1 (WinARM)
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.


Assembling: startup.S
arm-elf-gcc -c -mcpu=arm7tdmi -I. -x assembler-with-cpp -DROM_RUN
-Wa,-adhlns=startup.lst,-gstabs startup.S -o startup.o

Compiling: main.c
arm-elf-gcc -c -mcpu=arm7tdmi -I. -gstabs -DROM_RUN  -O0 -funsigned-char
-funsigned-bitfields -fpack-struct -fshort-enums -Wall
-Wstrict-prototypes -Wa,-adhlns=main.lst  -std=gnu99 -MD -MP -MF
.dep/main.o.d main.c -o main.o

Linking: main.elf
arm-elf-gcc -mcpu=arm7tdmi -I. -gstabs -DROM_RUN  -O0 -funsigned-char
-funsigned-bitfields -fpack-struct -fshort-enums -Wall
-Wstrict-prototypes -Wa,-adhlns=startup.o  -std=gnu99 -MD -MP -MF
.dep/main.elf.d startup.o main.o --output main.elf -nostartfiles
-Wl,-Map=main.map,--cref -lc  -lm -lc -lgcc -TAT91R40008-NavMe-ROM.ld
d:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/bin/ld.exe:
address 0x1000900 of main.elf section .stack is not within region SRAM
collect2: ld returned 1 exit status
make.exe: *** [main.elf] Error 1

> Process Exit Code: 2
> Time Taken: 00:02

This is the critical section in main.map:
=========================================

Discarded input sections

 .stabstr       0x00000000        0x0 startup.o
 .stabstr       0x00000000        0x0 main.o

Memory Configuration

Name             Origin             Length             Attributes
SRAM             0x00000000         0x00040000         rw
ROM              0x01000000         0x00800000         xr
RAM              0x03000000         0x00400000         rw
default        0x00000000         0xffffffff

Linker script and memory map

LOAD startup.o
LOAD main.o
LOAD
d:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libc.a
LOAD
d:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libm.a
LOAD
d:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libc.a
LOAD d:/winarm/bin/../lib/gcc/arm-elf/4.1.1\libgcc.a
START GROUP
LOAD d:/winarm/bin/../lib/gcc/arm-elf/4.1.1\libgcc.a
LOAD
d:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libg.a
LOAD
d:/winarm/bin/../lib/gcc/arm-elf/4.1.1/../../../../arm-elf/lib\libc.a
END GROUP
                0x00000400                STACK_SIZE = 0x400

.text           0x01000000      0x4bc
 *startup.o(.text)
 .text          0x01000000      0x170 startup.o
                0x01000150                reset
                0x01000000                _boot
                0x010000d4                _mainCRTStartup
                0x01000150                abort
                0x010000d4                _start
                0x01000150                _reset
                0x01000150                exit
                0x010000d4                start
 *(.text)
 .text          0x01000170      0x32c main.o
                0x010003f8                main
 *(.rodata)
 .rodata        0x0100049c       0x20 main.o
 *(.rodata*)
 *(.glue_7)
 .glue_7        0x010004bc        0x0 startup.o
 .glue_7        0x010004bc        0x0 main.o
 *(.glue_7t)
 .glue_7t       0x010004bc        0x0 startup.o
 .glue_7t       0x010004bc        0x0 main.o
                0x010004bc                . = ALIGN (0x4)
                0x010004bc                _etext = .
                0x010004bc                PROVIDE (etext, .)

.data           0x00000000        0x0 load address 0x010004bc
                0x00000000                _data = .
 *(.data)
 .data          0x00000000        0x0 startup.o
 .data          0x00000000        0x0 main.o
                0x00000000                . = ALIGN (0x4)
                0x00000000                _edata = .
                0x00000000                PROVIDE (edata, .)

.bss            0x00000000        0x0
                0x00000000                __bss_start = .
                0x00000000                _bss_start_ = .
 *(.bss)
 .bss           0x00000000        0x0 startup.o
 .bss           0x00000000        0x0 main.o
 *(COMMON)
                0x00000000                . = ALIGN (0x4)
                0x00000000                . = ALIGN (0x4)
                0x00000000                _bss_end_ = .
                0x00000000                PROVIDE (__bss_end, .)

.stack          0x01000500      0x400
                0x01000900                . = (. + STACK_SIZE)
 fill         0x01000500      0x400 00
                0x01000900                PROVIDE (_stack, .)
                0x01000900                _end = .
                0x01000900                PROVIDE (end, .)

.stab           0x00000000      0x75c
 *(.stab)
 .stab          0x00000000      0x3a8 startup.o
 .stab          0x000003a8      0x3b4 main.o
                                0x3c0 (size before relaxing)

.stabstr        0x00000000      0x307
 *(.stabstr)
 .stabstr       0x00000000      0x307 startup.o

<...rest (symbols) snipped...>

I checked the linker script file, but i can not detect a error.

Here is my AT91R40008-NavMe-ROM.ld file
=======================================


/*********************************************************************** 
*/
/*
*/
/*  ROM.ld:  Linker Script File
*/
/*                                       */
/*  v0.1 - Stefan - 1st version for GNUARM & AT91R40008 on NavMe board
*/
/*                  Toolchain is GNUARM 4.1.0
*/
/*                  written with teachings from WinARM example code 
*/
/*
*/
/*********************************************************************** 
*/
ENTRY(_boot)
STACK_SIZE = 0x400;

/* Memory Definitions */
MEMORY
{
  SRAM (rw) : ORIGIN = 0x00000000, LENGTH = 0x00040000
  ROM (rx)  : ORIGIN = 0x01000000, LENGTH = 0x00800000
  RAM (rw)  : ORIGIN = 0x03000000, LENGTH = 0x00400000
}

/* Section Definitions */
SECTIONS
{
  /* first section is .text which is used for code */
  .text :
  {
    *startup.o (.text)    /* Startup code */
    *(.text)               /* remaining code */
    *(.rodata)             /* read-only data (constants) */
    *(.rodata*)
    *(.glue_7)
    *(.glue_7t)
  } > ROM

  . = ALIGN(4);
  _etext = . ;
  PROVIDE (etext = .);

  /* .data section which is used for initialized data */
  .data : AT (_etext)
  {
    _data = .;
    *(.data)
  } > SRAM

  . = ALIGN(4);
  _edata = . ;
  PROVIDE (edata = .);

  /* .bss section which is used for uninitialized data */
  .bss (NOLOAD) :
  {
    __bss_start = . ;
    _bss_start_ = . ;
    *(.bss)
    *(COMMON)
    . = ALIGN(4);
  } > SRAM

  . = ALIGN(4);
  _bss_end_ = . ;
  PROVIDE (__bss_end = .);

  .stack ALIGN(256) :
  {
    . += STACK_SIZE;
    PROVIDE (_stack = .);
  } > SRAM

  _end = . ;
  PROVIDE (end = .);

  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the
beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }
}

Bye
Stefan

von Stefan (Guest)


Rate this post
useful
not useful
Perhaps it's a problem with .stack, because .data and/or .bss are empty?
I should  try this with another example with data/bss variables.

von Stefan (Guest)


Rate this post
useful
not useful
Stefan wrote:
> Perhaps it's a problem with .stack, because .data and/or .bss are empty?
> I should  try this with another example with data/bss variables.

Found something in the WINARM Readme Version 8/2005 -> Version 20060116.
Will check this out with WinARM and GNUARM as soon as possible.

====
It seems that the linker does not provide a correct "." if the section
before is empty and the current section is aligned in the section
"header". I'm not  sure why - maybe a new feature or a bug in the
binutils. In the "blinkswitch" examples for LPC2106 und LPC2129 I've
somehow fixed this and verified the correct result by the values given
in the map-file.

  In the linker-script for ROM
    .stack ALIGN(256) :
    {
    ...

  has been replaced with:

    .stack :
    {
      . = ALIGN(256);
====

I took some old WinARM linker script and modified it for GNUARM 4.1.0
(which doesn't throw this error).

von Stefan (Guest)


Rate this post
useful
not useful
I don't understand this.

Test #1 with a dummy variable in main.c and therefore a non empty .data
section
=> No linker error. Good main.map.

Test #2 with suggestion from WinARM readme with other description of
.stack section in the linker control script
=> No linker error. Good main.map.

And then test #3 with unmodified original linker command script from
yesterday (copyied version). All other files also unmodified
=> No linker error. Good main.map.

von Stefan (Guest)


Rate this post
useful
not useful
Made a fault and had an old main.c with dummy variable. Test #3 is same
as yesterday. Now i'll use a changed linker script file just as
suggested in the Winarm readme.

von Martin Thomas (Guest)


Rate this post
useful
not useful
Thank you Stefan for the testing. I'm glad it's now working for Win98
too. About your linker-script issues: I do not know the exact
explanation for this so I have mentioned the "workaround" in the
readme-file.

Martin Thomas

von Stefan (Guest)


Rate this post
useful
not useful
Martin Thomas wrote:
> Thank you Stefan for the testing. I'm glad it's now working for Win98
> too. About your linker-script issues: I do not know the exact
> explanation for this so I have mentioned the "workaround" in the
> readme-file.
>
> Martin Thomas

It's a bug in ld
http://www.mail-archive.com/bug-binutils@gnu.org/msg00677.html

But it is marked as

Status:     RESOLVED
Resolution:   FIXED

in
http://sourceware.org/bugzilla/show_bug.cgi?id=1353
=> http://sources.redhat.com/ml/binutils-cvs/2005-09/msg00078.html

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.