diff --git a/firmware/application/CMakeLists.txt b/firmware/application/CMakeLists.txt index cd06dceb..5e177854 100644 --- a/firmware/application/CMakeLists.txt +++ b/firmware/application/CMakeLists.txt @@ -27,6 +27,8 @@ enable_language(C CXX ASM) +include(CheckCXXCompilerFlag) + project(application) # Compiler options here. @@ -36,7 +38,13 @@ set(USE_OPT "-Os -g --specs=nano.specs") set(USE_COPT "-std=gnu99") # C++ specific options here (added to USE_OPT). -set(USE_CPPOPT "-std=c++17 -fno-rtti -fno-exceptions -Weffc++ -Wuninitialized") +check_cxx_compiler_flag("-std=c++20" cpp20_supported) +if(cpp20_supported) + set(USE_CPPOPT "-std=c++20") +else() + set(USE_CPPOPT "-std=c++17") +endif() +set(USE_CPPOPT "${USE_CPPOPT} -fno-rtti -fno-exceptions -Weffc++ -Wuninitialized -Wno-volatile") # Enable this if you want the linker to remove unused code and data set(USE_LINK_GC yes) diff --git a/firmware/application/apps/tpms_app.hpp b/firmware/application/apps/tpms_app.hpp index a30f6b9e..eef61846 100644 --- a/firmware/application/apps/tpms_app.hpp +++ b/firmware/application/apps/tpms_app.hpp @@ -38,10 +38,6 @@ namespace std { -constexpr bool operator==(const tpms::TransponderID& lhs, const tpms::TransponderID& rhs) { - return (lhs.value() == rhs.value()); -} - } /* namespace std */ struct TPMSRecentEntry { diff --git a/firmware/application/hw/max283x.hpp b/firmware/application/hw/max283x.hpp index 042b53d8..e997ea69 100644 --- a/firmware/application/hw/max283x.hpp +++ b/firmware/application/hw/max283x.hpp @@ -22,6 +22,8 @@ #ifndef __MAX283X_H__ #define __MAX283X_H__ +#include + #include "rf_path.hpp" namespace max283x { diff --git a/firmware/application/rf_path.cpp b/firmware/application/rf_path.cpp index 260a44c2..905a346c 100644 --- a/firmware/application/rf_path.cpp +++ b/firmware/application/rf_path.cpp @@ -162,8 +162,8 @@ constexpr ConfigAmp config_amp( const Direction direction, const Band band) { return {{ - {.direction = direction, .band = band, .amplify = false}, - {.direction = direction, .band = band, .amplify = true}, + Config(direction, band, false), + Config(direction, band, true), }}; } diff --git a/firmware/application/ui/ui_geomap.cpp b/firmware/application/ui/ui_geomap.cpp index b422ed29..0cd454b3 100644 --- a/firmware/application/ui/ui_geomap.cpp +++ b/firmware/application/ui/ui_geomap.cpp @@ -136,7 +136,7 @@ GeoMap::GeoMap( } void GeoMap::paint(Painter& painter) { - u_int16_t line; + uint16_t line; std::array map_line_buffer; const auto r = screen_rect(); diff --git a/firmware/baseband/CMakeLists.txt b/firmware/baseband/CMakeLists.txt index c6b44ef2..1721bb9a 100644 --- a/firmware/baseband/CMakeLists.txt +++ b/firmware/baseband/CMakeLists.txt @@ -27,6 +27,8 @@ enable_language(C CXX ASM) +include(CheckCXXCompilerFlag) + project(baseband_shared) # Compiler options here. @@ -36,7 +38,13 @@ set(USE_OPT "-O3 -g -falign-functions=16 -fno-math-errno --specs=nano.specs") set(USE_COPT "-std=gnu99") # C++ specific options here (added to USE_OPT). -set(USE_CPPOPT "-std=c++17 -fno-rtti -fno-exceptions -Weffc++ -Wuninitialized") +check_cxx_compiler_flag("-std=c++20" cpp20_supported) +if(cpp20_supported) + set(USE_CPPOPT "-std=c++20") +else() + set(USE_CPPOPT "-std=c++17") +endif() +set(USE_CPPOPT "${USE_CPPOPT} -fno-rtti -fno-exceptions -Weffc++ -Wuninitialized -Wno-volatile") # Enable this if you want the linker to remove unused code and data set(USE_LINK_GC yes) diff --git a/firmware/common/jtag_tap.cpp b/firmware/common/jtag_tap.cpp index c00843e9..330472a1 100644 --- a/firmware/common/jtag_tap.cpp +++ b/firmware/common/jtag_tap.cpp @@ -24,6 +24,7 @@ #include "utility.hpp" #include +#include namespace jtag { namespace tap { diff --git a/firmware/common/pocsag_packet.hpp b/firmware/common/pocsag_packet.hpp index c0a48ec4..c9835bc1 100644 --- a/firmware/common/pocsag_packet.hpp +++ b/firmware/common/pocsag_packet.hpp @@ -25,6 +25,7 @@ #include #include +#include #include "baseband.hpp" diff --git a/firmware/common/tonesets.hpp b/firmware/common/tonesets.hpp index e6ed7314..75b5e04b 100644 --- a/firmware/common/tonesets.hpp +++ b/firmware/common/tonesets.hpp @@ -24,6 +24,7 @@ #define __TONESETS_H__ #include +#include #define TONES_SAMPLERATE 1536000 #define TONES_DELTA_COEF(sr) ((1ULL << 32) / sr) diff --git a/firmware/common/tpms_packet.hpp b/firmware/common/tpms_packet.hpp index 34b7296c..43b745f8 100644 --- a/firmware/common/tpms_packet.hpp +++ b/firmware/common/tpms_packet.hpp @@ -60,6 +60,10 @@ class TransponderID { return id_; } + constexpr bool operator==(const TransponderID& other) const { + return id_ == other.id_; + } + private: uint32_t id_; };