summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2008-05-08 12:09:14 +0000
committerMichael Sevakis <jethead71@rockbox.org>2008-05-08 12:09:14 +0000
commit6dd6ea74af4ebfa1112f2e606db67357c0e2632f (patch)
tree5506268620a9dfe49923a4e6e5c957bedcd6fabe /firmware/target
parente616092fd566e9d0455727ef32a2879f15ac80da (diff)
Gigabeat S RoLo: Properly execute firmware copy from an IRAM stub because the currently running image was being overwritten in place. Minor tweak to rolo.c based on imx31 errata sheet about not masking FIQ without masking IRQ which is fine to use on all ARM anyway.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17414 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/imx31/rolo_restart.S66
1 files changed, 66 insertions, 0 deletions
diff --git a/firmware/target/arm/imx31/rolo_restart.S b/firmware/target/arm/imx31/rolo_restart.S
new file mode 100644
index 0000000000..39053de96f
--- /dev/null
+++ b/firmware/target/arm/imx31/rolo_restart.S
@@ -0,0 +1,66 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2008 by Michael Sevakis
+ *
+ * RoLo restart code for IMX31
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "config.h"
+#include "cpu.h"
+
+/****************************************************************************
+ * void rolo_restart(const unsigned char* source, unsigned char* dest,
+ * int length) __attribute__((noreturn));
+ */
+ .section .text, "ax", %progbits
+ .align 2
+ .global rolo_restart
+rolo_restart:
+ adr r4, restart_copy_start
+ adr r5, restart_copy_end
+ ldr r6, =IRAM_BASE_ADDR
+ mov r7, r6
+
+ @ Copy stub to IRAM
+1:
+ ldr r8, [r4], #4
+ str r8, [r7], #4
+ cmp r5, r4
+ bhi 1b
+
+ @ Branch to stub
+ bx r6
+
+restart_copy_start:
+ @ Trivial copy of firmware to final location
+ mov r4, r1
+1:
+ subs r2, r2, #1
+ ldrb r7, [r0], #1
+ strb r7, [r4], #1
+ bge 1b
+
+ @ Clean and invalidate all caches
+ mov r0, #0
+ mcr p15, 0, r0, c7, c14, 0
+ mcr p15, 0, r0, c7, c5, 0
+ mcr p15, 0, r0, c7, c10, 4
+ mcr p15, 0, r0, c7, c5, 4
+
+ @ Branch to destination (should be address 0x00000000)
+ bx r1
+restart_copy_end:
+ .size rolo_restart,.-rolo_restart