Skip to content

Commit 5331fe5

Browse files
committed
Start preparing am6254 benchmarks
1 parent 04acda9 commit 5331fe5

29 files changed

+316
-144
lines changed

ref_app/ref_app.vcxproj

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,18 +261,50 @@
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_cpu.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\am6254_soc\mcal_cpu_secure.s">
265269
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
266270
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
267271
</ClCompile>
272+
<ClCompile Include="src\mcal\am6254_soc\mcal_eep.cpp">
273+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
274+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
275+
</ClCompile>
268276
<ClCompile Include="src\mcal\am6254_soc\mcal_gpt.cpp">
269277
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
270278
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
271279
</ClCompile>
280+
<ClCompile Include="src\mcal\am6254_soc\mcal_irq.cpp">
281+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
282+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
283+
</ClCompile>
272284
<ClCompile Include="src\mcal\am6254_soc\mcal_led.cpp">
273285
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
274286
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
275287
</ClCompile>
288+
<ClCompile Include="src\mcal\am6254_soc\mcal_osc.cpp">
289+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
290+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
291+
</ClCompile>
292+
<ClCompile Include="src\mcal\am6254_soc\mcal_port.cpp">
293+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
294+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
295+
</ClCompile>
296+
<ClCompile Include="src\mcal\am6254_soc\mcal_pwm.cpp">
297+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
298+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
299+
</ClCompile>
300+
<ClCompile Include="src\mcal\am6254_soc\mcal_spi.cpp">
301+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
302+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
303+
</ClCompile>
304+
<ClCompile Include="src\mcal\am6254_soc\mcal_wdg.cpp">
305+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
306+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
307+
</ClCompile>
276308
<ClCompile Include="src\mcal\atmega2560\mcal_cpu.cpp">
277309
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
278310
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@@ -1520,6 +1552,10 @@
15201552
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
15211553
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
15221554
</ClInclude>
1555+
<ClInclude Include="src\mcal\am6254_soc\mcal_osc.h">
1556+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
1557+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
1558+
</ClInclude>
15231559
<ClInclude Include="src\mcal\am6254_soc\mcal_port.h">
15241560
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
15251561
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>

ref_app/ref_app.vcxproj.filters

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,30 @@
12791279
<ClCompile Include="src\mcal\am6254_soc\mcal_cpu_secure.s">
12801280
<Filter>src\mcal\am6254_soc</Filter>
12811281
</ClCompile>
1282+
<ClCompile Include="src\mcal\am6254_soc\mcal_eep.cpp">
1283+
<Filter>src\mcal\am6254_soc</Filter>
1284+
</ClCompile>
1285+
<ClCompile Include="src\mcal\am6254_soc\mcal_cpu.cpp">
1286+
<Filter>src\mcal\am6254_soc</Filter>
1287+
</ClCompile>
1288+
<ClCompile Include="src\mcal\am6254_soc\mcal_irq.cpp">
1289+
<Filter>src\mcal\am6254_soc</Filter>
1290+
</ClCompile>
1291+
<ClCompile Include="src\mcal\am6254_soc\mcal_pwm.cpp">
1292+
<Filter>src\mcal\am6254_soc</Filter>
1293+
</ClCompile>
1294+
<ClCompile Include="src\mcal\am6254_soc\mcal_osc.cpp">
1295+
<Filter>src\mcal\am6254_soc</Filter>
1296+
</ClCompile>
1297+
<ClCompile Include="src\mcal\am6254_soc\mcal_port.cpp">
1298+
<Filter>src\mcal\am6254_soc</Filter>
1299+
</ClCompile>
1300+
<ClCompile Include="src\mcal\am6254_soc\mcal_wdg.cpp">
1301+
<Filter>src\mcal\am6254_soc</Filter>
1302+
</ClCompile>
1303+
<ClCompile Include="src\mcal\am6254_soc\mcal_spi.cpp">
1304+
<Filter>src\mcal\am6254_soc</Filter>
1305+
</ClCompile>
12821306
</ItemGroup>
12831307
<ItemGroup>
12841308
<ClInclude Include="src\math\calculus\derivative.h">
@@ -2922,6 +2946,9 @@
29222946
<ClInclude Include="src\mcal\am6254_soc\mcal_reg.h">
29232947
<Filter>src\mcal\am6254_soc</Filter>
29242948
</ClInclude>
2949+
<ClInclude Include="src\mcal\am6254_soc\mcal_osc.h">
2950+
<Filter>src\mcal\am6254_soc</Filter>
2951+
</ClInclude>
29252952
</ItemGroup>
29262953
<ItemGroup>
29272954
<None Include="src\util\STL\algorithm">

ref_app/src/mcal/am6254_soc/mcal_benchmark.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{
1818
namespace benchmark
1919
{
20-
typedef mcal::port::port_pin<mcal::reg::gpio0, 2U> benchmark_port_type;
20+
typedef mcal::port::port_pin<mcal::reg::gpio0, 36U> benchmark_port_type;
2121
}
2222
}
2323

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
#include <mcal_cpu.h>
9+
10+
auto mcal::cpu::init() -> void
11+
{
12+
}
Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,59 @@
11
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2007 - 2025.
2+
// Copyright Christopher Kormanyos 2025.
33
// Distributed under the Boost Software License,
44
// Version 1.0. (See accompanying file LICENSE_1_0.txt
55
// or copy at http://www.boost.org/LICENSE_1_0.txt)
66
//
77

8-
#ifndef MCAL_CPU_2009_02_14_H
9-
#define MCAL_CPU_2009_02_14_H
8+
#ifndef MCAL_CPU_2025_07_30_H
9+
#define MCAL_CPU_2025_07_30_H
1010

