From 7de81e220e3ff92cb46247fad19458fac3064a55 Mon Sep 17 00:00:00 2001
From: Damiano Amatruda <damiano.amatruda@skywarder.eu>
Date: Sat, 11 Dec 2021 20:57:16 +0100
Subject: [PATCH] Add C++ files

---
 board_settings.h                              |  48 +++++
 config/miosix_settings.h                      |  72 +++++++
 interfaces/atomic_ops.h                       |  49 +++++
 interfaces/delays.cpp                         |  32 ++++
 interfaces/delays.h                           |  36 ++++
 interfaces/endianness.h                       |  40 ++++
 interfaces/gpio.cpp                           |  46 +++++
 interfaces/gpio.h                             | 167 +++++++++++++++++
 interfaces/portability.cpp                    |  76 ++++++++
 interfaces/portability.h                      |  84 +++++++++
 kernel/error.cpp                              |  30 +++
 kernel/error.h                                |  46 +++++
 kernel/kernel.cpp                             | 128 +++++++++++++
 kernel/kernel.h                               | 175 ++++++++++++++++++
 kernel/queue.h                                | 155 ++++++++++++++++
 .../priority/priority_scheduler_types.cpp     |  36 ++++
 .../priority/priority_scheduler_types.h       | 100 ++++++++++
 kernel/scheduler/sched_types.h                |  37 ++++
 kernel/scheduler/scheduler.h                  |  30 +++
 kernel/sync.cpp                               |  62 +++++++
 kernel/sync.h                                 | 161 ++++++++++++++++
 miosix.h                                      |  41 ++++
 util/util.cpp                                 |  59 ++++++
 util/util.h                                   |  52 ++++++
 util/version.cpp                              |  32 ++++
 util/version.h                                |  34 ++++
 26 files changed, 1828 insertions(+)
 create mode 100644 board_settings.h
 create mode 100644 config/miosix_settings.h
 create mode 100644 interfaces/atomic_ops.h
 create mode 100644 interfaces/delays.cpp
 create mode 100644 interfaces/delays.h
 create mode 100644 interfaces/endianness.h
 create mode 100644 interfaces/gpio.cpp
 create mode 100644 interfaces/gpio.h
 create mode 100644 interfaces/portability.cpp
 create mode 100644 interfaces/portability.h
 create mode 100644 kernel/error.cpp
 create mode 100644 kernel/error.h
 create mode 100644 kernel/kernel.cpp
 create mode 100644 kernel/kernel.h
 create mode 100644 kernel/queue.h
 create mode 100644 kernel/scheduler/priority/priority_scheduler_types.cpp
 create mode 100644 kernel/scheduler/priority/priority_scheduler_types.h
 create mode 100644 kernel/scheduler/sched_types.h
 create mode 100644 kernel/scheduler/scheduler.h
 create mode 100644 kernel/sync.cpp
 create mode 100644 kernel/sync.h
 create mode 100644 miosix.h
 create mode 100644 util/util.cpp
 create mode 100644 util/util.h
 create mode 100644 util/version.cpp
 create mode 100644 util/version.h

