diff --git a/.github/workflows/UniversalBareMetal.yml b/.github/workflows/UniversalBareMetal.yml
index 9a925a9..e2c1fe4 100644
--- a/.github/workflows/UniversalBareMetal.yml
+++ b/.github/workflows/UniversalBareMetal.yml
@@ -30,8 +30,8 @@ jobs:
- name: target-ubuntu-${{ matrix.suite }}
working-directory: ./Build/VS
run: |
- make -f ../Make/make_000.gmk ${{ matrix.suite }} TYP_OS=unix
- ls -la ../Bin/Stm32f446re_x64/stm32f446re.elf ../Bin/Stm32f446re_x64/stm32f446re.hex
+ make -f ../Make/make_000.gmk ${{ matrix.suite }} TYP_OS=unix TYP_MCU=stm32f446re
+ ls -la ../Bin/stm32f446re_x64/stm32f446re.elf ../Bin/stm32f446re_x64/stm32f446re.hex
msvc-msbuild:
runs-on: windows-latest
diff --git a/.github/workflows/UniversalBareMetal_CodeQl.yml b/.github/workflows/UniversalBareMetal_CodeQl.yml
index a883c33..c817247 100644
--- a/.github/workflows/UniversalBareMetal_CodeQl.yml
+++ b/.github/workflows/UniversalBareMetal_CodeQl.yml
@@ -44,8 +44,8 @@ jobs:
- name: target-ubuntu-${{ matrix.suite }}
working-directory: ./Build/VS
run: |
- make -f ../Make/make_000.gmk ${{ matrix.suite }} TYP_OS=unix
- ls -la ../Bin/Stm32f446re_x64/stm32f446re.elf ../Bin/Stm32f446re_x64/stm32f446re.hex
+ make -f ../Make/make_000.gmk ${{ matrix.suite }} TYP_OS=unix TYP_MCU=stm32f446re
+ ls -la ../Bin/stm32f446re_x64/stm32f446re.elf ../Bin/stm32f446re_x64/stm32f446re.hex
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
diff --git a/Build/Make/make_000.gmk b/Build/Make/make_000.gmk
index 78d469a..56ae279 100644
--- a/Build/Make/make_000.gmk
+++ b/Build/Make/make_000.gmk
@@ -3,5 +3,11 @@
PATH_ENV = $(CURDIR)/../Make
PATH_SRC = $(CURDIR)/../../Src
+ifeq ($(TYP_MCU),stm32f446re)
+include $(PATH_SRC)/Target/stm32f446re/Make/make_stm32f446re.gmk
+endif
+
+ifeq ($(TYP_MCU),stm32l432kc)
+include $(PATH_SRC)/Target/stm32l432kc/Make/make_stm32l432kc.gmk
+endif
-include $(PATH_SRC)/Target/Stm32f446re/Make/make_stm32f446re.gmk
diff --git a/Build/VS/UniversalBareMetal.sln b/Build/VS/UniversalBareMetal.sln
index 0f24e1f..cba82d9 100644
--- a/Build/VS/UniversalBareMetal.sln
+++ b/Build/VS/UniversalBareMetal.sln
@@ -33,6 +33,7 @@ Global
Debug|x64 = Debug|x64
Release|x64 = Release|x64
stm32f446re|x64 = stm32f446re|x64
+ stm32l432kc|x64 = stm32l432kc|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{32D529D9-6963-472C-9BB3-1E4E1933FC56}.Debug|x64.ActiveCfg = Debug|x64
@@ -41,6 +42,8 @@ Global
{32D529D9-6963-472C-9BB3-1E4E1933FC56}.Release|x64.Build.0 = Release|x64
{32D529D9-6963-472C-9BB3-1E4E1933FC56}.stm32f446re|x64.ActiveCfg = stm32f446re|x64
{32D529D9-6963-472C-9BB3-1E4E1933FC56}.stm32f446re|x64.Build.0 = stm32f446re|x64
+ {32D529D9-6963-472C-9BB3-1E4E1933FC56}.stm32l432kc|x64.ActiveCfg = stm32l432kc|x64
+ {32D529D9-6963-472C-9BB3-1E4E1933FC56}.stm32l432kc|x64.Build.0 = stm32l432kc|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Build/VS/UniversalBareMetal.vcxproj b/Build/VS/UniversalBareMetal.vcxproj
index 490e228..466bf0b 100644
--- a/Build/VS/UniversalBareMetal.vcxproj
+++ b/Build/VS/UniversalBareMetal.vcxproj
@@ -13,14 +13,24 @@
stm32f446re
x64
+
+ stm32l432kc
+ x64
+
-
+
+
+ true
+ true
+
true
+ true
true
+ true
true
@@ -62,23 +72,59 @@
true
true
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
-
-
+
+
+
+
true
+ true
true
+ true
true
+ true
true
+ true
true
@@ -116,8 +162,33 @@
true
true
-
-
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+ true
+ true
+ true
+ true
+
+
+
+
17.0
@@ -140,6 +211,10 @@
v143
Makefile
+
+ v143
+ Makefile
+
@@ -175,14 +250,25 @@
$(SolutionDir)..\Bin\$(Configuration)_$(Platform)\
$(SolutionDir)..\Tmp\$(Configuration)_$(Platform)\
- ..\build.bat build
- ..\build.bat all
- ..\build.bat clean
+ ..\build.bat build stm32f446re win
+ ..\build.bat all stm32f446re win
+ ..\build.bat clean stm32f446re win
__GNUC__=12;__attribute__()=
$(SolutionDir)../../Src/Target/Stm32f446re;$(SolutionDir)../../Src
+
+ $(SolutionDir)..\Bin\$(Configuration)_$(Platform)\
+ $(SolutionDir)..\Tmp\$(Configuration)_$(Platform)\
+ ..\build.bat build stm32l432kc win
+ ..\build.bat all stm32l432kc win
+ ..\build.bat clean stm32l432kc win
+
+
+ __GNUC__=12;__attribute__()=
+ $(SolutionDir)../../Src/Target/Stm32l432kc;$(SolutionDir)../../Src
+
$(OutDir)$(Configuration)_$(Platform)_BuildLog.htm
@@ -198,6 +284,11 @@
$(SolutionDir)..\Tmp\$(Configuration)_$(Platform)\$(Configuration)_BuildLog.htm
+
+
+ $(SolutionDir)..\Tmp\$(Configuration)_$(Platform)\$(Configuration)_BuildLog.htm
+
+
diff --git a/Build/VS/UniversalBareMetal.vcxproj.filters b/Build/VS/UniversalBareMetal.vcxproj.filters
index d3bb2ad..002de7c 100644
--- a/Build/VS/UniversalBareMetal.vcxproj.filters
+++ b/Build/VS/UniversalBareMetal.vcxproj.filters
@@ -14,75 +14,123 @@
{c82cbd11-d189-450a-a7cd-be261b671db9}
-
+
+ {4952d30c-12fd-4ca7-80e2-f3e33955723c}
+
+
+ {2da08224-fb44-418b-832e-93ca62bd6c72}
+
+
+ {57dcff24-5694-469b-a439-0d40ca4ed911}
+
+
{c2c8a067-58d7-4d3d-bf99-d9ad245d1603}
-
+
{09a60374-ec83-484c-bd6a-9d3311a775d8}
-
+
{ea042799-451b-4e1d-a9ee-3bc7a94f329b}
-
+
{844975ca-72d3-432e-9163-55d9f8130511}
-
- {4952d30c-12fd-4ca7-80e2-f3e33955723c}
+
+ {fb233c87-ae46-475c-80dc-3023a02d6df6}
-
- {2da08224-fb44-418b-832e-93ca62bd6c72}
+
+ {6d7da62d-8a32-4921-a2fa-36e377e0b02e}
-
- {57dcff24-5694-469b-a439-0d40ca4ed911}
+
+ {600ad60c-3aae-4256-bf9b-5a0cd5272e6d}
+
+
+ {7c6244fc-f19c-4ecd-9b62-cef9e5152879}
+
+
+ {7ab97707-bf6e-4efa-ae2d-322ecff22c7c}
+
+
+ {08d4bf42-a297-4f77-b393-be6ca6ed378a}
+
+
+ {4c097d0d-3470-49eb-bf09-dda805ba8149}
+
+
+ {a45a3942-f76a-45ff-a692-7bb355eb8e53}
- Source Files\Src\Target\Stm32f446re\Startup
+ Source Files\Src\Target\stm32f446re\Startup
- Source Files\Src\Target\Stm32f446re\Startup
+ Source Files\Src\Target\stm32f446re\Startup
- Source Files\Src\Target\Stm32f446re\Startup
+ Source Files\Src\Target\stm32f446re\Startup
- Source Files\Src\Target\Stm32f446re\Startup
+ Source Files\Src\Target\stm32f446re\Startup
- Source Files\Src\Target\Stm32f446re\Startup
-
-
- Source Files\Src\App
+ Source Files\Src\Target\stm32f446re\Startup
Source Files\Src\Target\Host\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
Source Files\Src\Target\Host\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
+
+
+ Source Files\Src\Target\stm32l432kc\Mcal
+
+
+ Source Files\Src\Target\stm32l432kc\Mcal
+
+
+ Source Files\Src\Target\stm32l432kc\Mcal
+
+
+ Source Files\Src\Target\stm32l432kc\Startup
+
+
+ Source Files\Src\Target\stm32l432kc\Startup
+
+
+ Source Files\Src\App\Cpp
+
+
+ Source Files\Src\App\C
-
- Source Files\Src\Target\Stm32f446re\Make
+
+ Source Files\Src\Target\stm32l432kc\Make
-
- Source Files\Src\Target\Stm32f446re\Make
+
+ Source Files\Src\Target\stm32l432kc\Make
+
+
+ Source Files\Src\Target\stm32f446re\Make
+
+
+ Source Files\Src\Target\stm32f446re\Make
@@ -96,40 +144,55 @@
Source Files\Src\Target\Host\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
Source Files\Src\Target\Host\Mcal
-
- Source Files\Src\Util
-
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
- Source Files\Src\Target\Stm32f446re\Mcal
+ Source Files\Src\Target\stm32f446re\Mcal
+
+
+ Source Files\Src\Target\stm32l432kc\Mcal
+
+
+ Source Files\Src\Target\stm32l432kc\Mcal
+
+
+ Source Files\Src\Target\stm32l432kc\Mcal
+
+
+ Source Files\Src\Target\stm32l432kc\Mcal
+
+
+ Source Files\Src\Util\C
+
+
+ Source Files\Src\Util\Cpp
-
- Source Files\Src\Util
+
+ Source Files\Src\Util\Cpp
\ No newline at end of file
diff --git a/Build/build.bat b/Build/build.bat
index 2e71ad8..00c4c45 100644
--- a/Build/build.bat
+++ b/Build/build.bat
@@ -1,7 +1,7 @@
echo off
-set BUILD_COMMAND=%CD%\..\tools\util\make\make.exe -f %CD%\..\Make\make_000.gmk all TYP_OS=win
-
+set TYP_MCU=%2
+set TYP_OS=%3
+set BUILD_COMMAND=%CD%\..\tools\util\make\make.exe -f %CD%\..\Make\make_000.gmk all
echo Build command is: %BUILD_COMMAND%
-
%BUILD_COMMAND%
diff --git a/Src/App/C/App.c b/Src/App/C/App.c
new file mode 100644
index 0000000..8945d80
--- /dev/null
+++ b/Src/App/C/App.c
@@ -0,0 +1,39 @@
+#include
+#include
+#include
+#include
+
+void msDelay(volatile uint32_t count);
+
+// Simple delay function
+void msDelay(volatile uint32_t count)
+{
+ while (count--)
+ {
+ __asm volatile ("nop"); // No operation (do nothing)
+ }
+}
+
+
+int main(void)
+{
+ /* Configure the System clock and flash */
+ SystemInit();
+ SetSysClock();
+
+ /*. Enable GPIO Clock for GPIOB */
+ RCC_AHB2ENR |= (1U << 1U);
+
+ /*. Configure PB3 as output */
+ GPIOB_MODER |= (1U << 6U);
+ GPIOB_MODER &= ~(1U << 7U);
+
+ for(;;)
+ {
+ /* Toggle PB3 to turn the LED on and off */
+ GPIOB_ODR ^= (1U << 3U);
+ msDelay(1000000U);
+ }
+
+ return 0;
+}
diff --git a/Src/App/App.cpp b/Src/App/Cpp/App.cpp
similarity index 92%
rename from Src/App/App.cpp
rename to Src/App/Cpp/App.cpp
index 5781233..05276c9 100644
--- a/Src/App/App.cpp
+++ b/Src/App/Cpp/App.cpp
@@ -1,7 +1,7 @@
#include
#include
-#include
+#include
namespace local
{
diff --git a/Src/Target/Stm32f446re/Make/make_stm32f446re.gmk b/Src/Target/stm32f446re/Make/make_stm32f446re.gmk
similarity index 96%
rename from Src/Target/Stm32f446re/Make/make_stm32f446re.gmk
rename to Src/Target/stm32f446re/Make/make_stm32f446re.gmk
index 638d99e..d905e09 100644
--- a/Src/Target/Stm32f446re/Make/make_stm32f446re.gmk
+++ b/Src/Target/stm32f446re/Make/make_stm32f446re.gmk
@@ -11,11 +11,11 @@
# Paths and tools
#------------------------------------------------------------------------------
-PATH_MAKE = $(CURDIR)/../../Src/Target/Stm32f446re/Make
+PATH_MAKE = $(CURDIR)/../../Src/Target/stm32f446re/Make
PATH_SRC = $(CURDIR)/../../Src
-PATH_TARGET = $(PATH_SRC)/Target/Stm32f446re
-PATH_TMP = $(CURDIR)/../Tmp/Stm32f446re_x64
-PATH_BIN = $(CURDIR)/../Bin/Stm32f446re_x64
+PATH_TARGET = $(PATH_SRC)/Target/stm32f446re
+PATH_TMP = $(CURDIR)/../Tmp/stm32f446re_x64
+PATH_BIN = $(CURDIR)/../Bin/stm32f446re_x64
PATH_OBJ = $(PATH_TMP)/Obj
ifeq ($(TYP_OS),win)
@@ -125,7 +125,7 @@ LDFLAGS = $(CPPFLAGS) \
# Source files
#------------------------------------------------------------------------------
-SRC_FILES = $(PATH_SRC)/App/App \
+SRC_FILES = $(PATH_SRC)/App/Cpp/App \
$(PATH_TARGET)/Mcal/mcal \
$(PATH_TARGET)/Mcal/mcal_cpu \
$(PATH_TARGET)/Mcal/mcal_gpt \
@@ -150,7 +150,7 @@ FILES_O := $(addprefix $(PATH_OBJ)/, $(notdir $(addsuffix .o, $(SRC_FILES))))
# Build targets
#------------------------------------------------------------------------------
-all : clean_all print_version $(PATH_BIN)/Stm32f446re.elf
+all : clean_all print_version $(PATH_BIN)/stm32f446re.elf
.PHONY : clean_all
clean_all :
@@ -172,7 +172,7 @@ print_version :
@$(CC) -v
@$(ECHO)
-$(PATH_BIN)/Stm32f446re.elf : $(FILES_O)
+$(PATH_BIN)/stm32f446re.elf : $(FILES_O)
@-$(ECHO)
@-$(ECHO) +++ linking application to absolute object file $(PATH_BIN)/stm32f446re.elf
@-$(CC) -x none $(LDFLAGS) $(FILES_O) -o $(PATH_BIN)/stm32f446re.elf
diff --git a/Src/Target/Stm32f446re/Make/stm32f446re.ld b/Src/Target/stm32f446re/Make/stm32f446re.ld
similarity index 84%
rename from Src/Target/Stm32f446re/Make/stm32f446re.ld
rename to Src/Target/stm32f446re/Make/stm32f446re.ld
index 3c2f407..bab9268 100644
--- a/Src/Target/Stm32f446re/Make/stm32f446re.ld
+++ b/Src/Target/stm32f446re/Make/stm32f446re.ld
@@ -1,9 +1,14 @@
-
/*
- Copyright Christopher Kormanyos 2007 - 2022.
- 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)
+******************************************************************************
+**
+** Copyright Iliass Mahjoub 2023 - 2024.
+** Copyright Christopher Kormanyos 2007 - 2024.
+**
+** 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)
+**
+******************************************************************************
*/
/* Linker script for STM32F4xx ARM(R) Cortex(TM)-M4 MCU */
diff --git a/Src/Target/Stm32f446re/Mcal/mcal.cpp b/Src/Target/stm32f446re/Mcal/mcal.cpp
similarity index 97%
rename from Src/Target/Stm32f446re/Mcal/mcal.cpp
rename to Src/Target/stm32f446re/Mcal/mcal.cpp
index 8d67843..b3355b9 100644
--- a/Src/Target/Stm32f446re/Mcal/mcal.cpp
+++ b/Src/Target/stm32f446re/Mcal/mcal.cpp
@@ -2,7 +2,7 @@
#include
#include
-#include
+#include
namespace local
{
diff --git a/Src/Target/Stm32f446re/Mcal/mcal.h b/Src/Target/stm32f446re/Mcal/mcal.h
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal.h
rename to Src/Target/stm32f446re/Mcal/mcal.h
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_cpu.cpp b/Src/Target/stm32f446re/Mcal/mcal_cpu.cpp
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal_cpu.cpp
rename to Src/Target/stm32f446re/Mcal/mcal_cpu.cpp
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_cpu.h b/Src/Target/stm32f446re/Mcal/mcal_cpu.h
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal_cpu.h
rename to Src/Target/stm32f446re/Mcal/mcal_cpu.h
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_gpt.cpp b/Src/Target/stm32f446re/Mcal/mcal_gpt.cpp
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal_gpt.cpp
rename to Src/Target/stm32f446re/Mcal/mcal_gpt.cpp
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_gpt.h b/Src/Target/stm32f446re/Mcal/mcal_gpt.h
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal_gpt.h
rename to Src/Target/stm32f446re/Mcal/mcal_gpt.h
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_gpt_arm_sys_tick.h b/Src/Target/stm32f446re/Mcal/mcal_gpt_arm_sys_tick.h
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal_gpt_arm_sys_tick.h
rename to Src/Target/stm32f446re/Mcal/mcal_gpt_arm_sys_tick.h
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_osc.cpp b/Src/Target/stm32f446re/Mcal/mcal_osc.cpp
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal_osc.cpp
rename to Src/Target/stm32f446re/Mcal/mcal_osc.cpp
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_osc.h b/Src/Target/stm32f446re/Mcal/mcal_osc.h
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal_osc.h
rename to Src/Target/stm32f446re/Mcal/mcal_osc.h
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_osc_detail.cpp b/Src/Target/stm32f446re/Mcal/mcal_osc_detail.cpp
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal_osc_detail.cpp
rename to Src/Target/stm32f446re/Mcal/mcal_osc_detail.cpp
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_osc_detail.h b/Src/Target/stm32f446re/Mcal/mcal_osc_detail.h
similarity index 97%
rename from Src/Target/Stm32f446re/Mcal/mcal_osc_detail.h
rename to Src/Target/stm32f446re/Mcal/mcal_osc_detail.h
index 6702576..4a2b47c 100644
--- a/Src/Target/Stm32f446re/Mcal/mcal_osc_detail.h
+++ b/Src/Target/stm32f446re/Mcal/mcal_osc_detail.h
@@ -10,7 +10,7 @@
#include
#include
- #include
+ #include
namespace mcal
{
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_reg.h b/Src/Target/stm32f446re/Mcal/mcal_reg.h
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal_reg.h
rename to Src/Target/stm32f446re/Mcal/mcal_reg.h
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_reg_access_dynamic.h b/Src/Target/stm32f446re/Mcal/mcal_reg_access_dynamic.h
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal_reg_access_dynamic.h
rename to Src/Target/stm32f446re/Mcal/mcal_reg_access_dynamic.h
diff --git a/Src/Target/Stm32f446re/Mcal/mcal_reg_access_static.h b/Src/Target/stm32f446re/Mcal/mcal_reg_access_static.h
similarity index 100%
rename from Src/Target/Stm32f446re/Mcal/mcal_reg_access_static.h
rename to Src/Target/stm32f446re/Mcal/mcal_reg_access_static.h
diff --git a/Src/Target/Stm32f446re/Startup/crt0.cpp b/Src/Target/stm32f446re/Startup/crt0.cpp
similarity index 100%
rename from Src/Target/Stm32f446re/Startup/crt0.cpp
rename to Src/Target/stm32f446re/Startup/crt0.cpp
diff --git a/Src/Target/Stm32f446re/Startup/crt0_init_ram.cpp b/Src/Target/stm32f446re/Startup/crt0_init_ram.cpp
similarity index 100%
rename from Src/Target/Stm32f446re/Startup/crt0_init_ram.cpp
rename to Src/Target/stm32f446re/Startup/crt0_init_ram.cpp
diff --git a/Src/Target/Stm32f446re/Startup/crt1.cpp b/Src/Target/stm32f446re/Startup/crt1.cpp
similarity index 100%
rename from Src/Target/Stm32f446re/Startup/crt1.cpp
rename to Src/Target/stm32f446re/Startup/crt1.cpp
diff --git a/Src/Target/Stm32f446re/Startup/int_vect.cpp b/Src/Target/stm32f446re/Startup/int_vect.cpp
similarity index 100%
rename from Src/Target/Stm32f446re/Startup/int_vect.cpp
rename to Src/Target/stm32f446re/Startup/int_vect.cpp
diff --git a/Src/Target/Stm32f446re/Startup/mcal_gcc_cxx_completion.cpp b/Src/Target/stm32f446re/Startup/mcal_gcc_cxx_completion.cpp
similarity index 100%
rename from Src/Target/Stm32f446re/Startup/mcal_gcc_cxx_completion.cpp
rename to Src/Target/stm32f446re/Startup/mcal_gcc_cxx_completion.cpp
diff --git a/Src/Target/stm32l432kc/Make/make_stm32l432kc.gmk b/Src/Target/stm32l432kc/Make/make_stm32l432kc.gmk
new file mode 100644
index 0000000..7f412db
--- /dev/null
+++ b/Src/Target/stm32l432kc/Make/make_stm32l432kc.gmk
@@ -0,0 +1,210 @@
+#------------------------------------------------------------------------------
+# Copyright Iliass Mahjoub 2023.
+# Copyright Christopher Kormanyos 1995 - 2023.
+# 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)
+#------------------------------------------------------------------------------
+
+
+#------------------------------------------------------------------------------
+# Paths and tools
+#------------------------------------------------------------------------------
+
+PATH_MAKE = $(CURDIR)/../../Src/Target/stm32l432kc/Make
+PATH_SRC = $(CURDIR)/../../Src
+PATH_TARGET = $(PATH_SRC)/Target/stm32l432kc
+PATH_TMP = $(CURDIR)/../Tmp/stm32l432kc_x64
+PATH_BIN = $(CURDIR)/../Bin/stm32l432kc_x64
+PATH_OBJ = $(PATH_TMP)/Obj
+
+
+ifeq ($(TYP_OS),win)
+
+PATH_TOOLS = $(CURDIR)/../tools
+PATH_TOOLS_UTIL = $(PATH_TOOLS)/util
+PATH_TOOLS_GCC = $(PATH_TOOLS)/gcc/gcc-11.2.0-arm-none-eabi/bin
+
+
+CC = $(PATH_TOOLS_GCC)/arm-none-eabi-g++.exe
+OBJCOPY = $(PATH_TOOLS_GCC)/arm-none-eabi-objcopy.exe
+OBJDUMP = $(PATH_TOOLS_GCC)/arm-none-eabi-objdump.exe
+READELF = $(PATH_TOOLS_GCC)/arm-none-eabi-readelf.exe
+
+ECHO = $(PATH_TOOLS_UTIL)/bin/echo.exe
+MAKE = $(PATH_TOOLS_UTIL)/bin/make.exe
+MKDIR = $(PATH_TOOLS_UTIL)/bin/mkdir.exe
+RM = $(PATH_TOOLS_UTIL)/bin/rm.exe
+SED = $(PATH_TOOLS_UTIL)/bin/sed.exe
+
+MY_NUL := NUL
+
+endif
+
+ifeq ($(TYP_OS),unix)
+
+CC = arm-none-eabi-g++
+OBJCOPY = arm-none-eabi-objcopy
+OBJDUMP = arm-none-eabi-objdump
+READELF = arm-none-eabi-readelf
+
+MAKE = make
+ECHO = echo
+RM = rm
+MKDIR = mkdir
+SED = sed
+
+MY_NUL := /dev/null
+
+endif
+
+#------------------------------------------------------------------------------
+# Toolchain flags
+#------------------------------------------------------------------------------
+
+WFLAGS = -Wall \
+ -Wextra \
+ -Wpedantic \
+ -Wmain \
+ -Wundef \
+ -Wconversion \
+ -Wsign-conversion \
+ -Wunused-parameter \
+ -Wuninitialized \
+ -Wmissing-declarations \
+ -Wshadow \
+ -Wunreachable-code \
+ -Wswitch-default \
+ -Wswitch-enum \
+ -Wcast-align \
+ -Wmissing-include-dirs \
+ -Winit-self \
+ -Wfloat-equal \
+ -Wdouble-promotion \
+ -Wno-comment
+
+C_INCLUDES = -I$(PATH_SRC) \
+ -I$(PATH_TARGET)
+
+C_DEFINES = -DSTM32F446xx
+
+CFLAGS_BASE = $(WFLAGS) \
+ -mcpu=cortex-m4 \
+ -mtune=cortex-m4 \
+ -mthumb \
+ -mfloat-abi=hard \
+ -mfpu=fpv4-sp-d16 \
+ -ffast-math \
+ -mno-unaligned-access \
+ -mno-long-calls \
+ -ffast-math \
+ -fno-inline-functions \
+ -g \
+ -gdwarf-2 \
+ -fno-exceptions \
+ -ffunction-sections \
+ -fdata-sections \
+ -MMD -MF $(PATH_OBJ)/$(basename $(@F)).d \
+ $(C_INCLUDES) \
+ $(C_DEFINES)
+
+
+CFLAGS = -O0 \
+ -std=c2x \
+ $(CFLAGS_BASE)
+
+CPPFLAGS = -O2 \
+ -std=c++20 \
+ $(CFLAGS_BASE) \
+ -fno-rtti \
+ -fno-use-cxa-atexit \
+ -fno-nonansi-builtins \
+ -fno-threadsafe-statics \
+ -fno-enforce-eh-specs \
+ -ftemplate-depth=128 \
+ -Wzero-as-null-pointer-constant
+
+
+LDFLAGS = $(CPPFLAGS) \
+ -nostdlib \
+ -nostartfiles \
+ -specs=nano.specs \
+ -specs=nosys.specs \
+ -T $(PATH_MAKE)/stm32l432kc.ld \
+ -Wl,--print-memory-usage \
+ -Wl,-Map,$(PATH_BIN)/stm32l432kc.map
+
+
+#------------------------------------------------------------------------------
+# Source files
+#------------------------------------------------------------------------------
+
+SRC_FILES = $(PATH_SRC)/App/C/App \
+ $(PATH_TARGET)/Mcal/Gpt \
+ $(PATH_TARGET)/Mcal/Mcu \
+ $(PATH_TARGET)/Mcal/SysTick \
+ $(PATH_TARGET)/Startup/IntVect \
+ $(PATH_TARGET)/Startup/SysStartup
+
+
+
+
+#------------------------------------------------------------------------------
+# Dependencies and targets
+#------------------------------------------------------------------------------
+
+VPATH := $(subst \,/,$(sort $(dir $(SRC_FILES)) $(PATH_OBJ)))
+
+FILES_O := $(addprefix $(PATH_OBJ)/, $(notdir $(addsuffix .o, $(SRC_FILES))))
+
+#------------------------------------------------------------------------------
+# Build targets
+#------------------------------------------------------------------------------
+
+all : clean_all print_version $(PATH_BIN)/stm32l432kc.elf
+
+.PHONY : clean_all
+clean_all :
+ @-$(ECHO) +++ cleaning all
+ @-$(MKDIR) -p $(PATH_BIN)
+ @-$(MKDIR) -p $(PATH_OBJ)
+ @-$(RM) -r $(PATH_BIN) 2>$(MY_NUL)
+ @-$(RM) -r $(PATH_OBJ) 2>$(MY_NUL)
+ @-$(MKDIR) -p $(PATH_BIN)
+ @-$(MKDIR) -p $(PATH_OBJ)
+ @-$(ECHO)
+
+.PHONY : print_version
+print_version :
+ @$(ECHO) +++ print GNUmake version
+ @$(MAKE) --version
+ @$(ECHO)
+ @$(ECHO) +++ print GCC version
+ @$(CC) -v
+ @$(ECHO)
+
+$(PATH_BIN)/stm32l432kc.elf : $(FILES_O)
+ @-$(ECHO)
+ @-$(ECHO) +++ linking application to absolute object file $(PATH_BIN)/stm32l432kc.elf
+ @-$(CC) -x none $(LDFLAGS) $(FILES_O) -o $(PATH_BIN)/stm32l432kc.elf
+ @-$(ECHO)
+ @-$(ECHO) +++ create HEX-file $(PATH_BIN)/stm32l432kc.hex
+ @-$(OBJCOPY) $(PATH_BIN)/stm32l432kc.elf -O ihex $(PATH_BIN)/stm32l432kc.hex
+ @-$(ECHO) +++ create list file $(PATH_BIN)/stm32l432kc.list
+ @-$(OBJDUMP) $(PATH_BIN)/stm32l432kc.elf -d > $(PATH_BIN)/stm32l432kc.list
+ @-$(ECHO) +++ create symbols with readelf in $(PATH_BIN)/stm32l432kc.readelf
+ @-$(READELF) $(PATH_BIN)/stm32l432kc.elf -a > $(PATH_BIN)/stm32l432kc.readelf
+
+#------------------------------------------------------------------------------
+# Pattern rules
+#------------------------------------------------------------------------------
+
+$(PATH_OBJ)/%.o : %.c
+ @-$(ECHO) +++ compile: $(subst \,/,$<) to $(subst \,/,$@)
+ @-$(CC) -x c -std=c11 $(CFLAGS) -c $< -o $(PATH_OBJ)/$(basename $(@F)).o 2> $(PATH_OBJ)/$(basename $(@F)).err
+ @-$(SED) -e 's|.h:\([0-9]*\),|.h(\1) :|' -e 's|:\([0-9]*\):|(\1) :|' $(PATH_OBJ)/$(basename $(@F)).err
+
+$(PATH_OBJ)/%.o : %.cpp
+ @-$(ECHO) +++ compile: $(subst \,/,$<) to $(subst \,/,$@)
+ @-$(CC) -x c++ -std=c++2a $(CPPFLAGS) -c $< -o $(PATH_OBJ)/$(basename $(@F)).o 2> $(PATH_OBJ)/$(basename $(@F)).err
+ @-$(SED) -e 's|.h:\([0-9]*\),|.h(\1) :|' -e 's|:\([0-9]*\):|(\1) :|' $(PATH_OBJ)/$(basename $(@F)).err
diff --git a/Src/Target/stm32l432kc/Make/stm32l432kc.ld b/Src/Target/stm32l432kc/Make/stm32l432kc.ld
new file mode 100644
index 0000000..3e97060
--- /dev/null
+++ b/Src/Target/stm32l432kc/Make/stm32l432kc.ld
@@ -0,0 +1,160 @@
+/*
+******************************************************************************
+**
+** Copyright Iliass Mahjoub 2023 - 2024.
+** Copyright Christopher Kormanyos 2007 - 2024.
+**
+** 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)
+**
+******************************************************************************
+*/
+
+/* Entry Point */
+ENTRY(__my_startup)
+
+/* Highest address of the user mode stack */
+__initial_stack_pointer = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
+
+_Min_Heap_Size = 0x08; /* required amount of heap */
+_Min_Stack_Size = 0x10; /* required amount of stack */
+
+/* Memories definition */
+MEMORY
+{
+ RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
+ ROM (rx) : ORIGIN = 0x08000000, LENGTH = 256K
+}
+
+/* Sections */
+SECTIONS
+{
+ /* The startup code into "ROM" Rom type memory */
+ .isr_vector :
+ {
+ . = ALIGN(4);
+ KEEP(*(.isr_vector)) /* Startup code */
+ . = ALIGN(4);
+ } > ROM
+
+ /* The program code and other data into "ROM" Rom type memory */
+ .text :
+ {
+ _ctors_begin = .;
+ KEEP(*(SORT(.init_array.*)))
+ KEEP(*(.init_array*))
+ _ctors_end = .;
+ . = ALIGN(4);
+ *(.text) /* .text sections (code) */
+ *(.text*) /* .text* sections (code) */
+ *(.glue_7) /* glue arm to thumb code */
+ *(.glue_7t) /* glue thumb to arm code */
+ *(.eh_frame)
+
+ KEEP (*(.init))
+ KEEP (*(.fini))
+
+ . = ALIGN(4);
+ _etext = .; /* define a global symbols at end of code */
+ } > ROM
+
+ /* Constant data into "ROM" Rom type memory */
+ .rodata :
+ {
+ . = ALIGN(4);
+ *(.rodata) /* .rodata sections (constants, strings, etc.) */
+ *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
+ . = ALIGN(4);
+ } > ROM
+
+ .ARM.extab : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
+ {
+ . = ALIGN(4);
+ *(.ARM.extab* .gnu.linkonce.armextab.*)
+ . = ALIGN(4);
+ } > ROM
+
+ .ARM : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
+ {
+ . = ALIGN(4);
+ __exidx_start = .;
+ *(.ARM.exidx*)
+ __exidx_end = .;
+ . = ALIGN(4);
+ } > ROM
+
+ .preinit_array : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
+ {
+ . = ALIGN(4);
+ PROVIDE_HIDDEN (__preinit_array_start = .);
+ KEEP (*(.preinit_array*))
+ PROVIDE_HIDDEN (__preinit_array_end = .);
+ . = ALIGN(4);
+ } > ROM
+
+ .init_array : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
+ {
+ . = ALIGN(4);
+ PROVIDE_HIDDEN (__init_array_start = .);
+ KEEP (*(SORT(.init_array.*)))
+ KEEP (*(.init_array*))
+ PROVIDE_HIDDEN (__init_array_end = .);
+ . = ALIGN(4);
+ } > ROM
+
+ .fini_array : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */
+ {
+ . = ALIGN(4);
+ PROVIDE_HIDDEN (__fini_array_start = .);
+ KEEP (*(SORT(.fini_array.*)))
+ KEEP (*(.fini_array*))
+ PROVIDE_HIDDEN (__fini_array_end = .);
+ . = ALIGN(4);
+ } > ROM
+
+ /* Used by the startup to initialize data */
+ _ldata = LOADADDR(.data);
+
+ /* Initialized data sections into "RAM" Ram type memory */
+ .data :
+ {
+ . = ALIGN(4);
+ _sdata = .; /* create a global symbol at data start */
+ *(.data) /* .data sections */
+ *(.data*) /* .data* sections */
+
+ . = ALIGN(4);
+ _edata = .; /* define a global symbol at data end */
+
+ } >RAM AT> ROM
+
+ /* Uninitialized data section into "RAM" Ram type memory */
+ . = ALIGN(4);
+ .bss :
+ {
+ /* This is used by the startup in order to initialize the .bss section */
+ _sbss = .; /* define a global symbol at bss start */
+ __bss_start__ = _sbss;
+ *(.bss)
+ *(.bss*)
+ *(COMMON)
+
+ . = ALIGN(4);
+ _ebss = .; /* define a global symbol at bss end */
+ __bss_end__ = _ebss;
+ } >RAM
+
+ /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
+ ._user_heap_stack :
+ {
+ . = ALIGN(8);
+ PROVIDE ( end = . );
+ PROVIDE ( _end = . );
+ . = . + _Min_Heap_Size;
+ . = . + _Min_Stack_Size;
+ . = ALIGN(8);
+ } >RAM
+
+ .ARM.attributes 0 : { *(.ARM.attributes) }
+}
diff --git a/Src/Target/stm32l432kc/Mcal/Gpt.c b/Src/Target/stm32l432kc/Mcal/Gpt.c
new file mode 100644
index 0000000..b3d4813
--- /dev/null
+++ b/Src/Target/stm32l432kc/Mcal/Gpt.c
@@ -0,0 +1,39 @@
+#include
+
+static volatile Gpt_ValueType my_millisec_counter;
+
+Gpt_ValueType Gpt_GetTimeElapsed(const Gpt_ChannelType DummyChannelIndex)
+{
+ (void) DummyChannelIndex;
+
+ volatile Gpt_ValueType Counter01;
+ volatile Gpt_ValueType Counter02;
+
+ uint32_t LowPart01;
+ uint32_t LowPart02;
+
+ do
+ {
+ // Here we need a consistency check for reading the
+ // 64-bit counter value on a 32-bit architecture.
+
+ // Note: This is because the 64-bit counter is incremented
+ // in interrupt level of SysTick.
+
+ Counter01 = my_millisec_counter;
+ Counter02 = my_millisec_counter;
+
+ LowPart01 = (uint32_t) Counter01;
+ LowPart02 = (uint32_t) Counter02;
+ }
+ while(LowPart01 > LowPart02);
+
+ return Counter02;
+}
+
+void SysTick_Handler(void);
+
+void SysTick_Handler(void)
+{
+ ++my_millisec_counter;
+}
diff --git a/Src/Target/stm32l432kc/Mcal/Gpt.h b/Src/Target/stm32l432kc/Mcal/Gpt.h
new file mode 100644
index 0000000..b03ee9b
--- /dev/null
+++ b/Src/Target/stm32l432kc/Mcal/Gpt.h
@@ -0,0 +1,11 @@
+#ifndef GPT_2023_08_23_H
+ #define GPT_2023_08_23_H
+
+ #include
+
+ typedef uint64_t Gpt_ValueType;
+ typedef uint8_t Gpt_ChannelType;
+
+ Gpt_ValueType Gpt_GetTimeElapsed(const Gpt_ChannelType DummyChannelIndex);
+
+#endif /* GPT_2023_08_23_H */
diff --git a/Src/Target/stm32l432kc/Mcal/Mcal.cpp b/Src/Target/stm32l432kc/Mcal/Mcal.cpp
new file mode 100644
index 0000000..43cfb7c
--- /dev/null
+++ b/Src/Target/stm32l432kc/Mcal/Mcal.cpp
@@ -0,0 +1,49 @@
+#include
+#include
+#include
+
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+ void mcal_init(void)
+ {
+ /* Configure the System clock and flash */
+ SystemInit();
+ SetSysClock();
+
+ /* Configure systick timer.*/
+ SysTick_Init();
+
+ /* Initialize the ports. */
+ /* Enable the clock for GPIOB */
+ RCC_AHB2ENR |= (1U << 1U);
+
+ /* Configure GPIOB Pin 3 as output */
+ GPIOB_MODER |= (1U << 6U);
+ GPIOB_MODER &= ~(1U << 7U);
+
+ /* Switch on the LED.*/
+ GPIOB_ODR |= (uint32_t)(1UL << 3U);
+
+ /* Set the next timer timeout to be 1s later, */
+ /* Toggling will be sequentially carried out in the task. */
+ TaskTimer01 = TimerStart(1000U);
+ }
+
+ void mcal_led_toggle(void)
+ {
+ if (TimerTimeout(TaskTimer01))
+ {
+ TaskTimer01 = TimerStart(1000U);
+
+ /* Toggle the LED pin */
+ GPIOB_ODR ^= (1U << 3U);
+ }
+ }
+
+#if defined(__cplusplus)
+}
+#endif
diff --git a/Src/Target/stm32l432kc/Mcal/Mcal.h b/Src/Target/stm32l432kc/Mcal/Mcal.h
new file mode 100644
index 0000000..2130b30
--- /dev/null
+++ b/Src/Target/stm32l432kc/Mcal/Mcal.h
@@ -0,0 +1,17 @@
+#ifndef MCAL_2024_07_31_H
+#define MCAL_2024_07_31_H
+
+#if defined(__cplusplus)
+extern "C"
+{
+#endif
+
+ void mcal_init(void);
+
+ void mcal_led_toggle(void);
+
+#if defined(__cplusplus)
+}
+#endif
+
+#endif // MCAL_2024_07_31_H
diff --git a/Src/Target/stm32l432kc/Mcal/Mcu.c b/Src/Target/stm32l432kc/Mcal/Mcu.c
new file mode 100644
index 0000000..ac836ec
--- /dev/null
+++ b/Src/Target/stm32l432kc/Mcal/Mcu.c
@@ -0,0 +1,79 @@
+#include
+#include
+
+
+void SystemInit(void)
+{
+ /* Set coprocessor access control register CP10 and CP11 Full Access (Enable floating point unit) */
+ SCB_CPACR |= (uint32_t)((uint32_t)(3UL << 20U) | (uint32_t)(3UL << 22U));
+
+ /* Reset HSEON, CSSON, HSEBYP and PLLON bits */
+ RCC_CR &= (uint32_t)((~(1UL << 16)) | (~(1UL << 18))) | (~(1UL << 19)) | (~(1UL << 24));
+
+ /* Reset CFGR register */
+ RCC_CFGR = (uint32_t)0x40000000UL;
+
+ /* Reset PLLCFGR register */
+ RCC_PLLCFGR = (uint32_t)0x00001000UL;
+
+ /* Disable all interrupts */
+ RCC_CIER = (uint32_t)0x00000000UL;
+
+ /* Configure Flash prefetch, Instruction cache, Data cache and wait state (3 wait states) */
+ FLASH_ACR = (uint32_t)((1UL << 9) | (1UL << 10) | (3UL << 0));
+}
+
+void SetSysClock(void)
+{
+ /* Set HSION (HSI16 clock enable) enable bit */
+ RCC_CR |= (uint32_t)(1UL << 8U);
+
+ /* wait until HSI16 clock is ready */
+ while (!(RCC_CR & (uint32_t)(1UL << 10UL)))
+ {
+ __asm volatile("nop");
+ }
+
+ /* PWREN: Power interface clock enable */
+ RCC_APB1ENR1 |= (uint32_t)(1UL << 28);
+
+ /* Enable main PLL */
+ RCC_CR &= (uint32_t)(~(uint32_t)(1UL << 24));
+
+ /* Wait until main PLL is enabled */
+ while (RCC_CR & (uint32_t)(1UL << 25))
+ {
+ __asm volatile("nop");
+ }
+
+ /* PLL configuration for 80MHz system clock from 16MHz HSI */
+ /* f(VCO clock) = 16MHz * (40 / 4) = 160MHz */
+ /* f(System Clock) = f(VCO clock) / PLLR = 80MHz */
+
+ RCC_PLLCFGR = (uint32_t)((2UL << 0U) /* Set PLL source to HSI */
+ | (3UL << 4U) /* Set PLLM to 4 */
+ | (40UL << 8U) /* Set PLLN to 40 */
+ | (0UL << 25U)); /* Set PLLR to 2 */
+
+ /* Enable Main PLLCLK output for the system clock */
+ RCC_PLLCFGR |= (uint32_t)(1UL << 24);
+
+ /* Enable main PLL */
+ RCC_CR |= (uint32_t)(1UL << 24);
+
+ /* Wait until main PLL is enabled */
+ while (!(RCC_CR & (uint32_t)(1UL << 25)))
+ {
+ __asm volatile("nop");
+ }
+
+ /* Select PLL as system clock source */
+ RCC_CFGR &= (uint32_t)(~(3UL << 0));
+ RCC_CFGR |= (uint32_t)(3UL << 0U);
+
+ /* Wait till the main PLL is used as system clock source */
+ while ((RCC_CFGR & (uint32_t)(0x0CU << 0)) != (0x0CU << 0))
+ {
+ __asm volatile("nop");
+ }
+}
diff --git a/Src/Target/stm32l432kc/Mcal/Mcu.h b/Src/Target/stm32l432kc/Mcal/Mcu.h
new file mode 100644
index 0000000..1c595c5
--- /dev/null
+++ b/Src/Target/stm32l432kc/Mcal/Mcu.h
@@ -0,0 +1,9 @@
+#ifndef MCU_2023_08_19_H
+ #define MCU_2023_08_19_H
+
+ #include
+
+ void SystemInit(void);
+ void SetSysClock(void);
+
+#endif /* MCU_2023_08_19_H */
diff --git a/Src/Target/stm32l432kc/Mcal/Reg.h b/Src/Target/stm32l432kc/Mcal/Reg.h
new file mode 100644
index 0000000..b713c86
--- /dev/null
+++ b/Src/Target/stm32l432kc/Mcal/Reg.h
@@ -0,0 +1,68 @@
+#ifndef REG_2023_08_26_H
+ #define REG_2023_08_26_H
+
+ #include
+
+ /* ----------------------------------------------------------------------------------- */
+ /* Types definition */
+ /* ----------------------------------------------------------------------------------- */
+
+ /* ----------------------------------------------------------------------------------- */
+ /* Macros */
+ /* ----------------------------------------------------------------------------------- */
+
+ /* System Control Space Base Address */
+ #define SCS_BASE (0xE000E000UL)
+
+ /* Core peripherals */
+ #define STK_BASE ((SCS_BASE + 0x0010UL))
+ #define NVIC_BASE ((SCS_BASE + 0x0100UL))
+ #define SCB_BASE ((SCS_BASE + 0x0D00UL))
+
+ /* SCB registers */
+ #define SCB_CPACR (*(volatile uint32_t*)(SCB_BASE + 0x88UL))
+
+ /* SysTick registers */
+ #define STK_CTRL (*(volatile uint32_t*)(STK_BASE + 0x00UL))
+ #define STK_LOAD (*(volatile uint32_t*)(STK_BASE + 0x04UL))
+ #define STK_VAL (*(volatile uint32_t*)(STK_BASE + 0x08UL))
+
+ /* Base addresses for peripheral registers */
+ #define RCC_BASE 0x40021000UL
+ #define PWR_BASE 0x40007000UL
+ #define FLASH_BASE 0x40022000UL
+ #define GPIOB_BASE 0x48000400UL
+
+ /* FLASH registers */
+ #define FLASH_ACR (*(volatile uint32_t*)(FLASH_BASE + 0x000UL))
+
+ /* PWR registers */
+ #define PWR_CR1 (*(volatile uint32_t*)(PWR_BASE + 0x000UL))
+ #define PWR_SR2 (*(volatile uint32_t*)(PWR_BASE + 0x014UL))
+
+
+
+ /* RCC Registers */
+ #define RCC_CR (*(volatile uint32_t*)(RCC_BASE + 0x00UL))
+ #define RCC_ICSCR (*(volatile uint32_t*)(RCC_BASE + 0x04UL))
+ #define RCC_CFGR (*(volatile uint32_t*)(RCC_BASE + 0x08UL))
+ #define RCC_PLLCFGR (*(volatile uint32_t*)(RCC_BASE + 0x0CUL))
+ #define RCC_CIER (*(volatile uint32_t*)(RCC_BASE + 0x18UL))
+ #define RCC_AHB1ENR (*(volatile uint32_t*)(RCC_BASE + 0x48UL))
+ #define RCC_AHB2ENR (*(volatile uint32_t*)(RCC_BASE + 0x4CUL))
+ #define RCC_APB1ENR1 (*(volatile uint32_t*)(RCC_BASE + 0x58UL))
+ #define RCC_APB1ENR2 (*(volatile uint32_t*)(RCC_BASE + 0x5CUL))
+ #define RCC_APB2ENR (*(volatile uint32_t*)(RCC_BASE + 0x60UL))
+
+ /* GPIOB registers */
+ #define GPIOB_MODER (*(volatile uint32_t*)(GPIOB_BASE + 0x00UL))
+ #define GPIOB_OTYPER (*(volatile uint32_t*)(GPIOB_BASE + 0x04UL))
+ #define GPIOB_OSPEEDR (*(volatile uint32_t*)(GPIOB_BASE + 0x08UL))
+ #define GPIOB_PUPDR (*(volatile uint32_t*)(GPIOB_BASE + 0x0CUL))
+ #define GPIOB_ODR (*(volatile uint32_t*)(GPIOB_BASE + 0x14UL))
+ #define GPIOB_AFRL (*(volatile uint32_t*)(GPIOB_BASE + 0x20UL))
+ #define GPIOB_AFRH (*(volatile uint32_t*)(GPIOB_BASE + 0x24UL))
+
+
+
+#endif /* REG_2023_08_26_H */
diff --git a/Src/Target/stm32l432kc/Mcal/SysTick.c b/Src/Target/stm32l432kc/Mcal/SysTick.c
new file mode 100644
index 0000000..9d2fff0
--- /dev/null
+++ b/Src/Target/stm32l432kc/Mcal/SysTick.c
@@ -0,0 +1,24 @@
+#include
+#include
+#include
+
+void SysTick_Init(void)
+{
+ /* Reset the SysTick control register */
+ STK_CTRL = (uint32_t)0x00000000UL;
+
+ /* Set the SysTick reload register to be equivalent to 1ms */
+ STK_LOAD = (uint32_t)(79999UL); /* we operate with 80Mhz */
+
+ /* Initialize the SysTick counter value (clear it to zero) */
+ STK_VAL = (uint32_t)0x00000000UL;
+
+ /* Set the SysTicl clock source to be the main processor clock */
+ STK_CTRL = (uint32_t)0x00000004UL;
+
+ /* Enable the SysTick interrupt */
+ STK_CTRL |= (uint32_t)(2UL);
+
+ /* Enable the SysTick counter */
+ STK_CTRL |= (uint32_t)(1UL << 0);
+}
diff --git a/Src/Target/stm32l432kc/Mcal/SysTick.h b/Src/Target/stm32l432kc/Mcal/SysTick.h
new file mode 100644
index 0000000..7aeb3de
--- /dev/null
+++ b/Src/Target/stm32l432kc/Mcal/SysTick.h
@@ -0,0 +1,6 @@
+#ifndef SYSTICK_2023_08_24_H
+ #define SYSTICK_2023_08_24_H
+
+ void SysTick_Init(void);
+
+#endif /* SYSTICK_2023_08_24_H */
diff --git a/Src/Target/stm32l432kc/Mcal/mcal_gpt.cpp b/Src/Target/stm32l432kc/Mcal/mcal_gpt.cpp
new file mode 100644
index 0000000..ffc85e4
--- /dev/null
+++ b/Src/Target/stm32l432kc/Mcal/mcal_gpt.cpp
@@ -0,0 +1,15 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2007 - 2023.
+// 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)
+//
+
+#include
+#include
+
+extern "C"
+void __sys_tick_handler(void)
+{
+ SysTick_Init();
+}
diff --git a/Src/Target/stm32l432kc/Mcal/mcal_gpt.h b/Src/Target/stm32l432kc/Mcal/mcal_gpt.h
new file mode 100644
index 0000000..e5a7cce
--- /dev/null
+++ b/Src/Target/stm32l432kc/Mcal/mcal_gpt.h
@@ -0,0 +1,52 @@
+///////////////////////////////////////////////////////////////////////////////
+// Copyright Christopher Kormanyos 2007 - 2023.
+// 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)
+//
+
+#ifndef MCAL_GPT_2011_10_20_H
+ #define MCAL_GPT_2011_10_20_H
+
+ #if defined(__cplusplus)
+ extern "C"
+ {
+ #endif
+
+ #include
+
+ #include
+ #include
+
+ // Forward declaration of the util::timer template class.
+ namespace util
+ {
+ template
+ class timer;
+ }
+
+ namespace mcal
+ {
+ namespace gpt
+ {
+ using arm_sys_tick_type = arm_sys_tick(UINT16_C(168))>;
+
+ using config_type = void;
+ using value_type = typename arm_sys_tick_type::value_type;
+
+ inline auto init(const config_type*) noexcept -> void;
+
+ struct secure final
+ {
+ static auto get_time_elapsed() -> value_type { return static_cast(arm_sys_tick_type::get_time_elapsed()); }
+ };
+ }
+ }
+
+ inline auto mcal::gpt::init(const config_type*) noexcept -> void { SysTick_Init(); }
+
+ #if defined(__cplusplus)
+ }
+ #endif
+
+#endif // MCAL_GPT_2011_10_20_H
diff --git a/Src/Target/stm32l432kc/Startup/IntVect.c b/Src/Target/stm32l432kc/Startup/IntVect.c
new file mode 100644
index 0000000..5e6e147
--- /dev/null
+++ b/Src/Target/stm32l432kc/Startup/IntVect.c
@@ -0,0 +1,268 @@
+/* Stack size */
+#define STACK_SIZE 0x00000400
+
+
+/* ----------------------------------------------------------------------------------- */
+/* Extern functions */
+/* ----------------------------------------------------------------------------------- */
+extern void __my_startup (void);
+extern void __initial_stack_pointer(void);
+
+/* ----------------------------------------------------------------------------------- */
+/* Functions prototype */
+/* ----------------------------------------------------------------------------------- */
+static void Undefined_Handler (void);
+
+void Reset_Handler (void) __attribute__((weak, alias("Undefined_Handler")));
+void NMI_Handler (void) __attribute__((weak, alias("Undefined_Handler")));
+void HardFault_Handler (void) __attribute__((weak, alias("Undefined_Handler")));
+void MemManage_Handler (void) __attribute__((weak, alias("Undefined_Handler")));
+void BusFault_Handler (void) __attribute__((weak, alias("Undefined_Handler")));
+void UsageFault_Handler (void) __attribute__((weak, alias("Undefined_Handler")));
+void SVC_Handler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DebugMon_Handler (void) __attribute__((weak, alias("Undefined_Handler")));
+void PendSV_Handler (void) __attribute__((weak, alias("Undefined_Handler")));
+void SysTick_Handler (void) __attribute__((weak, alias("Undefined_Handler")));
+void WWDG_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void PVD_PVM_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void TAMP_STAMP_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void RTC_WKUP_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void FLASH_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void RCC_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void EXTI0_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void EXTI1_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void EXTI2_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void EXTI3_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void EXTI4_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA1_Channel1_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA1_Channel2_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA1_Channel3_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA1_Channel4_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA1_Channel5_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA1_Channel6_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA1_Channel7_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void ADC1_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void CAN1_TX_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void CAN1_RX0_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void CAN1_RX1_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void CAN1_SCE_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void EXTI9_5_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void TIM1_BRK_TIM15_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void TIM1_UP_TIM16_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void TIM1_TRG_COM_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void TIM1_CC_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void TIM2_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void I2C1_EV_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void I2C1_ER_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void SPI1_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void USART1_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void USART2_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void EXTI15_10_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void RTC_Alarm_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void SPI3_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void TIM6_DAC_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void TIM7_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA2_Channel1_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA2_Channel2_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA2_Channel3_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA2_Channel4_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA2_Channel5_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void COMP_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void LPTIM1_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void LPTIM2_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void USB_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA2_Channel6_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void DMA2_Channel7_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void LPUART1_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void QUADSPI_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void I2C3_EV_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void I2C3_ER_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void SAI1_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void SWPMI1_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void TSC_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void RNG_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void FPU_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+void CRS_IRQHandler (void) __attribute__((weak, alias("Undefined_Handler")));
+
+/* ----------------------------------------------------------------------------------- */
+/* Functions defintion */
+/* ----------------------------------------------------------------------------------- */
+static void Undefined_Handler(void)
+{
+ while(1) { __asm("NOP"); }
+}
+
+
+/* ----------------------------------------------------------------------------------- */
+/* Types definition */
+/* ----------------------------------------------------------------------------------- */
+typedef void (*isr_type)(void);
+
+
+const volatile isr_type __isr_vector[] __attribute__ ((section(".isr_vector"))) =
+{
+ /* --------- Cortex-M4 Processor Exceptions ----------------------------------- */
+ __initial_stack_pointer, /* The initial stack pointer */
+ __my_startup, /* Reset Handler */
+ NMI_Handler, /* NMI Handler */
+ HardFault_Handler, /* Hard Fault Handler */
+ MemManage_Handler, /* MPU Fault Handler */
+ BusFault_Handler, /* Bus Fault Handler */
+ UsageFault_Handler, /* Usage Fault Handler */
+ 0, /* Reserved */
+ 0, /* Reserved */
+ 0, /* Reserved */
+ 0, /* Reserved */
+ SVC_Handler, /* SVCall Handler */
+ DebugMon_Handler, /* Debug Monitor Handler */
+ 0, /* Reserved */
+ PendSV_Handler, /* PendSV Handler */
+ SysTick_Handler, /* SysTick Handler */
+
+ /* --------- STM32 specific Interrupt ----------------------------------------- */
+ WWDG_IRQHandler, /* 0: */
+ PVD_PVM_IRQHandler, /* 1: */
+ TAMP_STAMP_IRQHandler, /* 2: */
+ RTC_WKUP_IRQHandler, /* 3: */
+ FLASH_IRQHandler, /* 4: */
+ RCC_IRQHandler, /* 5: */
+ EXTI0_IRQHandler, /* 6: */
+ EXTI1_IRQHandler, /* 7: */
+ EXTI2_IRQHandler, /* 8: */
+ EXTI3_IRQHandler, /* 9: */
+ EXTI4_IRQHandler, /* 10: */
+ DMA1_Channel1_IRQHandler, /* 11: */
+ DMA1_Channel2_IRQHandler, /* 12: */
+ DMA1_Channel3_IRQHandler, /* 13: */
+ DMA1_Channel4_IRQHandler, /* 14: */
+ DMA1_Channel5_IRQHandler, /* 15: */
+ DMA1_Channel6_IRQHandler, /* 16: */
+ DMA1_Channel7_IRQHandler, /* 17: */
+ ADC1_IRQHandler, /* 18: */
+ CAN1_TX_IRQHandler, /* 19: */
+ CAN1_RX0_IRQHandler, /* 20: */
+ CAN1_RX1_IRQHandler, /* 21: */
+ CAN1_SCE_IRQHandler, /* 22: */
+ EXTI9_5_IRQHandler, /* 23: */
+ TIM1_BRK_TIM15_IRQHandler, /* 24: */
+ TIM1_UP_TIM16_IRQHandler, /* 25: */
+ TIM1_TRG_COM_IRQHandler, /* 26: */
+ TIM1_CC_IRQHandler, /* 27: */
+ TIM2_IRQHandler, /* 28: */
+ 0, /* 29: */
+ 0, /* 30: */
+ I2C1_EV_IRQHandler, /* 31: */
+ I2C1_ER_IRQHandler, /* 32: */
+ 0, /* 33: */
+ 0, /* 34: */
+ SPI1_IRQHandler, /* 35: */
+ 0, /* 36: */
+ USART1_IRQHandler, /* 37: */
+ USART2_IRQHandler, /* 38: */
+ 0, /* 39: */
+ EXTI15_10_IRQHandler, /* 40: */
+ RTC_Alarm_IRQHandler, /* 41: */
+ 0, /* 42: */
+ 0, /* 43: */
+ 0, /* 44: */
+ 0, /* 45: */
+ 0, /* 46: */
+ 0, /* 47: */
+ 0, /* 48: */
+ 0, /* 49: */
+ 0, /* 50: */
+ SPI3_IRQHandler, /* 51: */
+ 0, /* 52: */
+ 0, /* 53: */
+ TIM6_DAC_IRQHandler, /* 54: */
+ TIM7_IRQHandler, /* 55: */
+ DMA2_Channel1_IRQHandler, /* 56: */
+ DMA2_Channel2_IRQHandler, /* 57: */
+ DMA2_Channel3_IRQHandler, /* 58: */
+ DMA2_Channel4_IRQHandler, /* 59: */
+ DMA2_Channel5_IRQHandler, /* 60: */
+ 0, /* 61: */
+ 0, /* 62: */
+ 0, /* 63: */
+ COMP_IRQHandler, /* 64: */
+ LPTIM1_IRQHandler, /* 65: */
+ LPTIM2_IRQHandler, /* 66: */
+ USB_IRQHandler, /* 67: */
+ DMA2_Channel6_IRQHandler, /* 68: */
+ DMA2_Channel7_IRQHandler, /* 69: */
+ LPUART1_IRQHandler, /* 70: */
+ QUADSPI_IRQHandler, /* 71: */
+ I2C3_EV_IRQHandler, /* 72: */
+ I2C3_ER_IRQHandler, /* 73: */
+ SAI1_IRQHandler, /* 74: */
+ 0, /* 75: */
+ SWPMI1_IRQHandler, /* 76: */
+ TSC_IRQHandler, /* 77: */
+ 0, /* 78: */
+ 0, /* 79: */
+ RNG_IRQHandler, /* 80: */
+ FPU_IRQHandler, /* 81: */
+ CRS_IRQHandler /* 82: */
+};
+#if 0
+ Window WatchDog Interrupt */
+ PVD/PVM3/PVM4 through EXTI Line detection Interrupts */
+ Tamper and TimeStamp interrupts through the EXTI line */
+ RTC Wakeup interrupt through the EXTI line */
+ FLASH global Interrupt */
+ RCC global Interrupt */
+ EXTI Line0 Interrupt */
+ EXTI Line1 Interrupt */
+ EXTI Line2 Interrupt */
+ EXTI Line3 Interrupt */
+ EXTI Line4 Interrupt */
+ DMA1 Channel 1 global Interrupt */
+ DMA1 Channel 2 global Interrupt */
+ DMA1 Channel 3 global Interrupt */
+ DMA1 Channel 4 global Interrupt */
+ DMA1 Channel 5 global Interrupt */
+ DMA1 Channel 6 global Interrupt */
+ DMA1 Channel 7 global Interrupt */
+ ADC1 global Interrupt */
+ CAN1 TX Interrupt */
+ CAN1 RX0 Interrupt */
+ CAN1 RX1 Interrupt */
+ CAN1 SCE Interrupt */
+ External Line[9:5] Interrupts */
+ TIM1 Break interrupt and TIM15 global interrupt */
+ TIM1 Update Interrupt and TIM16 global interrupt */
+ TIM1 Trigger and Commutation Interrupt */
+ TIM1 Capture Compare Interrupt */
+ TIM2 global Interrupt */
+ I2C1 Event Interrupt */
+ I2C1 Error Interrupt */
+ SPI1 global Interrupt */
+ USART1 global Interrupt */
+ USART2 global Interrupt */
+ External Line[15:10] Interrupts */
+ RTC Alarm (A and B) through EXTI Line Interrupt */
+ SPI3 global Interrupt */
+ TIM6 global and DAC1&2 underrun error interrupts */
+ TIM7 global interrupt */
+ DMA2 Channel 1 global Interrupt */
+ DMA2 Channel 2 global Interrupt */
+ DMA2 Channel 3 global Interrupt */
+ DMA2 Channel 4 global Interrupt */
+ DMA2 Channel 5 global Interrupt */
+ COMP1 and COMP2 Interrupts */
+ LP TIM1 interrupt */
+ LP TIM2 interrupt */
+ USB event Interrupt */
+ DMA2 Channel 6 global interrupt */
+ DMA2 Channel 7 global interrupt */
+ LP UART1 interrupt */
+ Quad SPI global interrupt */
+ I2C3 event interrupt */
+ I2C3 error interrupt */
+ Serial Audio Interface 1 global interrupt */
+ Serial Wire Interface 1 global interrupt */
+ Touch Sense Controller global interrupt */
+ RNG global interrupt */
+ FPU global interrupt */
+ CRS global interrupt
+#endif
diff --git a/Src/Target/stm32l432kc/Startup/SysStartup.c b/Src/Target/stm32l432kc/Startup/SysStartup.c
new file mode 100644
index 0000000..7976d67
--- /dev/null
+++ b/Src/Target/stm32l432kc/Startup/SysStartup.c
@@ -0,0 +1,86 @@
+#include
+
+/* ----------------------------------------------------------------------------------- */
+/* Function prototype */
+/* ----------------------------------------------------------------------------------- */
+void crt_init_ram(void);
+void crt_init_ctors(void);
+void __my_startup() __attribute__((used, noinline));
+
+
+/* ----------------------------------------------------------------------------------- */
+/* Types defintion */
+/* ----------------------------------------------------------------------------------- */
+typedef void(*function_type)(void);
+
+
+/* ----------------------------------------------------------------------------------- */
+/* Extern data */
+/* ----------------------------------------------------------------------------------- */
+extern int main(void);
+
+extern uintptr_t _sdata; /* Start address for the .data section. */
+extern uintptr_t _edata; /* End address for the .data section. */
+extern uintptr_t _sbss; /* Start address for the .bss section. */
+extern uintptr_t _ebss; /* End address for the .bss section. */
+extern uintptr_t _ldata; /* Load address for the init. values
+ of the rom-to-ram section. */
+
+extern function_type _ctors_end;
+extern function_type _ctors_begin;
+
+
+/* ----------------------------------------------------------------------------------- */
+/* Functions implementation */
+/* ----------------------------------------------------------------------------------- */
+void __my_startup(void)
+{
+ /* Load the stack pointer. */
+ /* The stack pointer is automatically loaded from */
+ /* the base position of the interrupt vector table */
+ /* So we do nothing here. */
+
+ /* Initialize statics from ROM to RAM */
+ /* Zero-clear default-initialized static RAM */
+ crt_init_ram();
+
+ /* Call all ctor initializations */
+ crt_init_ctors();
+
+ /* Jump to main (and never return) */
+ (void) main();
+
+ /* Catch an unexpected return from main. */
+ for(;;)
+ {
+ /* Replace with a loud error if desired. */
+ }
+}
+
+void crt_init_ram(void)
+{
+ /* Copy the data segment initializers from ROM to RAM.*/
+ /* Note that all data segments are aligned by 4. */
+ const unsigned size_data = (unsigned) ((uint8_t*) (&_edata) - (uint8_t*) &_sdata);
+
+ for(unsigned i = 0U; i < size_data; ++i)
+ {
+ ((uint8_t*) &_sdata)[i] = ((const uint8_t*) &_ldata)[i];
+ }
+
+ const unsigned size_bss = (unsigned) ((uint8_t*) (&_ebss) - (uint8_t*) &_sbss);
+
+ /* Clear the bss segment.*/
+ for(unsigned i = 0U; i < size_bss; ++i)
+ {
+ ((uint8_t*) &_sbss)[i] = (uint8_t) 0U;
+ }
+}
+
+void crt_init_ctors(void)
+{
+ for(function_type* pfn = (function_type*) &_ctors_begin; pfn != (function_type*) &_ctors_end; ++pfn)
+ {
+ (*pfn)();
+ }
+}
diff --git a/Src/Util/C/UtilTimer.h b/Src/Util/C/UtilTimer.h
new file mode 100644
index 0000000..e9964cb
--- /dev/null
+++ b/Src/Util/C/UtilTimer.h
@@ -0,0 +1,20 @@
+#ifndef UTIL_TIMER_2023_08_24_H
+ #define UTIL_TIMER_2023_08_24_H
+
+ #include
+ #include
+
+ #include
+
+
+ static inline Gpt_ValueType TimerStart(const unsigned NextTimeoutMillisec)
+ {
+ return (Gpt_ValueType) (Gpt_GetTimeElapsed((Gpt_ChannelType) UINT8_C(0)) + NextTimeoutMillisec);
+ }
+
+ static inline bool TimerTimeout(const Gpt_ValueType MyTimer)
+ {
+ return (bool) ((Gpt_GetTimeElapsed((Gpt_ChannelType) UINT8_C(0)) > MyTimer) ? true : false);
+ }
+
+#endif /* UTIL_TIMER_2023_08_24_H */
diff --git a/Src/Util/util_noncopyable.h b/Src/Util/Cpp/util_noncopyable.h
similarity index 100%
rename from Src/Util/util_noncopyable.h
rename to Src/Util/Cpp/util_noncopyable.h
diff --git a/Src/Util/util_time.h b/Src/Util/Cpp/util_time.h
similarity index 100%
rename from Src/Util/util_time.h
rename to Src/Util/Cpp/util_time.h