Skip to content

Commit a9d65e4

Browse files
committed
[NUC472] Fix warnings generated by armcc
1 parent dfc3240 commit a9d65e4

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

targets/TARGET_NUVOTON/TARGET_NUC472/device/cmsis_nvic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
#define NVIC_NUM_VECTORS (NVIC_USER_IRQ_OFFSET + NVIC_USER_IRQ_NUMBER)
2525

2626
#if defined(__CC_ARM)
27-
# define NVIC_RAM_VECTOR_ADDRESS &Image$$ER_IRAMVEC$$ZI$$Base
27+
# define NVIC_RAM_VECTOR_ADDRESS ((uint32_t) &Image$$ER_IRAMVEC$$ZI$$Base)
2828
#elif defined(__ICCARM__)
2929
# pragma section = "IRAMVEC"
3030
# define NVIC_RAM_VECTOR_ADDRESS ((uint32_t) __section_begin("IRAMVEC"))
3131
#elif defined(__GNUC__)
32-
# define NVIC_RAM_VECTOR_ADDRESS &__start_vector_table__
32+
# define NVIC_RAM_VECTOR_ADDRESS ((uint32_t) &__start_vector_table__)
3333
#endif
3434

3535

targets/TARGET_NUVOTON/TARGET_NUC472/device/startup_NUC472_442.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@
1111

1212
#include "NUC472_442.h"
1313

