# HG changeset patch # User Michael Spacefalcon # Date 1409600071 0 # Node ID 06ecb305f650dc8bb9abd7b0335bbc499686eb46 # Parent 658a83ff7221e389e9832ea8aa18654459a85b4c flashImage for BootROM-enabled targets: put something sensible at 0 diff -r 658a83ff7221 -r 06ecb305f650 gsm-fw/finlink/ld-script.src --- a/gsm-fw/finlink/ld-script.src Mon Sep 01 18:45:37 2014 +0000 +++ b/gsm-fw/finlink/ld-script.src Mon Sep 01 19:34:31 2014 +0000 @@ -29,8 +29,26 @@ ')dnl SECTIONS { -ifelse(Buildmem,FLASH,` - /* Flash boot entry point */ +dnl The following sections exist only in the flashImage build, +dnl and only on targets that use the Calypso boot ROM. +ifelse(Buildmem-FLASH_BOOT_VIA_BOOTROM,FLASH-1, +` /* Part of flash overlaid by the boot ROM */ + bootrom.overlay 0 : { + *(bootrom.overlay) + } > FLASH_OVERLAY + + /* code that enables the boot ROM and jumps to it */ + bootrom.switch : { + *(bootrom.switch) + } > IRAM AT> FLASH_OVERLAY + __romswitch_ram_addr = ADDR(bootrom.switch); + __romswitch_flash_addr = LOADADDR(bootrom.switch); + __romswitch_size = SIZEOF(bootrom.switch); +')dnl + +dnl all flashImage builds +ifelse(Buildmem,FLASH, +` /* Flash boot entry point */ flashboot.text FLASHIMAGE_BASE_ADDR : { *(flashboot.text) } > FLASH diff -r 658a83ff7221 -r 06ecb305f650 gsm-fw/sysglue/flashboot.S --- a/gsm-fw/sysglue/flashboot.S Mon Sep 01 18:45:37 2014 +0000 +++ b/gsm-fw/sysglue/flashboot.S Mon Sep 01 19:34:31 2014 +0000 @@ -5,6 +5,38 @@ #include "../include/config.h" +#if FLASH_BOOT_VIA_BOOTROM +/* + * Put something sensible in the boot ROM overlay area, just for the + * heck of it, or for extra robustness. + */ + .section bootrom.overlay,"ax",%progbits + .code 32 + .org 0 + b BootROM_disabled_entry +#include "vectors.S" +BootROM_disabled_entry: +/* copy the boot ROM switch code to IRAM and jump to it */ + ldr r4, =__romswitch_flash_addr + ldr r5, =__romswitch_ram_addr + ldr r2, =__romswitch_size +1: ldr r0, [r4], #4 + str r0, [r5], #4 + subs r2, r2, #4 + bhi 1b + ldr pc, =__romswitch_ram_addr + + .section bootrom.switch,"ax",%progbits + .code 32 + .org 0 +@ enable the Calypso boot ROM + ldr r1, =0xFFFFFB10 + mov r2, #0x0100 + strh r2, [r1] +@ jump to it! + mov pc, #0 +#endif + .section flashboot.text,"ax",%progbits .code 32 .org 0