Skip to content

Commit 30c14f1

Browse files
authored
Merge pull request #718 from ckormanyos/more_r4_minima
More r4 minima
2 parents 63d6686 + 90973e2 commit 30c14f1

File tree

6 files changed

+99
-4
lines changed

6 files changed

+99
-4
lines changed

.github/workflows/real-time-cpp.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ jobs:
176176
strategy:
177177
fail-fast: false
178178
matrix:
179-
suite: [ am335x, bcm2835_raspi_b, lpc11c24, nxp_imxrt1062, rpi_pico_rp2040, rpi_pico2_rp2350, stm32f100, stm32f407, stm32f429, stm32f446, stm32h7a3, stm32l100c, stm32l152, stm32l432 ]
179+
suite: [ am335x, bcm2835_raspi_b, lpc11c24, nxp_imxrt1062, r7fa4m1ab, rpi_pico_rp2040, rpi_pico2_rp2350, stm32f100, stm32f407, stm32f429, stm32f446, stm32h7a3, stm32l100c, stm32l152, stm32l432 ]
180180
steps:
181181
- uses: actions/checkout@v4
182182
with:

ref_app/cmake/r7fa4m1ab.cmake

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
##############################################################################
2+
# Copyright Christopher Kormanyos 2021 - 2026.
3+
# Distributed under the Boost Software License,
4+
# Version 1.0. (See accompanying file LICENSE_1_0.txt
5+
# or copy at http://www.boost.org/LICENSE_1_0.txt)
6+
7+
#
8+
# MIT License
9+
#
10+
# Copyright (c) 2019 Joel Winarske
11+
#
12+
# Permission is hereby granted, free of charge, to any person obtaining a copy
13+
# of this software and associated documentation files (the "Software"), to deal
14+
# in the Software without restriction, including without limitation the rights
15+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16+
# copies of the Software, and to permit persons to whom the Software is
17+
# furnished to do so, subject to the following conditions:
18+
#
19+
# The above copyright notice and this permission notice shall be included in all
20+
# copies or substantial portions of the Software.
21+
#
22+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28+
# SOFTWARE.
29+
#
30+
31+
set(APP ref_app)
32+
33+
set(CMAKE_EXECUTABLE_SUFFIX .elf)
34+
35+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
36+
set(CMAKE_CXX_STANDARD 14)
37+
38+
set(TARGET_INCLUDES
39+
${PATH_APP}/util/STL
40+
)
41+
42+
set(_TARGET_CFLAGS
43+
-finline-functions
44+
-finline-limit=32
45+
-mcpu=cortex-m4
46+
-mtune=cortex-m4
47+
-mthumb
48+
-mfloat-abi=hard
49+
-mfpu=fpv4-sp-d16
50+
-ffast-math
51+
-mno-unaligned-access
52+
-mno-long-calls
53+
)
54+
55+
set(TARGET_AFLAGS "")
56+
57+
set(_TARGET_LDFLAGS
58+
-nostdlib
59+
-nostartfiles
60+
-T ${LINKER_DEFINITION_FILE}
61+
)
62+
63+
string(REPLACE ";" " " TARGET_CFLAGS "${_TARGET_CFLAGS}")
64+
string(REPLACE ";" " " TARGET_LDFLAGS "${_TARGET_LDFLAGS}")
65+
66+
67+
set(FILES_TARGET
68+
${PATH_APP}/mcal/mcal_gcc_cxx_completion
69+
${PATH_TGT}/startup/crt0
70+
${PATH_TGT}/startup/crt0_init_ram
71+
${PATH_TGT}/startup/crt1
72+
${PATH_TGT}/startup/int_vect
73+
)

ref_app/ref_app.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3486,6 +3486,10 @@
34863486
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
34873487
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
34883488
</None>
3489+
<None Include="cmake\r7fa4m1ab.cmake">
3490+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
3491+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
3492+
</None>
34893493
<None Include="cmake\riscvfe310.cmake">
34903494
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
34913495
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>

ref_app/ref_app.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3353,6 +3353,9 @@
33533353
<None Include="tools\Util\msys64\usr\local\llvm-17.0.2-riscv32\COPYING">
33543354
<Filter>tools\Util\msys64\usr\local\llvm-17.0.2-riscv32</Filter>
33553355
</None>
3356+
<None Include="cmake\r7fa4m1ab.cmake">
3357+
<Filter>src\cmake</Filter>
3358+
</None>
33563359
</ItemGroup>
33573360
<ItemGroup>
33583361
<Text Include="CMakeLists.txt" />

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)