adamgreen / gcc4mbed

Project to allow GCC compilation of code using mbed SDK libraries.
173 stars 68 forks source link

Including External MBED Library Fails Compilation #34

Closed jcady closed 9 years ago

jcady commented 9 years ago

My target is the NRF51-Dongle (I know it isn't supported, but I added support for it, it's pretty close to the NRF51822).

I am able to compile just fine using gcc4mbed in Eclipse with a simple project, like HelloWorld. My project is a Bluetooth LE project, so I need to include the BLE_API and NRF51822 libraries that MBED makes. The issue is that whenever I put those directories into my build directory (without even calling) and attempt to compile, the build fails with a slew of errors. I've attached the full output of the errors below.

As a test, I exported the BLE_HeartRate test program, which includes those two libraries, for the NRF51-Dongle target to GCC. I made a makefile project with the MBED generated makefile in Eclipse. I set the path for arm-none-eabi and it compiled successfully, libraries in all.

It's nice that MBED can export straight to GCC and have everything work out of the box. But I really don't want to have to copy everything to the online IDE and re-export every time I want to add a file, just so it can generate a proper makefile. It also doesn't seem to support incremental builds (it builds everything every time, unlike gcc4mbed), which is a bit of a pain. Are those the main advantages of using gcc4mbed over exporting to gcc from the MBED online compiler?

Do you know how I can include the BLE_API and NRF51822 libraries and have them build properly with gcc4mbed?

