Skip to content

Commit e641fd4

Browse files
committed
Merge pull request #1547 from Parthasarathy/master
Fixed GCC Compiler warnings
2 parents 20948ad + a8e52a9 commit e641fd4

File tree

23 files changed

+96
-101
lines changed

23 files changed

+96
-101
lines changed

libraries/mbed/targets/cmsis/TARGET_Atmel/TARGET_SAM_CortexM0P/utils/compiler.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,14 @@
139139
#endif
140140

141141
/* Define WEAK attribute */
142-
#if defined ( __CC_ARM )
143-
# define WEAK __attribute__ ((weak))
144-
#elif defined ( __ICCARM__ )
145-
# define WEAK __weak
146-
#elif defined ( __GNUC__ )
147-
# define WEAK __attribute__ ((weak))
148-
#endif
142+
//defined in toochain.h
143+
//#if defined ( __CC_ARM )
144+
//# define WEAK __attribute__ ((weak))
145+
//#elif defined ( __ICCARM__ )
146+
//# define WEAK __weak
147+
//#elif defined ( __GNUC__ )
148+
//# define WEAK __attribute__ ((weak))
149+
//#endif
149150

150151
/* Define NO_INIT attribute */
151152
#if defined ( __CC_ARM )

libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM_CortexM0P/TARGET_SAMR21G18A/PeripheralPins.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ const struct pwm_pin_channel pwn_pins[] = {
218218
{PB31, PWM_0, 1},
219219

220220
/* Not connected */
221-
{NC , NC , NC}
221+
{(PinName) NC ,(PWMName) NC ,(uint8_t) NC}
222222
};
223223

224224

libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM_CortexM0P/TARGET_SAMR21G18A/SAMR21_XPLAINED_PRO/mbed_overrides.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "compiler.h"
1818
#include "system.h"
1919

20+
2021
uint8_t g_sys_init = 0;
2122

2223
//called before main - implement here if board needs it ortherwise, let

libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM_CortexM0P/analogin_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,10 @@ void analogin_init(analogin_t *obj, PinName pin)
192192
static uint8_t init_flag = 0;
193193

194194
pos_input = pinmap_find_peripheral(pin, PinMap_ADC);
195-
MBED_ASSERT(pos_input != NC);
195+
MBED_ASSERT(pos_input != (uint32_t)NC);
196196

197197
adc_get_config_defaults(&(obj->config_adc));
198-
obj->config_adc.positive_input = pos_input;
198+
obj->config_adc.positive_input = (enum adc_positive_input)pos_input;
199199
if (init_flag == 0) { // ADC init and enable to be done only once.
200200
adc_init(&adc_instance, ADC, &(obj->config_adc));
201201
adc_enable(&adc_instance);

libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM_CortexM0P/dma_api.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static void dma_handler(const struct dma_resource* const resource)
8383
return;
8484
}
8585

