Skip to content

Resolve Warnings for mbed-os-examples #4548

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 7, 2017
4 changes: 2 additions & 2 deletions drivers/CAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void donothing() {}
CAN::CAN(PinName rd, PinName td) : _can(), _irq() {
// No lock needed in constructor

for (int i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
for (size_t i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
_irq[i] = callback(donothing);
}

Expand All @@ -37,7 +37,7 @@ CAN::CAN(PinName rd, PinName td) : _can(), _irq() {
CAN::CAN(PinName rd, PinName td, int hz) : _can(), _irq() {
// No lock needed in constructor

for (int i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
for (size_t i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
_irq[i].attach(donothing);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ static void lpc_rxqueue_pbuf(struct lpc_enetdata *lpc_enetif, struct pbuf *p)
LPC_EMAC->RxConsumeIndex = idx;

LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
("lpc_rxqueue_pbuf: pbuf packet queued: %p (free desc=%d)\n", p,
("lpc_rxqueue_pbuf: pbuf packet queued: %p (free desc=%"U32_F")\n", p,
lpc_enetif->rx_free_descs));
}

Expand All @@ -215,7 +215,7 @@ s32_t lpc_rx_queue(struct netif *netif)
p = pbuf_alloc(PBUF_RAW, (u16_t) EMAC_ETH_MAX_FLEN, PBUF_RAM);
if (p == NULL) {
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
("lpc_rx_queue: could not allocate RX pbuf (free desc=%d)\n",
("lpc_rx_queue: could not allocate RX pbuf (free desc=%"U32_F")\n",
lpc_enetif->rx_free_descs));
return queued;
}
Expand Down Expand Up @@ -341,7 +341,7 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
lpc_rxqueue_pbuf(lpc_enetif, p);

LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
("lpc_low_level_input: Packet dropped with errors (0x%x)\n",
("lpc_low_level_input: Packet dropped with errors (%"X32_F")\n",
lpc_enetif->prxs[idx].statusinfo));

p = NULL;
Expand All @@ -365,10 +365,10 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)

/* Re-queue the pbuf for receive */
p->len = origLength;
lpc_rxqueue_pbuf(lpc_enetif, p);
lpc_rxqueue_pbuf(lpc_enetif, p);

LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
("lpc_low_level_input: Packet index %d dropped for OOM\n",
("lpc_low_level_input: Packet index %"U32_F" dropped for OOM\n",
idx));

#ifdef LOCK_RX_THREAD
Expand All @@ -381,7 +381,7 @@ static struct pbuf *lpc_low_level_input(struct netif *netif)
}

LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
("lpc_low_level_input: Packet received: %p, size %d (index=%d)\n",
("lpc_low_level_input: Packet received: %p, size %"U32_F" (index=%"U32_F")\n",
p, length, idx));

/* Save size */
Expand Down Expand Up @@ -479,7 +479,7 @@ static void lpc_tx_reclaim_st(struct lpc_enetdata *lpc_enetif, u32_t cidx)
while (cidx != lpc_enetif->lpc_last_tx_idx) {
if (lpc_enetif->txb[lpc_enetif->lpc_last_tx_idx] != NULL) {
LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
("lpc_tx_reclaim_st: Freeing packet %p (index %d)\n",
("lpc_tx_reclaim_st: Freeing packet %p (index %"U32_F")\n",
lpc_enetif->txb[lpc_enetif->lpc_last_tx_idx],
lpc_enetif->lpc_last_tx_idx));
pbuf_free(lpc_enetif->txb[lpc_enetif->lpc_last_tx_idx]);
Expand Down Expand Up @@ -646,8 +646,8 @@ static err_t lpc_low_level_output(struct netif *netif, struct pbuf *p)
}

LWIP_DEBUGF(UDP_LPC_EMAC | LWIP_DBG_TRACE,
("lpc_low_level_output: pbuf packet(%p) sent, chain#=%d,"
" size = %d (index=%d)\n", q->payload, dn, q->len, idx));
("lpc_low_level_output: pbuf packet(%p) sent, chain#=%"S32_F","
" size = %d (index=%"U32_F")\n", q->payload, dn, q->len, idx));

lpc_enetif->ptxd[idx].packet = (u32_t) q->payload;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2392,7 +2392,7 @@ static int32_t cfstore_delete_ex(cfstore_area_hkvt_t* hkvt)
memset(ctx->area_0_tail-kv_size, 0, kv_size);

/* The KV area has shrunk so a negative size_diff should be indicated to cfstore_file_update(). */
ret = cfstore_file_update(hkvt->head, -1 * kv_size);
ret = cfstore_file_update(hkvt->head, -1 *(int32_t)kv_size);
if(ret < ARM_DRIVER_OK){
CFSTORE_ERRLOG("%s:Error:file update failed\n", __func__);
goto out0;
Expand Down
2 changes: 1 addition & 1 deletion platform/mbed_mktime.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ time_t _rtc_mktime(const struct tm* time) {
}

if (result > INT32_MAX) {
return -1;
return (time_t) -1;
}

return result;
Expand Down
2 changes: 1 addition & 1 deletion platform/mbed_rtc_time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ time_t time(time_t *timer)
}
}

time_t t = -1;
time_t t = (time_t)-1;
if (_rtc_read != NULL) {
t = _rtc_read();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ static void (*callFlashCommonBitOperation)(FTFx_REG32_ACCESS_TYPE base,
* @endcode
* Note2: The binary code is generated by IAR 7.70.1
*/
const static uint16_t s_flashRunCommandFunctionCode[] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cc @mmahadevan108 please review this as it shall go upstream to fix warnings in drivers code

static const uint16_t s_flashRunCommandFunctionCode[] = {
0x2180, /* MOVS R1, #128 ; 0x80 */
0x7001, /* STRB R1, [R0] */
/* @4: */
Expand Down Expand Up @@ -432,7 +432,7 @@ const static uint16_t s_flashRunCommandFunctionCode[] = {
* @endcode
* Note2: The binary code is generated by IAR 7.70.1
*/
const static uint16_t s_flashCommonBitOperationFunctionCode[] = {
static const uint16_t s_flashCommonBitOperationFunctionCode[] = {
0xb510, /* PUSH {R4, LR} */
0x2900, /* CMP R1, #0 */
0xd005, /* BEQ.N @12 */
Expand Down Expand Up @@ -2734,11 +2734,12 @@ void flash_cache_clear(flash_config_t *config)
__DSB();
#endif /* FLASH_DRIVER_IS_FLASH_RESIDENT */
}
#if (defined(__GNUC__))
/* #pragma GCC pop_options */
#else
#if (defined(__CC_ARM))
#pragma pop
#endif
#if (defined(__GNUC__))
/* #pragma GCC pop_options */
#endif

#if FLASH_DRIVER_IS_FLASH_RESIDENT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,4 @@ void DisableDeepSleepIRQ(IRQn_Type interrupt)
DisableIRQ(interrupt); /* also disable interrupt at NVIC */
/* SYSCON->STARTERCLR[index] = 1u << intNumber; */
}
#endif /*CPU_QN908X */
#endif /*CPU_QN908X */
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,8 @@ void ENET_Init(ENET_Type *base,
assert(bufferConfig->rxBufferAlign);
assert(macAddr);

uint32_t instance = ENET_GetInstance(base);

#if !(defined(FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL) && FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL)
uint32_t instance = ENET_GetInstance(base);
/* Ungate ENET clock. */
CLOCK_EnableClock(s_enetClock[instance]);
#endif /* FSL_SDK_DISABLE_DRIVER_CLOCK_CONTROL */
Expand Down Expand Up @@ -413,7 +412,7 @@ static void ENET_SetMacController(ENET_Type *base,
uint32_t tcr = 0;
uint32_t ecr = 0;
uint32_t macSpecialConfig = config->macSpecialConfig;
uint32_t instance = ENET_GetInstance(base);
ENET_GetInstance(base);

/* Configures MAC receive controller with user configure structure. */
rcr = ENET_RCR_NLC(!!(macSpecialConfig & kENET_ControlRxPayloadCheckEnable)) |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ static void (*callFlashCommonBitOperation)(FTFx_REG32_ACCESS_TYPE base,
* @endcode
* Note2: The binary code is generated by IAR 7.70.1
*/
const static uint16_t s_flashRunCommandFunctionCode[] = {
static const uint16_t s_flashRunCommandFunctionCode[] = {
0x2180, /* MOVS R1, #128 ; 0x80 */
0x7001, /* STRB R1, [R0] */
/* @4: */
Expand Down Expand Up @@ -432,7 +432,7 @@ const static uint16_t s_flashRunCommandFunctionCode[] = {
* @endcode
* Note2: The binary code is generated by IAR 7.70.1
*/
const static uint16_t s_flashCommonBitOperationFunctionCode[] = {
static const uint16_t s_flashCommonBitOperationFunctionCode[] = {
0xb510, /* PUSH {R4, LR} */
0x2900, /* CMP R1, #0 */
0xd005, /* BEQ.N @12 */
Expand Down Expand Up @@ -2734,11 +2734,12 @@ void flash_cache_clear(flash_config_t *config)
__DSB();
#endif /* FLASH_DRIVER_IS_FLASH_RESIDENT */
}
#if (defined(__GNUC__))
/* #pragma GCC pop_options */
#else
#if (defined(__CC_ARM))
#pragma pop
#endif
#if (defined(__GNUC__))
/* #pragma GCC pop_options */
#endif

#if FLASH_DRIVER_IS_FLASH_RESIDENT
Expand Down
3 changes: 3 additions & 0 deletions targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/api/sleep.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ void hal_sleep(void)
void hal_deepsleep(void)
{
#if (defined(FSL_FEATURE_SOC_MCG_COUNT) && FSL_FEATURE_SOC_MCG_COUNT)
#if defined(kMCG_ModePEE)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is one commit (might be fine for this type of change) - please include as much details as you can . I would recommend to include what warnings are fixed here. For instance, what this ModePEE does ? how is it related to CLOCK_GetMode() ?

mcg_mode_t mode = CLOCK_GetMode();
#endif
#endif

SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);

SMC_SetPowerModeVlps(SMC);
Expand Down