From ca12478df64aaae9e6a79ba0079ed02bb860a601 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Thu, 3 Mar 2022 19:17:00 +0000 Subject: 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 --- firmware/target/mips/ingenic_x1000/crt0.S | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 -- cgit v1.2.3