bsp: fomu: update

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2019-10-14 11:30:05 +08:00
parent 470d827f13
commit ef07427e06
3 changed files with 98 additions and 54 deletions

View File

@ -116,9 +116,11 @@ int board_uart_read(uint8_t* buf, int len)
int board_uart_write(void const * buf, int len) int board_uart_write(void const * buf, int len)
{ {
(void) buf; int32_t offset = 0;
(void) len; for (offset = 0; offset < len; offset++)
return 0; if (! (messible_status_read() & CSR_MESSIBLE_STATUS_FULL_OFFSET))
messible_in_write(((uint8_t *)buf)[offset]);
return len;
} }
#if CFG_TUSB_OS == OPT_OS_NONE #if CFG_TUSB_OS == OPT_OS_NONE

View File

@ -57,13 +57,13 @@ trap_entry:
crt_init: crt_init:
la sp, _fstack + 4 la sp, _estack - 4
la a0, trap_entry la a0, trap_entry
csrw mtvec, a0 csrw mtvec, a0
bss_init: bss_init:
la a0, _fbss la a0, _sbss
la a1, _ebss la a1, _ebss + 4
bss_loop: bss_loop:
beq a0,a1,bss_done beq a0,a1,bss_done
sw zero,0(a0) sw zero,0(a0)
@ -72,13 +72,13 @@ bss_loop:
bss_done: bss_done:
/* Load DATA */ /* Load DATA */
la t0, _erodata la t0, _etext
la t1, _fdata la t1, _srelocate
la t2, _edata la t2, _erelocate + 4
3: 3:
lw t3, 0(t0) lw t3, 0(t0)
sw t3, 0(t1) sw t3, 0(t1)
/* _edata is aligned to 16 bytes. Use word-xfers. */ /* _edata is aligned to 4 bytes. Use word-xfers. */
addi t0, t0, 4 addi t0, t0, 4
addi t1, t1, 4 addi t1, t1, 4
bltu t1, t2, 3b bltu t1, t2, 3b

View File

@ -6,57 +6,99 @@ __DYNAMIC = 0;
MEMORY { MEMORY {
csr : ORIGIN = 0x60000000, LENGTH = 0x01000000 csr : ORIGIN = 0x60000000, LENGTH = 0x01000000
vexriscv_debug : ORIGIN = 0xf00f0000, LENGTH = 0x00000100 vexriscv_debug : ORIGIN = 0xf00f0000, LENGTH = 0x00000100
sram : ORIGIN = 0x10000000, LENGTH = 0x00020000 ram : ORIGIN = 0x10000000, LENGTH = 0x00020000
rom : ORIGIN = 0x2001a000, LENGTH = 0x00200000 - 0x1a000 rom : ORIGIN = 0x2001a000, LENGTH = 0x00200000 - 0x1a000
} }
/* The stack size used by the application. NOTE: you need to adjust according to your application. */
STACK_SIZE = DEFINED(STACK_SIZE) ? STACK_SIZE : DEFINED(__stack_size__) ? __stack_size__ : 0x2000;
/* Section Definitions */
SECTIONS SECTIONS
{ {
.text : .text :
{ {
_ftext = .; . = ALIGN(4);
_ftext = .;
*(.text.start) *(.text.start)
*(.text .stub .text.* .gnu.linkonce.t.*) *(.text .text.* .gnu.linkonce.t.*)
_etext = .; *(.glue_7t) *(.glue_7)
} > rom *(.rodata .rodata* .gnu.linkonce.r.*)
.rodata : /* Support C constructors, and C destructors in both user code
{ and the C library. This also provides support for C++ code. */
. = ALIGN(4); . = ALIGN(4);
_frodata = .; KEEP(*(.init))
*(.rodata .rodata.* .gnu.linkonce.r.*) . = ALIGN(4);
*(.rodata1) __preinit_array_start = .;
*(.srodata) KEEP (*(.preinit_array))
. = ALIGN(4); __preinit_array_end = .;
_erodata = .;
} > rom
.data : AT (ADDR(.rodata) + SIZEOF (.rodata)) . = ALIGN(4);
{ __init_array_start = .;
. = ALIGN(4); KEEP (*(SORT(.init_array.*)))
_fdata = .; KEEP (*(.init_array))
*(.data .data.* .gnu.linkonce.d.*) __init_array_end = .;
*(.data1)
_gp = ALIGN(16);
*(.sdata .sdata.* .gnu.linkonce.s.* .sdata2 .sdata2.*)
. = ALIGN(16);
_edata = .; /* Make sure _edata is >= _gp. */
} > sram
.bss : . = ALIGN(4);
{ KEEP (*crtbegin.o(.ctors))
_fbss = .; KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
*(.dynsbss) KEEP (*(SORT(.ctors.*)))
*(.sbss .sbss.* .gnu.linkonce.sb.*) KEEP (*crtend.o(.ctors))
*(.scommon)
*(.dynbss)
*(.bss .bss.* .gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = .;
_end = .;
PROVIDE(end = .);
} > sram
}
PROVIDE(_fstack = ORIGIN(sram) + LENGTH(sram) - 4); . = ALIGN(4);
KEEP(*(.fini))
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
} > rom
. = ALIGN(4);
_etext = .; /* End of text section */
.relocate : AT (_etext)
{
. = ALIGN(4);
_srelocate = .;
*(.ramfunc .ramfunc.*);
*(.data .data.*);
. = ALIGN(4);
_erelocate = .;
} > ram
/* .bss section which is used for uninitialized data */
.bss (NOLOAD) :
{
. = ALIGN(4);
_sbss = . ;
_szero = .;
*(.bss .bss.*)
*(.sbss .sbss.*)
*(COMMON)
. = ALIGN(4);
_ebss = . ;
_ezero = .;
end = .;
} > ram
/* stack section */
.stack (NOLOAD):
{
. = ALIGN(8);
_sstack = .;
. = . + STACK_SIZE;
. = ALIGN(8);
_estack = .;
} > ram
. = ALIGN(4);
_end = . ;
}