diff options
author | Ingo Albrecht <prom@berlin.ccc.de> | 2010-04-11 08:04:20 +0200 |
---|---|---|
committer | Ingo Albrecht <prom@berlin.ccc.de> | 2010-07-20 14:41:19 +0200 |
commit | 0068f87c1fa8e8ee788851b67f39dfd9ae307cb8 (patch) | |
tree | 7489a95e92bd7b8536be7fb2b78e8be20ae16eb0 /src/target/firmware/board/common | |
parent | 3936c397a7918fa8625355b5af39a371da6adc3a (diff) |
firmware: linker script and startup code reorg.
Diffstat (limited to 'src/target/firmware/board/common')
-rw-r--r-- | src/target/firmware/board/common/compal_app.lds | 107 | ||||
-rw-r--r-- | src/target/firmware/board/common/compal_osmoload.lds | 98 | ||||
-rw-r--r-- | src/target/firmware/board/common/compal_ramload.lds | 103 | ||||
-rw-r--r-- | src/target/firmware/board/common/compal_ramload_start.S | 164 | ||||
-rw-r--r-- | src/target/firmware/board/common/rffe_compal_dualband.c | 80 |
5 files changed, 0 insertions, 552 deletions
diff --git a/src/target/firmware/board/common/compal_app.lds b/src/target/firmware/board/common/compal_app.lds deleted file mode 100644 index 3d821ae8..00000000 --- a/src/target/firmware/board/common/compal_app.lds +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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_osmoload.lds b/src/target/firmware/board/common/compal_osmoload.lds deleted file mode 100644 index 2765ec22..00000000 --- a/src/target/firmware/board/common/compal_osmoload.lds +++ /dev/null @@ -1,98 +0,0 @@ -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -OUTPUT_ARCH(arm) -ENTRY(_start) -MEMORY -{ - /* compal-loaded binary: text, initialized data */ - LRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x00010000 - /* compal-loaded binary: unitialized data, stacks, heap */ - DRAM (rw) : ORIGIN = 0x00810000, LENGTH = 0x00010000 - /* remainder of internal ram: this is where we are linking to */ - IRAM (rw) : ORIGIN = 0x00820000, LENGTH = 0x00020000 -} -SECTIONS -{ - . = 0x820000; - - /* initialization code */ - . = ALIGN(4); - .text.start : { - PROVIDE(_start = .); - KEEP(*(.text.start)) - *(.text.start) - } > IRAM - - /* exception vectors from 0x80001c to 0x800034 */ - .text.exceptions 0x80001c : AT (LOADADDR(.text.start) + SIZEOF(.text.start)) { - KEEP(*(.text.exceptions)) - * (.text.exceptions) - . = ALIGN(4); - - /* constructors and destructors */ - . = ALIGN(4); - __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) - KEEP(*(SORT(.ctors))) - LONG(0) /* end of list */ - __CTOR_END__ = .; - __DTOR_LIST__ = .; - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) - KEEP(*(SORT(.dtors))) - LONG(0) /* end of list */ - __DTOR_END__ = .; - } > LRAM - PROVIDE(_exceptions = LOADADDR(.text.exceptions)); - - /* code */ - . = ALIGN(4); - .text (LOADADDR(.text.exceptions) + SIZEOF(.text.exceptions)) : - AT (LOADADDR(.text.exceptions) + SIZEOF(.text.exceptions)) { - /* regular code */ - *(.text*) - /* gcc voodoo */ - *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx) - } > IRAM - PROVIDE(_text_start = LOADADDR(.text)); - PROVIDE(_text_end = LOADADDR(.text) + SIZEOF(.text)); - - /* read-only data */ - . = ALIGN(4); - .rodata : { - *(.rodata*) - } > IRAM - PROVIDE(_rodata_start = LOADADDR(.rodata)); - PROVIDE(_rodata_end = LOADADDR(.rodata) + SIZEOF(.rodata)); - - /* initialized data */ - . = ALIGN(4); - .data : { - *(.data) - } > IRAM - PROVIDE(_data_start = LOADADDR(.data)); - PROVIDE(_data_end = LOADADDR(.data) + SIZEOF(.data)); - - /* pic offset tables */ - . = ALIGN(4); - .got : { - *(.got) - *(.got.plt) *(.igot.plt) *(.got) *(.igot) - } > IRAM - PROVIDE(_got_start = LOADADDR(.got)); - PROVIDE(_got_end = LOADADDR(.got) + SIZEOF(.got)); - - /* uninitialized data */ - .bss (NOLOAD) : { - . = ALIGN(4); - __bss_start = .; - *(.bss) - } > IRAM - . = ALIGN(4); - __bss_end = .; - 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.lds b/src/target/firmware/board/common/compal_ramload.lds deleted file mode 100644 index 00f0d001..00000000 --- a/src/target/firmware/board/common/compal_ramload.lds +++ /dev/null @@ -1,103 +0,0 @@ -OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") -OUTPUT_ARCH(arm) -ENTRY(_start) -MEMORY -{ - /* compal-loaded binary: our text, initialized data */ - LRAM (rw) : ORIGIN = 0x00800000, LENGTH = 0x00010000 - /* compal-loaded binary: our unitialized data, stacks, heap */ - IRAM (rw) : ORIGIN = 0x00810000, LENGTH = 0x00010000 -} -SECTIONS -{ - . = 0x800000; - - /* romloader data section, contains passthru interrupt vectors */ - .compal.loader (NOLOAD) : { . = 0x100; } > LRAM - - /* image signature (prepended by osmocon according to phone type) */ - .compal.header (NOLOAD) : { . = 4; } > LRAM - - /* initialization code */ - . = ALIGN(4); - .text.start : { - PROVIDE(_start = .); - KEEP(*(.text.start)) - *(.text.start) - } > LRAM - - /* exception vectors from 0x80001c to 0x800034 */ - .text.exceptions 0x80001c : AT (LOADADDR(.text.start) + SIZEOF(.text.start)) { - KEEP(*(.text.exceptions)) - * (.text.exceptions) - . = ALIGN(4); - } > LRAM - PROVIDE(_exceptions = LOADADDR(.text.exceptions)); - - /* code */ - . = ALIGN(4); - .text (LOADADDR(.text.exceptions) + SIZEOF(.text.exceptions)) : - AT (LOADADDR(.text.exceptions) + SIZEOF(.text.exceptions)) { - /* regular code */ - *(.text*) - /* gcc voodoo */ - *(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx) - . = ALIGN(4); - - /* constructors and destructors */ - . = ALIGN(4); - __CTOR_LIST__ = .; - LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) - KEEP(*(SORT(.ctors))) - LONG(0) /* end of list */ - __CTOR_END__ = .; - __DTOR_LIST__ = .; - LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) - KEEP(*(SORT(.dtors))) - LONG(0) /* end of list */ - __DTOR_END__ = .; - } > LRAM - PROVIDE(_text_start = LOADADDR(.text)); - PROVIDE(_text_end = LOADADDR(.text) + SIZEOF(.text)); - - /* read-only data */ - . = ALIGN(4); - .rodata : { - *(.rodata*) - } > LRAM - PROVIDE(_rodata_start = LOADADDR(.rodata)); - PROVIDE(_rodata_end = LOADADDR(.rodata) + SIZEOF(.rodata)); - - /* initialized data */ - . = ALIGN(4); - .data : { - *(.data) - } > LRAM - PROVIDE(_data_start = LOADADDR(.data)); - PROVIDE(_data_end = LOADADDR(.data) + SIZEOF(.data)); - - /* pic offset tables */ - . = ALIGN(4); - .got : { - *(.got) - *(.got.plt) *(.igot.plt) *(.got) *(.igot) - } > LRAM - PROVIDE(_got_start = LOADADDR(.got)); - PROVIDE(_got_end = LOADADDR(.got) + SIZEOF(.got)); - - /* uninitialized data */ - .bss (NOLOAD) : { - . = ALIGN(4); - __bss_start = .; - *(.bss) - } > IRAM - . = ALIGN(4); - __bss_end = .; - 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 deleted file mode 100644 index 3036fec9..00000000 --- a/src/target/firmware/board/common/compal_ramload_start.S +++ /dev/null @@ -1,164 +0,0 @@ - - .EQU ARM_MODE_FIQ, 0x11 - .EQU ARM_MODE_IRQ, 0x12 - .EQU ARM_MODE_SVC, 0x13 - - .EQU I_BIT, 0x80 - .EQU F_BIT, 0x40 - -#define TOP_OF_RAM 0x083fff0 -#define FIQ_STACK_SIZE 1024 -#define IRQ_STACK_SIZE 1024 - -.section .text.start - -.globl _start -_start: - /* clear bss section */ - .global __bss_start - .global __bss_end - mov r0, #0 - ldr r1, =__bss_start - ldr r2, =__bss_end -2: cmp r1, r2 - strlo r0, [r1], #4 - blo 2b - - /* initialize stacks, starting at TOP_OF_RAM */ - ldr r0, =TOP_OF_RAM - - /* initialize FIQ stack */ - msr CPSR_c, #ARM_MODE_FIQ | I_BIT | F_BIT - mov r13, r0 - sub r0, r0, #FIQ_STACK_SIZE - - /* initialize IRQ stack */ - msr CPSR_c, #ARM_MODE_IRQ | I_BIT | F_BIT - mov r13, r0 - sub r0, r0, #IRQ_STACK_SIZE - - /* initialize supervisor stack */ - msr CPSR_c, #ARM_MODE_SVC | I_BIT | F_BIT - mov r13, r0 - - /* set backlight to moderate level */ - bl pwl_init - mov r0, #50 - bl pwl_set_level - - /* test uart output */ - @ldr r0, =string - @bl puts_asm - - /* dump some memory */ - @ldr r0, =0xfffef000 - @bl memdump - @ldr r0, =0xfffffe00 - @bl memdump - - /* call constructor functions */ - ldr r0, _ctor_list - ldr r1, _ctor_end - bl do_global_ctors - - /* jump to main */ - ldr pc, _jump_main - - /* endless loop at end of program */ -_end: b _end - b _start - -_jump_main: .word main -_ctor_list: .word __CTOR_LIST__ -_ctor_end: .word __CTOR_END__ - -/* handler for all kinds of aborts */ -handle_abort: - @ print the PC we would jump back to... - sub lr, lr, #4 @ we assume to be ARM32 - - mov r0, lr - mov r1, #8 - bl phex - - @ print abort message - mov r0, #'A' - bl putchar_asm - mov r0, #'B' - bl putchar_asm - mov r0, #'O' - bl putchar_asm - mov r0, #'R' - bl putchar_asm - mov r0, #'T' - bl putchar_asm - - @ disable IRQ and FIQ - msr CPSR_c, #I_BIT | F_BIT - -0: @ dead - b 0b - -/* entry point for IRQs */ -irq_entry: - /* Adjust and save LR_irq in IRQ stack */ - sub lr, lr, #4 - stmfd sp!, {lr} - - /* Save SPSR for nested interrupt */ - mrs r14, SPSR - stmfd sp!, {r14} - - /* Call the interrupt handler C function */ - stmfd sp!, {r0-r4, r12} - bl irq - ldmfd sp!, {r0-r4, r12} - - /* Restore SPSR_irq from IRQ stack */ - ldmia sp!, {r14} - msr SPSR_cxsf, r14 - - /* Restore adjusted LR_irq from IRQ stack directly in the PC */ - ldmia sp!, {pc}^ - -/* entry point for FIQs */ -fiq_entry: - /* Adjust and save LR_irq in IRQ stack */ - sub lr, lr, #4 - stmfd sp!, {lr} - - /* Save SPSR for nested interrupt */ - mrs r14, SPSR - stmfd sp!, {r14} - - /* Call the interrupt handler C function */ - stmfd sp!, {r0-r4, r12} - bl fiq - ldmfd sp!, {r0-r4, r12} - - /* Restore SPSR_irq from IRQ stack */ - ldmia sp!, {r14} - msr SPSR_cxsf, r14 - - /* Restore adjusted LR_irq from IRQ stack directly in the PC */ - ldmia sp!, {pc}^ - -/* Exception Vectors like they are needed for the exception vector - indirection of the internal boot ROM. The following section must be liked - to appear at 0x80'001c */ -.section .text.exceptions -_undef_instr: - b handle_abort -_sw_interr: - b _sw_interr -_prefetch_abort: - b handle_abort -_data_abort: - b handle_abort -_reserved: - b _reserved -_irq: - b irq_entry -_fiq: - b fiq_entry - diff --git a/src/target/firmware/board/common/rffe_compal_dualband.c b/src/target/firmware/board/common/rffe_compal_dualband.c deleted file mode 100644 index bfd3d98e..00000000 --- a/src/target/firmware/board/common/rffe_compal_dualband.c +++ /dev/null @@ -1,80 +0,0 @@ -#include <stdint.h> -#include <stdio.h> - -#include <debug.h> -#include <memory.h> -#include <rffe.h> -#include <calypso/tsp.h> -#include <rf/trf6151.h> - -/* This is a value that has been measured on the C123 by Harald: 71dBm, - it is the difference between the input level at the antenna and what - the DSP reports, subtracted by the total gain of the TRF6151 */ -#define SYSTEM_INHERENT_GAIN 71 - -/* describe how the RF frontend is wired on the Motorola E88 board (C117/C118/C121/C123) */ - -#define RITA_RESET TSPACT(0) /* Reset of the Rita TRF6151 */ -#define PA_ENABLE TSPACT(1) /* Enable the Power Amplifier */ -#define TRENA TSPACT(6) /* Transmit Enable (Antenna Switch) */ -#define GSM_TXEN TSPACT(8) /* GSM (as opposed to DCS) Transmit */ - -#define IOTA_STROBE TSPEN0 /* Strobe for the Iota TSP */ -#define RITA_STROBE TSPEN2 /* Strobe for the Rita TSP */ - -/* switch RF Frontend Mode */ -void rffe_mode(enum gsm_band band, int tx) -{ - uint16_t tspact = tsp_act_state(); - - /* First we mask off all bits from the state cache */ - tspact &= ~PA_ENABLE; - tspact |= TRENA | GSM_TXEN; /* low-active */ - -#ifdef CONFIG_TX_ENABLE - /* Then we selectively set the bits on, if required */ - if (tx) { - tspact &= ~TRENA; - if (band == GSM_BAND_900) - tspact &= ~GSM_TXEN; - tspact |= PA_ENABLE; /* Dieter: TODO */ - } -#endif /* TRANSMIT_SUPPORT */ - - tsp_act_update(tspact); -} - -#define MCU_SW_TRACE 0xfffef00e -#define ARM_CONF_REG 0xfffef006 - -void rffe_init(void) -{ - uint16_t reg; - - reg = readw(ARM_CONF_REG); - reg &= ~ (1 << 5); /* TSPACT6 I/O function, not nCS6 */ - writew(reg, ARM_CONF_REG); - - reg = readw(MCU_SW_TRACE); - reg &= ~(1 << 5); /* TSPACT8 I/O function, not nMREQ */ - writew(reg, MCU_SW_TRACE); -} - -uint8_t rffe_get_gain(void) -{ - return trf6151_get_gain(); -} - -const uint8_t system_inherent_gain = SYSTEM_INHERENT_GAIN; - -/* Given the expected input level of exp_inp dBm/8 and the target of target_bb - * dBm8, configure the RF Frontend with the respective gain */ -void rffe_set_gain(int16_t exp_inp, int16_t target_bb) -{ - trf6151_compute_gain(exp_inp, target_bb); -} - -void rffe_rx_win_ctrl(int16_t exp_inp, int16_t target_bb) -{ - /* FIXME */ -} |