summaryrefslogtreecommitdiff
path: root/rbutil/mkamsboot/test.S
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2008-10-04 08:46:03 +0000
committerDave Chapman <dave@dchapman.com>2008-10-04 08:46:03 +0000
commitc6be818212de133da4a51cebcdfee84c6dbae984 (patch)
treee6e321e0c0437d5a937db7c126be2289f30cb874 /rbutil/mkamsboot/test.S
parentd16fe2d36a0881a1bf4f65b945087a10962ed33a (diff)
Move mkamsboot into the rbutil/mkamsboot/ directory - no other changes, so this should still work the same as before.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18706 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/mkamsboot/test.S')
-rw-r--r--rbutil/mkamsboot/test.S55
1 files changed, 55 insertions, 0 deletions
diff --git a/rbutil/mkamsboot/test.S b/rbutil/mkamsboot/test.S
new file mode 100644
index 0000000000..a4757b44ce
--- /dev/null
+++ b/rbutil/mkamsboot/test.S
@@ -0,0 +1,55 @@
+/* int ucl_nrv2e_decompress_8(const unsigned char *src, unsigned char *dst,
+ unsigned long *dst_len) */
+
+.text
+.global ucl_nrv2e_decompress_8
+
+
+/* Vectors */
+ ldr pc, =start
+.word 0
+.word 0
+.word 0
+.word 0
+.word 0
+.word 0
+.word 0
+
+/* These values are filled in by mkamsboot - don't move them from offset 0x20 */
+ucl_unpack: .word 0 /* Entry point (plus 1 - for thumb) of ucl_unpack after copy*/
+ucl_start: .word 0 /* Start of the ucl-compressed OF image after copy */
+ucl_size: .word 0 /* Length in bytes of the compressed OF image */
+copy_start: .word 0 /* Start of the copy of the ucl_unpack function */
+copy_size: .word 0 /* uclunpack_size + ucl_paddedsize */
+
+start:
+ /* A delay loop - just to prove we're running */
+ mov r1, #0x500000 /* Approximately 5 seconds */
+loop: subs r1, r1, #1
+ bne loop
+
+ /* First copy the compressed firmware to unused RAM */
+
+ ldr r0, copy_start /* Source */
+ ldr r1, copy_size /* Source length */
+
+ mov r2, #0x40000 /* Destination end */
+ sub r2, r2, r1
+
+memcpy:
+ ldrb r3, [r0], #1
+ strb r3, [r2], #1
+ cmp r2, #0x40000 /* Stop when we reached dest_end */
+ bne memcpy
+
+ /* Call the ucl decompress function, which will branch to 0x0 */
+ /* on completion */
+
+ ldr r0, ucl_start /* Address of compressed image */
+ ldr r1, ucl_size /* Compressed size */
+ mov r2, #0 /* Destination */
+
+ ldr r3, ucl_unpack
+ bx r3
+
+ /* never reached */