11+
#if defined(__cplusplus)
1112
#include <cstdint>
13+
#else
14+
#include <stdint.h>
15+
#endif
1216

13-
extern "C" auto hw_acquire_spin_lock(volatile std::uint32_t*) noexcept -> void;
14-
extern "C" auto hw_release_spin_lock(volatile std::uint32_t*) noexcept -> void;
17+
#if defined(__cplusplus)
18+
extern "C"
19+
{
20+
#endif
21+
22+
void mcal_cpu_secure_acquire_spin_lock(volatile uint32_t*);
23+
void mcal_cpu_secure_release_spin_lock(volatile uint32_t*);
24+
25+
static inline void mcal_cpu_nop(void);
26+
27+
#if defined(__cplusplus)
28+
}
29+
#endif
1530

31+
#if defined(__cplusplus)
1632
namespace mcal
1733
{
1834
namespace cpu
1935
{
20-
void init();
36+
auto init() -> void;
2137

2238
inline auto post_init() -> void { }
2339

2440
inline auto nop() noexcept -> void { asm volatile("nop"); }
2541

26-
inline auto acquire_spin_lock(volatile std::uint32_t* p_sync) noexcept -> void { hw_acquire_spin_lock(p_sync); }
27-
inline auto release_spin_lock(volatile std::uint32_t* p_sync) noexcept -> void { hw_release_spin_lock(p_sync); }
42+
inline auto acquire_spin_lock(volatile std::uint32_t* p_sync) noexcept -> void { mcal_cpu_secure_acquire_spin_lock(p_sync); }
43+
inline auto release_spin_lock(volatile std::uint32_t* p_sync) noexcept -> void { mcal_cpu_secure_release_spin_lock(p_sync); }
2844
}
2945
}
46+
#endif
47+
48+
#if defined(__cplusplus)
49+
extern "C"
50+
{
51+
#endif
52+
53+
static inline void mcal_cpu_nop(void) { __asm volatile("nop"); }
54+
55+
#if defined(__cplusplus)
56+
}
57+
#endif
3058

31-
#endif // MCAL_CPU_2009_02_14_H
59+
#endif // MCAL_CPU_2025_07_30_H

ref_app/src/mcal/am6254_soc/mcal_cpu_secure.s

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@
2323
// ***************************************************************************************
2424

2525
.section .text
26-
.type hw_acquire_spin_lock,@function
26+
.type mcal_cpu_secure_acquire_spin_lock,@function
2727
.align 3
28-
.globl hw_acquire_spin_lock
28+
.globl mcal_cpu_secure_acquire_spin_lock
2929

30-
hw_acquire_spin_lock:
30+
mcal_cpu_secure_acquire_spin_lock:
3131
mov w1, #1
3232
.L_loop:
3333
ldaxr w2, [x0]
@@ -38,11 +38,11 @@ hw_acquire_spin_lock:
3838
ret
3939

4040
.section .text
41-
.type hw_release_spin_lock,@function
41+
.type mcal_cpu_secure_release_spin_lock,@function
4242
.align 3
43-
.globl hw_release_spin_lock
43+
.globl mcal_cpu_secure_release_spin_lock
4444

45-
hw_release_spin_lock:
45+
mcal_cpu_secure_release_spin_lock:
4646
dmb ish
4747
stlr wzr, [x0]
4848
ret
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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+
#include <mcal_eep.h>
9+
10+
auto mcal::eep::write(const address_type addr, const std::uint8_t data) -> void
11+
{
12+
static_cast<void>(addr);
13+
static_cast<void>(data);
14+
}
15+
16+
auto mcal::eep::read(const address_type addr) -> std::uint8_t
17+
{
18+
static_cast<void>(addr);
19+
20+
return UINT8_C(0);
21+
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2007 - 2022.
2+
// Copyright Christopher Kormanyos 2007 - 2025.
33
// Distributed under the Boost Software License,
44
// Version 1.0. (See accompanying file LICENSE_1_0.txt
55
// or copy at http://www.boost.org/LICENSE_1_0.txt)
66
//
77

8-
#ifndef MCAL_EEP_2018_12_15_H_
9-
#define MCAL_EEP_2018_12_15_H_
8+
#ifndef MCAL_EEP_2018_12_15_H
9+
#define MCAL_EEP_2018_12_15_H
1010

1111
#include <cstdint>
1212

@@ -17,11 +17,11 @@
1717
using config_type = void;
1818
using address_type = std::uint32_t;
1919

20-
inline void init(const config_type*) { }
20+
inline auto init(const config_type*) -> void { }
2121

22-
inline void write(const address_type addr, const std::uint8_t data) { static_cast<void>(addr); static_cast<void>(data); }
23-
inline std::uint8_t read (const address_type addr) { static_cast<void>(addr); return UINT8_C(0); }
22+
auto write(const address_type addr, const std::uint8_t data) -> void;
23+
auto read (const address_type addr) -> std::uint8_t;
2424
}
2525
}
2626

27-
#endif // MCAL_EEP_2018_12_15_H_
27+
#endif // MCAL_EEP_2018_12_15_H
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
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+
#include <mcal_irq.h>
9+
10+
auto mcal::irq::init(const config_type*) -> void
11+
{
12+
}

ref_app/src/mcal/am6254_soc/mcal_irq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
{
1515
using config_type = void;
1616

17-
inline void init(const config_type*) { }
17+
void init(const config_type*);
1818

1919
inline void enable_all () { /* TBD enable/disable fiqs/irqs for this arch. */ }
2020
inline void disable_all() { /* TBD enable/disable fiqs/irqs for this arch. */ }

0 commit comments

Comments
 (0)