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