view nuc-fw/finlink/xram.lds @ 80:39b1c369b67f

nuc-fw: links to an ELF image
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Fri, 16 Aug 2013 02:25:58 +0000
parents
children dd13211c9f10
line wrap: on
line source

/*
 * This linker script is used when building the ramImage version of
 * FreeCalypso firmware: the version which is to be test-run via fc-xram
 * without touching the flash.  Everything is loaded into IRAM or XRAM,
 * and in this ld script we pretend as if the actual flash memory
 * does not exist.
 */

ENTRY(_FlashorXram_entry)

MEMORY {
	IRAM : ORIGIN = 0x00800000, LENGTH = 512K
	XRAM : ORIGIN = 0x01000000, LENGTH = 8M
}

SECTIONS {
	/* XIP code, using XRAM to emulate flash */
	xip.text : {
		*(xip.text*)
		xipcode.o(.text*)
		*libplus.xip.a:(.text*)
		*libsprintf.a:(.text*)
	} > XRAM

	/* copy-to-IRAM code */
	iram.text 0x80001C : {
		/* the 7 exception and interrupt vectors @ 0x80001C */
		*(iram.vectors)
		*(iram.text*)
		iramcode.o(.text*)
		*libplus.iram.a:(.text*)
		*libc.a:(.text*)
		*libgcc.a:(.text*)
	} > IRAM AT> XRAM
	__iramtext_ram_addr = ADDR(iram.text);
	__iramtext_flash_addr = LOADADDR(iram.text);
	__iramtext_size = SIZEOF(iram.text);

	/* all .rodata will stay in flash */
	.rodata : {
		*(.rodata*)
	} > XRAM

	/* all .data will go into XRAM */
	.data : {
		*(.data*)
	} > XRAM

	/* we have two kinds of BSS: internal and external */
	int.bss (NOLOAD) : {
		*(int.bss*)
		iramcode.o(.bss* COMMON)
		*libplus.iram.a:(.bss* COMMON)
		*libc.a:(.bss* COMMON)
		*libgcc.a:(.bss* COMMON)
		. = ALIGN(4);
	} > IRAM
	__intbss_start = ADDR(int.bss);
	__intbss_size = SIZEOF(int.bss);

	ext.bss (NOLOAD) : {
		*(ext.bss*)
		xipcode.o(.bss* COMMON)
		*libplus.xip.a:(.bss* COMMON)
		*libsprintf.a:(.bss* COMMON)
		. = ALIGN(4);
	} > XRAM
	__extbss_start = ADDR(ext.bss);
	__extbss_size = SIZEOF(ext.bss);

	/* finally, we have "raw RAM": like BSS, but we don't zero it out */
	int.ram (NOLOAD) : {
		*(int.ram*)
		*(system_stack)
		*(irq_stack)
		*(fiq_stack)
		*(timer_hisr_stack)
		. = ALIGN(4);
		_iram_end = .;
	} > IRAM

	ext.ram (NOLOAD) : {
		*(ext.ram*)
		. = ALIGN(4);
		_xram_end = .;
	} > XRAM
}