Skip to content

Commit b3435d1

Browse files
committed
Get 1MHz tick working and LED classes
1 parent 6d88a81 commit b3435d1

22 files changed

Lines changed: 281 additions & 317 deletions

File tree

ref_app/ref_app.vcxproj

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,10 @@
261261
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
262262
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
263263
</ClCompile>
264+
<ClCompile Include="src\mcal\am6254_soc\mcal_gpt.cpp">
265+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
266+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
267+
</ClCompile>
264268
<ClCompile Include="src\mcal\atmega2560\mcal_cpu.cpp">
265269
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
266270
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@@ -1480,6 +1484,18 @@
14801484
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
14811485
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
14821486
</ClInclude>
1487+
<ClInclude Include="src\mcal\am6254_soc\mcal_cpu.h">
1488+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
1489+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
1490+
</ClInclude>
1491+
<ClInclude Include="src\mcal\am6254_soc\mcal_gpt.h">
1492+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
1493+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
1494+
</ClInclude>
1495+
<ClInclude Include="src\mcal\am6254_soc\mcal_wdg.h">
1496+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
1497+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
1498+
</ClInclude>
14831499
<ClInclude Include="src\mcal\atmega2560\mcal_benchmark.h">
14841500
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
14851501
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@@ -3430,7 +3446,6 @@
34303446
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
34313447
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
34323448
</Text>
3433-
<Text Include="src\mcal\am6254_soc\am6254_soc.txt" />
34343449
<Text Include="tools\Util\msys64\usr\bin\README.md" />
34353450
<Text Include="tools\Util\msys64\usr\local\gcc-13.2.0-x86_64-w64-mingw32\README_STL.txt" />
34363451
</ItemGroup>

ref_app/ref_app.vcxproj.filters

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,6 +1270,9 @@
12701270
<ClCompile Include="src\mcal\xtensa_esp32_s3_riscv_cop\mcal_eep.cpp">
12711271
<Filter>src\mcal\xtensa_esp32_s3_riscv_cop</Filter>
12721272
</ClCompile>
1273+
<ClCompile Include="src\mcal\am6254_soc\mcal_gpt.cpp">
1274+
<Filter>src\mcal\am6254_soc</Filter>
1275+
</ClCompile>
12731276
</ItemGroup>
12741277
<ItemGroup>
12751278
<ClInclude Include="src\math\calculus\derivative.h">
@@ -2874,6 +2877,15 @@
28742877
<ClInclude Include="src\mcal\xtensa_esp32_s3_riscv_cop\mcal_eep.h">
28752878
<Filter>src\mcal\xtensa_esp32_s3_riscv_cop</Filter>
28762879
</ClInclude>
2880+
<ClInclude Include="src\mcal\am6254_soc\mcal_gpt.h">
2881+
<Filter>src\mcal\am6254_soc</Filter>
2882+
</ClInclude>
2883+
<ClInclude Include="src\mcal\am6254_soc\mcal_wdg.h">
2884+
<Filter>src\mcal\am6254_soc</Filter>
2885+
</ClInclude>
2886+
<ClInclude Include="src\mcal\am6254_soc\mcal_cpu.h">
2887+
<Filter>src\mcal\am6254_soc</Filter>
2888+
</ClInclude>
28772889
</ItemGroup>
28782890
<ItemGroup>
28792891
<None Include="src\util\STL\algorithm">
@@ -3116,8 +3128,5 @@
31163128
<Text Include="tools\Util\msys64\usr\bin\README.md">
31173129
<Filter>tools\Util\msys64\usr\bin</Filter>
31183130
</Text>
3119-
<Text Include="src\mcal\am6254_soc\am6254_soc.txt">
3120-
<Filter>src\mcal\am6254_soc</Filter>
3121-
</Text>
31223131
</ItemGroup>
31233132
</Project>

