Skip to content

Commit

Permalink
ARM: define bootloader stack in linker script
Browse files Browse the repository at this point in the history
This removes the need for the whole HAIKU_BOARD_LOADER_STACK_BASE
sing and dance, since it is always included in the bootloader binary
itself.
  • Loading branch information
Ithamar committed Sep 7, 2014
1 parent 6fb65b9 commit 0a163b6
Show file tree
Hide file tree
Showing 9 changed files with 14 additions and 26 deletions.
3 changes: 0 additions & 3 deletions build/jam/board/beagle/BoardSetup
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ HAIKU_BOARD_LOADER_FAKE_OS = netbsd ;
# (must be different than real load address)
HAIKU_BOARD_LOADER_UIBASE = 0x82800000 ;

HAIKU_BOARD_LOADER_STACK_BASE = 0x81a00000 ;

#
# Flash image
#
Expand Down Expand Up @@ -64,7 +62,6 @@ HAIKU_BOARD_SDIMAGE_FILES =
# gcc flags for the specific cpu

local flags = -mcpu=cortex-a8 -mfpu=vfpv3 -mfloat-abi=hard
-DHAIKU_BOARD_LOADER_STACK_BASE=$(HAIKU_BOARD_LOADER_STACK_BASE)
-DHAIKU_BOARD_LOADER_UIBASE=$(HAIKU_BOARD_LOADER_UIBASE) ;

HAIKU_ASFLAGS_$(HAIKU_PACKAGING_ARCH) += $(flags) ;
Expand Down
2 changes: 0 additions & 2 deletions build/jam/board/neo_freerunner/BoardSetup
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ HAIKU_BOARD_LOADER_FAKE_OS = netbsd ;
# (must be different than real load address)
HAIKU_BOARD_LOADER_UIBASE = 0x34000000 ;

HAIKU_BOARD_LOADER_STACK_BASE = 0x34000000 ;

#
# Flash image
#
Expand Down
3 changes: 0 additions & 3 deletions build/jam/board/overo/BoardSetup
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ HAIKU_BOARD_LOADER_FAKE_OS = netbsd ;
# (must be different than real load address)
HAIKU_BOARD_LOADER_UIBASE = 0x84000000 ;

HAIKU_BOARD_LOADER_STACK_BASE = 0x84000000 ;


#
# mmc/SD image
#
Expand Down
2 changes: 0 additions & 2 deletions build/jam/board/sam460ex/BoardSetup
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ HAIKU_BOARD_LOADER_FAKE_OS = linux ;
# (must be different than real load address)
HAIKU_BOARD_LOADER_UIBASE = 0x02000000 ;

HAIKU_BOARD_LOADER_STACK_BASE = 0x02000000 ;

#
# gcc flags for the specific cpu
#
Expand Down
2 changes: 0 additions & 2 deletions build/jam/board/verdex/BoardSetup
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ HAIKU_BOARD_LOADER_FAKE_OS = netbsd ;
# (must be different than real load address)
HAIKU_BOARD_LOADER_UIBASE = 0xa4000000 ;

HAIKU_BOARD_LOADER_STACK_BASE = 0xa4000000 ;

#
# Flash image
#
Expand Down
6 changes: 0 additions & 6 deletions src/system/boot/arch/arm/arch_mmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ static struct memblock LOADER_MEMORYMAP[] = {
kLoaderBaseAddress + 0x11FFFFF,
ARM_MMU_L2_FLAG_C,
},
{
"RAM_stack", // stack
HAIKU_BOARD_LOADER_STACK_BASE,
HAIKU_BOARD_LOADER_STACK_BASE + 0xe00000,
ARM_MMU_L2_FLAG_C,
},
{
"RAM_initrd", // initrd
HAIKU_BOARD_LOADER_UIBASE,
Expand Down
8 changes: 2 additions & 6 deletions src/system/boot/platform/u-boot/arch/arm/shell.S
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include <asm_defs.h>

#include <board_config.h>

.text

/*
Expand Down Expand Up @@ -59,10 +57,7 @@ SYMBOL(_start_common):
mov r4, r4
mov r4, r4




ldr sp,=SDRAM_BASE + KSTACK_TOP
ldr sp,=__stack_top
ldrb r4,gUBootOS
cmp r4,#0
beq start_raw
Expand All @@ -75,6 +70,7 @@ SYMBOL_END(_start_common)
//XXX: doesn't seem to work
//.data

.global __stack_end, __stack_start

SYMBOL(gUBootGlobalData):
.long 0
Expand Down
4 changes: 2 additions & 2 deletions src/system/boot/platform/u-boot/start.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ typedef struct uboot_gd {
// GCC defined globals
extern void (*__ctor_list)(void);
extern void (*__ctor_end)(void);
extern uint8 __bss_start;
extern uint8 __bss_start, __bss_end;
extern uint8 _end;

extern "C" int main(stage2_args *args);
Expand All @@ -72,7 +72,7 @@ static uint32 sBootOptions;
static void
clear_bss(void)
{
memset(&__bss_start, 0, &_end - &__bss_start);
memset(&__bss_start, 0, &__bss_end - &__bss_start);
}


Expand Down
10 changes: 10 additions & 0 deletions src/system/ldscripts/arm/boot_loader_u-boot.ld
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
OUTPUT_ARCH(arm)

STACK_SIZE = 16384;

ENTRY(_start)
SECTIONS
{
Expand Down Expand Up @@ -29,6 +31,14 @@ SECTIONS
/* uninitialized data (in same segment as writable data) */
__bss_start = .;
.bss : { *(.bss) }
__bss_end = .;

.stack : {
__stack_start = .;
. += STACK_SIZE;
. = ALIGN(0x8);
__stack_top = .;
}

. = ALIGN(0x1000);
_end = . ;
Expand Down

0 comments on commit 0a163b6

Please sign in to comment.