diff --git a/cmake/toolchain/arm-none-eabi.cmake b/cmake/toolchain/arm-none-eabi.cmake index 6ec5d6204..0f3153cb6 100644 --- a/cmake/toolchain/arm-none-eabi.cmake +++ b/cmake/toolchain/arm-none-eabi.cmake @@ -1,7 +1,7 @@ # arm-none-eabi toolchain set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_SYSTEM_PROCESSOR arm) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 17) set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) diff --git a/radio/src/CMakeLists.txt b/radio/src/CMakeLists.txt index 8c742f141..5f33c1dbb 100644 --- a/radio/src/CMakeLists.txt +++ b/radio/src/CMakeLists.txt @@ -115,6 +115,9 @@ endif() if(ARCH STREQUAL ARM) include(targets/common/arm/CMakeLists.txt) + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "14.2.1") + message(WARNING "Only Arm GNU Toolchain version 14.2.rel1 is supported") + endif() endif() include_directories(targets/${TARGET_DIR} ${THIRDPARTY_DIR}) diff --git a/radio/src/bin_allocator.cpp b/radio/src/bin_allocator.cpp index 88d668582..ab9c95c20 100644 --- a/radio/src/bin_allocator.cpp +++ b/radio/src/bin_allocator.cpp @@ -100,7 +100,7 @@ typedef BinAllocator<28,400> BinAllocator_slots1; typedef BinAllocator<92,90> BinAllocator_slots2; #else typedef BinAllocator<28,415> BinAllocator_slots1; -typedef BinAllocator<92,100> BinAllocator_slots2; +typedef BinAllocator<92,98> BinAllocator_slots2; #endif #else typedef BinAllocator<28,200> BinAllocator_slots1; diff --git a/radio/src/boards/generic_stm32/aux_ports.cpp b/radio/src/boards/generic_stm32/aux_ports.cpp index 21cd6b4a4..c3976b4b0 100644 --- a/radio/src/boards/generic_stm32/aux_ports.cpp +++ b/radio/src/boards/generic_stm32/aux_ports.cpp @@ -82,7 +82,7 @@ const etx_serial_port_t auxSerialPort = { .name = "AUX1", .uart = &STM32SerialDriver, .hw_def = REF_STM32_SERIAL_PORT(Aux), - AUX_PWR_FCT + .set_pwr = AUX_PWR_FCT }; #define AUX_SERIAL_PORT &auxSerialPort #else @@ -121,7 +121,7 @@ const etx_serial_port_t aux2SerialPort = { .name = "AUX2", .uart = &STM32SerialDriver, .hw_def = REF_STM32_SERIAL_PORT(Aux2), - AUX2_PWR_FCT + .set_pwr = AUX2_PWR_FCT }; #define AUX2_SERIAL_PORT &aux2SerialPort #else diff --git a/radio/src/storage/yaml/yaml_node.h b/radio/src/storage/yaml/yaml_node.h index 49b564747..3ee409ec3 100644 --- a/radio/src/storage/yaml/yaml_node.h +++ b/radio/src/storage/yaml/yaml_node.h @@ -115,25 +115,25 @@ struct YamlNode .tag=(str) #define YAML_IDX \ - { .size=0, .type=YDT_IDX, 0, YAML_TAG("idx") } + { .size=0, .type=YDT_IDX, .elmts=0, YAML_TAG("idx") } #define YAML_IDX_CUST(tag, f_read, f_write) \ - { .size=0, .type=YDT_IDX, 0, YAML_TAG(tag), .u={._cust_idx={.read=(f_read), .write=(f_write) }} } + { .size=0, .type=YDT_IDX, .elmts=0, YAML_TAG(tag), .u={._cust_idx={.read=(f_read), .write=(f_write) }} } #define YAML_SIGNED(tag, bits) \ - { .size=(bits), .type=YDT_SIGNED, 0, YAML_TAG(tag) } + { .size=(bits), .type=YDT_SIGNED, .elmts=0, YAML_TAG(tag) } #define YAML_UNSIGNED(tag, bits) \ - { .size=(bits), .type=YDT_UNSIGNED, 0, YAML_TAG(tag) } + { .size=(bits), .type=YDT_UNSIGNED, .elmts=0, YAML_TAG(tag) } #define YAML_SIGNED_CUST(tag, bits, f_cust_to_uint, f_uint_to_cust) \ - { .size=(bits), .type=YDT_SIGNED, 0, YAML_TAG(tag), .u={._cust={ .cust_to_uint=f_cust_to_uint, .uint_to_cust=f_uint_to_cust }} } + { .size=(bits), .type=YDT_SIGNED, .elmts=0, YAML_TAG(tag), .u={._cust={ .cust_to_uint=f_cust_to_uint, .uint_to_cust=f_uint_to_cust }} } #define YAML_UNSIGNED_CUST(tag, bits, f_cust_to_uint, f_uint_to_cust) \ - { .size=(bits), .type=YDT_UNSIGNED, 0, YAML_TAG(tag), .u={._cust={ .cust_to_uint=f_cust_to_uint, .uint_to_cust=f_uint_to_cust }} } + { .size=(bits), .type=YDT_UNSIGNED, .elmts=0, YAML_TAG(tag), .u={._cust={ .cust_to_uint=f_cust_to_uint, .uint_to_cust=f_uint_to_cust }} } #define YAML_STRING(tag, max_len) \ - { .size=((max_len)<<3), .type=YDT_STRING, 0, YAML_TAG(tag) } + { .size=((max_len)<<3), .type=YDT_STRING, .elmts=0, YAML_TAG(tag) } #define YAML_STRUCT(tag, bits, nodes, f_is_active) \ { .size=(bits), .type=YDT_ARRAY, .elmts=1, YAML_TAG(tag), .u={._array={ .child=(nodes), .u={.is_active=(f_is_active)}}} } @@ -142,16 +142,16 @@ struct YamlNode { .size=(bits), .type=YDT_ARRAY, .elmts=(max_elmts), YAML_TAG(tag), .u={._array={ .child=(nodes), .u={.is_active=(f_is_active)}}} } #define YAML_ENUM(tag, bits, id_strs) \ - { .size=(bits), .type=YDT_ENUM, 0, YAML_TAG(tag), .u={._enum={ .choices=(id_strs) }} } + { .size=(bits), .type=YDT_ENUM, .elmts=0, YAML_TAG(tag), .u={._enum={ .choices=(id_strs) }} } #define YAML_UNION(tag, bits, nodes, f_sel_m) \ - { .size=(bits), .type=YDT_UNION, 0, YAML_TAG(tag), .u={._array={ .child=(nodes), .u={.select_member=(f_sel_m) }}} } + { .size=(bits), .type=YDT_UNION, .elmts=0, YAML_TAG(tag), .u={._array={ .child=(nodes), .u={.select_member=(f_sel_m) }}} } #define YAML_PADDING(bits) \ { .size=(bits), .type=YDT_PADDING } #define YAML_CUSTOM(tag, f_read, f_write) \ - { .size=0, .type=YDT_CUSTOM, 0, YAML_TAG(tag), .u={._cust_attr={.read=(f_read), .write=(f_write) }} } + { .size=0, .type=YDT_CUSTOM, .elmts=0, YAML_TAG(tag), .u={._cust_attr={.read=(f_read), .write=(f_write) }} } #define YAML_END \ { .size=0, .type=YDT_NONE } @@ -170,22 +170,22 @@ struct YamlNode (str) #define YAML_IDX \ - { 0, YDT_IDX, 0, YAML_TAG("idx") } + { 0, YDT_IDX, .elmts=0, YAML_TAG("idx") } #define YAML_SIGNED(tag, bits) \ - { (bits), YDT_SIGNED, 0, YAML_TAG(tag) } + { (bits), YDT_SIGNED, .elmts=0, YAML_TAG(tag) } #define YAML_UNSIGNED(tag, bits) \ - { (bits), YDT_UNSIGNED, 0, YAML_TAG(tag) } + { (bits), YDT_UNSIGNED, .elmts=0, YAML_TAG(tag) } #define YAML_SIGNED_CUST(tag, bits, f_cust_to_uint, f_uint_to_cust) \ - { (bits), YDT_SIGNED, 0, YAML_TAG(tag), {{ (const YamlNode*)f_cust_to_uint, {{ (YamlNode::is_active_func)f_uint_to_cust, 0 }}}} } + { (bits), YDT_SIGNED, .elmts=0, YAML_TAG(tag), {{ (const YamlNode*)f_cust_to_uint, {{ (YamlNode::is_active_func)f_uint_to_cust, 0 }}}} } #define YAML_UNSIGNED_CUST(tag, bits, f_cust_to_uint, f_uint_to_cust) \ - { (bits), YDT_UNSIGNED, 0, YAML_TAG(tag), {{ (const YamlNode*)f_cust_to_uint, {{ (YamlNode::is_active_func)f_uint_to_cust, 0}}}} } + { (bits), YDT_UNSIGNED, .elmts=0, YAML_TAG(tag), {{ (const YamlNode*)f_cust_to_uint, {{ (YamlNode::is_active_func)f_uint_to_cust, 0}}}} } #define YAML_STRING(tag, max_len) \ - { ((max_len)<<3), YDT_STRING, 0, YAML_TAG(tag) } + { ((max_len)<<3), YDT_STRING, .elmts=0, YAML_TAG(tag) } #define YAML_STRUCT(tag, bits, nodes, f_is_active) \ { (bits), YDT_ARRAY, 1, YAML_TAG(tag), {{ (nodes), {{ (f_is_active) }}}} } @@ -194,10 +194,10 @@ struct YamlNode { (bits), YDT_ARRAY, (max_elmts), YAML_TAG(tag), {{ (nodes), {{ (f_is_active) }}}} } #define YAML_ENUM(tag, bits, id_strs) \ - { (bits), YDT_ENUM, 0, YAML_TAG(tag), {{ (const YamlNode*)(id_strs) }} } + { (bits), YDT_ENUM, .elmts=0, YAML_TAG(tag), {{ (const YamlNode*)(id_strs) }} } #define YAML_UNION(tag, bits, nodes, f_sel_m) \ - { (bits), YDT_UNION, 0, YAML_TAG(tag), {{ (nodes), {{ (YamlNode::is_active_func)(f_sel_m) }}}} } + { (bits), YDT_UNION, .elmts=0, YAML_TAG(tag), {{ (nodes), {{ (YamlNode::is_active_func)(f_sel_m) }}}} } #define YAML_PADDING(bits) \ { (bits), YDT_PADDING } diff --git a/radio/src/syscalls.c b/radio/src/syscalls.c index e0e9fa190..9eb5421b7 100644 --- a/radio/src/syscalls.c +++ b/radio/src/syscalls.c @@ -134,3 +134,11 @@ extern void _kill(int pid, int sig) { return; } + +extern void __assert_func (const char *p1, int p2, const char *p3, const char *p4) +{ + asm("BKPT"); +#if defined(DEBUG) + while(1); +#endif +} diff --git a/tools/setup_buildenv_msys2_stage2.sh b/tools/setup_buildenv_msys2_stage2.sh index b693c247e..3c2e7dae4 100644 --- a/tools/setup_buildenv_msys2_stage2.sh +++ b/tools/setup_buildenv_msys2_stage2.sh @@ -14,20 +14,43 @@ do done echo "=== Step $((STEP++)): Installing packages ===" -pacman -S --noconfirm mingw-w64-x86_64-cmake mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-pillow mingw-w64-x86_64-python-lz4 mingw-w64-x86_64-arm-none-eabi-gcc mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-zlib mingw-w64-x86_64-libtiff mingw-w64-x86_64-freetype mingw-w64-x86_64-lcms2 mingw-w64-x86_64-libwebp mingw-w64-x86_64-openjpeg2 mingw-w64-x86_64-libimagequant mingw-w64-x86_64-libraqm mingw-w64-x86_64-SDL2 mingw-w64-x86_64-nsis mingw-w64-x86_64-clang mingw-w64-x86_64-openssl +pacman -S --noconfirm mingw-w64-x86_64-cmake mingw-w64-x86_64-python-pip mingw-w64-x86_64-python-pillow mingw-w64-x86_64-python-lz4 mingw-w64-x86_64-libjpeg-turbo mingw-w64-x86_64-zlib mingw-w64-x86_64-libtiff mingw-w64-x86_64-freetype mingw-w64-x86_64-lcms2 mingw-w64-x86_64-libwebp mingw-w64-x86_64-openjpeg2 mingw-w64-x86_64-libimagequant mingw-w64-x86_64-libraqm mingw-w64-x86_64-SDL2 mingw-w64-x86_64-nsis mingw-w64-x86_64-clang mingw-w64-x86_64-openssl unzip wget if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop." read fi +echo "=== Step $((STEP++)): Downloading GNU Arm Embedded Toolchain ===" +wget https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi.zip +if [[ $PAUSEAFTEREACHLINE == "true" ]]; then + echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop." + read +fi + +echo "=== Step $((STEP++)): Installing GNU Arm Embedded Toolchain ===" +unzip arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi.zip -d gcc-arm-none-eabi +rm arm-gnu-toolchain-14.2.rel1-mingw-w64-i686-arm-none-eabi.zip +mv gcc-arm-none-eabi/ /opt/gcc-arm-none-eabi +if [[ $PAUSEAFTEREACHLINE == "true" ]]; then + echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop." + read +fi + +echo "=== Step $((STEP++)): Adding GNU Arm Embedded Toolchain to PATH of current user ===" +echo 'export PATH="/opt/gcc-arm-none-eabi/bin:$PATH"' >> ~/.bashrc +if [[ $PAUSEAFTEREACHLINE == "true" ]]; then + echo "Step finished. Please press Enter to continue or Ctrl+C to stop." + read +fi + echo "=== Step $((STEP++)): Installing Python clang ===" python -m pip install clang if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop." read fi -echo "=== Step $((STEP++)): Installing Python jinja2 ===" +echo "=== Step $((STEP++)): Installing Python jinja2 ===" python -m pip install jinja2 if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please check the output above and press Enter to continue or Ctrl+C to stop." diff --git a/tools/setup_buildenv_ubuntu20.04.sh b/tools/setup_buildenv_ubuntu20.04.sh index 6cd02ff38..67c3776d5 100755 --- a/tools/setup_buildenv_ubuntu20.04.sh +++ b/tools/setup_buildenv_ubuntu20.04.sh @@ -56,29 +56,29 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then fi echo "=== Step $((STEP++)): Fetching GNU Arm Embedded Toolchains ===" -# EdgeTX uses GNU Arm Embedded Toolchain in version 10-2020-q4 -wget -q --show-progress --progress=bar:force:noscroll https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 +# EdgeTX uses GNU Arm Embedded Toolchain version 14.2.rel1 +wget -q --show-progress --progress=bar:force:noscroll https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please press Enter to continue or Ctrl+C to stop." read fi echo "=== Step $((STEP++)): Unpacking GNU Arm Embedded Toolchains ===" -pv gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 | tar xjf - +pv arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz | tar xJf - if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please press Enter to continue or Ctrl+C to stop." read fi echo "=== Step $((STEP++)): Removing the downloaded archives ===" -rm gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 +rm arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please press Enter to continue or Ctrl+C to stop." read fi echo "=== Step $((STEP++)): Moving GNU Arm Embedded Toolchains to /opt ===" -sudo mv gcc-arm-none-eabi-10-2020-q4-major /opt/gcc-arm-none-eabi +sudo mv arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi /opt/gcc-arm-none-eabi if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please press Enter to continue or Ctrl+C to stop." read diff --git a/tools/setup_buildenv_ubuntu22.04.sh b/tools/setup_buildenv_ubuntu22.04.sh index cb65ea8e8..553189d98 100755 --- a/tools/setup_buildenv_ubuntu22.04.sh +++ b/tools/setup_buildenv_ubuntu22.04.sh @@ -56,29 +56,29 @@ if [[ $PAUSEAFTEREACHLINE == "true" ]]; then fi echo "=== Step $((STEP++)): Fetching GNU Arm Embedded Toolchains ===" -# EdgeTX uses GNU Arm Embedded Toolchain in version 10-2020-q4 -wget -q --show-progress --progress=bar:force:noscroll https://developer.arm.com/-/media/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 +# EdgeTX uses GNU Arm Embedded Toolchain version 14.2.rel1 +wget -q --show-progress --progress=bar:force:noscroll https://developer.arm.com/-/media/Files/downloads/gnu/14.2.rel1/binrel/arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please press Enter to continue or Ctrl+C to stop." read fi echo "=== Step $((STEP++)): Unpacking GNU Arm Embedded Toolchains ===" -pv gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 | tar xjf - +pv arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz | tar xJf - if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please press Enter to continue or Ctrl+C to stop." read fi echo "=== Step $((STEP++)): Removing the downloaded archives ===" -rm gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 +rm arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi.tar.xz if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please press Enter to continue or Ctrl+C to stop." read fi echo "=== Step $((STEP++)): Moving GNU Arm Embedded Toolchains to /opt ===" -sudo mv gcc-arm-none-eabi-10-2020-q4-major /opt/gcc-arm-none-eabi +sudo mv arm-gnu-toolchain-14.2.rel1-x86_64-arm-none-eabi /opt/gcc-arm-none-eabi if [[ $PAUSEAFTEREACHLINE == "true" ]]; then echo "Step finished. Please press Enter to continue or Ctrl+C to stop." read