Description Resource    Path    Location    Type
'NRF_ERROR_NOT_FOUND' undeclared (first use in this function)   ble_advdata_parser.c    /ble/nRF51822/source/nordic-sdk/components/ble/common   line 55 C/C++ Problem
'NRF_SUCCESS' undeclared (first use in this function)   ble_advdata_parser.c    /ble/nRF51822/source/nordic-sdk/components/ble/common   line 51 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   BLE.h   /ble/BLE_API/ble    line 31 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   BLE.h   /test_proj/BLE_API/ble  line 31 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   BLEInstanceBase.h   /ble/BLE_API/ble    line 31 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   BLEInstanceBase.h   /test_proj/BLE_API/ble  line 31 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   CallChain.h /HelloWorld/mbed/libraries/mbed/api line 22 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   CallChain.h /ble/mbed/libraries/mbed/api    line 22 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   FunctionPointer.h   /HelloWorld/mbed/libraries/mbed/api line 22 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   FunctionPointer.h   /ble/mbed/libraries/mbed/api    line 22 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   Gap.h   /ble/BLE_API/ble    line 34 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   Gap.h   /test_proj/BLE_API/ble  line 34 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GapAdvertisingData.h    /ble/BLE_API/ble    line 76 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GapAdvertisingData.h    /test_proj/BLE_API/ble  line 76 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GapAdvertisingParams.h  /ble/BLE_API/ble    line 35 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GapAdvertisingParams.h  /test_proj/BLE_API/ble  line 35 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GapEvents.h /ble/BLE_API/ble    line 30 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GapEvents.h /test_proj/BLE_API/ble  line 30 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GapScanningParams.h /ble/BLE_API/ble    line 20 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GapScanningParams.h /test_proj/BLE_API/ble  line 20 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattAttribute.h /ble/BLE_API/ble    line 22 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattAttribute.h /test_proj/BLE_API/ble  line 22 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattCharacteristic.h    /ble/BLE_API/ble    line 26 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattCharacteristic.h    /test_proj/BLE_API/ble  line 26 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattClient.h    /ble/BLE_API/ble    line 26 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattClient.h    /test_proj/BLE_API/ble  line 26 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattServer.h    /ble/BLE_API/ble    line 27 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattServer.h    /test_proj/BLE_API/ble  line 27 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattServerEvents.h  /ble/BLE_API/ble    line 26 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattServerEvents.h  /test_proj/BLE_API/ble  line 26 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattService.h   /ble/BLE_API/ble    line 23 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   GattService.h   /test_proj/BLE_API/ble  line 23 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   SecurityManager.h   /ble/BLE_API/ble    line 24 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   SecurityManager.h   /test_proj/BLE_API/ble  line 24 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   ServiceDiscovery.h  /ble/BLE_API/ble    line 27 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   ServiceDiscovery.h  /test_proj/BLE_API/ble  line 27 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   UUID.h  /ble/BLE_API/ble    line 25 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '{' token   UUID.h  /test_proj/BLE_API/ble  line 25 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   CallChainOfFunctionPointersWithContext.h    /ble/BLE_API/ble    line 58 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   CallChainOfFunctionPointersWithContext.h    /test_proj/BLE_API/ble  line 58 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   FunctionPointerWithContext.h    /ble/BLE_API/ble    line 26 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   FunctionPointerWithContext.h    /test_proj/BLE_API/ble  line 26 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /ble/BLE_API/ble    line 457    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /ble/BLE_API/ble    line 466    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /ble/BLE_API/ble    line 475    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /ble/BLE_API/ble    line 485    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /ble/BLE_API/ble    line 495    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /ble/BLE_API/ble    line 505    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /test_proj/BLE_API/ble  line 457    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /test_proj/BLE_API/ble  line 466    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /test_proj/BLE_API/ble  line 475    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /test_proj/BLE_API/ble  line 485    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /test_proj/BLE_API/ble  line 495    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before '<' token   GattCharacteristic.h    /test_proj/BLE_API/ble  line 505    C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before 'mbed'  Gap.h   /ble/BLE_API/ble    line 27 C/C++ Problem
expected '=', ',', ';', 'asm' or '__attribute__' before 'mbed'  Gap.h   /test_proj/BLE_API/ble  line 27 C/C++ Problem
expected specifier-qualifier-list before 'GattAttribute'    GattCallbackParamTypes.h    /ble/BLE_API/ble    line 31 C/C++ Problem
expected specifier-qualifier-list before 'GattAttribute'    GattCallbackParamTypes.h    /ble/BLE_API/ble    line 39 C/C++ Problem
expected specifier-qualifier-list before 'GattAttribute'    GattCallbackParamTypes.h    /ble/BLE_API/ble    line 61 C/C++ Problem
expected specifier-qualifier-list before 'GattAttribute'    GattCallbackParamTypes.h    /ble/BLE_API/ble    line 70 C/C++ Problem
expected specifier-qualifier-list before 'GattAttribute'    GattCallbackParamTypes.h    /ble/BLE_API/ble    line 80 C/C++ Problem
expected specifier-qualifier-list before 'GattAttribute'    GattCallbackParamTypes.h    /test_proj/BLE_API/ble  line 31 C/C++ Problem
expected specifier-qualifier-list before 'GattAttribute'    GattCallbackParamTypes.h    /test_proj/BLE_API/ble  line 39 C/C++ Problem
expected specifier-qualifier-list before 'GattAttribute'    GattCallbackParamTypes.h    /test_proj/BLE_API/ble  line 61 C/C++ Problem
expected specifier-qualifier-list before 'GattAttribute'    GattCallbackParamTypes.h    /test_proj/BLE_API/ble  line 70 C/C++ Problem
expected specifier-qualifier-list before 'GattAttribute'    GattCallbackParamTypes.h    /test_proj/BLE_API/ble  line 80 C/C++ Problem
Invalid arguments '
Candidates are:
int wait(int *)
 wait()
 wait(const wait &)
'   main.cpp    /test_proj  line 15 Semantic Error
Invalid arguments '
Candidates are:
int wait(int *)
 wait()
 wait(const wait &)
