diff --git a/features/FEATURE_BLE/ble/deprecate.h b/features/FEATURE_BLE/ble/deprecate.h index 47fd3bb2d5..f0b7d38cb8 100644 --- a/features/FEATURE_BLE/ble/deprecate.h +++ b/features/FEATURE_BLE/ble/deprecate.h @@ -23,4 +23,4 @@ #define __deprecated_message(msg) #endif -#endif \ No newline at end of file +#endif diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/common/ble_conn_state.c b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/common/ble_conn_state.c index 739cf1f638..a5f5461595 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/common/ble_conn_state.c +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/common/ble_conn_state.c @@ -169,7 +169,7 @@ static void record_purge_disconnected() m_bcs.valid_conn_handles, (~m_bcs.flags.connected_flags) & (m_bcs.flags.valid_flags)); - for (int i = 0; i < disconnected_list.len; i++) + for (uint32_t i = 0; i < disconnected_list.len; i++) { record_invalidate(disconnected_list.flag_keys[i]); } diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/peer_manager/peer_database.c b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/peer_manager/peer_database.c index a34fc78fb3..8a790c02dd 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/peer_manager/peer_database.c +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/peer_manager/peer_database.c @@ -172,7 +172,7 @@ static pdb_buffer_record_t * write_buffer_record_find_unused(void) */ static void write_buffer_record_release(pdb_buffer_record_t * p_write_buffer_record) { - for (int i = 0; i < p_write_buffer_record->n_bufs; i++) + for (uint32_t i = 0; i < p_write_buffer_record->n_bufs; i++) { pm_buffer_release(&m_pdb.write_buffer, p_write_buffer_record->buffer_block_id + i); } diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/peer_manager/pm_buffer.c b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/peer_manager/pm_buffer.c index 87379e3ac0..4299793732 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/peer_manager/pm_buffer.c +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/ble/peer_manager/pm_buffer.c @@ -93,7 +93,7 @@ uint8_t pm_buffer_block_acquire(pm_buffer_t * p_buffer, uint32_t n_blocks) { first_locked_mutex = i; } - if ((i - first_locked_mutex + 1) == n_blocks) + if ((i - first_locked_mutex + 1) >= 0 && ((uint32_t)(i - first_locked_mutex + 1)) == n_blocks) { return first_locked_mutex; } diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/drivers_nrf/delay/nrf_delay.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/drivers_nrf/delay/nrf_delay.h index 79ba8872fb..85e2c3c8ba 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/drivers_nrf/delay/nrf_delay.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/drivers_nrf/delay/nrf_delay.h @@ -191,8 +191,8 @@ __STATIC_INLINE void nrf_delay_us(uint32_t volatile number_of_us) #elif defined ( __GNUC__ ) -static void __INLINE nrf_delay_us(uint32_t volatile number_of_us) __attribute__((always_inline)); -static void __INLINE nrf_delay_us(uint32_t volatile number_of_us) +static __INLINE void nrf_delay_us(uint32_t volatile number_of_us) __attribute__((always_inline)); +static __INLINE void nrf_delay_us(uint32_t volatile number_of_us) { register uint32_t delay __ASM ("r0") = number_of_us; __ASM volatile ( diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fds/fds.c b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fds/fds.c index 6de311a34b..edcefd3010 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fds/fds.c +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fds/fds.c @@ -40,6 +40,10 @@ #include "nrf_error.h" #include "app_util.h" +static void fs_callback(uint8_t op_code, + uint32_t result, + uint32_t const * p_data, + fs_length_t length_words); /** Our fstorage configuration. * The other fields will be assigned automatically during compilation. */ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fds/fds_types_internal.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fds/fds_types_internal.h index a97a6af196..9429285333 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fds/fds_types_internal.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fds/fds_types_internal.h @@ -68,7 +68,7 @@ #define FDS_CMD_QUEUE_SIZE_GC (1) -static uint8_t m_nested_critical; +//static uint8_t m_nested_critical; /** Macros to enable and disable application interrupts. */ #define CRITICAL_SECTION_ENTER() //sd_nvic_critical_region_enter(&m_nested_critical) diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fstorage/fstorage.c b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fstorage/fstorage.c index d75df2ecb1..8cc8cc1af0 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fstorage/fstorage.c +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fstorage/fstorage.c @@ -559,7 +559,7 @@ void fs_debug_print() printf("Num items: 0x%08lx\r\n", (unsigned long)FS_SECTION_VARS_COUNT); printf("===== ITEMS %lu =====\r\n", (unsigned long)FS_SECTION_VARS_COUNT); - for(int i = 0; i < FS_SECTION_VARS_COUNT; i++) + for(uint32_t i = 0; i < FS_SECTION_VARS_COUNT; i++) { fs_config_t* config = FS_SECTION_VARS_GET(i); printf( "Address: 0x%08lx, CB: 0x%08lx\r\n", diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fstorage/fstorage.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fstorage/fstorage.h index cf19e2e25b..6f364ca27c 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fstorage/fstorage.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/fstorage/fstorage.h @@ -74,23 +74,6 @@ typedef void (*fs_cb_t)(uint8_t op_code, fs_length_t length_words); -/**@brief Function prototype for a callback handler. - * - * @details This function is expected to be implemented by the module that - * registers for fstorage usage. Its usage is described - * in the function pointer type fs_cb_t. - * - * @param[in] op_code Flash operation code. - * @param[in] result Result of the flash operation. - * @param[in] p_data Pointer to the resulting data (or NULL if not in use). - * @param[in] length_words Length of data in words. - */ -static void fs_callback(uint8_t op_code, - uint32_t result, - uint32_t const * p_data, - fs_length_t length_words); - - /**@brief Flash storage config variable. * * @details The fstorage module will update the start_addr and end_address according to diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/util/app_util_platform.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/util/app_util_platform.h index de07685736..dd5c984357 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/util/app_util_platform.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/util/app_util_platform.h @@ -68,8 +68,6 @@ typedef enum #define EXTERNAL_INT_VECTOR_OFFSET 16 /**@endcond */ -#define PACKED(TYPE) __packed TYPE - void critical_region_enter (void); void critical_region_exit (void); diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/util/sdk_mapped_flags.c b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/util/sdk_mapped_flags.c index 93a17d7e9f..78d3929ea8 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/util/sdk_mapped_flags.c +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/libraries/util/sdk_mapped_flags.c @@ -111,7 +111,7 @@ void sdk_mapped_flags_bulk_update_by_key(uint16_t * p_keys, { if (p_keys[i] == key) { - for (int j = 0; j < n_flag_collections; j++) + for (uint32_t j = 0; j < n_flag_collections; j++) { if (value) { diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/softdevice/s130/headers/nrf_svc.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/softdevice/s130/headers/nrf_svc.h index e7b8f59471..9311be90cc 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/softdevice/s130/headers/nrf_svc.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/sdk/source/softdevice/s130/headers/nrf_svc.h @@ -42,11 +42,11 @@ #define SVCALL(number, return_type, signature) return_type __svc(number) signature #elif defined (__GNUC__) #define SVCALL(number, return_type, signature) \ - _Pragma("GCC diagnostic ignored \"-Wunused-function\"") \ - _Pragma("GCC diagnostic ignored \"-Wunused-parameter\"") \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wreturn-type\"") \ - __attribute__((naked)) static return_type signature \ + __attribute__((naked)) \ + __attribute__((unused)) \ + static return_type signature \ { \ __asm( \ "svc %0\n" \ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle.cpp index cee1cfca9e..0bb0c400fe 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle.cpp @@ -234,7 +234,7 @@ static void btle_handler(ble_evt_t *p_ble_evt) /*! @brief Callback when an error occurs inside the SoftDevice */ void assert_nrf_callback(uint16_t line_num, const uint8_t *p_file_name) { - ASSERT(false, (void) 0); + ASSERT_TRUE(false, (void) 0); } /*! diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle_discovery.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle_discovery.cpp index 4d5eea004d..d6f815d64e 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle_discovery.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle_discovery.cpp @@ -23,7 +23,6 @@ void bleGattcEventHandler(const ble_evt_t *p_ble_evt) { nRF5xn &ble = nRF5xn::Instance(BLE::DEFAULT_INSTANCE); - nRF5xGap &gap = (nRF5xGap &) ble.getGap(); nRF5xGattClient &gattClient = (nRF5xGattClient &) ble.getGattClient(); nRF5xServiceDiscovery &sdSingleton = gattClient.discovery(); nRF5xCharacteristicDescriptorDiscoverer &characteristicDescriptorDiscoverer = diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/custom/custom_helper.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/custom/custom_helper.cpp index 60ff8544c5..b7fbb61d77 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/custom/custom_helper.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/custom/custom_helper.cpp @@ -135,7 +135,7 @@ ble_uuid_t custom_convert_to_nordic_uuid(const UUID &uuid) #define CFG_CUSTOM_UUID_BASE "\x6E\x40\x00\x00\xB5\xA3\xF3\x93\xE0\xA9\xE5\x0E\x24\xDC\xCA\x9E" uint8_t uuid_type = custom_add_uuid_base(CFG_CUSTOM_UUID_BASE); - ASSERT(uuid_type > 0, ERROR_NOT_FOUND); + ASSERT_TRUE(uuid_type > 0, ERROR_NOT_FOUND); // We can now safely add the primary service and any characteristics // for our custom service ... diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/common/assertion.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/common/assertion.h index c0bd8c0d66..71bacb3e81 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/common/assertion.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/common/assertion.h @@ -125,7 +125,6 @@ static inline void debugger_breakpoint(void) //--------------------------------------------------------------------+ // Logical Assert //--------------------------------------------------------------------+ -#define ASSERT(...) ASSERT_TRUE(__VA_ARGS__) #define ASSERT_TRUE(condition , error) ASSERT_DEFINE( , (condition), error, "%s", "evaluated to false") #define ASSERT_FALSE(condition , error) ASSERT_DEFINE( ,!(condition), error, "%s", "evaluated to true") diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.cpp index 629f471c9f..77cb11b91d 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.cpp @@ -96,7 +96,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons //} /* Send advertising data! */ - ASSERT(ERROR_NONE == + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_data_set(advData.getPayload(), advData.getPayloadLen(), scanResponse.getPayload(), @@ -105,7 +105,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons /* Make sure the GAP Service appearance value is aligned with the *appearance from GapAdvertisingData */ - ASSERT(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()), + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()), BLE_ERROR_PARAM_OUT_OF_RANGE); /* ToDo: Perform some checks on the payload, for example the Scan Response can't */ @@ -196,7 +196,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) adv_para.interval = params.getIntervalInADVUnits(); // advertising interval (in units of 0.625 ms) adv_para.timeout = params.getTimeout(); - ASSERT(ERROR_NONE == sd_ble_gap_adv_start(&adv_para), BLE_ERROR_PARAM_OUT_OF_RANGE); + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_start(&adv_para), BLE_ERROR_PARAM_OUT_OF_RANGE); return BLE_ERROR_NONE; } @@ -267,7 +267,7 @@ ble_error_t nRF5xGap::stopScan(void) { ble_error_t nRF5xGap::stopAdvertising(void) { /* Stop Advertising */ - ASSERT(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE); + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE); state.advertising = 0; diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.h index 25c507c19a..90a2e2a383 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.h @@ -220,7 +220,7 @@ private: */ void processRadioNotificationEvent(bool param) { radioNotificationCallbackParam = param; - radioNotificationTimeout.attach_us(this, &nRF5xGap::postRadioNotificationCallback, 0); + radioNotificationTimeout.attach_us(mbed::callback(this, &nRF5xGap::postRadioNotificationCallback), 0); } friend void radioNotificationStaticCallback(bool param); /* allow invocations of processRadioNotificationEvent() */ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGattServer.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGattServer.cpp index db0647583a..4c5365f1b7 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGattServer.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGattServer.cpp @@ -52,7 +52,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) nordicUUID = custom_convert_to_nordic_uuid(service.getUUID()); uint16_t serviceHandle; - ASSERT( ERROR_NONE == + ASSERT_TRUE( ERROR_NONE == sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &nordicUUID, &serviceHandle), @@ -88,7 +88,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) } } - ASSERT ( ERROR_NONE == + ASSERT_TRUE ( ERROR_NONE == custom_add_in_characteristic(BLE_GATT_HANDLE_INVALID, &nordicUUID, p_char->getProperties(), @@ -123,7 +123,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) nordicUUID = custom_convert_to_nordic_uuid(p_desc->getUUID()); - ASSERT(ERROR_NONE == + ASSERT_TRUE(ERROR_NONE == custom_add_in_descriptor(BLE_GATT_HANDLE_INVALID, &nordicUUID, p_desc->getValuePtr(), @@ -177,7 +177,7 @@ ble_error_t nRF5xGattServer::read(Gap::Handle_t connectionHandle, GattAttribute: .p_value = buffer, }; - ASSERT( ERROR_NONE == + ASSERT_TRUE( ERROR_NONE == sd_ble_gatts_value_get(connectionHandle, attributeHandle, &value), BLE_ERROR_PARAM_OUT_OF_RANGE); *lengthP = value.len; diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle.cpp index afe6c77d8f..f004d86cb1 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle.cpp @@ -292,7 +292,7 @@ static void btle_handler(ble_evt_t *p_ble_evt) /*! @brief Callback when an error occurs inside the SoftDevice */ void assert_nrf_callback(uint16_t line_num, const uint8_t *p_file_name) { - ASSERT(false, (void) 0); + ASSERT_TRUE(false, (void) 0); } /*! diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/common/assertion.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/common/assertion.h index c0bd8c0d66..71bacb3e81 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/common/assertion.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/common/assertion.h @@ -125,7 +125,6 @@ static inline void debugger_breakpoint(void) //--------------------------------------------------------------------+ // Logical Assert //--------------------------------------------------------------------+ -#define ASSERT(...) ASSERT_TRUE(__VA_ARGS__) #define ASSERT_TRUE(condition , error) ASSERT_DEFINE( , (condition), error, "%s", "evaluated to false") #define ASSERT_FALSE(condition , error) ASSERT_DEFINE( ,!(condition), error, "%s", "evaluated to true") diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.cpp index a2f59dd4da..f874bfefe5 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.cpp @@ -96,7 +96,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons //} /* Send advertising data! */ - ASSERT(ERROR_NONE == + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_data_set(advData.getPayload(), advData.getPayloadLen(), scanResponse.getPayload(), @@ -105,7 +105,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons /* Make sure the GAP Service appearance value is aligned with the *appearance from GapAdvertisingData */ - ASSERT(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()), + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()), BLE_ERROR_PARAM_OUT_OF_RANGE); /* ToDo: Perform some checks on the payload, for example the Scan Response can't */ @@ -273,7 +273,7 @@ ble_error_t nRF5xGap::stopScan(void) { ble_error_t nRF5xGap::stopAdvertising(void) { /* Stop Advertising */ - ASSERT(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE); + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE); state.advertising = 0; diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.h index adb80851dd..cdcd9fa8fe 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.h @@ -221,7 +221,7 @@ private: */ void processRadioNotificationEvent(bool param) { radioNotificationCallbackParam = param; - radioNotificationTimeout.attach_us(this, &nRF5xGap::postRadioNotificationCallback, 0); + radioNotificationTimeout.attach_us(mbed::callback(this, &nRF5xGap::postRadioNotificationCallback), 0); } friend void radioNotificationStaticCallback(bool param); /* allow invocations of processRadioNotificationEvent() */ diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGattServer.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGattServer.cpp index 4f4c562920..7d079855cb 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGattServer.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGattServer.cpp @@ -52,7 +52,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) nordicUUID = custom_convert_to_nordic_uuid(service.getUUID()); uint16_t serviceHandle; - ASSERT( ERROR_NONE == + ASSERT_TRUE( ERROR_NONE == sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &nordicUUID, &serviceHandle), @@ -88,7 +88,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) } } - ASSERT ( ERROR_NONE == + ASSERT_TRUE ( ERROR_NONE == custom_add_in_characteristic(BLE_GATT_HANDLE_INVALID, &nordicUUID, p_char->getProperties(), @@ -123,7 +123,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) nordicUUID = custom_convert_to_nordic_uuid(p_desc->getUUID()); - ASSERT(ERROR_NONE == + ASSERT_TRUE(ERROR_NONE == custom_add_in_descriptor(BLE_GATT_HANDLE_INVALID, &nordicUUID, p_desc->getValuePtr(), @@ -177,7 +177,7 @@ ble_error_t nRF5xGattServer::read(Gap::Handle_t connectionHandle, GattAttribute: .p_value = buffer, }; - ASSERT( ERROR_NONE == + ASSERT_TRUE( ERROR_NONE == sd_ble_gatts_value_get(connectionHandle, attributeHandle, &value), BLE_ERROR_PARAM_OUT_OF_RANGE); *lengthP = value.len; diff --git a/hal/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/nrf_delay.h b/hal/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/nrf_delay.h index 4ce34e15e1..be4b9f4e15 100644 --- a/hal/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/nrf_delay.h +++ b/hal/targets/cmsis/TARGET_NORDIC/TARGET_MCU_NRF51822/nrf_delay.h @@ -45,7 +45,7 @@ __ASM ( " BNE loop\n\t"); } #elif defined ( __GNUC__ ) -__INLINE static void nrf_delay_us(uint32_t volatile number_of_us) +static __INLINE void nrf_delay_us(uint32_t volatile number_of_us) { do { diff --git a/hal/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/spi_api.c b/hal/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/spi_api.c index 35ad304b85..8e745ba6c3 100755 --- a/hal/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/spi_api.c +++ b/hal/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/spi_api.c @@ -32,7 +32,7 @@ extern volatile i2c_spi_peripheral_t i2c1_spi1_peripheral; void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel) { - SPIName spi; + SPIName spi = SPI_0; if (ssel == NC && i2c0_spi0_peripheral.usage == I2C_SPI_PERIPHERAL_FOR_SPI && i2c0_spi0_peripheral.sda_mosi == (uint8_t)mosi && diff --git a/hal/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c b/hal/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c index bdbb3abddb..0781f1689b 100644 --- a/hal/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c +++ b/hal/targets/hal/TARGET_NORDIC/TARGET_MCU_NRF51822/us_ticker.c @@ -588,6 +588,4 @@ uint32_t os_tick_val(void) { return clock_cycles_by_tick - ((current_counter - next_tick_cc_value) % clock_cycles_by_tick); } - - return 0; } diff --git a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/ble/peer_manager/pm_buffer.c b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/ble/peer_manager/pm_buffer.c index 20ea66b521..f185b5358e 100644 --- a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/ble/peer_manager/pm_buffer.c +++ b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/ble/peer_manager/pm_buffer.c @@ -100,7 +100,7 @@ uint8_t pm_buffer_block_acquire(pm_buffer_t * p_buffer, uint32_t n_blocks) { first_locked_mutex = i; } - if ((i - first_locked_mutex + 1) == n_blocks) + if ((i - first_locked_mutex + 1) >= 0 && ((uint32_t) (i - first_locked_mutex + 1)) == n_blocks) { return first_locked_mutex; } diff --git a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/drivers_nrf/delay/nrf_delay.h b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/drivers_nrf/delay/nrf_delay.h index c68bd9a941..a9b110b092 100644 --- a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/drivers_nrf/delay/nrf_delay.h +++ b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/drivers_nrf/delay/nrf_delay.h @@ -159,8 +159,8 @@ __STATIC_INLINE void nrf_delay_us(uint32_t volatile number_of_us) #elif defined ( __GNUC__ ) -static void __INLINE nrf_delay_us(uint32_t volatile number_of_us) __attribute__((always_inline)); -static void __INLINE nrf_delay_us(uint32_t volatile number_of_us) +static __INLINE void nrf_delay_us(uint32_t volatile number_of_us) __attribute__((always_inline)); +static __INLINE void nrf_delay_us(uint32_t volatile number_of_us) { register uint32_t delay __ASM ("r0") = number_of_us; __ASM volatile ( diff --git a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/pwm/app_pwm.c b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/pwm/app_pwm.c index 83ad686cbb..760b410f20 100644 --- a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/pwm/app_pwm.c +++ b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/pwm/app_pwm.c @@ -375,10 +375,10 @@ static void pwm_transition_n_to_m(app_pwm_t const * const p_instance, #ifdef NRF52 if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == - (m_use_ppi_delay_workaround ? NRF_TIMER_FREQ_8MHz : NRF_TIMER_FREQ_16MHz) ) ? 1 : 0) + (m_use_ppi_delay_workaround ? NRF_TIMER_FREQ_8MHz : NRF_TIMER_FREQ_16MHz) ) ? 1U : 0U) < p_ch_cb->pulsewidth) #else - if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == NRF_TIMER_FREQ_16MHz) ? 1 : 0) + if (ticks + ((nrf_timer_frequency_get(p_instance->p_timer->p_reg) == NRF_TIMER_FREQ_16MHz) ? 1U : 0U) < p_ch_cb->pulsewidth) #endif { diff --git a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/util/app_util_platform.h b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/util/app_util_platform.h index 9eb20b7e43..0d082e2e65 100644 --- a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/util/app_util_platform.h +++ b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/sdk/libraries/util/app_util_platform.h @@ -111,10 +111,6 @@ typedef enum #define EXTERNAL_INT_VECTOR_OFFSET 16 /**@endcond */ -#ifndef PACKED - #define PACKED(TYPE) __packed TYPE -#endif - void app_util_critical_region_enter (uint8_t *p_nested); void app_util_critical_region_exit (uint8_t nested); diff --git a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/serial_api.c b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/serial_api.c index d1a0fe6218..8589cd4c62 100644 --- a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/serial_api.c +++ b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/serial_api.c @@ -310,7 +310,7 @@ void serial_init(serial_t *obj, PinName tx, PinName rx) { nrf_uart_configure(UART_INSTANCE, UART_CB.parity, UART_CB.hwfc); if (UART_CB.hwfc == NRF_UART_HWFC_ENABLED) { serial_set_flow_control(obj, FlowControlRTSCTS, - UART_CB.pselrts, UART_CB.pselcts); + (PinName) UART_CB.pselrts, (PinName) UART_CB.pselcts); } nrf_uart_enable(UART_INSTANCE); diff --git a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/us_ticker.c b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/us_ticker.c index da93ae5a5a..35045fdb3f 100644 --- a/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/us_ticker.c +++ b/hal/targets/hal/TARGET_NORDIC/TARGET_NRF5/us_ticker.c @@ -284,7 +284,7 @@ US_TICKER_HANDLER push {r3, lr} bl common_rtc_irq_handler pop {r3, pc} - nop /* padding */ + ; ALIGN ; } #elif defined (__GNUC__) /* GNU Compiler */