summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIngo Albrecht <prom@berlin.ccc.de>2010-04-11 01:38:24 +0200
committerIngo Albrecht <prom@berlin.ccc.de>2010-07-20 14:41:19 +0200
commite258b5db7972e13d0dd82d2f70308a81a3e93412 (patch)
tree397123c834de3294c071cdacdf3f541725cd53ca
parentd25e7b135a41be556aea60db9dbadde53be89799 (diff)
firmware: linker script for flashed app on e88.
-rw-r--r--src/target/firmware/Makefile3
-rw-r--r--src/target/firmware/Makefile.inc1
-rw-r--r--src/target/firmware/board/common/compal_app.lds107
-rw-r--r--src/target/firmware/board/common/compal_ramload_start.S6
4 files changed, 116 insertions, 1 deletions
diff --git a/src/target/firmware/Makefile b/src/target/firmware/Makefile
index a78d5227..46cd6d4c 100644
--- a/src/target/firmware/Makefile
+++ b/src/target/firmware/Makefile
@@ -20,7 +20,8 @@ compal_e99_OBJS=$(compal_COMMON_OBJS) board/compal_e99/init.o
gta0x_OBJS=$(gta0x_COMMON_OBJS) board/gta0x/init.o
# List of all supported execution environments
-ENVIRONMENTS?=ramload osmoload
+ENVIRONMENTS?=app ramload osmoload
+app_LDS=board/common/compal_app.lds
ramload_LDS=board/common/compal_ramload.lds
osmoload_LDS=board/common/compal_osmoload.lds
diff --git a/src/target/firmware/Makefile.inc b/src/target/firmware/Makefile.inc
index 7f91fb18..eec793d7 100644
--- a/src/target/firmware/Makefile.inc
+++ b/src/target/firmware/Makefile.inc
@@ -35,6 +35,7 @@ GIT_MODIFIED:=$(shell (git status | grep "modified:\|added:\|deleted:" -q) && ec
GIT_REVISION:=$(GIT_COMMIT)$(GIT_MODIFIED)
+ASFLAGS += -DGIT_REVISION=\"$(GIT_REVISION)\"
CFLAGS += -DGIT_REVISION=\"$(GIT_REVISION)\"
#### GLOBAL DATA ####
diff --git a/src/target/firmware/board/common/compal_app.lds b/src/target/firmware/board/common/compal_app.lds
new file mode 100644
index 00000000..3d821ae8
--- /dev/null
+++ b/src/target/firmware/board/common/compal_app.lds
@@ -0,0 +1,107 @@
+/*
+ * Linker script for flashed applications on the Compal E88
+ *
+ * This script creates a binary that can replace a standard firmware
+ * located at 0x2000. It works in conjunction with the compal ramloader.
+ *
+ * The interrupt vectors and start address are at known, fixed offsets.
+ *
+ */
+OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
+OUTPUT_ARCH(arm)
+ENTRY(_start)
+MEMORY
+{
+ /* 2 MBytes of external flash memory */
+ FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x200000
+ /* 256 kBytes of internal zero-waitstate sram */
+ IRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x040000
+ /* 256 kBytes of external slow sram */
+ ERAM (rw) : ORIGIN = 0x01000000, LENGTH = 0x040000
+}
+SECTIONS
+{
+ /* Provide symbols for the compal loader */
+ .compal.loader 0x00000000 (NOLOAD) : {
+ _compal_loader_start = .;
+ . = 0x2000;
+ _compal_loader_end = .;
+ } > FLASH
+
+ /* Compal-style image header */
+ .compal.header 0x00002000 : {
+ _compal_header_start = .;
+ KEEP(*(.compal.header))
+ *(.compal.header)
+ . = 0xA0;
+ _compal_header_end = .;
+ } > FLASH
+
+ /* Compal-style vector table */
+ .compal.vectors 0x000020A0 : {
+ PROVIDE(_exceptions = .);
+ KEEP(*(.text.exceptions))
+ *(.text.exceptions)
+ } > FLASH
+
+ /* Compal-style entry point */
+ .text.start 0x000020F8 : {
+ PROVIDE(_start = .);
+ KEEP(*(.text.start))
+ *(.text.start)
+ } > FLASH
+
+ /* code */
+ .text : {
+ /* regular code */
+ *(.text*)
+ /* gcc voodoo */
+ *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
+ } > FLASH
+ PROVIDE(_text_start = ADDR(.text));
+ PROVIDE(_text_end = ADDR(.text) + SIZEOF(.text));
+
+ /* read-only data */
+ .rodata : {
+ *(.rodata*)
+ } > FLASH
+ PROVIDE(_rodata_start = ADDR(.rodata));
+ PROVIDE(_rodata_end = ADDR(.rodata) + SIZEOF(.rodata));
+
+ /* pic offset tables */
+ .got : {
+ . = ALIGN(4);
+ *(.got)
+ *(.got.plt) *(.igot.plt) *(.got) *(.igot)
+ . = ALIGN(4);
+ } > FLASH
+ PROVIDE(_got_start = ADDR(.got));
+ PROVIDE(_got_end = ADDR(.got) + SIZEOF(.got));
+
+ /* initialized data */
+ .data : AT (LOADADDR(.got) + SIZEOF(.got)) {
+ . = ALIGN(4);
+ *(.data)
+ . = ALIGN(4);
+ } > IRAM
+ PROVIDE(__data_start = LOADADDR(.data));
+ PROVIDE(__data_end = LOADADDR(.data) + SIZEOF(.data));
+ PROVIDE(_data_start = ADDR(.data));
+ PROVIDE(_data_end = ADDR(.data) + SIZEOF(.data));
+
+ /* uninitialized data */
+ .bss (NOLOAD) : {
+ . = ALIGN(4);
+ *(.bss)
+ . = ALIGN(4);
+ } > IRAM
+ PROVIDE(__bss_start = ADDR(.bss));
+ PROVIDE(__bss_end = ADDR(.bss) + SIZEOF(.bss));
+ PROVIDE(_bss_start = __bss_start);
+ PROVIDE(_bss_end = __bss_end);
+
+ /* end of image */
+ . = ALIGN(4);
+ _end = .;
+ PROVIDE(end = .);
+}
diff --git a/src/target/firmware/board/common/compal_ramload_start.S b/src/target/firmware/board/common/compal_ramload_start.S
index c89c881c..12107fd6 100644
--- a/src/target/firmware/board/common/compal_ramload_start.S
+++ b/src/target/firmware/board/common/compal_ramload_start.S
@@ -161,3 +161,9 @@ _irq:
b irq_entry
_fiq:
b fiq_entry
+
+/* A few strings to be linked as the description header for compal images */
+.section .compal.header
+.ascii "OSMOCOM"
+ . = 0x20
+.ascii GIT_REVISION