ChibiOS
ChibiOS copied to clipboard
Fix:mac_lld_init build error, '__eth_rb' will never be NULL
To fix a compile error happen on hardware target with ETH driver, gcc12.2/13.3 with Holybro Pixhawk v6x and CUAV Nano7
this error will only rasie in gcc above 12
[11/12] Linking build/Pixhawk6X/modules/ChibiOS/libch.a
[1/1] ChibiOS: Compiling hal_mac_lld.c
../../modules/ChibiOS/os/hal/ports/STM32/LLD/MACv2/hal_mac_lld.c: In function 'mac_lld_init':
../../modules/ChibiOS/os/hal/ports/STM32/LLD/MACv2/hal_mac_lld.c:283:16: error: the comparison will always evaluate as 'false' for the address of '__eth_rb' will never be NULL [-Werror=address]
283 | if (__eth_rb == NULL || __eth_tb == NULL || __eth_rd == NULL || __eth_td == NULL) {
| ^~
../../modules/ChibiOS/os/hal/ports/STM32/LLD/MACv2/hal_mac_lld.c:130:18: note: '__eth_rb' declared here
130 | extern uint32_t *__eth_rb[STM32_MAC_RECEIVE_BUFFERS];
| ^~~~~~~~
../../modules/ChibiOS/os/hal/ports/STM32/LLD/MACv2/hal_mac_lld.c:283:36: error: the comparison will always evaluate as 'false' for the address of '__eth_tb' will never be NULL [-Werror=address]
283 | if (__eth_rb == NULL || __eth_tb == NULL || __eth_rd == NULL || __eth_td == NULL) {
| ^~
../../modules/ChibiOS/os/hal/ports/STM32/LLD/MACv2/hal_mac_lld.c:131:18: note: '__eth_tb' declared here
131 | extern uint32_t *__eth_tb[STM32_MAC_TRANSMIT_BUFFERS];
| ^~~~~~~~
cc1: all warnings being treated as errors
make: *** [modules/ChibiOS/obj/hal_mac_lld.o] Error 1
This issue still exist, can someone please fix it?
Just use the supported compiler version - 10.2.1
@andyp1per @tridge Actually I'm having the same issue on Linux using supported 12.2 version downloaded from official Tools repo here https://firmware.ardupilot.org/Tools/STM32-tools/