Skip to content

Commit b5f7dce

Browse files
committed
Remember to enable the FPU
1 parent 63d6686 commit b5f7dce

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

ref_app/src/mcal/r7fa4m1ab/mcal_cpu.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
//
77

88
#include <mcal_cpu.h>
9-
#include <mcal_gpt.h>
109
#include <mcal_osc.h>
1110
#include <mcal_port.h>
11+
#include <mcal_reg.h>
1212
#include <mcal_wdg.h>
1313

1414
auto mcal::cpu::post_init() noexcept -> void
@@ -17,6 +17,12 @@ auto mcal::cpu::post_init() noexcept -> void
1717

1818
auto mcal::cpu::init() -> void
1919
{
20+
// Initialize the fpu: Enable cp10 and cp11.
21+
mcal::reg::reg_access_static<std::uint32_t,
22+
std::uint32_t,
23+
mcal::reg::scb_cpacr,
24+
static_cast<std::uint32_t>(UINT32_C(0x00F00000))>::reg_or();
25+
2026
mcal::wdg::init(nullptr);
2127
mcal::port::init(nullptr);
2228
mcal::osc::init(nullptr);

ref_app/src/mcal/r7fa4m1ab/mcal_reg.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,22 @@
1414
{
1515
namespace reg
1616
{
17-
// Register bases.
17+
// Global base addresses.
18+
constexpr std::uint32_t scs_base { UINT32_C(0xE000E000) };
19+
20+
// Individual unit base addresses.
21+
constexpr std::uint32_t scb_base { scs_base + UINT32_C(0x00000D00) };
1822
constexpr std::uint32_t system_base { UINT32_C(0x4001E000) };
1923
constexpr std::uint32_t unknown_hococr2 { UINT32_C(0x4001E037) };
2024
constexpr std::uint32_t pfs_base { UINT32_C(0x40040800) };
2125
constexpr std::uint32_t pmisc_base { UINT32_C(0x40040D00) };
2226

23-
// System registers.
27+
// Core system registers.
28+
constexpr std::uint32_t scb_cpacr { scb_base + UINT32_C(0x00000088) };
29+
30+
static_assert(scb_cpacr == UINT32_C(0xE000ED88), "Error: wrong scb_cpacr register address)");
31+
32+
// System (system struct) registers.
2433
constexpr std::uint32_t system_sckdivcr { system_base + UINT32_C(0x00000020) };
2534
constexpr std::uint32_t system_sckscr { system_base + UINT32_C(0x00000026) };
2635
constexpr std::uint32_t system_memwait { system_base + UINT32_C(0x00000031) };

0 commit comments

Comments
 (0)