14+
/* Suppress warning messages */
15+
#if defined(__CC_ARM)
16+
// Suppress warning message: extended constant initialiser used
17+
#pragma diag_suppress 1296
18+
#elif defined(__ICCARM__)
19+
#elif defined(__GNUC__)
20+
#endif
21+
1422
/* Macro Definitions */
1523
#if defined(__CC_ARM)
1624
#define WEAK __attribute__ ((weak))
@@ -238,12 +246,12 @@ const uint32_t __vector_handlers[] = {
238246

239247
/* Configure Initial Stack Pointer, using linker-generated symbols */
240248
#if defined(__CC_ARM)
241-
&Image$$ARM_LIB_STACK$$ZI$$Limit,
249+
(uint32_t) &Image$$ARM_LIB_STACK$$ZI$$Limit,
242250
#elif defined(__ICCARM__)
243251
//(uint32_t) __sfe("CSTACK"),
244252
(uint32_t) &CSTACK$$Limit,
245253
#elif defined(__GNUC__)
246-
&__StackTop,
254+
(uint32_t) &__StackTop,
247255
#endif
248256

249257
(uint32_t) Reset_Handler, // Reset Handler

targets/TARGET_NUVOTON/TARGET_NUC472/device/system_NUC472_442.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void SystemCoreClockUpdate (void) /* Get Core Clock Frequency */
5858
*/
5959
void SystemInit (void)
6060
{
61-
uint32_t u32RTC_EN_Flag = 0;
61+
//uint32_t u32RTC_EN_Flag = 0;
6262

6363
/* FPU settings ------------------------------------------------------------*/
6464
#if (__FPU_PRESENT == 1) && (__FPU_USED == 1)

targets/TARGET_NUVOTON/TARGET_NUC472/i2c_api.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ static int i2c_do_trsn(i2c_t *obj, uint32_t i2c_ctl, int sync);
9393
#define NU_I2C_TIMEOUT_STOP 500000
9494
static int i2c_poll_status_timeout(i2c_t *obj, int (*is_status)(i2c_t *obj), uint32_t timeout);
9595
static int i2c_poll_tran_heatbeat_timeout(i2c_t *obj, uint32_t timeout);
96-
static int i2c_is_stat_int(i2c_t *obj);
97-
static int i2c_is_stop_det(i2c_t *obj);
96+
//static int i2c_is_stat_int(i2c_t *obj);
97+
//static int i2c_is_stop_det(i2c_t *obj);
9898
static int i2c_is_trsn_done(i2c_t *obj);
9999
static int i2c_is_tran_started(i2c_t *obj);
100100
static int i2c_addr2data(int address, int read);
@@ -115,6 +115,8 @@ static void i2c_rollback_vector_interrupt(i2c_t *obj);
115115
#define TRANCTRL_STARTED (1)
116116
#define TRANCTRL_NAKLASTDATA (1 << 1)
117117

118+
uint32_t us_ticker_read(void);
119+
118120
void i2c_init(i2c_t *obj, PinName sda, PinName scl)
119121
{
120122
uint32_t i2c_sda = pinmap_peripheral(sda, PinMap_I2C_SDA);
@@ -178,8 +180,6 @@ void i2c_frequency(i2c_t *obj, int hz)
178180

179181
int i2c_read(i2c_t *obj, int address, char *data, int length, int stop)
180182
{
181-
int i;
182-
183183
if (i2c_start(obj)) {
184184
i2c_stop(obj);
185185
return I2C_ERROR_BUS_BUSY;
@@ -203,8 +203,6 @@ int i2c_read(i2c_t *obj, int address, char *data, int length, int stop)
203203

204204
int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop)
205205
{
206-
int i;
207-
208206
if (i2c_start(obj)) {
209207
i2c_stop(obj);
210208
return I2C_ERROR_BUS_BUSY;
@@ -306,7 +304,6 @@ static int i2c_addr2bspaddr(int address)
306304

307305
static void i2c_enable_int(i2c_t *obj)
308306
{
309-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
310307
const struct nu_modinit_s *modinit = get_modinit(obj->i2c.i2c, i2c_modinit_tab);
311308

312309
core_util_critical_section_enter();
@@ -320,7 +317,6 @@ static void i2c_enable_int(i2c_t *obj)
320317

321318
static void i2c_disable_int(i2c_t *obj)
322319
{
323-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
324320
const struct nu_modinit_s *modinit = get_modinit(obj->i2c.i2c, i2c_modinit_tab);
325321

326322
core_util_critical_section_enter();
@@ -334,7 +330,6 @@ static void i2c_disable_int(i2c_t *obj)
334330

335331
static int i2c_set_int(i2c_t *obj, int inten)
336332
{
337-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
338333
int inten_back;
339334

340335
core_util_critical_section_enter();
@@ -374,8 +369,6 @@ int i2c_allow_powerdown(void)
374369

375370
static int i2c_do_tran(i2c_t *obj, char *buf, int length, int read, int naklastdata)
376371
{
377-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
378-
int err = 0;
379372
int tran_len = 0;
380373

381374
i2c_disable_int(obj);
@@ -386,7 +379,6 @@ static int i2c_do_tran(i2c_t *obj, char *buf, int length, int read, int naklastd
386379
i2c_enable_int(obj);
387380

388381
if (i2c_poll_tran_heatbeat_timeout(obj, NU_I2C_TIMEOUT_STAT_INT)) {
389-
err = I2C_ERROR_BUS_BUSY;
390382
#if NU_I2C_DEBUG
391383
MY_I2C_2 = obj->i2c;
392384
while (1);
@@ -502,7 +494,6 @@ static int i2c_poll_status_timeout(i2c_t *obj, int (*is_status)(i2c_t *obj), uin
502494
static int i2c_poll_tran_heatbeat_timeout(i2c_t *obj, uint32_t timeout)
503495
{
504496
uint32_t t1, t2, elapsed = 0;
505-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
506497
int tran_started;
507498
char *tran_pos = NULL;
508499
char *tran_pos2 = NULL;
@@ -547,19 +538,22 @@ static int i2c_poll_tran_heatbeat_timeout(i2c_t *obj, uint32_t timeout)
547538
return (elapsed >= timeout);
548539
}
549540

541+
#if 0
550542
static int i2c_is_stat_int(i2c_t *obj)
551543
{
552544
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
553545

554546
return !! (i2c_base->CTL & I2C_CTL_SI_Msk);
555547
}
556548

549+
557550
static int i2c_is_stop_det(i2c_t *obj)
558551
{
559552
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
560553

561554
return ! (i2c_base->CTL & I2C_CTL_STO_Msk);
562555
}
556+
#endif
563557

564558
static int i2c_is_trsn_done(i2c_t *obj)
565559
{
@@ -578,7 +572,6 @@ static int i2c_is_trsn_done(i2c_t *obj)
578572

579573
static int i2c_is_tran_started(i2c_t *obj)
580574
{
581-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
582575
int started;
583576
int inten_back;
584577

@@ -619,7 +612,6 @@ static void i2c_irq(i2c_t *obj)
619612
{
620613
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
621614
uint32_t status;
622-
int data_recv = 0;
623615

624616
if (I2C_GET_TIMEOUT_FLAG(i2c_base)) {
625617
I2C_ClearTimeoutFlag(i2c_base);

targets/TARGET_NUVOTON/TARGET_NUC472/spi_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ void spi_init(spi_t *obj, PinName mosi, PinName miso, PinName sclk, PinName ssel
116116
// Enable IP clock
117117
CLK_EnableModuleClock(modinit->clkidx);
118118

119-
SPI_T *spi_base = (SPI_T *) NU_MODBASE(obj->spi.spi);
119+
//SPI_T *spi_base = (SPI_T *) NU_MODBASE(obj->spi.spi);
120120

121121
pinmap_pinout(mosi, PinMap_SPI_MOSI);
122122
pinmap_pinout(miso, PinMap_SPI_MISO);

0 commit comments

Comments
 (0)