Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: failing DEBUG simulator build for radios without customisable switches #5086

Merged
merged 1 commit into from
May 30, 2024

Conversation

philmoz
Copy link
Collaborator

@philmoz philmoz commented May 29, 2024

Also removed unused code from radio_diagcustswitches.cpp.

@pfeerick
Copy link
Member

pfeerick commented May 29, 2024

Does diagcustswitches perhaps need the same treatment in 2.10 that was done here?

40fd258

@philmoz
Copy link
Collaborator Author

philmoz commented May 29, 2024

Does diagcustswitches perhaps need the same treatment in 2.10 that was done here?

40fd258

Not sure how that would work - there is no FUNCTION_SWITCHES option defined for CMake. It is only set as a compiler option (-DFUNCTION_SWITCHES).

@pfeerick
Copy link
Member

CMake IF can test for more than just options, and an option is not appropriate here anyway. May possibly have been better for it to have been IF(DEFINED FUNCTION_SWITCHES)1 but it appears to work correctly as radio_diagcustswitches.cpp no longer needs special handling.

It's the last commit of #5025, and prevents the two files being blindly/forcibly compiled even when not in use.

Footnotes

  1. https://cmake.org/cmake/help/latest/command/if.html#defined

@philmoz
Copy link
Collaborator Author

philmoz commented May 29, 2024

T15 will not build with this change unless -DFUNCTION_SWITCHES=YES is added to the CMAKE configuration options.
This should not be necessary.

@pfeerick
Copy link
Member

Yeah, OK, something isn't working properly there... maybe it does need the option set to work properly, meaning #5025 needs more work also as it will fail once the T15 is added.

This doesn't actually fix the debug build for radio without function switches though, does it?

root@827f153b90e1:/workspaces/edgetx# FLAVOR=TX12MK2 EXTRA_OPTIONS="-DDEBUG=Y" tools/build-gh.sh 
+ '[' -f /usr/bin/nproc ']'
++ nproc
+ num_cpus=16
+ : 16
+ [[ -n '' ]]
+++ pwd
++ dirname /workspaces/edgetx/tools/build-gh.sh
+ : /workspaces/edgetx/tools/..
+ [[ -z '' ]]
++ echo ''
++ awk -F / '{print $2}'
+ gh_type=
+ [[ '' = \t\a\g\s ]]
+ [[ '' = \p\u\l\l ]]
+ [[ '' = \h\e\a\d\s ]]
+ : Release
+ : '-DCMAKE_BUILD_TYPE=Release -DCMAKE_RULE_MESSAGES=OFF -Wno-dev '
+ : -DDEBUG=Y
+ COMMON_OPTIONS+='-DDEBUG=Y '
+ : firmware-size
++ pwd
+ git config --global --add safe.directory /workspaces/edgetx
+ rm -rf build
+ mkdir -p build
+ cd build
++ git rev-parse --short HEAD
+ GIT_SHA_SHORT=d2d8f8e50
++ echo TX12MK2
++ tr '[:upper:]' '[:lower:]'
++ tr ';' '\n'
+ target_names=tx12mk2
+ for target_name in $target_names
+ fw_name=tx12mk2-d2d8f8e50.bin
+ BUILD_OPTIONS='-DCMAKE_BUILD_TYPE=Release -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DDEBUG=Y '
+ echo 'Building tx12mk2-d2d8f8e50.bin'
Building tx12mk2-d2d8f8e50.bin
+ case $target_name in
+ BUILD_OPTIONS+='-DPCB=X7 -DPCBREV=TX12MK2'
+ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_RULE_MESSAGES=OFF -Wno-dev -DDEBUG=Y -DPCB=X7 -DPCBREV=TX12MK2 /workspaces/edgetx/tools/..
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_ARGS: -DCMAKE_RULE_MESSAGES=OFF;-DDEBUG=Y;-DPCB=X7;-DPCBREV=TX12MK2
-- CMAKE_BUILD_TYPE: Release
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /workspaces/edgetx/build
+ cmake --build . --target arm-none-eabi-configure
loading initial cache file /workspaces/edgetx/build/arm-none-eabi-prefix/tmp/arm-none-eabi-cache-Release.cmake
-- The C compiler identification is GNU 10.2.1
-- The CXX compiler identification is GNU 10.2.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- The ASM compiler identification is GNU
-- Found assembler: /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-gcc
-- Found Git: /usr/bin/git (found version "2.42.0") 
-- Found PythonInterp: /usr/bin/python3 (found suitable version "3.8.10", minimum required is "3") 
-- Python found, version: 3.8.10
-- EdgeTX 2.10.0-selfbuild @ d2d8f8e5
CPU_TYPE_FULL = STM32F407xE
-- Adding support for USB serial
-- Adding support for MULTI as internal module
-- Adding support for CRSF as internal module
-- Use LTO to compile bootloader
TARGET bootloader: cpp compiler /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-g++ v10.2.1
TARGET firmware: cpp compiler /opt/gcc-arm-none-eabi-10-2020-q4-major/bin/arm-none-eabi-g++ v10.2.1
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /workspaces/edgetx/build/arm-none-eabi
[100%] Built target arm-none-eabi-configure
+ cmake --build arm-none-eabi -j16 --target firmware-size
[  0%] Built target 9x_xbm_1bit
[  1%] Built target stm32usb_device_bl
[  2%] Built target minimal_board_lib
[  3%] Built target stm32usb_device_fw
[  4%] Built target stm32_stdperiph
[  6%] Built target stm32usb
[ 12%] Built target stm32cube_ll
[ 27%] Built target 9x_fonts_1bit
[ 29%] Built target freertos
[ 29%] Built target 9x_bitmaps
[ 33%] Built target stm32_drivers
[ 36%] Built target board_lib
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /tmp/bootloader.elf.2H0Gbe.ltrans0.ltrans.o: in function `_wait_for_not_busy(stm32_spi_t const*, unsigned long) [clone .constprop.0]':
/workspaces/edgetx/radio/src/targets/common/arm/stm32/sdcard_spi.cpp:98: undefined reference to `dbgSerialPrintf'
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /tmp/bootloader.elf.2H0Gbe.ltrans0.ltrans.o: in function `sdcard_spi_send_cmd(stm32_spi_t const*, unsigned char, unsigned long, unsigned long)':
/workspaces/edgetx/radio/src/targets/common/arm/stm32/sdcard_spi.cpp:187: undefined reference to `dbgSerialPrintf'
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /workspaces/edgetx/radio/src/targets/common/arm/stm32/sdcard_spi.cpp:210: undefined reference to `dbgSerialPrintf'
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /tmp/bootloader.elf.2H0Gbe.ltrans0.ltrans.o: in function `sdcard_spi_send_acmd(stm32_spi_t const*, unsigned char, unsigned long, unsigned long)':
/workspaces/edgetx/radio/src/targets/common/arm/stm32/sdcard_spi.cpp:236: undefined reference to `dbgSerialPrintf'
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /tmp/bootloader.elf.2H0Gbe.ltrans0.ltrans.o: in function `_read_blocks(sdcard_spi_t const*, unsigned char, unsigned long, unsigned char*, unsigned short, unsigned short, sd_rw_response_t*)':
/workspaces/edgetx/radio/src/targets/common/arm/stm32/sdcard_spi.cpp:575: undefined reference to `dbgSerialPrintf'
/opt/gcc-arm-none-eabi-10-2020-q4-major/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: /tmp/bootloader.elf.2H0Gbe.ltrans0.ltrans.o:/workspaces/edgetx/radio/src/targets/common/arm/stm32/sdcard_spi.cpp:626: more undefined references to `dbgSerialPrintf' follow
collect2: error: ld returned 1 exit status
make[3]: *** [radio/src/targets/common/arm/stm32/bootloader/CMakeFiles/bootloader.dir/build.make:590: radio/src/targets/common/arm/stm32/bootloader/bootloader.elf] Error 1
make[2]: *** [CMakeFiles/Makefile2:827: radio/src/targets/common/arm/stm32/bootloader/CMakeFiles/bootloader.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:619: radio/src/CMakeFiles/firmware-size.dir/rule] Error 2
make: *** [Makefile:332: firmware-size] Error 2

