From 1c14a9005346a5d74eb039f64b12427ab901c2d1 Mon Sep 17 00:00:00 2001 From: mwachs5 Date: Wed, 11 Jan 2017 12:30:45 -0800 Subject: Add the 'bootloader' which ships on HiFive1 Boards. --- bsp/env/freedom-e300-hifive1/init.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'bsp/env') diff --git a/bsp/env/freedom-e300-hifive1/init.c b/bsp/env/freedom-e300-hifive1/init.c index 71e1659..fff1f2e 100644 --- a/bsp/env/freedom-e300-hifive1/init.c +++ b/bsp/env/freedom-e300-hifive1/init.c @@ -215,6 +215,10 @@ uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc) } +#ifdef NO_INIT +void _init() { +} +#else void _init() { use_default_clocks(); @@ -229,6 +233,7 @@ void _init() write_csr(fcsr, 0); // initialize rounding mode, undefined at reset } } +#endif void _fini() { -- cgit v1.2.3 From c7f7bec992d3d6787cf001892a24d0660ce192b1 Mon Sep 17 00:00:00 2001 From: mwachs5 Date: Wed, 11 Jan 2017 14:25:45 -0800 Subject: reduce code duplication and apply the same flags to Arty board --- bsp/env/freedom-e300-arty/init.c | 3 ++- bsp/env/freedom-e300-hifive1/init.c | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'bsp/env') diff --git a/bsp/env/freedom-e300-arty/init.c b/bsp/env/freedom-e300-arty/init.c index 35b1104..a6f4b39 100644 --- a/bsp/env/freedom-e300-arty/init.c +++ b/bsp/env/freedom-e300-arty/init.c @@ -73,14 +73,15 @@ uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc) void _init() { + #ifndef NO_INIT uart_init(115200); printf("core freq at %d Hz\n", get_cpu_freq()); write_csr(mtvec, &trap_entry); + #endif } - void _fini() { } diff --git a/bsp/env/freedom-e300-hifive1/init.c b/bsp/env/freedom-e300-hifive1/init.c index fff1f2e..de046cc 100644 --- a/bsp/env/freedom-e300-hifive1/init.c +++ b/bsp/env/freedom-e300-hifive1/init.c @@ -214,13 +214,10 @@ uintptr_t handle_trap(uintptr_t mcause, uintptr_t epc) return epc; } - -#ifdef NO_INIT -void _init() { -} -#else void _init() { + + #ifndef NO_INIT use_default_clocks(); use_pll(0, 0, 1, 31, 1); uart_init(115200); @@ -232,8 +229,9 @@ void _init() write_csr(mstatus, MSTATUS_FS); // allow FPU instructions without trapping write_csr(fcsr, 0); // initialize rounding mode, undefined at reset } + #endif + } -#endif void _fini() { -- cgit v1.2.3