From 193cb0de389e4e3b71b7670fb8c777334a51a53c Mon Sep 17 00:00:00 2001 From: thomas-bc <49786685+thomas-bc@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:46:11 -0700 Subject: [PATCH 1/4] Add OSAL singleton initialization to `Os::init()` --- Os/Os.cpp | 6 +++++- Os/Os.hpp | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Os/Os.cpp b/Os/Os.cpp index 7fb93b2f46..dac567791c 100644 --- a/Os/Os.cpp +++ b/Os/Os.cpp @@ -5,14 +5,18 @@ #include "Os/Os.hpp" #include "FpConfig.h" #include "Os/Console.hpp" +#include "Os/Cpu.hpp" #include "Os/FileSystem.hpp" +#include "Os/Memory.hpp" namespace Os { void init() { - // Console and FileSystem are singletons and must be initialized + // Initialize all OSAL singletons (void)Os::Console::init(); (void)Os::FileSystem::init(); + (void)Os::Cpu::init(); + (void)Os::Memory::init(); } } // namespace Os diff --git a/Os/Os.hpp b/Os/Os.hpp index 1794c6deb9..69575a8fbe 100644 --- a/Os/Os.hpp +++ b/Os/Os.hpp @@ -35,7 +35,9 @@ struct UsedTotal { } -//! \brief Initialization function for the OSAL layer +//! \brief Initialization of the OSAL layer +//! +//! - Initialize all singletons for the OSAL modules that use the singleton pattern void init(); } // namespace Os From 96a783556ceebd0ce4f2ce80262865f0dcae4d41 Mon Sep 17 00:00:00 2001 From: thomas-bc <49786685+thomas-bc@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:47:38 -0700 Subject: [PATCH 2/4] grammar nit --- Os/Os.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Os/Os.hpp b/Os/Os.hpp index 69575a8fbe..931403f891 100644 --- a/Os/Os.hpp +++ b/Os/Os.hpp @@ -35,7 +35,7 @@ struct UsedTotal { } -//! \brief Initialization of the OSAL layer +//! \brief Initialize the OSAL layer //! //! - Initialize all singletons for the OSAL modules that use the singleton pattern void init(); From 3554c1d4ca6b891306da64eb26103fc39fd81c64 Mon Sep 17 00:00:00 2001 From: thomas-bc <49786685+thomas-bc@users.noreply.github.com> Date: Mon, 14 Oct 2024 16:49:13 -0700 Subject: [PATCH 3/4] second grammar nit?? --- Os/Os.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Os/Os.hpp b/Os/Os.hpp index 931403f891..b082e20f0e 100644 --- a/Os/Os.hpp +++ b/Os/Os.hpp @@ -35,7 +35,7 @@ struct UsedTotal { } -//! \brief Initialize the OSAL layer +//! \brief Initialize the OS Abstraction Layer (OSAL) //! //! - Initialize all singletons for the OSAL modules that use the singleton pattern void init(); From 25fa5331a3961d508ceb10a765f7eca070d3fea0 Mon Sep 17 00:00:00 2001 From: thomas-bc <49786685+thomas-bc@users.noreply.github.com> Date: Mon, 14 Oct 2024 18:00:38 -0700 Subject: [PATCH 4/4] Add missing static modifier to Cpu/Memory --- Os/Cpu.hpp | 2 +- Os/Memory.hpp | 2 +- Os/Os.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Os/Cpu.hpp b/Os/Cpu.hpp index 4db967dbb6..94eecbcc77 100644 --- a/Os/Cpu.hpp +++ b/Os/Cpu.hpp @@ -79,7 +79,7 @@ class Cpu final : public CpuInterface { //----------------------------------------------------------------------------- //! \brief initialize the singleton - void init(); + static void init(); //! \brief return singleton static Cpu& getSingleton(); diff --git a/Os/Memory.hpp b/Os/Memory.hpp index 0d42b08fb5..d2710a167c 100644 --- a/Os/Memory.hpp +++ b/Os/Memory.hpp @@ -67,7 +67,7 @@ class Memory final : public MemoryInterface { public: //! \brief initialize the singleton - void init(); + static void init(); //! \brief return singleton static Memory& getSingleton(); diff --git a/Os/Os.cpp b/Os/Os.cpp index dac567791c..c714398a38 100644 --- a/Os/Os.cpp +++ b/Os/Os.cpp @@ -13,10 +13,10 @@ namespace Os { void init() { // Initialize all OSAL singletons - (void)Os::Console::init(); - (void)Os::FileSystem::init(); - (void)Os::Cpu::init(); - (void)Os::Memory::init(); + Os::Console::init(); + Os::FileSystem::init(); + Os::Cpu::init(); + Os::Memory::init(); } } // namespace Os