'   main.cpp    /test_proj  line 17 Semantic Error
invalid initializer ble_advdata.c   /ble/nRF51822/source/nordic-sdk/components/ble/common   line 178    C/C++ Problem
invalid initializer ble_advdata.c   /test_proj/nRF51822/source/nordic-sdk/components/ble/common line 178    C/C++ Problem
make: *** [NRF51_DONGLE/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu/ble_dfu.o] Error 1   ble         C/C++ Problem
make: *** [NRF51_DONGLE/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu/ble_dfu.o] Error 1   test_proj           C/C++ Problem
make: *** [NRF51_DONGLE/nRF51822/source/nordic-sdk/components/ble/common/ble_advdata_parser.o] Error 1  ble         C/C++ Problem
make: *** [NRF51_DONGLE/nRF51822/source/nordic-sdk/components/ble/common/ble_advdata.o] Error 1 ble         C/C++ Problem
make: *** [NRF51_DONGLE/nRF51822/source/nordic-sdk/components/ble/common/ble_advdata.o] Error 1 test_proj           C/C++ Problem
make: *** Waiting for unfinished jobs....   ble         C/C++ Problem
make: *** Waiting for unfinished jobs....   test_proj           C/C++ Problem
Type 'DigitalOut' could not be resolved main.cpp    /test_proj  line 7  Semantic Error
Type 'LED1' could not be resolved   main.cpp    /test_proj  line 7  Semantic Error
unknown type name 'ble_evt_t'   ble_dfu.c   /ble/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu line 228    C/C++ Problem
unknown type name 'ble_evt_t'   ble_dfu.c   /ble/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu line 416    C/C++ Problem
unknown type name 'ble_evt_t'   ble_dfu.c   /ble/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu line 451    C/C++ Problem
unknown type name 'ble_evt_t'   ble_dfu.c   /ble/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu line 473    C/C++ Problem
unknown type name 'ble_evt_t'   ble_dfu.c   /ble/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu line 548    C/C++ Problem
unknown type name 'ble_evt_t'   ble_dfu.c   /test_proj/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu   line 228    C/C++ Problem
unknown type name 'ble_evt_t'   ble_dfu.c   /test_proj/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu   line 416    C/C++ Problem
unknown type name 'ble_evt_t'   ble_dfu.c   /test_proj/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu   line 451    C/C++ Problem
unknown type name 'ble_evt_t'   ble_dfu.c   /test_proj/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu   line 473    C/C++ Problem
unknown type name 'ble_evt_t'   ble_dfu.c   /test_proj/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu   line 548    C/C++ Problem
unknown type name 'ble_evt_t'   ble_dfu.h   /ble/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu line 190    C/C++ Problem
unknown type name 'ble_evt_t'   ble_dfu.h   /test_proj/nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu   line 190    C/C++ Problem
unknown type name 'ble_uuid_t'  ble_advdata.h   /ble/nRF51822/source/nordic-sdk/components/ble/common   line 64 C/C++ Problem
unknown type name 'ble_uuid_t'  ble_advdata.h   /test_proj/nRF51822/source/nordic-sdk/components/ble/common line 64 C/C++ Problem
unknown type name 'BLE' BLE.h   /ble/BLE_API/ble    line 1339   C/C++ Problem
unknown type name 'BLE' BLE.h   /test_proj/BLE_API/ble  line 1339   C/C++ Problem
unknown type name 'BLEInstanceBase' BLEInstanceBase.h   /ble/BLE_API/ble    line 54 C/C++ Problem
unknown type name 'BLEInstanceBase' BLEInstanceBase.h   /test_proj/BLE_API/ble  line 54 C/C++ Problem
unknown type name 'class'   BLE.h   /ble/BLE_API/ble    line 30 C/C++ Problem
unknown type name 'class'   BLE.h   /test_proj/BLE_API/ble  line 30 C/C++ Problem
unknown type name 'class'   BLEInstanceBase.h   /ble/BLE_API/ble    line 23 C/C++ Problem

And here is the makefile that MBED generates for the BLE_HeartRate example, in case it helps diagnose what's going on:

# This file was automagically generated by mbed.org. For more information, 
# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded

