From 08ff68cd4f961b9234c50e20ea18b4d16fd1b49d Mon Sep 17 00:00:00 2001 From: Leo Date: Fri, 7 Feb 2025 23:03:49 +0200 Subject: [PATCH] Added guide for compiling under Windows (#2060) * Update documentation to build IronOS in Windows using MSYS2 environment and fix compilation on case-sensitive file systems. --------- Co-authored-by: Ivan Zorin --- Documentation/Development.md | 36 +++++++++++++++++++ source/Core/BSP/MHP30/BSP.cpp | 2 +- source/Core/BSP/MHP30/ThermoModel.cpp | 2 +- source/Core/BSP/Miniware/ThermoModel.cpp | 2 +- source/Core/BSP/Pinecil/ThermoModel.cpp | 2 +- source/Core/BSP/Pinecilv2/BSP.cpp | 2 +- source/Core/BSP/Pinecilv2/ThermoModel.cpp | 2 +- .../ble/ble_stack/port/include/bl_port.h | 2 +- source/Core/BSP/Pinecilv2/ble_peripheral.h | 2 +- source/Core/BSP/Sequre/ThermoModel.cpp | 2 +- source/Core/Drivers/HUB238.cpp | 2 +- source/Core/Drivers/TipThermoModel.cpp | 2 +- source/Core/Drivers/Utils.cpp | 2 +- source/Core/Drivers/{Utils.h => Utils.hpp} | 8 ++--- source/Core/Inc/Types.h | 2 +- source/Makefile | 2 +- 16 files changed, 54 insertions(+), 18 deletions(-) rename source/Core/Drivers/{Utils.h => Utils.hpp} (76%) diff --git a/Documentation/Development.md b/Documentation/Development.md index 9e39209f..9cc3995c 100644 --- a/Documentation/Development.md +++ b/Documentation/Development.md @@ -14,6 +14,42 @@ You will need to update the build settings for include paths and point to the ne In the `source` folder there is a `Makefile` that can be used to build the repository using command line tools. When running the `make` command, specify which model of the device and the language(s) you would like to use. +### Windows (MSYS2 environment) + +1. Download `msys2` install package from the [official website](https://msys2.org) and install it according to the instruction there; +2. Install requried packages (here and for the future commands use **`mingw64.exe`** terminal): +``` +$ pacman -S mingw-w64-x86_64-arm-none-eabi-gcc mingw-w64-x86_64-libwinpthread-git python3 python3-pip make unzip git +``` +3. Download _3rd party RISC-V toolchain_ `xpack-riscv-none-elf-gcc-...-win32-x64.zip` from [this repository](https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases); +4. Move downloaded `xpack-riscv-none-elf-gcc-...-win32-x64.zip` to `msys64` _Windows_ directory (e.g., `C:\msys64\`); +5. Extract files from `xpack-riscv-none-elf-gcc-...-win32-x64.zip` and go back to _home_ directory: +``` +$ cd / +$ unzip xpack-riscv-none-elf-gcc-...-win32-x64.zip +$ cd ~ +``` +6. Permanently set `PATH` environment variable, so all required toolchains could be available for `make` and for other build scripts: +``` +$ echo 'export PATH=/xpack-riscv-none-elf-gcc-.../bin:${PATH}' >> ~/.bashrc +$ source ~/.bashrc +``` +7. Additionally, `OpenOCD` and/or `ST-Link` can be installed as well to help with flashing: +``` +$ pacman -S mingw-w64-x86_64-openocd +$ pacman -S mingw-w64-x86_64-stlink +``` +8. Clone _IronOS_ repo: +``` +$ git clone --recursive https://github.com/Ralim/IronOS.git +$ cd IronOS +``` +9. Follow steps _4-8_ from [macOS section](#macos); +10. `pip` can be updated inside `venv` only: +``` +$ python3 -m pip install --upgrade pip +``` + ### macOS Use the following steps to set up a build environment for IronOS on the command line (in Terminal). diff --git a/source/Core/BSP/MHP30/BSP.cpp b/source/Core/BSP/MHP30/BSP.cpp index dde331d4..aa88f28e 100644 --- a/source/Core/BSP/MHP30/BSP.cpp +++ b/source/Core/BSP/MHP30/BSP.cpp @@ -6,7 +6,7 @@ #include "Pins.h" #include "Setup.h" #include "TipThermoModel.h" -#include "Utils.h" +#include "Utils.hpp" #include "WS2812.h" #include "configuration.h" #include "history.hpp" diff --git a/source/Core/BSP/MHP30/ThermoModel.cpp b/source/Core/BSP/MHP30/ThermoModel.cpp index 9275d835..b779aba9 100644 --- a/source/Core/BSP/MHP30/ThermoModel.cpp +++ b/source/Core/BSP/MHP30/ThermoModel.cpp @@ -7,7 +7,7 @@ #include "Setup.h" #include "TipThermoModel.h" #include "Types.h" -#include "Utils.h" +#include "Utils.hpp" #include "configuration.h" extern uint16_t tipSenseResistancex10Ohms; diff --git a/source/Core/BSP/Miniware/ThermoModel.cpp b/source/Core/BSP/Miniware/ThermoModel.cpp index da9dac4c..ddfd720a 100644 --- a/source/Core/BSP/Miniware/ThermoModel.cpp +++ b/source/Core/BSP/Miniware/ThermoModel.cpp @@ -5,7 +5,7 @@ * Author: Ralim */ #include "TipThermoModel.h" -#include "Utils.h" +#include "Utils.hpp" #include "configuration.h" #ifdef TEMP_uV_LOOKUP_HAKKO diff --git a/source/Core/BSP/Pinecil/ThermoModel.cpp b/source/Core/BSP/Pinecil/ThermoModel.cpp index a20fe0aa..9a6b589e 100644 --- a/source/Core/BSP/Pinecil/ThermoModel.cpp +++ b/source/Core/BSP/Pinecil/ThermoModel.cpp @@ -5,7 +5,7 @@ * Author: Ralim */ #include "TipThermoModel.h" -#include "Utils.h" +#include "Utils.hpp" #include "configuration.h" #ifdef TEMP_uV_LOOKUP_HAKKO diff --git a/source/Core/BSP/Pinecilv2/BSP.cpp b/source/Core/BSP/Pinecilv2/BSP.cpp index 4bcedb13..7eb3c99b 100644 --- a/source/Core/BSP/Pinecilv2/BSP.cpp +++ b/source/Core/BSP/Pinecilv2/BSP.cpp @@ -9,7 +9,7 @@ #include "Setup.h" #include "TipThermoModel.h" #include "USBPD.h" -#include "Utils.h" +#include "Utils.hpp" #include "bl702_adc.h" #include "configuration.h" #include "crc32.h" diff --git a/source/Core/BSP/Pinecilv2/ThermoModel.cpp b/source/Core/BSP/Pinecilv2/ThermoModel.cpp index 028a477b..80889d94 100644 --- a/source/Core/BSP/Pinecilv2/ThermoModel.cpp +++ b/source/Core/BSP/Pinecilv2/ThermoModel.cpp @@ -5,7 +5,7 @@ * Author: Ralim */ #include "TipThermoModel.h" -#include "Utils.h" +#include "Utils.hpp" #include "configuration.h" #ifdef TEMP_uV_LOOKUP_HAKKO diff --git a/source/Core/BSP/Pinecilv2/bl_mcu_sdk/components/ble/ble_stack/port/include/bl_port.h b/source/Core/BSP/Pinecilv2/bl_mcu_sdk/components/ble/ble_stack/port/include/bl_port.h index 6fea9235..8a45fe31 100644 --- a/source/Core/BSP/Pinecilv2/bl_mcu_sdk/components/ble/ble_stack/port/include/bl_port.h +++ b/source/Core/BSP/Pinecilv2/bl_mcu_sdk/components/ble/ble_stack/port/include/bl_port.h @@ -10,7 +10,7 @@ #include #include #include -#include "types.h" +#include #include "bl_port.h" #define BT_UINT_MAX 0xffffffff diff --git a/source/Core/BSP/Pinecilv2/ble_peripheral.h b/source/Core/BSP/Pinecilv2/ble_peripheral.h index 3d45290d..db8410e3 100644 --- a/source/Core/BSP/Pinecilv2/ble_peripheral.h +++ b/source/Core/BSP/Pinecilv2/ble_peripheral.h @@ -10,7 +10,7 @@ NOTES #ifndef _BLE_TP_SVC_H_ #define _BLE_TP_SVC_H_ -#include "types.h" +#include #include "ble_config.h" // read value handle offset 2 diff --git a/source/Core/BSP/Sequre/ThermoModel.cpp b/source/Core/BSP/Sequre/ThermoModel.cpp index 9fe38597..8e49b985 100644 --- a/source/Core/BSP/Sequre/ThermoModel.cpp +++ b/source/Core/BSP/Sequre/ThermoModel.cpp @@ -5,7 +5,7 @@ * Author: Ralim */ #include "TipThermoModel.h" -#include "Utils.h" +#include "Utils.hpp" #include "configuration.h" #ifdef TEMP_uV_LOOKUP_PT1000 diff --git a/source/Core/Drivers/HUB238.cpp b/source/Core/Drivers/HUB238.cpp index 6d2940b0..2dfd37da 100644 --- a/source/Core/Drivers/HUB238.cpp +++ b/source/Core/Drivers/HUB238.cpp @@ -1,6 +1,6 @@ #include "HUB238.hpp" #include "I2CBB2.hpp" -#include "Utils.h" +#include "Utils.hpp" #include "configuration.h" #if POW_PD_EXT == 1 diff --git a/source/Core/Drivers/TipThermoModel.cpp b/source/Core/Drivers/TipThermoModel.cpp index f52f4733..e1bee830 100644 --- a/source/Core/Drivers/TipThermoModel.cpp +++ b/source/Core/Drivers/TipThermoModel.cpp @@ -9,7 +9,7 @@ #include "BSP.h" #include "Settings.h" #include "Types.h" -#include "Utils.h" +#include "Utils.hpp" #include "configuration.h" #include "main.hpp" #include "power.hpp" diff --git a/source/Core/Drivers/Utils.cpp b/source/Core/Drivers/Utils.cpp index 4ebb6e73..b4091854 100644 --- a/source/Core/Drivers/Utils.cpp +++ b/source/Core/Drivers/Utils.cpp @@ -8,7 +8,7 @@ #include "BSP_Power.h" #include "Settings.h" #include "configuration.h" -#include +#include int32_t Utils::InterpolateLookupTable(const int32_t *lookupTable, const int noItems, const int32_t value) { for (int i = 1; i < (noItems - 1); i++) { diff --git a/source/Core/Drivers/Utils.h b/source/Core/Drivers/Utils.hpp similarity index 76% rename from source/Core/Drivers/Utils.h rename to source/Core/Drivers/Utils.hpp index ede29124..f4bad5c6 100644 --- a/source/Core/Drivers/Utils.h +++ b/source/Core/Drivers/Utils.hpp @@ -1,12 +1,12 @@ /* - * Utils.h + * Utils.hpp * * Created on: 28 Apr 2021 * Author: Ralim */ -#ifndef CORE_DRIVERS_UTILS_H_ -#define CORE_DRIVERS_UTILS_H_ +#ifndef CORE_DRIVERS_UTILS_HPP_ +#define CORE_DRIVERS_UTILS_HPP_ #include class Utils { public: @@ -18,4 +18,4 @@ public: }; -#endif /* CORE_DRIVERS_UTILS_H_ */ +#endif /* CORE_DRIVERS_UTILS_HPP_ */ diff --git a/source/Core/Inc/Types.h b/source/Core/Inc/Types.h index a5d3fe59..ad215994 100644 --- a/source/Core/Inc/Types.h +++ b/source/Core/Inc/Types.h @@ -7,4 +7,4 @@ typedef int32_t TemperatureType_t; -#endif \ No newline at end of file +#endif diff --git a/source/Makefile b/source/Makefile index 5b84ca92..d7990c79 100644 --- a/source/Makefile +++ b/source/Makefile @@ -287,7 +287,7 @@ DEV_GLOBAL_DEFS=-DCFG_FREERTOS \ # -DCONFIG_BT_SMP # Required to be turned off due to their drivers tripping warnings -DEV_CFLAGS=-Wno-error=enum-conversion -Wno-type-limits -Wno-implicit-fallthrough +DEV_CFLAGS=-Wno-error=enum-conversion -Wno-type-limits -Wno-implicit-fallthrough -Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types DEV_CXXFLAGS=$(DEV_CFLAGS) flash_size=128k bootldr_size=0x0