gcc+newlib的问题

内核编译和嵌入式产品的设计与开发
回复
rayfox
帖子: 39
注册时间: 2007-02-03 9:12

gcc+newlib的问题

#1

帖子 rayfox » 2008-06-19 10:06

我使用gcc+newlib
我的 代码如下

代码: 全选

#include <stdio.h>
#include <string.h>

#include "LPC2294.h"
#include "target.h"
#include "serial.h"

char s[256];
		
int main(void)
{			 
	int temp;
	char i, c;

	TargetInit();
	
	sscanf("1234", "%d", &temp);

	while (1) {
	}

	return 0;
}
连接脚本

代码: 全选

MEMORY
{
	DATA (rw) : ORIGIN = 0x40000000, LENGTH = 0x00004000
}

SECTIONS
{
	.text :
	{
		*startup.o (.text)
		*(.text)
		*(.glue_7t) *(.glue_7)
	} >DATA
	. = ALIGN(4);

	.rodata :
	{
		*(.rodata)
	} >DATA
	. = ALIGN(4);
	_etext = . ;
	PROVIDE (etext = .);

	.data : AT (_etext)
	{
		_data = . ;
		*(.data)
		SORT(CONSTRUCTORS)
	} >DATA
	. = ALIGN(4);
	_edata = . ;
	PROVIDE (edata = .);
	
	.bss :
	{
		__bss_start = . ;
		__bss_start__ = . ;
		*(.bss)
		*(COMMON)
	} >DATA
	. = ALIGN(4);
	__bss_end__ = . ;
	__bss_end__ = . ;
	_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) }
}
编译后出现以下错误

代码: 全选

d:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe: region DATA is full (flashdown.elf section .text)
d:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe: section .text [40000000 -> 4000c1db] overlaps section .rodata [40000000 -> 400002d3]
d:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe: section .bss [40000b24 -> 40000d67] overlaps section .text [40000000 -> 4000c1db]
d:/winarm/bin/../lib/gcc/arm-elf/4.1.2/../../../../arm-elf/bin/ld.exe: flashdown.elf: section .text lma 0x40000000 overlaps previous sections
大家帮我看看是怎么回事?
回复