changeset 636:06ecb305f650

flashImage for BootROM-enabled targets: put something sensible at 0
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Mon, 01 Sep 2014 19:34:31 +0000
parents 658a83ff7221
children 0677a6fbb8b6
files gsm-fw/finlink/ld-script.src gsm-fw/sysglue/flashboot.S
diffstat 2 files changed, 52 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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