[nRF52] compile error in ble_drv.c with fix

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
User avatar
FoldedToad
Posts: 8
Joined: Sat Feb 23, 2019 11:50 pm

[nRF52] compile error in ble_drv.c with fix

Post by FoldedToad » Sun Mar 03, 2019 9:46 pm

I am building micro python with on a Ubuntu 16.04 system using the Ubuntu gcc toolchain package (see gcc info below) --

robin@deeplearner:~/micropython/ports/nrf$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

The snippet of the build listing, showing the compile error, is included below --

CC main.c
CC mphalport.c
CC help.c
CC gccollect.c
CC pin_named_pins.c
CC fatfs_port.c
CC drivers/flash.c
CC drivers/softpwm.c
CC drivers/ticker.c
CC drivers/bluetooth/ble_drv.c
drivers/bluetooth/ble_drv.c:115:1: error: missing braces around initializer [-Werror=missing-braces]
nrf_nvic_state_t nrf_nvic_state = {0};
^
drivers/bluetooth/ble_drv.c:115:1: error: (near initialization for 'nrf_nvic_state.__irq_masks') [-Werror=missing-braces]
cc1: all warnings being treated as errors
../../py/mkrules.mk:47: recipe for target 'build-pca10040-s132/drivers/bluetooth/ble_drv.o' failed
make: *** [build-pca10040-s132/drivers/bluetooth/ble_drv.o] Error 1


I have a patch file which fixes this problem but I can't attach it (yet), so will copy contexts below --

--------------------- ble_drv.patch ----------------------------------
diff --git a/ports/nrf/drivers/bluetooth/ble_drv.c b/ports/nrf/drivers/bluetooth/ble_drv.c
index ff3c885..e8a3fe5 100644
--- a/ports/nrf/drivers/bluetooth/ble_drv.c
+++ b/ports/nrf/drivers/bluetooth/ble_drv.c
@@ -112,7 +112,7 @@ static mp_obj_t mp_gattc_char_data_observer;
static uint8_t m_adv_handle = BLE_GAP_ADV_SET_HANDLE_NOT_SET;
static uint8_t m_scan_buffer[BLE_GAP_SCAN_BUFFER_MIN];

-nrf_nvic_state_t nrf_nvic_state = {0};
+nrf_nvic_state_t nrf_nvic_state = {{0},0};
#endif

#if (BLUETOOTH_SD == 110)
--------------------- ble_drv.patch end -------------------------------

Post Reply