GCC_BIN = 
PROJECT = BLE_HeartRate
OBJECTS = ./nRF51822/source/nordic-sdk/components/drivers_nrf/ble_flash/ble_flash.o ./nRF51822/source/nordic-sdk/components/drivers_nrf/pstorage/pstorage.o ./nRF51822/source/nordic-sdk/components/drivers_nrf/hal/nrf_nvmc.o ./nRF51822/source/nordic-sdk/components/drivers_nrf/hal/nrf_delay.o ./nRF51822/source/nordic-sdk/components/drivers_nrf/hal/nrf_ecb.o ./nRF51822/source/nordic-sdk/components/libraries/util/app_util_platform.o ./nRF51822/source/nordic-sdk/components/libraries/util/nrf_assert.o ./nRF51822/source/nordic-sdk/components/libraries/util/app_error.o ./nRF51822/source/nordic-sdk/components/libraries/hci/hci_mem_pool.o ./nRF51822/source/nordic-sdk/components/libraries/bootloader_dfu/dfu_init_template.o ./nRF51822/source/nordic-sdk/components/libraries/bootloader_dfu/bootloader_util_arm.o ./nRF51822/source/nordic-sdk/components/libraries/bootloader_dfu/experimental/dfu_app_handler.o ./nRF51822/source/nordic-sdk/components/libraries/scheduler/app_scheduler.o ./nRF51822/source/nordic-sdk/components/libraries/crc16/crc16.o ./nRF51822/source/nordic-sdk/components/softdevice/common/softdevice_handler/softdevice_handler.o ./nRF51822/source/nordic-sdk/components/softdevice/common/softdevice_handler/softdevice_handler_appsh.o ./nRF51822/source/nordic-sdk/components/ble/common/ble_advdata_parser.o ./nRF51822/source/nordic-sdk/components/ble/common/ble_srv_common.o ./nRF51822/source/nordic-sdk/components/ble/common/ble_advdata.o ./nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu/ble_dfu.o ./nRF51822/source/nordic-sdk/components/ble/ble_radio_notification/ble_radio_notification.o ./nRF51822/source/nordic-sdk/components/ble/device_manager/device_manager_peripheral.o ./main.o ./nRF51822/source/nRF51Gap.o ./nRF51822/source/nRF51SecurityManager.o ./nRF51822/source/nRF51GattServer.o ./nRF51822/source/nRF51DiscoveredCharacteristic.o ./nRF51822/source/nRF51ServiceDiscovery.o ./nRF51822/source/nRF51GattClient.o ./nRF51822/source/nRF51822n.o ./nRF51822/source/nordic-sdk/components/ble/common/ble_conn_params.o ./nRF51822/source/btle/btle_gap.o ./nRF51822/source/btle/btle_advertising.o ./nRF51822/source/btle/btle_security.o ./nRF51822/source/btle/btle.o ./nRF51822/source/btle/btle_discovery.o ./nRF51822/source/btle/custom/custom_helper.o ./BLE_API/source/BLE.o ./BLE_API/source/DiscoveredCharacteristic.o ./BLE_API/source/GapScanningParams.o ./BLE_API/source/services/UARTService.o ./BLE_API/source/services/DFUService.o ./BLE_API/source/services/URIBeaconConfigService.o 
SYS_OBJECTS = ./mbed/TARGET_NRF51_DONGLE/TOOLCHAIN_GCC_ARM/startup_NRF51822.o ./mbed/TARGET_NRF51_DONGLE/TOOLCHAIN_GCC_ARM/board.o ./mbed/TARGET_NRF51_DONGLE/TOOLCHAIN_GCC_ARM/system_nrf51.o ./mbed/TARGET_NRF51_DONGLE/TOOLCHAIN_GCC_ARM/cmsis_nvic.o ./mbed/TARGET_NRF51_DONGLE/TOOLCHAIN_GCC_ARM/retarget.o 
INCLUDE_PATHS = -I. -I./nRF51822 -I./nRF51822/source -I./nRF51822/source/common -I./nRF51822/source/nordic-sdk -I./nRF51822/source/nordic-sdk/components -I./nRF51822/source/nordic-sdk/components/drivers_nrf -I./nRF51822/source/nordic-sdk/components/drivers_nrf/ble_flash -I./nRF51822/source/nordic-sdk/components/drivers_nrf/pstorage -I./nRF51822/source/nordic-sdk/components/drivers_nrf/pstorage/config -I./nRF51822/source/nordic-sdk/components/drivers_nrf/hal -I./nRF51822/source/nordic-sdk/components/libraries -I./nRF51822/source/nordic-sdk/components/libraries/util -I./nRF51822/source/nordic-sdk/components/libraries/hci -I./nRF51822/source/nordic-sdk/components/libraries/bootloader_dfu -I./nRF51822/source/nordic-sdk/components/libraries/bootloader_dfu/hci_transport -I./nRF51822/source/nordic-sdk/components/libraries/bootloader_dfu/experimental -I./nRF51822/source/nordic-sdk/components/libraries/scheduler -I./nRF51822/source/nordic-sdk/components/libraries/crc16 -I./nRF51822/source/nordic-sdk/components/softdevice -I./nRF51822/source/nordic-sdk/components/softdevice/common -I./nRF51822/source/nordic-sdk/components/softdevice/common/softdevice_handler -I./nRF51822/source/nordic-sdk/components/softdevice/s130 -I./nRF51822/source/nordic-sdk/components/softdevice/s130/include -I./nRF51822/source/nordic-sdk/components/ble -I./nRF51822/source/nordic-sdk/components/ble/common -I./nRF51822/source/nordic-sdk/components/ble/ble_services -I./nRF51822/source/nordic-sdk/components/ble/ble_services/ble_dfu -I./nRF51822/source/nordic-sdk/components/ble/ble_radio_notification -I./nRF51822/source/nordic-sdk/components/ble/device_manager -I./nRF51822/source/nordic-sdk/components/ble/device_manager/config -I./nRF51822/source/btle -I./nRF51822/source/btle/custom -I./mbed -I./mbed/TARGET_NRF51_DONGLE -I./mbed/TARGET_NRF51_DONGLE/TOOLCHAIN_GCC_ARM -I./mbed/TARGET_NRF51_DONGLE/TARGET_NORDIC -I./mbed/TARGET_NRF51_DONGLE/TARGET_NORDIC/TARGET_MCU_NRF51822 -I./mbed/TARGET_NRF51_DONGLE/TARGET_NORDIC/TARGET_MCU_NRF51822/TARGET_NRF51_DONGLE -I./mbed/TARGET_NRF51_DONGLE/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib -I./mbed/TARGET_NRF51_DONGLE/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/s130_nrf51822_1_0_0 -I./mbed/TARGET_NRF51_DONGLE/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/nordic_sdk -I./mbed/TARGET_NRF51_DONGLE/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/nordic_sdk/components -I./mbed/TARGET_NRF51_DONGLE/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/nordic_sdk/components/libraries -I./mbed/TARGET_NRF51_DONGLE/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/nordic_sdk/components/libraries/util -I./mbed/TARGET_NRF51_DONGLE/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/nordic_sdk/components/libraries/scheduler -I./mbed/TARGET_NRF51_DONGLE/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/nordic_sdk/components/libraries/crc16 -I./BLE_API -I./BLE_API/ble -I./BLE_API/ble/services -I./BLE_API/source -I./BLE_API/source/services 
LIBRARY_PATHS = -L./mbed/TARGET_NRF51_DONGLE/TOOLCHAIN_GCC_ARM 
LIBRARIES = -lmbed 
LINKER_SCRIPT = ./mbed/TARGET_NRF51_DONGLE/TOOLCHAIN_GCC_ARM/NRF51822.ld
SOFTDEVICE = mbed/TARGET_NRF51822/TARGET_NORDIC/TARGET_MCU_NRF51822/Lib/s110_nrf51822_7_0_0/s110_nrf51822_7.0.0_softdevice.hex

