Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/real-time-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ jobs:
strategy:
fail-fast: false
matrix:
suite: [ am335x, bcm2835_raspi_b, lpc11c24, nxp_imxrt1062, rpi_pico_rp2040, rpi_pico2_rp2350, stm32f100, stm32f407, stm32f429, stm32f446, stm32h7a3, stm32l100c, stm32l152, stm32l432 ]
suite: [ am335x, bcm2835_raspi_b, lpc11c24, nxp_imxrt1062, r7fa4m1ab, rpi_pico_rp2040, rpi_pico2_rp2350, stm32f100, stm32f407, stm32f429, stm32f446, stm32h7a3, stm32l100c, stm32l152, stm32l432 ]
steps:
- uses: actions/checkout@v4
with:
Expand Down
73 changes: 73 additions & 0 deletions ref_app/cmake/r7fa4m1ab.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
##############################################################################
# Copyright Christopher Kormanyos 2021 - 2026.
# Distributed under the Boost Software License,
# Version 1.0. (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)

#
# MIT License
#
# Copyright (c) 2019 Joel Winarske
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#

set(APP ref_app)

set(CMAKE_EXECUTABLE_SUFFIX .elf)

set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)

set(TARGET_INCLUDES
${PATH_APP}/util/STL
)

set(_TARGET_CFLAGS
-finline-functions
-finline-limit=32
-mcpu=cortex-m4
-mtune=cortex-m4
-mthumb
-mfloat-abi=hard
-mfpu=fpv4-sp-d16
-ffast-math
-mno-unaligned-access
-mno-long-calls
)

set(TARGET_AFLAGS "")

set(_TARGET_LDFLAGS
-nostdlib
-nostartfiles
-T ${LINKER_DEFINITION_FILE}
)

string(REPLACE ";" " " TARGET_CFLAGS "${_TARGET_CFLAGS}")
string(REPLACE ";" " " TARGET_LDFLAGS "${_TARGET_LDFLAGS}")


set(FILES_TARGET
${PATH_APP}/mcal/mcal_gcc_cxx_completion
${PATH_TGT}/startup/crt0
${PATH_TGT}/startup/crt0_init_ram
${PATH_TGT}/startup/crt1
${PATH_TGT}/startup/int_vect
)
4 changes: 4 additions & 0 deletions ref_app/ref_app.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3486,6 +3486,10 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="cmake\r7fa4m1ab.cmake">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</None>
<None Include="cmake\riscvfe310.cmake">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
Expand Down
3 changes: 3 additions & 0 deletions ref_app/ref_app.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -3353,6 +3353,9 @@
<None Include="tools\Util\msys64\usr\local\llvm-17.0.2-riscv32\COPYING">
<Filter>tools\Util\msys64\usr\local\llvm-17.0.2-riscv32</Filter>
</None>
<None Include="cmake\r7fa4m1ab.cmake">
<Filter>src\cmake</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Text Include="CMakeLists.txt" />
Expand Down
8 changes: 7 additions & 1 deletion ref_app/src/mcal/r7fa4m1ab/mcal_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
//

#include <mcal_cpu.h>
#include <mcal_gpt.h>
#include <mcal_osc.h>
#include <mcal_port.h>
#include <mcal_reg.h>
#include <mcal_wdg.h>

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

auto mcal::cpu::init() -> void
{
// Initialize the fpu: Enable cp10 and cp11.
mcal::reg::reg_access_static<std::uint32_t,
std::uint32_t,
mcal::reg::scb_cpacr,
static_cast<std::uint32_t>(UINT32_C(0x00F00000))>::reg_or();

mcal::wdg::init(nullptr);
mcal::port::init(nullptr);
mcal::osc::init(nullptr);
Expand Down
13 changes: 11 additions & 2 deletions ref_app/src/mcal/r7fa4m1ab/mcal_reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,22 @@
{
namespace reg
{
// Register bases.
// Global base addresses.
constexpr std::uint32_t scs_base { UINT32_C(0xE000E000) };

// Individual unit base addresses.
constexpr std::uint32_t scb_base { scs_base + UINT32_C(0x00000D00) };
constexpr std::uint32_t system_base { UINT32_C(0x4001E000) };
constexpr std::uint32_t unknown_hococr2 { UINT32_C(0x4001E037) };
constexpr std::uint32_t pfs_base { UINT32_C(0x40040800) };
constexpr std::uint32_t pmisc_base { UINT32_C(0x40040D00) };

// System registers.
// Core system registers.
constexpr std::uint32_t scb_cpacr { scb_base + UINT32_C(0x00000088) };

static_assert(scb_cpacr == UINT32_C(0xE000ED88), "Error: wrong scb_cpacr register address)");

// System (system struct) registers.
constexpr std::uint32_t system_sckdivcr { system_base + UINT32_C(0x00000020) };
constexpr std::uint32_t system_sckscr { system_base + UINT32_C(0x00000026) };
constexpr std::uint32_t system_memwait { system_base + UINT32_C(0x00000031) };
Expand Down
Loading