Skip to content

Commit 002d6ac

Browse files
authored
Merge pull request #686 from ckormanyos/more_modernization
Do more modernization
2 parents 831def9 + c6322e2 commit 002d6ac

87 files changed

Lines changed: 1753 additions & 1302 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/chapter04_04/build.bat

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
@rem
3-
@rem Copyright Christopher Kormanyos 2014 - 2024.
3+
@rem Copyright Christopher Kormanyos 2014 - 2025.
44
@rem Distributed under the Boost Software License,
55
@rem Version 1.0. (See accompanying file LICENSE_1_0.txt
66
@rem or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -27,8 +27,8 @@
2727
@set TOOL_PATH=%1
2828
@set TOOL_PREFIX=%2
2929

30-
@set CFLAGS=-Wall -Wextra -pedantic -mmcu=atmega328p -fsigned-char -O2 -fno-exceptions
31-
@set CPPFLAGS= -fno-rtti -fstrict-enums -fno-use-cxa-atexit -fno-use-cxa-get-exception-ptr -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs
30+
@set CFLAGS=-Wall -Wextra -Wpedantic -mmcu=atmega328p -fsigned-char -O2 -fno-exceptions
31+
@set CPPFLAGS=-std=c++14 -fno-rtti -fstrict-enums -fno-use-cxa-atexit -fno-use-cxa-get-exception-ptr -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs
3232
@set CINCLUDES=-Isrc/util/STL -Isrc/mcal/avr -Isrc
3333

3434
@echo.

examples/chapter04_04/build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright Christopher Kormanyos 2014 - 2024.
3+
# Copyright Christopher Kormanyos 2014 - 2025.
44
# Distributed under the Boost Software License,
55
# Version 1.0. (See accompanying file LICENSE_1_0.txt
66
# or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -48,7 +48,7 @@ else
4848
fi
4949

5050
CFLAGS="-Wall -Wextra -pedantic -mmcu=atmega328p -fsigned-char -O2 -fno-exceptions"
51-
CPPFLAGS=" -fno-rtti -fstrict-enums -fno-use-cxa-atexit -fno-use-cxa-get-exception-ptr -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs"
51+
CPPFLAGS="-std=c++14 -fno-rtti -fstrict-enums -fno-use-cxa-atexit -fno-use-cxa-get-exception-ptr -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs"
5252
CINCLUDES="-Isrc/util/STL -Isrc/mcal/avr -Isrc"
5353

5454
echo

examples/chapter09_08/build.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
@rem
3-
@rem Copyright Christopher Kormanyos 2014 - 2021.
3+
@rem Copyright Christopher Kormanyos 2014 - 2025.
44
@rem Distributed under the Boost Software License,
55
@rem Version 1.0. (See accompanying file LICENSE_1_0.txt
66
@rem or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -27,7 +27,7 @@
2727
@set TOOL_PATH=%1
2828
@set TOOL_PREFIX=%2
2929

30-
@set CFLAGS=-C -Wall -Wextra -pedantic -mmcu=atmega328p -fsigned-char -O2 -fno-exceptions -gdwarf-2 -ffunction-sections -fdata-sections
30+
@set CFLAGS=-Wall -Wextra -Wpedantic -mmcu=atmega328p -fsigned-char -O2 -fno-exceptions
3131
@set CPPFLAGS=-std=c++14 -fno-rtti -fstrict-enums -fno-use-cxa-atexit -fno-use-cxa-get-exception-ptr -fno-nonansi-builtins -fno-threadsafe-statics -fno-enforce-eh-specs
3232
@set CINCLUDES=-Isrc/util/STL_C++XX_stdfloat -Isrc/util/STL -Isrc -Isrc/mcal/avr
3333

examples/chapter09_08/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright Christopher Kormanyos 2014 - 2020.
3+
# Copyright Christopher Kormanyos 2014 - 2025.
44
# Distributed under the Boost Software License,
55
# Version 1.0. (See accompanying file LICENSE_1_0.txt
66
# or copy at http://www.boost.org/LICENSE_1_0.txt)

examples/chapter09_08/chapter09_08.vcxproj

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@
244244
<ClInclude Include="src\mcal\mcal_led_monochrome.h" />
245245
<ClInclude Include="src\mcal\mcal_led_rgb.h" />
246246
<ClInclude Include="src\mcal\mcal_pwm_base.h" />
247-
<ClInclude Include="src\mcal\mcal_reg_access_template.h" />
248-
<ClInclude Include="src\mcal\mcal_reg_dynamic_access_template.h" />
247+
<ClInclude Include="src\mcal\mcal_reg_access_dynamic.h" />
248+
<ClInclude Include="src\mcal\mcal_reg_access_static.h" />
249249
<ClInclude Include="src\mcal\win32\mcal_cpu.h" />
250250
<ClInclude Include="src\mcal\win32\mcal_gpt.h" />
251251
<ClInclude Include="src\mcal\win32\mcal_irq.h" />
@@ -368,6 +368,10 @@
368368
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
369369
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
370370
</None>
371+
<None Include="src\util\STL\ciso646">
372+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
373+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
374+
</None>
371375
<None Include="src\util\STL\climits">
372376
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
373377
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@@ -444,6 +448,10 @@
444448
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
445449
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
446450
</None>
451+
<None Include="src\util\STL\stdfloat">
452+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
453+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
454+
</None>
447455
<None Include="src\util\STL\string">
448456
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
449457
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@@ -464,6 +472,10 @@
464472
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
465473
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
466474
</None>
475+
<None Include="src\util\STL\version">
476+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
477+
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
478+
</None>
467479
<None Include="src\util\STL_C++XX_stdfloat\cstdfloat" />
468480
</ItemGroup>
469481
<ItemGroup>

examples/chapter09_08/chapter09_08.vcxproj.filters

Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,6 @@
167167
<ClInclude Include="src\mcal\mcal.h">
168168
<Filter>src\mcal</Filter>
169169
</ClInclude>
170-
<ClInclude Include="src\mcal\mcal_reg_access_template.h">
171-
<Filter>src\mcal</Filter>
172-
</ClInclude>
173170
<ClInclude Include="src\os\os.h">
174171
<Filter>src\os</Filter>
175172
</ClInclude>
@@ -179,9 +176,6 @@
179176
<ClInclude Include="src\os\os_task_control_block.h">
180177
<Filter>src\os</Filter>
181178
</ClInclude>
182-
<ClInclude Include="src\mcal\mcal_reg_dynamic_access_template.h">
183-
<Filter>src\mcal</Filter>
184-
</ClInclude>
185179
<ClInclude Include="src\util\device\util_device_led_base.h">
186180
<Filter>src\util\device</Filter>
187181
</ClInclude>
@@ -320,9 +314,6 @@
320314
<ClInclude Include="src\util\STL\impl\avr\avr_atomic.h">
321315
<Filter>src\util\STL\impl\avr</Filter>
322316
</ClInclude>
323-
<ClInclude Include="src\util\STL\time.h">
324-
<Filter>src\util\STL</Filter>
325-
</ClInclude>
326317
<ClInclude Include="src\util\utility\util_linear_interpolate.h">
327318
<Filter>src\util\utility</Filter>
328319
</ClInclude>
@@ -368,11 +359,35 @@
368359
<ClInclude Include="src\util\utility\util_dynamic_array.h">
369360
<Filter>src\util\utility</Filter>
370361
</ClInclude>
362+
<ClInclude Include="src\mcal\mcal_reg_access_dynamic.h">
363+
<Filter>src\mcal</Filter>
364+
</ClInclude>
365+
<ClInclude Include="src\mcal\mcal_reg_access_static.h">
366+
<Filter>src\mcal</Filter>
367+
</ClInclude>
368+
<ClInclude Include="src\util\STL\time.h">
369+
<Filter>src\util\STL</Filter>
370+
</ClInclude>
371371
</ItemGroup>
372372
<ItemGroup>
373373
<None Include="src\util\STL_C++XX_stdfloat\cstdfloat">
374374
<Filter>src\util\STL_C++XX_stdfloat</Filter>
375375
</None>
376+
<None Include="src\util\STL\functional">
377+
<Filter>src\util\STL</Filter>
378+
</None>
379+
<None Include="src\util\STL\initializer_list">
380+
<Filter>src\util\STL</Filter>
381+
</None>
382+
<None Include="src\util\STL\iterator">
383+
<Filter>src\util\STL</Filter>
384+
</None>
385+
<None Include="src\util\STL\limits">
386+
<Filter>src\util\STL</Filter>
387+
</None>
388+
<None Include="src\util\STL\memory">
389+
<Filter>src\util\STL</Filter>
390+
</None>
376391
<None Include="src\util\STL\numeric">
377392
<Filter>src\util\STL</Filter>
378393
</None>
@@ -388,6 +403,9 @@
388403
<None Include="src\util\STL\stdexcept">
389404
<Filter>src\util\STL</Filter>
390405
</None>
406+
<None Include="src\util\STL\stdfloat">
407+
<Filter>src\util\STL</Filter>
408+
</None>
391409
<None Include="src\util\STL\string">
392410
<Filter>src\util\STL</Filter>
393411
</None>
@@ -403,6 +421,9 @@
403421
<None Include="src\util\STL\vector">
404422
<Filter>src\util\STL</Filter>
405423
</None>
424+
<None Include="src\util\STL\version">
425+
<Filter>src\util\STL</Filter>
426+
</None>
406427
<None Include="src\util\STL\algorithm">
407428
<Filter>src\util\STL</Filter>
408429
</None>
@@ -439,6 +460,9 @@
439460
<None Include="src\util\STL\cinttypes">
440461
<Filter>src\util\STL</Filter>
441462
</None>
463+
<None Include="src\util\STL\ciso646">
464+
<Filter>src\util\STL</Filter>
465+
</None>
442466
<None Include="src\util\STL\climits">
443467
<Filter>src\util\STL</Filter>
444468
</None>
@@ -466,21 +490,6 @@
466490
<None Include="src\util\STL\ctime">
467491
<Filter>src\util\STL</Filter>
468492
</None>
469-
<None Include="src\util\STL\functional">
470-
<Filter>src\util\STL</Filter>
471-
</None>
472-
<None Include="src\util\STL\initializer_list">
473-
<Filter>src\util\STL</Filter>
474-
</None>
475-
<None Include="src\util\STL\iterator">
476-
<Filter>src\util\STL</Filter>
477-
</None>
478-
<None Include="src\util\STL\limits">
479-
<Filter>src\util\STL</Filter>
480-
</None>
481-
<None Include="src\util\STL\memory">
482-
<Filter>src\util\STL</Filter>
483-
</None>
484493
</ItemGroup>
485494
<ItemGroup>
486495
<ResourceCompile Include="src\chapter09_08.rc">

examples/chapter09_08/src/mcal/avr/mcal_benchmark.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2014.
2+
// Copyright Christopher Kormanyos 2014 - 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)
@@ -8,18 +8,19 @@
88
#ifndef MCAL_BENCHMARK_2014_04_16_H_
99
#define MCAL_BENCHMARK_2014_04_16_H_
1010

11-
#include <cstdint>
1211
#include <mcal_port.h>
1312
#include <mcal_reg.h>
1413

14+
#include <cstdint>
15+
1516
namespace mcal
1617
{
1718
namespace benchmark
1819
{
19-
typedef mcal::port::port_pin<std::uint8_t,
20-
std::uint8_t,
21-
mcal::reg::portd,
22-
UINT8_C(3)> benchmark_port_type;
20+
using benchmark_port_type = mcal::port::port_pin<std::uint8_t,
21+
std::uint8_t,
22+
mcal::reg::portd,
23+
UINT8_C(3)>;
2324
}
2425
}
2526

examples/chapter09_08/src/mcal/avr/mcal_cpu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2007 - 2018.
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)
@@ -10,7 +10,7 @@
1010
#include <mcal_port.h>
1111
#include <mcal_wdg.h>
1212

13-
void mcal::cpu::init()
13+
auto mcal::cpu::init() -> void
1414
{
1515
mcal::wdg::init(nullptr);
1616
mcal::port::init(nullptr);
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2007 - 2020.
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_CPU_2009_02_14_H_
9-
#define MCAL_CPU_2009_02_14_H_
8+
#ifndef MCAL_CPU_2009_02_14_H
9+
#define MCAL_CPU_2009_02_14_H
1010

1111
#include <cstdint>
1212

@@ -16,10 +16,10 @@
1616
{
1717
void init();
1818

19-
inline void post_init() { }
19+
inline auto post_init() -> void { }
2020

21-
inline void nop() noexcept { asm volatile("nop"); }
21+
inline auto nop() noexcept -> void { asm volatile("nop"); }
2222
}
2323
}
2424

25-
#endif // MCAL_CPU_2009_02_14_H_
25+
#endif // MCAL_CPU_2009_02_14_H

examples/chapter09_08/src/mcal/avr/mcal_gpt.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
///////////////////////////////////////////////////////////////////////////////
2-
// Copyright Christopher Kormanyos 2007 - 2015.
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)

0 commit comments

Comments
 (0)