diff options
author | Scott Johnson <scottj@sifive.com> | 2016-12-07 18:05:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-07 18:05:38 -0800 |
commit | 7011ca48a2ef9205184a03a854ba310ebcda0e40 (patch) | |
tree | 3264e0a12875a55a1d2458bb254faabbab2cc081 /bsp | |
parent | 9ad15e8896557e9526a12e868801ed5e7d320298 (diff) | |
parent | e0f235fc5344ccf79fa0e5bdd64591aef3814799 (diff) |
Merge pull request #17 from sifive/enable-fpu
Enable FPU in MSTATUS CSR during init
Diffstat (limited to 'bsp')
-rw-r--r-- | bsp/env/freedom-e300-hifive1/init.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/bsp/env/freedom-e300-hifive1/init.c b/bsp/env/freedom-e300-hifive1/init.c index d085f6c..343f071 100644 --- a/bsp/env/freedom-e300-hifive1/init.c +++ b/bsp/env/freedom-e300-hifive1/init.c @@ -182,6 +182,10 @@ void _init() printf("core freq at %d Hz\n", get_cpu_freq()); write_csr(mtvec, &handle_trap); + if (read_csr(misa) & (1 << ('F' - 'A'))) { // if F extension is present + write_csr(mstatus, MSTATUS_FS); // allow FPU instructions without trapping + write_csr(fcsr, 0); // initialize rounding mode, undefined at reset + } _exit(main(0, NULL)); } |