[arch][microblaze] change linker script to support having a different LMA for the vector table
The qemu target has 128KB of ram at 0 and the rest at 0x90000000. Split the binary so that the vector table lives at 0 and everything else in the high address.
This commit is contained in:
@@ -8,10 +8,14 @@ SECTIONS
|
||||
|
||||
_start = .;
|
||||
|
||||
/* vector table goes at 0, for qemu target, at least */
|
||||
.vectors : AT(0) {
|
||||
KEEP(*(.vectors))
|
||||
}
|
||||
|
||||
/* text/read-only data */
|
||||
/* set the load address to physical MEMBASE */
|
||||
.text : AT(%MEMBASE% + %KERNEL_LOAD_OFFSET%) {
|
||||
KEEP(*(.vectors))
|
||||
.text : AT(%MEMBASE% + %KERNEL_LOAD_OFFSET% + SIZEOF(.vectors)) {
|
||||
KEEP(*(.text.boot))
|
||||
*(.text* .gnu.linkonce.t.*)
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ ARCH_OPTFLAGS := -O2
|
||||
|
||||
GLOBAL_LDFLAGS += -relax
|
||||
|
||||
KERNEL_BASE ?= 0
|
||||
KERNEL_BASE ?= $(MEMBASE)
|
||||
KERNEL_LOAD_OFFSET ?= 0
|
||||
|
||||
# potentially generated files that should be cleaned out with clean make rule
|
||||
|
||||
@@ -22,26 +22,26 @@
|
||||
*/
|
||||
#include <asm.h>
|
||||
|
||||
.section ".vectors"
|
||||
.globl _start
|
||||
_start:
|
||||
.section ".vectors", "ax"
|
||||
.globl _vectab
|
||||
_vectab:
|
||||
/* vector table here */
|
||||
# start vector
|
||||
bri start
|
||||
brai start
|
||||
# user exception
|
||||
bri unhandled_exception
|
||||
brai unhandled_exception
|
||||
# interrupt
|
||||
bri microblaze_irq
|
||||
brai microblaze_irq
|
||||
# break
|
||||
bri unhandled_exception
|
||||
brai unhandled_exception
|
||||
# hardware exception
|
||||
bri unhandled_exception
|
||||
brai unhandled_exception
|
||||
|
||||
# reserved for future
|
||||
.fill (0x50 - 0x28)
|
||||
|
||||
.section ".text.boot"
|
||||
start:
|
||||
FUNCTION(start)
|
||||
# set the default stack
|
||||
addik r1, r0, default_stack_top
|
||||
|
||||
@@ -49,13 +49,15 @@ start:
|
||||
addik r2, r0, _SDATA2_START__
|
||||
addik r13, r0, _SDATA_START__
|
||||
|
||||
# TODO: make sure irqs are disabled and any other cpu specific setup
|
||||
# set the processor mode to default
|
||||
mts rmsr, r0
|
||||
|
||||
# zero out bss sections
|
||||
addik r5, r0, __bss_start
|
||||
addik r6, r0, 0
|
||||
brlid r15, memset
|
||||
rsubik r7, r5, __bss_end
|
||||
brlid r15, memset
|
||||
nop
|
||||
|
||||
# arguments to main
|
||||
addik r5, r0, 1
|
||||
@@ -67,7 +69,7 @@ start:
|
||||
# shouldn't be here
|
||||
bri .
|
||||
|
||||
unhandled_exception:
|
||||
FUNCTION(unhandled_exception)
|
||||
bri .
|
||||
|
||||
.bss
|
||||
|
||||
@@ -11,8 +11,8 @@ MODULE_SRCS += \
|
||||
$(LOCAL_DIR)/platform.c \
|
||||
$(LOCAL_DIR)/uartlite.c
|
||||
|
||||
MEMBASE := 0x0
|
||||
MEMSIZE := 0x08000000 # 128MB
|
||||
MEMBASE ?= 0x0
|
||||
MEMSIZE ?= 0x20000 # 128KB
|
||||
|
||||
MODULE_DEPS += \
|
||||
|
||||
|
||||
@@ -5,5 +5,8 @@ GLOBAL_INCLUDES += \
|
||||
|
||||
PLATFORM := microblaze
|
||||
|
||||
MEMBASE ?= 0x90000000
|
||||
MEMSIZE ?= 0x08000000
|
||||
|
||||
#include make/module.mk
|
||||
|
||||
|
||||
Reference in New Issue
Block a user