diff --git a/board_settings.h b/board_settings.h
new file mode 100644
index 0000000..6abf9cd
--- /dev/null
+++ b/board_settings.h
@@ -0,0 +1,48 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+#define BOARD_SETTINGS_VERSION 100
+
+namespace miosix
+{
+
+const unsigned int MAIN_STACK_SIZE = 4 * 1024;
+
+const unsigned int TICK_FREQ = 1000;
+
+const unsigned int AUX_TIMER_CLOCK = 100000;
+const unsigned int AUX_TIMER_MAX   = 0xffff;
+
+const unsigned int defaultSerial      = 2;
+const unsigned int defaultSerialSpeed = 19200;
+const bool defaultSerialFlowctrl      = false;
+
+static const unsigned char sdVoltage = 30;
+#define SD_ONE_BIT_DATABUS
+
+}  // namespace miosix
diff --git a/config/miosix_settings.h b/config/miosix_settings.h
new file mode 100644
index 0000000..cb37100
--- /dev/null
+++ b/config/miosix_settings.h
@@ -0,0 +1,72 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+#define MIOSIX_SETTINGS_VERSION 100
+
+namespace miosix
+{
+
+#define SCHED_TYPE_PRIORITY
+
+#define WITH_FILESYSTEM
+
+#define WITH_DEVFS
+
+#define SYNC_AFTER_WRITE
+
+const unsigned char MAX_OPEN_FILES = 8;
+
+#define WITH_BOOTLOG
+
+#define WITH_ERRLOG
+
+#define JTAG_DISABLE_SLEEP
+
+const unsigned int STACK_MIN = 256;
+
+const unsigned int STACK_IDLE = 256;
+
+const unsigned int STACK_DEFAULT_FOR_PTHREAD = 2048;
+
+const unsigned int MAX_PROCESS_IMAGE_SIZE = 64 * 1024;
+
+const unsigned int MIN_PROCESS_STACK_SIZE = STACK_MIN;
+
+const unsigned int SYSTEM_MODE_PROCESS_STACK_SIZE = 2 * 1024;
+
+const short int PRIORITY_MAX = 4;
+
+const unsigned char MAIN_PRIORITY = 1;
+
+const unsigned int WATERMARK_LEN = 16;
+
+const unsigned int WATERMARK_FILL = 0xaaaaaaaa;
+
+const unsigned int STACK_FILL = 0xbbbbbbbb;
+
+}  // namespace miosix
diff --git a/interfaces/atomic_ops.h b/interfaces/atomic_ops.h
new file mode 100644
index 0000000..b193828
--- /dev/null
+++ b/interfaces/atomic_ops.h
@@ -0,0 +1,49 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+namespace miosix
+{
+
+inline int atomicSwap(volatile int *p, int v) { return 0; }
+
+inline void atomicAdd(volatile int *p, int incr) {}
+
+inline int atomicAddExchange(volatile int *p, int incr) { return 0; }
+
+inline int atomicCompareAndSwap(volatile int *p, int prev, int next)
+{
+    return 0;
+}
+
+inline void *atomicFetchAndIncrement(void *const volatile *p, int offset,
+                                     int incr)
+{
+    return (void *)0;
+}
+
+}  // namespace miosix
diff --git a/interfaces/delays.cpp b/interfaces/delays.cpp
new file mode 100644
index 0000000..97d4b33
--- /dev/null
+++ b/interfaces/delays.cpp
@@ -0,0 +1,32 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "delays.h"
+
+namespace miosix
+{
+
+void delayMs(unsigned int mseconds) {}
+
+void delayUs(unsigned int useconds) {}
+
+}  // namespace miosix
diff --git a/interfaces/delays.h b/interfaces/delays.h
new file mode 100644
index 0000000..fa212b5
--- /dev/null
+++ b/interfaces/delays.h
@@ -0,0 +1,36 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+namespace miosix
+{
+
+void delayMs(unsigned int mseconds);
+
+void delayUs(unsigned int useconds);
+
+}  // namespace miosix
diff --git a/interfaces/endianness.h b/interfaces/endianness.h
new file mode 100644
index 0000000..f46c39c
--- /dev/null
+++ b/interfaces/endianness.h
@@ -0,0 +1,40 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda, Luca Erbetta
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+#include <cstdint>
+
+#if defined(__GNUC__)
+
+#define swapBytes64 __builtin_bswap64
+
+static uint16_t swapBytes16(uint16_t x)
+{
+    return (x & 0xFF00) >> 8 | (x & 0x00FF) << 8;
+}
+
+#endif
diff --git a/interfaces/gpio.cpp b/interfaces/gpio.cpp
new file mode 100644
index 0000000..f94dc7c
--- /dev/null
+++ b/interfaces/gpio.cpp
@@ -0,0 +1,46 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "gpio.h"
+
+namespace miosix
+{
+
+GpioPin::GpioPin(unsigned int p, unsigned char n) {}
+
+void GpioPin::mode(Mode::Mode_ m) {}
+
+void GpioPin::speed(Speed::Speed_ s) {}
+
+void GpioPin::alternateFunction(unsigned char af) {}
+
+void GpioPin::high() {}
+
+void GpioPin::low() {}
+
+int GpioPin::value() { return 0; }
+
+unsigned int GpioPin::getPort() const { return 0; }
+
+unsigned char GpioPin::getNumber() const { return 0; }
+
+}  // namespace miosix
diff --git a/interfaces/gpio.h b/interfaces/gpio.h
new file mode 100644
index 0000000..0238adc
--- /dev/null
+++ b/interfaces/gpio.h
@@ -0,0 +1,167 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+namespace miosix
+{
+
+class Mode
+{
+public:
+    enum Mode_
+    {
+        INPUT           = 0,
+        INPUT_PULL_UP   = 1,
+        INPUT_PULL_DOWN = 2,
+        INPUT_ANALOG    = 24,
+        OUTPUT          = 8,
+        OPEN_DRAIN      = 12,
+        ALTERNATE       = 16,
+        ALTERNATE_OD    = 20,
+    };
+
+private:
+    Mode();
+};
+
+class Speed
+{
+public:
+    enum Speed_
+    {
+        _2MHz   = 0x0,
+        _25MHz  = 0x1,
+        _50MHz  = 0x2,
+        _100MHz = 0x3
+    };
+
+private:
+    Speed();
+};
+
+class GpioBase
+{
+};
+
+class GpioPin : private GpioBase
+{
+public:
+    GpioPin(unsigned int p, unsigned char n);
+
+    void mode(Mode::Mode_ m);
+
+    void speed(Speed::Speed_ s);
+
+    void alternateFunction(unsigned char af);
+
+    void high();
+
+    void low();
+
+    int value();
+
+    unsigned int getPort() const;
+
+    unsigned char getNumber() const;
+};
+
+template <unsigned int P, unsigned char N>
+class Gpio : private GpioBase
+{
+public:
+    static void mode(Mode::Mode_ m);
+
+    static void speed(Speed::Speed_ s);
+
+    static void alternateFunction(unsigned char af);
+
+    static void high();
+
+    static void low();
+
+    static int value();
+
+    static GpioPin getPin();
+
+    unsigned int getPort() const;
+
+    unsigned char getNumber() const;
+
+private:
+    Gpio();
+};
+
+template <unsigned int P, unsigned char N>
+void Gpio<P, N>::mode(Mode::Mode_ m)
+{
+}
+
+template <unsigned int P, unsigned char N>
+void Gpio<P, N>::speed(Speed::Speed_ s)
+{
+}
+
+template <unsigned int P, unsigned char N>
+void Gpio<P, N>::alternateFunction(unsigned char af)
+{
+}
+
+template <unsigned int P, unsigned char N>
+void Gpio<P, N>::high()
+{
+}
+
+template <unsigned int P, unsigned char N>
+void Gpio<P, N>::low()
+{
+}
+
+template <unsigned int P, unsigned char N>
+int Gpio<P, N>::value()
+{
+    return 0;
+}
+
+template <unsigned int P, unsigned char N>
+GpioPin Gpio<P, N>::getPin()
+{
+    return GpioPin{0, 0};
+}
+
+template <unsigned int P, unsigned char N>
+unsigned int Gpio<P, N>::getPort() const
+{
+    return 0;
+}
+
+template <unsigned int P, unsigned char N>
+unsigned char Gpio<P, N>::getNumber() const
+{
+    return 0;
+}
+
+}  // namespace miosix
diff --git a/interfaces/portability.cpp b/interfaces/portability.cpp
new file mode 100644
index 0000000..f958329
--- /dev/null
+++ b/interfaces/portability.cpp
@@ -0,0 +1,76 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "portability.h"
+
+namespace miosix_private
+{
+
+void IRQsystemReboot() {}
+
+inline void doYield() {}
+
+void initCtxsave(unsigned int *ctxsave, void *(*pc)(void *), unsigned int *sp,
+                 void *argv)
+{
+}
+
+SyscallParameters::SyscallParameters(unsigned int *context) {}
+
+int SyscallParameters::getSyscallId() const { return 0; }
+
+unsigned int SyscallParameters::getFirstParameter() const { return 0; }
+
+unsigned int SyscallParameters::getSecondParameter() const { return 0; }
+
+unsigned int SyscallParameters::getThirdParameter() const { return 0; }
+
+void SyscallParameters::setReturnValue(unsigned int ret) {}
+
+FaultData::FaultData() {}
+
+FaultData::FaultData(int id, unsigned int pc, unsigned int arg) {}
+
+bool FaultData::faultHappened() const { return false; }
+
+void FaultData::print() const {}
+
+void initCtxsave(unsigned int *ctxsave, void *(*pc)(void *), unsigned int *sp,
+                 void *argv, unsigned int *gotBase)
+{
+}
+
+inline void portableSwitchToUserspace() {}
+
+void IRQstackOverflowCheck() {}
+
+void IRQportableStartKernel() {}
+
+inline void doDisableInterrupts() {}
+
+inline void doEnableInterrupts() {}
+
+inline bool checkAreInterruptsEnabled() { return true; }
+
+void sleepCpu() {}
+
+}  // namespace miosix_private
diff --git a/interfaces/portability.h b/interfaces/portability.h
new file mode 100644
index 0000000..1ab2e9c
--- /dev/null
+++ b/interfaces/portability.h
@@ -0,0 +1,84 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+namespace miosix_private
+{
+
+void IRQsystemReboot();
+
+inline void doYield();
+
+void initCtxsave(unsigned int *ctxsave, void *(*pc)(void *), unsigned int *sp,
+                 void *argv);
+
+class SyscallParameters
+{
+public:
+    SyscallParameters(unsigned int *context);
+
+    int getSyscallId() const;
+
+    unsigned int getFirstParameter() const;
+
+    unsigned int getSecondParameter() const;
+
+    unsigned int getThirdParameter() const;
+
+    void setReturnValue(unsigned int ret);
+};
+
+class FaultData
+{
+public:
+    FaultData();
+
+    FaultData(int id, unsigned int pc, unsigned int arg = 0);
+
+    bool faultHappened() const;
+
+    void print() const;
+};
+
+void initCtxsave(unsigned int *ctxsave, void *(*pc)(void *), unsigned int *sp,
+                 void *argv, unsigned int *gotBase);
+
+inline void portableSwitchToUserspace();
+
+void IRQstackOverflowCheck();
+
+void IRQportableStartKernel();
+
+inline void doDisableInterrupts();
+
+inline void doEnableInterrupts();
+
+inline bool checkAreInterruptsEnabled();
+
+void sleepCpu();
+
+}  // namespace miosix_private
diff --git a/kernel/error.cpp b/kernel/error.cpp
new file mode 100644
index 0000000..0ede6a3
--- /dev/null
+++ b/kernel/error.cpp
@@ -0,0 +1,30 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "error.h"
+
+namespace miosix
+{
+
+void errorHandler(Error e) {}
+
+}  // namespace miosix
diff --git a/kernel/error.h b/kernel/error.h
new file mode 100644
index 0000000..ecca8b5
--- /dev/null
+++ b/kernel/error.h
@@ -0,0 +1,46 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+namespace miosix
+{
+
+enum Error
+{
+    OUT_OF_MEMORY,
+    STACK_OVERFLOW,
+    UNEXPECTED,
+    PAUSE_KERNEL_NESTING,
+    DISABLE_INTERRUPTS_NESTING,
+    MUTEX_DEADLOCK,
+    NESTING_OVERFLOW,
+    INTERRUPTS_ENABLED_AT_BOOT
+};
+
+void errorHandler(Error e);
+
+}  // namespace miosix
diff --git a/kernel/kernel.cpp b/kernel/kernel.cpp
new file mode 100644
index 0000000..6716584
--- /dev/null
+++ b/kernel/kernel.cpp
@@ -0,0 +1,128 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "kernel.h"
+
+#include "kernel/scheduler/priority/priority_scheduler_types.h"
+
+namespace miosix
+{
+
+void disableInterrupts() {}
+
+void enableInterrupts() {}
+
+inline void fastDisableInterrupts() {}
+
+inline void fastEnableInterrupts() {}
+
+InterruptEnableLock::InterruptEnableLock(InterruptDisableLock &l) {}
+
+FastInterruptEnableLock::FastInterruptEnableLock(FastInterruptDisableLock &l) {}
+
+void pauseKernel() {}
+
+void restartKernel() {}
+
+bool areInterruptsEnabled() { return true; }
+
+RestartKernelLock::RestartKernelLock(PauseKernelLock &l) {}
+
+void startKernel() {}
+
+bool isKernelRunning() { return true; }
+
+long long getTick() { return time(NULL); }
+
+Thread *Thread::create(void *(*startfunc)(void *), unsigned int stacksize,
+                       Priority priority, void *argv, unsigned short options)
+{
+    return new Thread();
+}
+
+Thread *Thread::create(void (*startfunc)(void *), unsigned int stacksize,
+                       Priority priority, void *argv, unsigned short options)
+{
+    return new Thread();
+}
+
+void Thread::yield() {}
+
+bool Thread::testTerminate() { return true; }
+
+void Thread::sleep(unsigned int ms) {}
+
+void Thread::sleepUntil(long long absoluteTime) {}
+
+Thread *Thread::getCurrentThread() { return new Thread(); }
+
+bool Thread::exists(Thread *p) { return true; }
+
+Priority Thread::getPriority() { return Priority{}; }
+
+void Thread::setPriority(Priority pr) {}
+
+void Thread::terminate() {}
+
+void Thread::wait() {}
+
+void Thread::wakeup() {}
+
+void Thread::PKwakeup() {}
+
+void Thread::detach() {}
+
+bool Thread::isDetached() const { return false; }
+
+bool Thread::join(void **result) { return true; }
+
+Thread *Thread::IRQgetCurrentThread() { return new Thread(); }
+
+Priority Thread::IRQgetPriority() { return Priority{}; }
+
+void Thread::IRQwait() {}
+
+void Thread::IRQwakeup() {}
+
+bool Thread::IRQexists(Thread *p) { return true; }
+
+const unsigned int *Thread::getStackBottom() { return 0; }
+
+int Thread::getStackSize() { return __INT_MAX__; }
+
+// ProcessBase *Thread::getProcess()
+// {
+// }
+
+void Thread::IRQhandleSvc(unsigned int svcNumber) {}
+
+bool Thread::IRQreportFault(const miosix_private::FaultData &fault)
+{
+    return false;
+}
+
+bool LowerPriority::operator()(Thread *a, Thread *b)
+{
+    return a->getPriority() < b->getPriority();
+}
+
+}  // namespace miosix
diff --git a/kernel/kernel.h b/kernel/kernel.h
new file mode 100644
index 0000000..0ba0b1a
--- /dev/null
+++ b/kernel/kernel.h
@@ -0,0 +1,175 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+#include <pthread.h>
+
+#include <cstdint>
+#include <cstdlib>
+#include <functional>
+#include <new>
+
+#include "interfaces/portability.h"
+#include "kernel/scheduler/sched_types.h"
+
+namespace miosix
+{
+
+void disableInterrupts();
+
+void enableInterrupts();
+
+inline void fastDisableInterrupts();
+
+inline void fastEnableInterrupts();
+
+class InterruptDisableLock
+{
+};
+
+class InterruptEnableLock
+{
+public:
+    InterruptEnableLock(InterruptDisableLock &l);
+};
+
+class FastInterruptDisableLock
+{
+};
+
+class FastInterruptEnableLock
+{
+public:
+    FastInterruptEnableLock(FastInterruptDisableLock &l);
+};
+
+void pauseKernel();
+
+void restartKernel();
+
+bool areInterruptsEnabled();
+
+class PauseKernelLock
+{
+};
+
+class RestartKernelLock
+{
+public:
+    RestartKernelLock(PauseKernelLock &l);
+};
+
+void startKernel();
+
+bool isKernelRunning();
+
+long long getTick();
+
+class Thread
+{
+public:
+    enum Options
+    {
+        DEFAULT  = 0,
+        JOINABLE = 1 << 0
+    };
+
+    static Thread *create(void *(*startfunc)(void *), unsigned int stacksize,
+                          Priority priority = Priority(), void *argv = NULL,
+                          unsigned short options = DEFAULT);
+
+    static Thread *create(void (*startfunc)(void *), unsigned int stacksize,
+                          Priority priority = Priority(), void *argv = NULL,
+                          unsigned short options = DEFAULT);
+
+    static void yield();
+
+    static bool testTerminate();
+
+    static void sleep(unsigned int ms);
+
+    static void sleepUntil(long long absoluteTime);
+
+    static Thread *getCurrentThread();
+
+    static bool exists(Thread *p);
+
+    Priority getPriority();
+
+    static void setPriority(Priority pr);
+
+    void terminate();
+
+    static void wait();
+
+    void wakeup();
+
+    void PKwakeup();
+
+    void detach();
+
+    bool isDetached() const;
+
+    bool join(void **result = NULL);
+
+    static Thread *IRQgetCurrentThread();
+
+    Priority IRQgetPriority();
+
+    static void IRQwait();
+
+    void IRQwakeup();
+
+    static bool IRQexists(Thread *p);
+
+    static const unsigned int *getStackBottom();
+
+    static int getStackSize();
+
+    // ProcessBase *getProcess();
+
+    static void IRQhandleSvc(unsigned int svcNumber);
+
+    static bool IRQreportFault(const miosix_private::FaultData &fault);
+};
+
+class LowerPriority : public std::binary_function<Thread *, Thread *, bool>
+{
+public:
+    bool operator()(Thread *a, Thread *b);
+};
+
+struct SleepData
+{
+    Thread *p;
+
+    long long wakeup_time;
+
+    SleepData *next;
+};
+
+}  // namespace miosix
diff --git a/kernel/queue.h b/kernel/queue.h
new file mode 100644
index 0000000..ca82617
--- /dev/null
+++ b/kernel/queue.h
@@ -0,0 +1,155 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+namespace miosix
+{
+
+template <typename T, unsigned int len>
+class Queue
+{
+public:
+    Queue();
+
+    bool isEmpty() const;
+
+    bool isFull() const;
+
+    unsigned int size() const;
+
+    unsigned int capacity() const;
+
+    void waitUntilNotEmpty();
+
+    void waitUntilNotFull();
+
+    void get(T& elem);
+
+    void put(const T& elem);
+
+    bool IRQget(T& elem);
+
+    bool IRQget(T& elem, bool& hppw);
+
+    bool IRQput(const T& elem);
+
+    bool IRQput(const T& elem, bool& hppw);
+
+    void reset();
+
+    void IRQreset();
+};
+
+}  // namespace miosix
+
+namespace miosix
+{
+
+template <typename T, unsigned int len>
+Queue<T, len>::Queue()
+{
+}
+
+template <typename T, unsigned int len>
+bool Queue<T, len>::isEmpty() const
+{
+    return false;
+}
+
+template <typename T, unsigned int len>
+bool Queue<T, len>::isFull() const
+{
+    return false;
+}
+
+template <typename T, unsigned int len>
+unsigned int Queue<T, len>::size() const
+{
+    return 0;
+}
+
+template <typename T, unsigned int len>
+unsigned int Queue<T, len>::capacity() const
+{
+    return (unsigned int)__INT_MAX__;
+}
+
+template <typename T, unsigned int len>
+void Queue<T, len>::waitUntilNotEmpty()
+{
+}
+
+template <typename T, unsigned int len>
+void Queue<T, len>::waitUntilNotFull()
+{
+}
+
+template <typename T, unsigned int len>
+void Queue<T, len>::get(T& elem)
+{
+}
+
+template <typename T, unsigned int len>
+void Queue<T, len>::put(const T& elem)
+{
+}
+
+template <typename T, unsigned int len>
+bool Queue<T, len>::IRQget(T& elem)
+{
+    return true;
+}
+
+template <typename T, unsigned int len>
+bool Queue<T, len>::IRQget(T& elem, bool& hppw)
+{
+    return true;
+}
+
+template <typename T, unsigned int len>
+bool Queue<T, len>::IRQput(const T& elem)
+{
+    return true;
+}
+
+template <typename T, unsigned int len>
+bool Queue<T, len>::IRQput(const T& elem, bool& hppw)
+{
+    return true;
+}
+
+template <typename T, unsigned int len>
+void Queue<T, len>::reset()
+{
+}
+
+template <typename T, unsigned int len>
+void Queue<T, len>::IRQreset()
+{
+}
+
+}  // namespace miosix
diff --git a/kernel/scheduler/priority/priority_scheduler_types.cpp b/kernel/scheduler/priority/priority_scheduler_types.cpp
new file mode 100644
index 0000000..04513cf
--- /dev/null
+++ b/kernel/scheduler/priority/priority_scheduler_types.cpp
@@ -0,0 +1,36 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "priority_scheduler_types.h"
+
+namespace miosix
+{
+
+PrioritySchedulerPriority::PrioritySchedulerPriority(short int priority) {}
+
+PrioritySchedulerPriority::PrioritySchedulerPriority() {}
+
+short int PrioritySchedulerPriority::get() const { return 0; }
+
+bool PrioritySchedulerPriority::validate() const { return true; }
+
+}  // namespace miosix
diff --git a/kernel/scheduler/priority/priority_scheduler_types.h b/kernel/scheduler/priority/priority_scheduler_types.h
new file mode 100644
index 0000000..f3c40b0
--- /dev/null
+++ b/kernel/scheduler/priority/priority_scheduler_types.h
@@ -0,0 +1,100 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+namespace miosix
+{
+
+class Thread;  // Forward declaration
+
+class PrioritySchedulerPriority
+{
+public:
+    PrioritySchedulerPriority(short int priority);
+
+    PrioritySchedulerPriority();
+
+    short int get() const;
+
+    bool validate() const;
+};
+
+inline bool operator<(PrioritySchedulerPriority a, PrioritySchedulerPriority b);
+
+inline bool operator<=(PrioritySchedulerPriority a,
+                       PrioritySchedulerPriority b);
+
+inline bool operator>(PrioritySchedulerPriority a, PrioritySchedulerPriority b);
+
+inline bool operator>=(PrioritySchedulerPriority a,
+                       PrioritySchedulerPriority b);
+
+inline bool operator==(PrioritySchedulerPriority a,
+                       PrioritySchedulerPriority b);
+
+inline bool operator!=(PrioritySchedulerPriority a,
+                       PrioritySchedulerPriority b);
+
+inline bool operator<(PrioritySchedulerPriority a, PrioritySchedulerPriority b)
+{
+    return false;
+}
+
+inline bool operator<=(PrioritySchedulerPriority a, PrioritySchedulerPriority b)
+{
+    return false;
+}
+
+inline bool operator>(PrioritySchedulerPriority a, PrioritySchedulerPriority b)
+{
+    return false;
+}
+
+inline bool operator>=(PrioritySchedulerPriority a, PrioritySchedulerPriority b)
+{
+    return false;
+}
+
+inline bool operator==(PrioritySchedulerPriority a, PrioritySchedulerPriority b)
+{
+    return false;
+}
+
+inline bool operator!=(PrioritySchedulerPriority a, PrioritySchedulerPriority b)
+{
+    return false;
+}
+
+class PrioritySchedulerData
+{
+public:
+    PrioritySchedulerPriority priority;
+
+    Thread *next;
+};
+
+}  // namespace miosix
diff --git a/kernel/scheduler/sched_types.h b/kernel/scheduler/sched_types.h
new file mode 100644
index 0000000..e318c72
--- /dev/null
+++ b/kernel/scheduler/sched_types.h
@@ -0,0 +1,37 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+#include "kernel/scheduler/priority/priority_scheduler_types.h"
+
+namespace miosix
+{
+
+typedef PrioritySchedulerPriority Priority;
+typedef PrioritySchedulerData SchedulerData;
+
+}  // namespace miosix
diff --git a/kernel/scheduler/scheduler.h b/kernel/scheduler/scheduler.h
new file mode 100644
index 0000000..991f6af
--- /dev/null
+++ b/kernel/scheduler/scheduler.h
@@ -0,0 +1,30 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+#include "config/miosix_settings.h"
+#include "kernel/scheduler/priority/priority_scheduler_types.h"
diff --git a/kernel/sync.cpp b/kernel/sync.cpp
new file mode 100644
index 0000000..08cd0de
--- /dev/null
+++ b/kernel/sync.cpp
@@ -0,0 +1,62 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "sync.h"
+
+namespace miosix
+{
+
+FastMutex::FastMutex(Options opt) {}
+
+void FastMutex::lock() {}
+
+bool FastMutex::tryLock() { return true; }
+
+void FastMutex::unlock() {}
+
+FastMutex::~FastMutex() {}
+
+void Mutex::lock() {}
+
+bool Mutex::tryLock() { return true; }
+
+void Mutex::unlock() {}
+
+void ConditionVariable::wait(Mutex& m) {}
+
+void ConditionVariable::wait(FastMutex& m) {}
+
+void ConditionVariable::signal() {}
+
+void ConditionVariable::broadcast() {}
+
+void Timer::start() { running = true; }
+
+void Timer::stop() { running = false; }
+
+bool Timer::isRunning() const { return running; }
+
+int Timer::interval() const { return 100; }
+
+void Timer::clear() { running = false; }
+
+}  // namespace miosix
diff --git a/kernel/sync.h b/kernel/sync.h
new file mode 100644
index 0000000..fe96bfc
--- /dev/null
+++ b/kernel/sync.h
@@ -0,0 +1,161 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+namespace miosix
+{
+
+class FastMutex
+{
+public:
+    enum Options
+    {
+        DEFAULT,
+        RECURSIVE
+    };
+
+    FastMutex(Options opt = DEFAULT);
+
+    void lock();
+
+    bool tryLock();
+
+    void unlock();
+
+    ~FastMutex();
+
+private:
+    FastMutex(const FastMutex&);
+    FastMutex& operator=(const FastMutex&);
+};
+
+class Mutex
+{
+public:
+    void lock();
+
+    bool tryLock();
+
+    void unlock();
+};
+
+template <typename T>
+class Lock
+{
+public:
+    explicit Lock(T& m);
+
+    ~Lock();
+
+    T& get() { return mutex; }
+
+private:
+    Lock(const Lock& l);
+    Lock& operator=(const Lock& l);
+    T& mutex;
+};
+
+template <typename T>
+Lock<T>::Lock(T& m) : mutex(m)
+{
+}
+
+template <typename T>
+Lock<T>::~Lock()
+{
+}
+
+template <typename T>
+class Unlock
+{
+public:
+    explicit Unlock(Lock<T>& l);
+    Unlock(T& m);
+
+    ~Unlock();
+
+    T& get() { return mutex; }
+
+private:
+    Unlock(const Unlock& l);
+    Unlock& operator=(const Unlock& l);
+    T& mutex;
+};
+
+template <typename T>
+Unlock<T>::Unlock(Lock<T>& l) : mutex(l.get())
+{
+}
+
+template <typename T>
+Unlock<T>::Unlock(T& m) : mutex(m)
+{
+}
+
+template <typename T>
+Unlock<T>::~Unlock()
+{
+}
+
+class ConditionVariable
+{
+public:
+    template <typename T>
+    void wait(Lock<T>& l);
+
+    void wait(Mutex& m);
+
+    void wait(FastMutex& m);
+
+    void signal();
+
+    void broadcast();
+};
+
+template <typename T>
+void ConditionVariable::wait(Lock<T>& l)
+{
+}
+
+class Timer
+{
+public:
+    void start();
+
+    void stop();
+
+    bool isRunning() const;
+
+    int interval() const;
+
+    void clear();
+
+private:
+    bool running = false;
+};
+
+}  // namespace miosix
diff --git a/miosix.h b/miosix.h
new file mode 100644
index 0000000..4a74c8e
--- /dev/null
+++ b/miosix.h
@@ -0,0 +1,41 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+#include "board_settings.h"
+#include "config/miosix_settings.h"
+#include "interfaces/delays.h"
+#include "interfaces/gpio.h"
+#include "interfaces/portability.h"
+#include "kernel/error.h"
+#include "kernel/kernel.h"
+#include "kernel/queue.h"
+#include "kernel/scheduler/priority/priority_scheduler_types.h"
+#include "kernel/scheduler/sched_types.h"
+#include "kernel/sync.h"
+#include "util/util.h"
+#include "util/version.h"
diff --git a/util/util.cpp b/util/util.cpp
new file mode 100644
index 0000000..baf7bb1
--- /dev/null
+++ b/util/util.cpp
@@ -0,0 +1,59 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "util.h"
+
+namespace miosix
+{
+
+void MemoryProfiling::print() {}
+
+unsigned int MemoryProfiling::getStackSize() { return 0; }
+
+unsigned int MemoryProfiling::getAbsoluteFreeStack()
+{
+    return (unsigned int)__INT_MAX__;
+}
+
+unsigned int MemoryProfiling::getCurrentFreeStack()
+{
+    return (unsigned int)__INT_MAX__;
+}
+
+unsigned int MemoryProfiling::getHeapSize()
+{
+    return (unsigned int)__INT_MAX__;
+}
+
+unsigned int MemoryProfiling::getAbsoluteFreeHeap()
+{
+    return (unsigned int)__INT_MAX__;
+}
+
+unsigned int MemoryProfiling::getCurrentFreeHeap()
+{
+    return (unsigned int)__INT_MAX__;
+}
+
+void memDump(const void *start, int len) {}
+
+}  // namespace miosix
diff --git a/util/util.h b/util/util.h
new file mode 100644
index 0000000..aea55d9
--- /dev/null
+++ b/util/util.h
@@ -0,0 +1,52 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+namespace miosix
+{
+
+class MemoryProfiling
+{
+public:
+    static void print();
+
+    static unsigned int getStackSize();
+
+    static unsigned int getAbsoluteFreeStack();
+
+    static unsigned int getCurrentFreeStack();
+
+    static unsigned int getHeapSize();
+
+    static unsigned int getAbsoluteFreeHeap();
+
+    static unsigned int getCurrentFreeHeap();
+};
+
+void memDump(const void *start, int len);
+
+}  // namespace miosix
diff --git a/util/version.cpp b/util/version.cpp
new file mode 100644
index 0000000..c04c7e9
--- /dev/null
+++ b/util/version.cpp
@@ -0,0 +1,32 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#include "version.h"
+
+namespace miosix
+{
+
+const char ver[] = "Miosix v2.22 (host, " __DATE__ " " __TIME__ ")";
+
+const char *getMiosixVersion() { return ver; }
+
+}  // namespace miosix
diff --git a/util/version.h b/util/version.h
new file mode 100644
index 0000000..c5e88fe
--- /dev/null
+++ b/util/version.h
@@ -0,0 +1,34 @@
+/* Copyright (c) 2021 Skyward Experimental Rocketry
+ * Author: Damiano Amatruda
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+#pragma once
+
+#ifndef COMPILE_FOR_HOST
+#error "Unsupported"
+#endif
+
+namespace miosix
+{
+
+const char *getMiosixVersion();
+
+}  // namespace miosix
-- 
GitLab