86-
callback_func = dma_channels[channel_index].handler;
86+
callback_func = (void(*)(void))(dma_channels[channel_index].handler);
8787
if (callback_func) {
8888
callback_func();
8989
}
@@ -268,7 +268,6 @@ bool dma_start_transfer(int channelid)
268268
*/
269269
bool dma_busy(int channelid)
270270
{
271-
int res = 0;
272271
/* Sanity check arguments */
273272
MBED_ASSERT(channelid < CONF_MAX_USED_CHANNEL_NUM);
274273

@@ -278,7 +277,8 @@ bool dma_busy(int channelid)
278277

279278
if (channel_index >= CONF_MAX_USED_CHANNEL_NUM) {
280279
/* This channel is not active! return zero for now */
281-
res = 0;
280+
//res = 0;
281+
return 0;
282282
}
283283

284284
return dma_is_busy(&dma_channels[channel_index].resource);
@@ -292,7 +292,6 @@ bool dma_busy(int channelid)
292292
*/
293293
bool dma_is_transfer_complete(int channelid)
294294
{
295-
int res = 0;
296295
/* Sanity check arguments */
297296
MBED_ASSERT(channelid < CONF_MAX_USED_CHANNEL_NUM);
298297

@@ -302,7 +301,8 @@ bool dma_is_transfer_complete(int channelid)
302301

303302
if (channel_index >= CONF_MAX_USED_CHANNEL_NUM) {
304303
/* This channel is not active! return zero for now */
305-
res = 0;
304+
// res = 0;
305+
return 0;
306306
}
307307

308308
return (STATUS_OK == dma_get_job_status(&dma_channels[channel_index].resource));
@@ -332,10 +332,10 @@ void dma_set_handler(int channelid, uint32_t handler, uint32_t event)
332332

333333
dma_channels[channel_index].handler = handler;
334334
if (event & DMA_TRANSFER_ERROR) {
335-
dma_register_callback(&dma_channels[channel_index].resource, dma_handler, DMA_CALLBACK_TRANSFER_ERROR);
335+
dma_register_callback(&dma_channels[channel_index].resource, (dma_callback_t)dma_handler, DMA_CALLBACK_TRANSFER_ERROR);
336336
}
337337
if (event & DMA_TRANSFER_COMPLETE) {
338-
dma_register_callback(&dma_channels[channel_index].resource, dma_handler, DMA_CALLBACK_TRANSFER_DONE);
338+
dma_register_callback(&dma_channels[channel_index].resource, (dma_callback_t)dma_handler, DMA_CALLBACK_TRANSFER_DONE);
339339
}
340340

341341
/* Set interrupt vector if someone have removed it */

libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM_CortexM0P/dma_api_HAL.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ void dma_set_handler(int channelid, uint32_t handler, uint32_t event);
103103
}
104104
#endif
105105

106-
#endif /* _DMA_API_HAL_H */
106+
#endif /* _DMA_API_HAL_H */

libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM_CortexM0P/drivers/system/clock/TARGET_SAMD21/clock.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -487,40 +487,29 @@ enum status_code system_clock_source_write_calibration(
487487
{
488488
switch (clock_source) {
489489
case SYSTEM_CLOCK_SOURCE_OSC8M:
490-
491490
if (calibration_value > 0xfff || freq_range > 4) {
492491
return STATUS_ERR_INVALID_ARG;
493492
}
494-
495493
SYSCTRL->OSC8M.bit.CALIB = calibration_value;
496494
SYSCTRL->OSC8M.bit.FRANGE = freq_range;
497495
break;
498-
499496
case SYSTEM_CLOCK_SOURCE_OSC32K:
500-
501497
if (calibration_value > 128) {
502498
return STATUS_ERR_INVALID_ARG;
503499
}
504-
505500
_system_osc32k_wait_for_sync();
506501
SYSCTRL->OSC32K.bit.CALIB = calibration_value;
507502
break;
508-
509503
case SYSTEM_CLOCK_SOURCE_ULP32K:
510-
511504
if (calibration_value > 32) {
512505
return STATUS_ERR_INVALID_ARG;
513506
}
514-
515507
SYSCTRL->OSCULP32K.bit.CALIB = calibration_value;
516508
break;
517-
518509
default:
519510
Assert(false);
520511
return STATUS_ERR_INVALID_ARG;
521-
break;
522512
}
523-
524513
return STATUS_OK;
525514
}
526515

libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM_CortexM0P/drivers/system/clock/TARGET_SAMR21/clock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ enum status_code system_clock_source_write_calibration(
518518
default:
519519
Assert(false);
520520
return STATUS_ERR_INVALID_ARG;
521-
break;
521+
522522
}
523523

524524
return STATUS_OK;

libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM_CortexM0P/drivers/system/system.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
*/
4646

4747
#include <system.h>
48+
#include <toolchain.h>
4849

4950
/**
5051
* \internal

libraries/mbed/targets/hal/TARGET_Atmel/TARGET_SAM_CortexM0P/gpio_api.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void gpio_mode(gpio_t *obj, PinMode mode)
5555
struct port_config pin_conf;
5656

5757
obj->mode = mode;
58-
pin_conf.direction = obj->direction;
58+
pin_conf.direction = (enum port_pin_dir)obj->direction;
5959
pin_conf.powersave = obj->powersave;
6060
switch (mode) {
6161
case PullNone :
@@ -75,9 +75,8 @@ void gpio_dir(gpio_t *obj, PinDirection direction)
7575
{
7676
MBED_ASSERT(obj->pin != (PinName)NC);
7777
struct port_config pin_conf;
78-
7978
obj->direction = direction;
80-
pin_conf.input_pull = obj->mode;
79+
pin_conf.input_pull = (enum port_pin_pull)obj->mode;
8180
pin_conf.powersave = obj->powersave;
8281
switch (direction) {
8382
case PIN_INPUT :

0 commit comments

Comments
 (0)