Revision 65ad9c7449205552ce1477f495b0c2281b19f447 authored by danne on 10 January 2017, 07:55:06 UTC, committed by danne on 10 January 2017, 07:55:06 UTC
2 parent s 01e8bb7 + c8ed1b9
Raw File
footer.c
/* this magic is a BX R3 */
#define FOOTER_MAGIC 0xE12FFF13
#define STR(x) STRx(x)
#define STRx(x) #x

asm(
    /* footer is read by first instructions to check if autoexec.bin was loaded correctly 
       .data is selected after .text by the default linker script, so this will go to the
       end of the file, being a usable footer.
    */
    ".section .data\n"
    
    ".align 5, 0xCE\n"

    /* fill up so there are only two words left */
    ".word   0xCEEEEEEC\n"
    ".word   0xCEEEEEEC\n"
    ".word   0xCEEEEEEC\n"
    ".word   0xCEEEEEEC\n"
    ".word   0xCEEEEEEC\n"
    ".word   0xCEEEEEEC\n"
    
    ".globl autoexec_bin_footer\n"
    "autoexec_bin_footer:\n"
    ".word   "STR(FOOTER_MAGIC)"\n"
    "autoexec_bin_checksum:\n"
    ".word   0xCCCCCCCC\n"
    ".globl autoexec_bin_checksum_end\n"
    "autoexec_bin_checksum_end:\n"
);
back to top