############################################################################### 
AS      = $(GCC_BIN)arm-none-eabi-as
CC      = $(GCC_BIN)arm-none-eabi-gcc
CPP     = $(GCC_BIN)arm-none-eabi-g++
LD      = $(GCC_BIN)arm-none-eabi-gcc
OBJCOPY = $(GCC_BIN)arm-none-eabi-objcopy
OBJDUMP = $(GCC_BIN)arm-none-eabi-objdump
SIZE    = $(GCC_BIN)arm-none-eabi-size
SREC_CAT = srec_cat

CPU = -mcpu=cortex-m0 -mthumb 
CC_FLAGS = $(CPU) -c -g -fno-common -fmessage-length=0 -Wall -fno-exceptions -ffunction-sections -fdata-sections -fomit-frame-pointer -MMD -MP
CC_SYMBOLS = -DTARGET_NRF51_DONGLE -DTARGET_M0 -DTARGET_CORTEX_M -DTARGET_NORDIC -DTARGET_MCU_NRF51822 -DTARGET_MCU_NORDIC_32K -DTOOLCHAIN_GCC_ARM -DTOOLCHAIN_GCC -D__CORTEX_M0 -DARM_MATH_CM0 -DMBED_BUILD_TIMESTAMP=1436400097.71 -D__MBED__=1 -DTARGET_NRF51822 -DNRF51 

