os-workshop

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit e224e0782865150a3c5f8469a097524b57320022
parent 00dc2d4901bd114fd412e6b491b349a979719379
Author: Brian Swetland <swetland@frotz.net>
Date:   Sat, 14 May 2022 21:17:24 -0700

build: prep for kernel/user projects

- linker script adds __stack_top symbol pointing to top of ram
- start.S now uses that for stack initialization
- new linker scripts for kernel and user type programs

Diffstat:
Mhw/src/start.S | 2+-
Mmake/common.ram.ld | 3+++
Amake/kernel.ram.ld | 6++++++
Amake/user.ram.ld | 6++++++
4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/hw/src/start.S b/hw/src/start.S @@ -18,7 +18,7 @@ zero_loop: zero_done: /* setup initial stack */ - li sp, (DRAM_BASE + DRAM_SIZE) + la sp, __stack_top /* enter C code */ jal start diff --git a/make/common.ram.ld b/make/common.ram.ld @@ -45,4 +45,7 @@ SECTIONS { . = ALIGN(4); __bss_end = .; } > RAM + + /* initialize stack to top of memory */ + __stack_top = ORIGIN(RAM) + LENGTH(RAM); } diff --git a/make/kernel.ram.ld b/make/kernel.ram.ld @@ -0,0 +1,6 @@ + +MEMORY { + RAM (rwx) : ORIGIN = 0xC0008000, LENGTH = 0x400000 +} + +INCLUDE "make/common.ram.ld" diff --git a/make/user.ram.ld b/make/user.ram.ld @@ -0,0 +1,6 @@ + +MEMORY { + RAM (rwx) : ORIGIN = 0x10000000, LENGTH = 0x400000 +} + +INCLUDE "make/common.ram.ld"