summaryrefslogtreecommitdiffstats
path: root/firmware/target/mips/ingenic_x1000/crt0.S
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-03-03 19:17:00 +0000
committerAidan MacDonald <amachronic@protonmail.com>2022-03-06 23:22:49 +0000
commitca12478df64aaae9e6a79ba0079ed02bb860a601 (patch)
tree6f3b0857f3be6b27f5c168462eedd303b934af5e /firmware/target/mips/ingenic_x1000/crt0.S
parent19d95d7b56aa8a6a3a7cdcd2ee80161de9598225 (diff)
downloadrockbox-ca12478df64aaae9e6a79ba0079ed02bb860a601.tar.gz
rockbox-ca12478df64aaae9e6a79ba0079ed02bb860a601.zip
x1000: add simple binary header to declare the load address
The header format is basic, a variable length list of values tagged by 4-byte strings. The main application to to allow a loader to determine the load address of the binary at runtime instead of using a hardcoded address. But the header contents aren't fixed and it could be extended for other purposes too. Change-Id: If51d85b4c2eb53c919a91b54985b157e8e5c20ef
Diffstat (limited to 'firmware/target/mips/ingenic_x1000/crt0.S')
-rw-r--r--firmware/target/mips/ingenic_x1000/crt0.S14
1 files changed, 14 insertions, 0 deletions
diff --git a/firmware/target/mips/ingenic_x1000/crt0.S b/firmware/target/mips/ingenic_x1000/crt0.S
index 304f8d682f..47c3c4f964 100644
--- a/firmware/target/mips/ingenic_x1000/crt0.S
+++ b/firmware/target/mips/ingenic_x1000/crt0.S
@@ -25,6 +25,7 @@
.text
.extern main
.extern system_early_init
+ .extern _loadaddress
.global _start
.set push
@@ -35,6 +36,19 @@
.section .init.text
_start:
+ b _realstart
+ nop
+
+ /* Header entries are 4-byte string labels (not null terminated!) followed
+ * by 4-byte values. Header should begin in the first 128 bytes and should
+ * be no more than 256 bytes in length. */
+_header:
+ .ascii "BEGINHDR" /* beginning of header */
+ .ascii "LOAD"
+ .word _loadaddress
+ .ascii "ENDH" /* end of header structure */
+
+_realstart:
/* Cache init */
li v0, 0x80000000
ori v1, v0, 0x4000