ref_app/src/mcal/am6254_soc/am6254_soc.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
///////////////////////////////////////////////////////////////////////////////
2+
// Copyright Christopher Kormanyos 2007 - 2025.
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+
#ifndef MCAL_CPU_2009_02_14_H
9+
#define MCAL_CPU_2009_02_14_H
10+
11+
#include <cstdint>
12+
13+
namespace mcal
14+
{
15+
namespace cpu
16+
{
17+
void init();
18+
19+
inline auto post_init() -> void { }
20+
21+
inline auto nop() noexcept -> void { asm volatile("nop"); }
22+
}
23+
}
24+
25+
#endif // MCAL_CPU_2009_02_14_H
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <mcal_gpt.h>
2+
3+
#include <core_macros.h>
4+
5+
mcal::gpt::value_type mcal::gpt::secure::get_time_elapsed()
6+
{
7+
// Get the system tick from the system counter register.
8+
const value_type consistent_microsecond_tick = (value_type) ARM64_READ_SYSREG(CNTPCT_EL0);
9+
10+
// Convert the consistent tick to microseconds.
11+
return static_cast<value_type>(static_cast<value_type>(consistent_microsecond_tick + UINT64_C(100)) / UINT64_C(200));
12+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
///////////////////////////////////////////////////////////////////////////////
2+
// Copyright Christopher Kormanyos 2007 - 2025.
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+
#ifndef MCAL_GPT_2025_02_22_H
9+
#define MCAL_GPT_2025_02_22_H
10+
11+
#include <chrono>
12+
#include <cstdint>
13+
14+
// Forward declaration of the util::timer template class.
15+
namespace util
16+
{
17+
template<typename unsigned_tick_type>
18+
class timer;
19+
}
20+
21+
namespace mcal
22+
{
23+
namespace gpt
24+
{
25+
using config_type = void;
26+
using value_type = std::uint64_t;
27+
28+
auto init(const config_type*) -> void;
29+
30+
struct secure final
31+
{
32+
private:
33+
static auto get_time_elapsed() -> value_type;
34+
35+
friend auto std::chrono::high_resolution_clock::now() noexcept -> std::chrono::high_resolution_clock::time_point;
36+
37+
template<typename unsigned_tick_type>
38+
friend class util::timer;
39+
};
40+
}
41+
}
42+
43+
#endif // MCAL_GPT_2011_10_20_H
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
///////////////////////////////////////////////////////////////////////////////
2+
// Copyright Christopher Kormanyos 2007 - 2024.
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+
#ifndef MCAL_WDG_2010_04_10_H_
9+
#define MCAL_WDG_2010_04_10_H_
10+
11+
namespace util { template<typename unsigned_tick_type> class timer; }
12+
13+
namespace mcal
14+
{
15+
namespace wdg
16+
{
17+
class secure final
18+
{
19+
static void trigger() { }
20+
21+
template<typename unsigned_tick_type>
22+
friend class util::timer;
23+
};
24+
}
25+
}
26+
27+
#endif // MCAL_WDG_2010_04_10_H_

ref_app/target.vcxproj

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,9 +1087,8 @@
10871087
<ClCompile Include="target\micros\am335x\startup\crt1.cpp" />
10881088
<ClCompile Include="target\micros\am335x\startup\int_vect.cpp" />
10891089
<ClCompile Include="target\micros\am6254_soc\Code\Appli\Core\a53\main.c" />
1090+
<ClCompile Include="target\micros\am6254_soc\Code\Appli\Core\a53\main_core0.cpp" />
10901091
<ClCompile Include="target\micros\am6254_soc\Code\Mcal\SysTickTimer\SysTickTimer.c" />
1091-
<ClCompile Include="target\micros\am6254_soc\Code\Mcal\Timer\timer.c" />
1092-
<ClCompile Include="target\micros\am6254_soc\Code\Mcal\VIM\vim.c" />
10931092
<ClCompile Include="target\micros\am6254_soc\Code\Startup\Core\a53\Startup.c" />
10941093
<ClCompile Include="target\micros\am6254_soc\Code\Std\StdLib.c" />
10951094
<ClCompile Include="target\micros\atmega2560\startup\crt0.cpp" />
@@ -1200,10 +1199,8 @@
12001199
<Text Include="target\micros\bcm2835_raspi_b\startup\SD_CARD\PiZero\config.txt" />
12011200
</ItemGroup>
12021201
<ItemGroup>
1203-
<ClInclude Include="target\micros\am6254_soc\Code\Mcal\Gpio\led.h" />
1202+
<ClInclude Include="target\micros\am6254_soc\Code\Mcal\Gpio\my_led.h" />
12041203
<ClInclude Include="target\micros\am6254_soc\Code\Mcal\SysTickTimer\SysTickTimer.h" />
1205-
<ClInclude Include="target\micros\am6254_soc\Code\Mcal\Timer\timer.h" />
1206-
<ClInclude Include="target\micros\am6254_soc\Code\Mcal\VIM\vim.h" />
12071204
<ClInclude Include="target\micros\am6254_soc\Code\Startup\Core\a53\core_macros.h" />
12081205
<ClInclude Include="target\micros\am6254_soc\Code\Startup\Core\a53\gic-500.h" />
12091206
<ClInclude Include="target\micros\xtensa_esp32_s3\startup\Std\core-isa.h" />

ref_app/target.vcxproj.filters

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,6 @@
325325
<Filter Include="micros\am6254_soc\Code\Mcal\Gpio">
326326
<UniqueIdentifier>{464c3a7e-dc2f-4c17-912d-a3ccbd91ccfa}</UniqueIdentifier>
327327
</Filter>
328-
<Filter Include="micros\am6254_soc\Code\Mcal\VIM">
329-
<UniqueIdentifier>{19a09498-4103-416e-b459-b281eccec107}</UniqueIdentifier>
330-
</Filter>
331-
<Filter Include="micros\am6254_soc\Code\Mcal\Timer">
332-
<UniqueIdentifier>{0ae3e2d5-c21e-4577-9e06-b34171f8bc8c}</UniqueIdentifier>
333-
</Filter>
334328
<Filter Include="micros\am6254_soc\Code\Startup">
335329
<UniqueIdentifier>{0fb41c05-2289-4721-980a-786b1026a315}</UniqueIdentifier>
336330
</Filter>
@@ -1085,18 +1079,15 @@
10851079
<ClCompile Include="target\micros\am6254_soc\Code\Mcal\SysTickTimer\SysTickTimer.c">
10861080
<Filter>micros\am6254_soc\Code\Mcal\SysTickTimer</Filter>
10871081
</ClCompile>
1088-
<ClCompile Include="target\micros\am6254_soc\Code\Mcal\Timer\timer.c">
1089-
<Filter>micros\am6254_soc\Code\Mcal\Timer</Filter>
1090-
</ClCompile>
1091-
<ClCompile Include="target\micros\am6254_soc\Code\Mcal\VIM\vim.c">
1092-
<Filter>micros\am6254_soc\Code\Mcal\VIM</Filter>
1093-
</ClCompile>
10941082
<ClCompile Include="target\micros\am6254_soc\Code\Std\StdLib.c">
10951083
<Filter>micros\am6254_soc\Code\Std</Filter>
10961084
</ClCompile>
10971085
<ClCompile Include="target\micros\am6254_soc\Code\Startup\Core\a53\Startup.c">
10981086
<Filter>micros\am6254_soc\Code\Startup\Core\a53</Filter>
10991087
</ClCompile>
1088+
<ClCompile Include="target\micros\am6254_soc\Code\Appli\Core\a53\main_core0.cpp">
1089+
<Filter>micros\am6254_soc\Code\Appli\Core\a53</Filter>
1090+
</ClCompile>
11001091
</ItemGroup>
11011092
<ItemGroup>
11021093
<Text Include="target\micros\bcm2835_raspi_b\startup\SD_CARD\PiZero\config.txt">
@@ -1110,18 +1101,12 @@
11101101
<ClInclude Include="target\micros\xtensa_esp32_s3\startup\Std\core-isa.h">
11111102
<Filter>micros\xtensa_esp32_s3\startup\Std</Filter>
11121103
</ClInclude>
1113-
<ClInclude Include="target\micros\am6254_soc\Code\Mcal\Gpio\led.h">
1104+
<ClInclude Include="target\micros\am6254_soc\Code\Mcal\Gpio\my_led.h">
11141105
<Filter>micros\am6254_soc\Code\Mcal\Gpio</Filter>
11151106
</ClInclude>
11161107
<ClInclude Include="target\micros\am6254_soc\Code\Mcal\SysTickTimer\SysTickTimer.h">
11171108
<Filter>micros\am6254_soc\Code\Mcal\SysTickTimer</Filter>
11181109
</ClInclude>
1119-
<ClInclude Include="target\micros\am6254_soc\Code\Mcal\Timer\timer.h">
1120-
<Filter>micros\am6254_soc\Code\Mcal\Timer</Filter>
1121-
</ClInclude>
1122-
<ClInclude Include="target\micros\am6254_soc\Code\Mcal\VIM\vim.h">
1123-
<Filter>micros\am6254_soc\Code\Mcal\VIM</Filter>
1124-
</ClInclude>
11251110
<ClInclude Include="target\micros\am6254_soc\Code\Startup\Core\a53\core_macros.h">
11261111
<Filter>micros\am6254_soc\Code\Startup\Core\a53</Filter>
11271112
</ClInclude>

0 commit comments

Comments
 (0)