From 02dc7f4f76e4f6c2cb31207b14f261fec49f98ce Mon Sep 17 00:00:00 2001 From: Nathaniel Graff Date: Wed, 3 Apr 2019 12:50:13 -0700 Subject: Update BSPs for Unleashed and U54(MC) Signed-off-by: Nathaniel Graff --- bsp/coreip-e20-arty/metal.default.lds | 2 +- bsp/coreip-e20-arty/metal.h | 67 ++++++++++++++++++++++++-------- bsp/coreip-e20-arty/metal.ramrodata.lds | 2 +- bsp/coreip-e20-arty/metal.scratchpad.lds | 1 + 4 files changed, 54 insertions(+), 18 deletions(-) (limited to 'bsp/coreip-e20-arty') diff --git a/bsp/coreip-e20-arty/metal.default.lds b/bsp/coreip-e20-arty/metal.default.lds index 46e2407..7b20841 100644 --- a/bsp/coreip-e20-arty/metal.default.lds +++ b/bsp/coreip-e20-arty/metal.default.lds @@ -20,6 +20,7 @@ PHDRS SECTIONS { __stack_size = DEFINED(__stack_size) ? __stack_size : 0x400; + PROVIDE(__stack_size = __stack_size); __heap_size = DEFINED(__heap_size) ? __heap_size : 0x400; @@ -217,7 +218,6 @@ SECTIONS { PROVIDE( metal_segment_heap_target_start = . ); . = __heap_size; - . = __heap_size == 0 ? 0 : ORIGIN(ram) + LENGTH(ram); PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); } >ram AT>ram :ram diff --git a/bsp/coreip-e20-arty/metal.h b/bsp/coreip-e20-arty/metal.h index 36ddab0..8528cc9 100644 --- a/bsp/coreip-e20-arty/metal.h +++ b/bsp/coreip-e20-arty/metal.h @@ -5,9 +5,15 @@ #ifdef __METAL_MACHINE_MACROS +#ifndef __METAL_CLINT_NUM_PARENTS +#define __METAL_CLINT_NUM_PARENTS 0 +#endif #ifndef __METAL_PLIC_SUBINTERRUPTS #define __METAL_PLIC_SUBINTERRUPTS 0 #endif +#ifndef __METAL_PLIC_NUM_PARENTS +#define __METAL_PLIC_NUM_PARENTS 0 +#endif #define __METAL_CLIC_SUBINTERRUPTS 58 #ifndef __METAL_CLIC_SUBINTERRUPTS @@ -18,9 +24,13 @@ #define METAL_MAX_CLINT_INTERRUPTS 0 +#define __METAL_CLINT_NUM_PARENTS 0 + #define __METAL_PLIC_SUBINTERRUPTS 0 #define METAL_MAX_PLIC_INTERRUPTS 0 +#define __METAL_PLIC_NUM_PARENTS 0 + #define __METAL_INTERRUPT_CONTROLLER_2000000_INTERRUPTS 3 #define __METAL_CLIC_SUBINTERRUPTS 58 @@ -45,6 +55,7 @@ #include +#include #include #include #include @@ -62,13 +73,18 @@ asm (".weak __metal_dt_clock_0"); struct __metal_driver_fixed_clock __metal_dt_clock_0; +asm (".weak __metal_dt_mem_sys_sram_0_80000000"); +struct metal_memory __metal_dt_mem_sys_sram_0_80000000; + +asm (".weak __metal_dt_mem_spi_20004000"); +struct metal_memory __metal_dt_mem_spi_20004000; + /* From cpu@0 */ asm (".weak __metal_dt_cpu_0"); struct __metal_driver_cpu __metal_dt_cpu_0; -/* From interrupt_controller */ -asm (".weak __metal_dt_interrupt_controller"); -struct __metal_driver_riscv_cpu_intc __metal_dt_interrupt_controller; +asm (".weak __metal_dt_cpu_0_interrupt_controller"); +struct __metal_driver_riscv_cpu_intc __metal_dt_cpu_0_interrupt_controller; /* From interrupt_controller@2000000 */ asm (".weak __metal_dt_interrupt_controller_2000000"); @@ -150,16 +166,38 @@ struct __metal_driver_fixed_clock __metal_dt_clock_0 = { .rate = 32500000UL, }; +struct metal_memory __metal_dt_mem_sys_sram_0_80000000 = { + ._base_address = 2147483648UL, + ._size = 65536UL, + ._attrs = { + .R = 1, + .W = 1, + .X = 1, + .C = 1, + .A = 1}, +}; + +struct metal_memory __metal_dt_mem_spi_20004000 = { + ._base_address = 1073741824UL, + ._size = 536870912UL, + ._attrs = { + .R = 1, + .W = 1, + .X = 1, + .C = 1, + .A = 1}, +}; + /* From cpu@0 */ struct __metal_driver_cpu __metal_dt_cpu_0 = { .vtable = &__metal_driver_vtable_cpu, .cpu.vtable = &__metal_driver_vtable_cpu.cpu_vtable, .timebase = 32000000UL, - .interrupt_controller = &__metal_dt_interrupt_controller.controller, + .interrupt_controller = &__metal_dt_cpu_0_interrupt_controller.controller, }; /* From interrupt_controller */ -struct __metal_driver_riscv_cpu_intc __metal_dt_interrupt_controller = { +struct __metal_driver_riscv_cpu_intc __metal_dt_cpu_0_interrupt_controller = { .vtable = &__metal_driver_vtable_riscv_cpu_intc, .controller.vtable = &__metal_driver_vtable_riscv_cpu_intc.controller_vtable, .init_done = 0, @@ -174,7 +212,7 @@ struct __metal_driver_sifive_clic0 __metal_dt_interrupt_controller_2000000 = { .control_size = 16777216UL, .init_done = 0, .num_interrupts = METAL_MAX_CLIC_INTERRUPTS, - .interrupt_parent = &__metal_dt_interrupt_controller.controller, + .interrupt_parent = &__metal_dt_cpu_0_interrupt_controller.controller, .interrupt_lines[0] = 3, .interrupt_lines[1] = 7, .interrupt_lines[2] = 11, @@ -431,6 +469,13 @@ struct __metal_driver_sifive_uart0 __metal_dt_serial_20000000 = { }; +#define __METAL_DT_MAX_MEMORIES 2 + +asm (".weak __metal_memory_table"); +struct metal_memory *__metal_memory_table[] = { + &__metal_dt_mem_sys_sram_0_80000000, + &__metal_dt_mem_spi_20004000}; + /* From serial@20000000 */ #define __METAL_DT_STDOUT_UART_HANDLE (&__metal_dt_serial_20000000.uart) @@ -438,22 +483,12 @@ struct __metal_driver_sifive_uart0 __metal_dt_serial_20000000 = { #define __METAL_DT_STDOUT_UART_BAUD 115200 -/* From cpu@0 */ -#define __METAL_DT_RISCV_CPU_HANDLE (&__metal_dt_cpu_0.cpu) - -#define __METAL_DT_CPU_0_HANDLE (&__metal_dt_cpu_0.cpu) - #define __METAL_DT_MAX_HARTS 1 asm (".weak __metal_cpu_table"); struct __metal_driver_cpu *__metal_cpu_table[] = { &__metal_dt_cpu_0}; -/* From interrupt_controller */ -#define __METAL_DT_RISCV_CPU_INTC_HANDLE (&__metal_dt_interrupt_controller.controller) - -#define __METAL_DT_INTERRUPT_CONTROLLER_HANDLE (&__metal_dt_interrupt_controller.controller) - /* From interrupt_controller@2000000 */ #define __METAL_DT_SIFIVE_CLIC0_HANDLE (&__metal_dt_interrupt_controller_2000000.controller) diff --git a/bsp/coreip-e20-arty/metal.ramrodata.lds b/bsp/coreip-e20-arty/metal.ramrodata.lds index bb8171e..5fc1e00 100644 --- a/bsp/coreip-e20-arty/metal.ramrodata.lds +++ b/bsp/coreip-e20-arty/metal.ramrodata.lds @@ -20,6 +20,7 @@ PHDRS SECTIONS { __stack_size = DEFINED(__stack_size) ? __stack_size : 0x400; + PROVIDE(__stack_size = __stack_size); __heap_size = DEFINED(__heap_size) ? __heap_size : 0x400; @@ -214,7 +215,6 @@ SECTIONS { PROVIDE( metal_segment_heap_target_start = . ); . = __heap_size; - . = __heap_size == 0 ? 0 : ORIGIN(ram) + LENGTH(ram); PROVIDE( metal_segment_heap_target_end = . ); PROVIDE( _heap_end = . ); } >ram AT>ram :ram diff --git a/bsp/coreip-e20-arty/metal.scratchpad.lds b/bsp/coreip-e20-arty/metal.scratchpad.lds index 9b63e9b..4aa5569 100644 --- a/bsp/coreip-e20-arty/metal.scratchpad.lds +++ b/bsp/coreip-e20-arty/metal.scratchpad.lds @@ -20,6 +20,7 @@ PHDRS SECTIONS { __stack_size = DEFINED(__stack_size) ? __stack_size : 0x400; + PROVIDE(__stack_size = __stack_size); __heap_size = DEFINED(__heap_size) ? __heap_size : 0x400; -- cgit v1.2.3