From b916e51292133e9f55a335af1e3344bc62c504f6 Mon Sep 17 00:00:00 2001 From: DizzyOfCRN Date: Tue, 28 Oct 2014 09:57:39 +0000 Subject: [PATCH] BROM loads 4K of boot0 code (=bootstrap) make sure the first level bootcode fits inside. bootstrap code never returns and is inside boot0 section, make sure text section is behind boot0. Make also a map file and assembler output file. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@49730 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- arch/arm-sun4i/bootstrap/bootstrap.c | 9 ++++++++- arch/arm-sun4i/bootstrap/ldscript.lds | 28 ++++++++++++++++++++++++++++ arch/arm-sun4i/bootstrap/mmakefile.src | 3 ++- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 arch/arm-sun4i/bootstrap/ldscript.lds diff --git a/arch/arm-sun4i/bootstrap/bootstrap.c b/arch/arm-sun4i/bootstrap/bootstrap.c index 99a867892e..826f8be489 100644 --- a/arch/arm-sun4i/bootstrap/bootstrap.c +++ b/arch/arm-sun4i/bootstrap/bootstrap.c @@ -6,6 +6,13 @@ Lang: english */ -void bootstrap(void) { +#define asmdelay(t) asm volatile("mov r0, %[value]\n1: sub r0, #1\nbne 1b\n"::[value] "i" (t) : "r0", "cc"); + +void __attribute__((noreturn, section(".bootstrap"))) bootstrap(void) { + + asmdelay(200); + asmdelay(200); + while(1); } + diff --git a/arch/arm-sun4i/bootstrap/ldscript.lds b/arch/arm-sun4i/bootstrap/ldscript.lds new file mode 100644 index 0000000000..f3d041f98f --- /dev/null +++ b/arch/arm-sun4i/bootstrap/ldscript.lds @@ -0,0 +1,28 @@ +MEMORY { + boot0 (rwx) : org = 0x00000000 , l = 4K + invalid (rwx) : org = 0xdead0000 , l = 0x0 +} + +SECTIONS +{ + .boot0 : { + *(.bootstrap) + } >boot0 + + .text : { *(.text*) } + + /* This should cause angry complaints if .data exists + * We don't want .bss, and we don't need it. + */ + .bss : { + *(.bss) + } >invalid + + /* This should cause angry complaints if .data exists + * We don't want .data, and we don't need it. + */ + .data : { + *(.data) + } >invalid + +} diff --git a/arch/arm-sun4i/bootstrap/mmakefile.src b/arch/arm-sun4i/bootstrap/mmakefile.src index b43f60374b..3d48dc94ca 100644 --- a/arch/arm-sun4i/bootstrap/mmakefile.src +++ b/arch/arm-sun4i/bootstrap/mmakefile.src @@ -8,7 +8,8 @@ FILES := bootstrap #MM sun4i-bootstrap-img: $(foreach f, $(FILES), $(TARGETDIR)/$(f).o $(TARGETDIR)/$(f).d) - $(KERNEL_LD) -s --entry=bootstrap $(foreach f, $(FILES), $(TARGETDIR)/$(f).o) -o $(TARGETDIR)/sun4i-bootstrap-img + $(KERNEL_LD) -s --entry=bootstrap --script=$(SRCDIR)/$(CURDIR)/ldscript.lds -Map $(TARGETDIR)/sun4i-bootstrap-img.map $(foreach f, $(FILES), $(TARGETDIR)/$(f).o) -L$(AROS_LIB) -o $(TARGETDIR)/sun4i-bootstrap-img + $(OBJDUMP) -D $(TARGETDIR)/sun4i-bootstrap-img >>$(TARGETDIR)/sun4i-bootstrap-img.asm $(TARGET_OBJCOPY) -O binary $(TARGETDIR)/sun4i-bootstrap-img $(MKSUNXIBOOT) $(TARGETDIR)/sun4i-bootstrap-img $(AROSDIR)/sun4i-bootstrap-img -- 2.11.4.GIT