Może zacznę od komunikatu błędu kompilacji:
Sprawa ma się tak, że używam następującego skryptu linkera (z jakiegoś przykładu):
No i skrypt ten działa normalnie dla projektu, gdzie używam m. in. bibliotek EFSL i HELIX (wielki projekt, razem jakieś 118 kB kodu, na razie...) i śmiga. Kiedy natomiast skompilowałem sobie FreeRTOS (wykaz plików we fragmencie makefile) to wywala wspomniany wyżej błąd (że sekcje .bss i .stack zachodzą na siebie). WTF? Że tak powiem ?
Wspomniany fragment makefile:
make all
arm-none-eabi-gcc ./SRC/startup.o ./SRC/low_level_init.o ./SRC/main.o ./SRC/RTOS/lib_AT91SAM7X256.o ./SRC/RTOS/port.o ./SRC/RTOS/portISR.o ./SRC/RTOS/croutine.o ./SRC/RTOS/heap_2.o ./SRC/RTOS/list.o ./SRC/RTOS/queue.o ./SRC/RTOS/tasks.o -mcpu=arm7tdmi -nostartfiles -T./LNK/sam7s256_rom.ld -Wl,-Map=main_rom.map,--cref,--no-warn-mismatch -o main_rom.elf
d:/programy/mikrokontrolery/arm/codesourcery/bin/../lib/gcc/arm-none-eabi/4.3.3/../../../../arm-none-eabi/bin/ld.exe: section .stack [0010c760 -> 0010ca5f] overlaps section .bss [0010c760 -> 0010f177]
d:/programy/mikrokontrolery/arm/codesourcery/bin/../lib/gcc/arm-none-eabi/4.3.3/../../../../arm-none-eabi/bin/ld.exe: main_rom.elf: warning: sh_link not set for section `.ARM.exidx'
./SRC/RTOS/tasks.o: In function `vTaskIncrementTick':
E:\Projekty\ARM\Eclipse\AT91SAM7Sxxx_RTOS/SRC/RTOS/tasks.c:1392: undefined reference to `vApplicationTickHook'
E:\Projekty\ARM\Eclipse\AT91SAM7Sxxx_RTOS/SRC/RTOS/tasks.c:1405: undefined reference to `vApplicationTickHook'
d:/programy/mikrokontrolery/arm/codesourcery/bin/../lib/gcc/arm-none-eabi/4.3.3/../../../../arm-none-eabi/lib\libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
sbrkr.c:(.text+0x18): undefined reference to `_sbrk'
collect2: ld returned 1 exit status
make: *** [main_rom.elf] Error 1
Sprawa ma się tak, że używam następującego skryptu linkera (z jakiegoś przykładu):
OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
OUTPUT_ARCH(arm)
ENTRY(_start)
MEMORY { /* memory map of AT91SAM7S256 */
ROM (rx) : ORIGIN = 0x00100000, LENGTH = 256k
RAM (rwx) : ORIGIN = 0x00200000, LENGTH = 64k
}
/* The sizes of the stacks used by the application. NOTE: you need to adjust */
C_STACK_SIZE = 512;
IRQ_STACK_SIZE = 128;
FIQ_STACK_SIZE = 128;
SVC_STACK_SIZE = 0;
ABT_STACK_SIZE = 0;
UND_STACK_SIZE = 0;
SECTIONS {
.reset : {
*startup.o (.text) /* startup code (ARM vectors and reset handler) */
. = ALIGN(0x4);
} >ROM
.ramvect : { /* used for vectors remapped to RAM */
__ram_start = .;
. = 0x40;
} >RAM
.fastcode : {
__fastcode_load = LOADADDR (.fastcode);
__fastcode_start = .;
*(.glue_7t) *(.glue_7)
*isr.o (.text.*)
*(.text.fastcode)
*(.text.Blinky_dispatch)
/* add other modules here ... */
. = ALIGN (4);
__fastcode_end = .;
} >RAM AT>ROM
.text : {
CREATE_OBJECT_SYMBOLS
*(.text .text.* .gnu.linkonce.t.*)
*(.plt)
*(.gnu.warning)
*(.glue_7t) *(.glue_7) /* NOTE: placed already in .fastcode */
. = ALIGN (4);
/* These are for static constructors and destructors under ELF */
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.ARM.extab* .gnu.linkonce.armextab.*)
*(.gcc_except_table)
*(.eh_frame_hdr)
*(.eh_frame)
*(.init)
*(.fini)
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
PROVIDE_HIDDEN (__fini_array_end = .);
} >ROM
/* .ARM.exidx is sorted, so has to go in its own output section. */
.ARM.exidx : {
__exidx_start = .;
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
__exidx_end = .;
} >ROM
_etext = .;
.data : {
__data_load = LOADADDR (.data);
__data_start = .;
KEEP(*(.jcr))
*(.got.plt) *(.got)
*(.shdata)
*(.data .data.* .gnu.linkonce.d.*)
. = ALIGN (4);
_edata = .;
} >RAM AT>ROM
.bss : {
__bss_start__ = . ;
*(.shbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN (8);
__bss_end__ = .;
} >RAM
.stack : {
__stack_start__ = . ;
. += IRQ_STACK_SIZE;
. = ALIGN (4);
__irq_stack_top__ = . ;
. += FIQ_STACK_SIZE;
. = ALIGN (4);
__fiq_stack_top__ = . ;
. += SVC_STACK_SIZE;
. = ALIGN (4);
__svc_stack_top__ = . ;
. += ABT_STACK_SIZE;
. = ALIGN (4);
__abt_stack_top__ = . ;
. += UND_STACK_SIZE;
. = ALIGN (4);
__und_stack_top__ = . ;
. += C_STACK_SIZE;
. = ALIGN (4);
__c_stack_top__ = . ;
__stack_end__ = .;
} >RAM
_end = . ;
__end = . ;
PROVIDE(end = .);
.stab 0 (NOLOAD) : {
*(.stab)
}
.stabstr 0 (NOLOAD) : {
*(.stabstr)
}
/* 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) }
.note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
.ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
/DISCARD/ : { *(.note.GNU-stack) }
}
/*** EOF ***/
No i skrypt ten działa normalnie dla projektu, gdzie używam m. in. bibliotek EFSL i HELIX (wielki projekt, razem jakieś 118 kB kodu, na razie...) i śmiga. Kiedy natomiast skompilowałem sobie FreeRTOS (wykaz plików we fragmencie makefile) to wywala wspomniany wyżej błąd (że sekcje .bss i .stack zachodzą na siebie). WTF? Że tak powiem ?
Wspomniany fragment makefile:
DINCDIR = INC/ \
INC/RTOS/
# List the default directory to look for the libraries here
DLIBDIR =
# List all default libraries here
DLIBS =
#
# End of default section
##############################################################################################
##############################################################################################
# Start of user section
#
# Define project name here
PROJECT = main
# Define linker script file here
LDSCRIPT_ROM = ./LNK/sam7s256_rom.ld
# List all user C define here, like -D_DEBUG=1
UDEFS =
# Define ASM defines here
UADEFS =
# List C source files here
SRC = ./SRC/low_level_init.c \
./SRC/main.c \
./SRC/RTOS/lib_AT91SAM7X256.c \
./SRC/RTOS/port.c \
./SRC/RTOS/portISR.c \
./SRC/RTOS/croutine.c \
./SRC/RTOS/heap_2.c \
./SRC/RTOS/list.c \
./SRC/RTOS/queue.c \
./SRC/RTOS/tasks.c \
# List ASM source files here
ASRC = ./SRC/startup.s