Merge pull request #2785 from pan-/remove_warnings_from_nordic_target

TARGET_NRF - Remove warnings from nordic target.
pull/2822/head^2
Sam Grove 2016-09-27 21:53:28 -07:00 committed by GitHub
commit 681cff8010
33 changed files with 45 additions and 69 deletions

View File

@ -23,4 +23,4 @@
#define __deprecated_message(msg)
#endif
#endif
#endif

View File

@ -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]);
}

View File

@ -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);
}

View File

@ -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;
}

View File

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

View File

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

View File

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

View File

@ -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",

View File

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

View File

@ -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);

View File

@ -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)
{

View File

@ -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" \

View File

@ -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);
}
/*!

View File

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

View File

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

View File

@ -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")

View File

@ -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 &params)
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;

View File

@ -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() */

View File

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

View File

@ -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);
}
/*!

View File

@ -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")

View File

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

View File

@ -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() */

View File

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

View File

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

View File

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

View File

@ -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;
}

View File

@ -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;
}

View File

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

View File

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

View File

@ -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);

View File

@ -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);

View File

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