LD_FLAGS = $(CPU) -Wl,--gc-sections --specs=nano.specs -Wl,--wrap,main -Wl,-Map=$(PROJECT).map,--cref
#LD_FLAGS += -u _printf_float -u _scanf_float
LD_SYS_LIBS = -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys

ifeq ($(DEBUG), 1)
  CC_FLAGS += -DDEBUG -O0
else
  CC_FLAGS += -DNDEBUG -Os
endif

.PHONY: all clean lst size

all: $(PROJECT).bin $(PROJECT).hex size

clean:
    rm -f $(PROJECT).bin $(PROJECT).elf $(PROJECT).hex $(PROJECT).map $(PROJECT).lst $(OBJECTS) $(DEPS)

.s.o:
    $(AS) $(CPU) -o $@ $<

.c.o:
    $(CC)  $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu99   $(INCLUDE_PATHS) -o $@ $<

.cpp.o:
    $(CPP) $(CC_FLAGS) $(CC_SYMBOLS) -std=gnu++98 -fno-rtti $(INCLUDE_PATHS) -o $@ $<

$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS)
    $(LD) $(LD_FLAGS) -T$(LINKER_SCRIPT) $(LIBRARY_PATHS) -o $@ $^ $(LIBRARIES) $(LD_SYS_LIBS) $(LIBRARIES) $(LD_SYS_LIBS)

$(PROJECT).bin: $(PROJECT).elf
    $(OBJCOPY) -O binary $< $@

$(PROJECT).hex: $(PROJECT).elf
    @$(OBJCOPY) -O ihex $< $@

$(PROJECT).lst: $(PROJECT).elf
    @$(OBJDUMP) -Sdh $< > $@

lst: $(PROJECT).lst

size: $(PROJECT).elf
    $(SIZE) $(PROJECT).elf

DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
-include $(DEPS)

merge:
    $(SREC_CAT) $(SOFTDEVICE) -intel $(PROJECT).hex -intel -o combined.hex -intel --line-length=44
adamgreen commented 9 years ago

gcc4mbed samples/ folder has a BLEHearRate sample already. Can you start with that first?

jcady commented 9 years ago

Well, would you look at that. I completely missed that sample. That looks like it will be of some help!

It looks like the libs are about a month or so old, though. So it's still a little worth it to me to figure out how to drop in the newest ones myself. Do you have any idea what might be going on?

adamgreen commented 9 years ago

Maybe you need to match the mbed SDK in external with the BLE / nRF51822 libs? Are you able to build the existing sample for your new NRF51-Dongle?

jcady commented 9 years ago

Hmmmm, that is a good idea. I'll give that a shot.

The sample built no problem.

jcady commented 9 years ago

Looks like the problem persists, even with the latest mbed.

adamgreen commented 9 years ago

If you pull down the latest mbed SDK into the external directory of gcc4mbed, make sure that you do a "make clean-all" before attempting the first build. That will make sure that any old files get cleaned out.

jcady commented 9 years ago

I didn't do that, but the build files for mbed rely in the mbed directory itself, right? I did delete the entire mbed directory and replace it with the one I pulled down, so that shouldn't be the issue.

adamgreen commented 9 years ago

Ok. I guess I don't know what is causing the problem then. It sounds like you have done what I would have done.

I can look at it when I update gcc4mbed to a newer version of the mbed SDK later in the year and run the accompanying test pass.

jcady commented 9 years ago

Sounds good to me, thanks for the support. For now, the sample fulfills my needs, so I'm satisfied!

adamgreen commented 9 years ago

I was able to reproduce this problem when I upgraded to the latest mbed sources and I now have a fix in the working branch with commit 61ae5063846cc8412890e051f0a7dd59967ce8ff. This should be merged into the master branch soon. Thanks for reporting.

adamgreen commented 9 years ago

Fix now merged into master.