@philmoz
Copy link
Collaborator Author

philmoz commented May 30, 2024

The missing 'dbgSerialPrintf' function on B&W radios is a different issues.
The fie serial.cpp is not being included in the bootloader build for B&W radios where it is for color.

Update: including serial.cpp makes the B&W bootloader too big, so more complex fix needed.

@pfeerick
Copy link
Member

So since PL18, TX16 and T15 all work here with DEBUG=Y, with 2.10 unchanged, is this only fixing the warnings, not an actual build failure?

@philmoz
Copy link
Collaborator Author

philmoz commented May 30, 2024

So since PL18, TX16 and T15 all work here with DEBUG=Y, with 2.10 unchanged, is this only fixing the warnings, not an actual build failure?

Firmware builds for me; but simulator does not. Possibly compiler version issue.

@pfeerick
Copy link
Member

pfeerick commented May 30, 2024

Ok, gotcha... thanks for the clarification. And yes, possibly, as TX16S /w DEBUG=Y was able to build both simu and libsimulator.

@pfeerick pfeerick changed the title fix(build): fix DEBUG build for radios without function switches. fix: failing DEBUG simulator build for radios without function switches May 30, 2024
@pfeerick pfeerick added the compilation Related to compiling the firmware and firmware options label May 30, 2024
@pfeerick pfeerick added this to the 2.10.1 milestone May 30, 2024
@pfeerick pfeerick changed the title fix: failing DEBUG simulator build for radios without function switches fix: failing DEBUG simulator build for radios without customisable switches May 30, 2024
@pfeerick pfeerick merged commit 93bd54b into 2.10 May 30, 2024
45 checks passed
@pfeerick pfeerick deleted the philmoz/fix-debug-build branch May 30, 2024 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compilation Related to compiling the firmware and firmware options
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants