ChibiOS icon indicating copy to clipboard operation
ChibiOS copied to clipboard

Fix:mac_lld_init build error, '__eth_rb' will never be NULL

Open Huibean opened this issue 1 year ago • 3 comments

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

Huibean avatar Jan 25 '25 12:01 Huibean

This issue still exist, can someone please fix it?

TheSparkyBoy avatar Jul 12 '25 03:07 TheSparkyBoy

Just use the supported compiler version - 10.2.1

andyp1per avatar Jul 12 '25 09:07 andyp1per

@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/

Jaaaky avatar Aug 04 '25 22:08 Jaaaky