Skip to content

Commit 21e8c5b

Browse files
committed
[M453] Fix warnings generated by armcc
1 parent a9d65e4 commit 21e8c5b

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

targets/TARGET_NUVOTON/TARGET_M451/TARGET_NUMAKER_PFM_M453/PeripheralPins.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ const PinMap PinMap_UART_RX[] = {
256256
{PB_5, UART_2, SYS_GPB_MFPL_PB5MFP_UART2_RXD},
257257
{PC_1, UART_3, SYS_GPC_MFPL_PC1MFP_UART3_RXD},
258258
{PC_3, UART_2, SYS_GPC_MFPL_PC3MFP_UART2_RXD},
259-
{PC_7, UART_0, SYS_GPC_MFPL_PC7MFP_UART0_RXD},
259+
{PC_7, UART_0, (int) SYS_GPC_MFPL_PC7MFP_UART0_RXD},
260260
{PD_0, UART_0, SYS_GPD_MFPL_PD0MFP_UART0_RXD},
261261
{PD_6, UART_0, SYS_GPD_MFPL_PD6MFP_UART0_RXD},
262262
{PD_13, UART_3, SYS_GPD_MFPH_PD13MFP_UART3_RXD},

targets/TARGET_NUVOTON/TARGET_M451/i2c_api.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ static int i2c_do_trsn(i2c_t *obj, uint32_t i2c_ctl, int sync);
7575
#define NU_I2C_TIMEOUT_STOP 500000
7676
static int i2c_poll_status_timeout(i2c_t *obj, int (*is_status)(i2c_t *obj), uint32_t timeout);
7777
static int i2c_poll_tran_heatbeat_timeout(i2c_t *obj, uint32_t timeout);
78-
static int i2c_is_stat_int(i2c_t *obj);
79-
static int i2c_is_stop_det(i2c_t *obj);
78+
//static int i2c_is_stat_int(i2c_t *obj);
79+
//static int i2c_is_stop_det(i2c_t *obj);
8080
static int i2c_is_trsn_done(i2c_t *obj);
8181
static int i2c_is_tran_started(i2c_t *obj);
8282
static int i2c_addr2data(int address, int read);
@@ -98,6 +98,8 @@ static void i2c_rollback_vector_interrupt(i2c_t *obj);
9898
#define TRANCTRL_STARTED (1)
9999
#define TRANCTRL_NAKLASTDATA (1 << 1)
100100

101+
uint32_t us_ticker_read(void);
102+
101103
void i2c_init(i2c_t *obj, PinName sda, PinName scl)
102104
{
103105
uint32_t i2c_sda = pinmap_peripheral(sda, PinMap_I2C_SDA);
@@ -161,8 +163,6 @@ void i2c_frequency(i2c_t *obj, int hz)
161163

162164
int i2c_read(i2c_t *obj, int address, char *data, int length, int stop)
163165
{
164-
int i;
165-
166166
if (i2c_start(obj)) {
167167
i2c_stop(obj);
168168
return I2C_ERROR_BUS_BUSY;
@@ -186,8 +186,6 @@ int i2c_read(i2c_t *obj, int address, char *data, int length, int stop)
186186

187187
int i2c_write(i2c_t *obj, int address, const char *data, int length, int stop)
188188
{
189-
int i;
190-
191189
if (i2c_start(obj)) {
192190
i2c_stop(obj);
193191
return I2C_ERROR_BUS_BUSY;
@@ -289,7 +287,6 @@ static int i2c_addr2bspaddr(int address)
289287

290288
static void i2c_enable_int(i2c_t *obj)
291289
{
292-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
293290
const struct nu_modinit_s *modinit = get_modinit(obj->i2c.i2c, i2c_modinit_tab);
294291

295292
core_util_critical_section_enter();
@@ -303,7 +300,6 @@ static void i2c_enable_int(i2c_t *obj)
303300

304301
static void i2c_disable_int(i2c_t *obj)
305302
{
306-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
307303
const struct nu_modinit_s *modinit = get_modinit(obj->i2c.i2c, i2c_modinit_tab);
308304

309305
core_util_critical_section_enter();
@@ -317,7 +313,6 @@ static void i2c_disable_int(i2c_t *obj)
317313

318314
static int i2c_set_int(i2c_t *obj, int inten)
319315
{
320-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
321316
int inten_back;
322317

323318
core_util_critical_section_enter();
@@ -357,8 +352,6 @@ int i2c_allow_powerdown(void)
357352

358353
static int i2c_do_tran(i2c_t *obj, char *buf, int length, int read, int naklastdata)
359354
{
360-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
361-
int err = 0;
362355
int tran_len = 0;
363356

364357
i2c_disable_int(obj);
@@ -369,7 +362,6 @@ static int i2c_do_tran(i2c_t *obj, char *buf, int length, int read, int naklastd
369362
i2c_enable_int(obj);
370363

371364
if (i2c_poll_tran_heatbeat_timeout(obj, NU_I2C_TIMEOUT_STAT_INT)) {
372-
err = I2C_ERROR_BUS_BUSY;
373365
#if NU_I2C_DEBUG
374366
MY_I2C_2 = obj->i2c;
375367
while (1);
@@ -485,7 +477,6 @@ static int i2c_poll_status_timeout(i2c_t *obj, int (*is_status)(i2c_t *obj), uin
485477
static int i2c_poll_tran_heatbeat_timeout(i2c_t *obj, uint32_t timeout)
486478
{
487479
uint32_t t1, t2, elapsed = 0;
488-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
489480
int tran_started;
490481
char *tran_pos = NULL;
491482
char *tran_pos2 = NULL;
@@ -529,6 +520,8 @@ static int i2c_poll_tran_heatbeat_timeout(i2c_t *obj, uint32_t timeout)
529520

530521
return (elapsed >= timeout);
531522
}
523+
524+
#if 0
532525
static int i2c_is_stat_int(i2c_t *obj)
533526
{
534527
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
@@ -542,6 +535,7 @@ static int i2c_is_stop_det(i2c_t *obj)
542535

543536
return ! (i2c_base->CTL & I2C_CTL_STO_Msk);
544537
}
538+
#endif
545539

546540
static int i2c_is_trsn_done(i2c_t *obj)
547541
{
@@ -560,7 +554,6 @@ static int i2c_is_trsn_done(i2c_t *obj)
560554

561555
static int i2c_is_tran_started(i2c_t *obj)
562556
{
563-
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
564557
int started;
565558
int inten_back;
566559

@@ -589,7 +582,6 @@ static void i2c_irq(i2c_t *obj)
589582
{
590583
I2C_T *i2c_base = (I2C_T *) NU_MODBASE(obj->i2c.i2c);
591584
uint32_t status;
592-
int data_recv = 0;
593585

594586
if (I2C_GET_TIMEOUT_FLAG(i2c_base)) {
595587
I2C_ClearTimeoutFlag(i2c_base);

targets/TARGET_NUVOTON/TARGET_M451/spi_api.c

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

114-
SPI_T *spi_base = (SPI_T *) NU_MODBASE(obj->spi.spi);
114+
//SPI_T *spi_base = (SPI_T *) NU_MODBASE(obj->spi.spi);
115115

116116
pinmap_pinout(mosi, PinMap_SPI_MOSI);
117117
pinmap_pinout(miso, PinMap_SPI_MISO);

targets/cmsis/TARGET_NUVOTON/TARGET_M451/TARGET_NUMAKER_PFM_M453/startup_M451Series.c

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

1212
#include "M451Series.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))
@@ -158,12 +166,12 @@ const uint32_t __vector_handlers[] = {
158166

159167
/* Configure Initial Stack Pointer, using linker-generated symbols */
160168
#if defined(__CC_ARM)
161-
&Image$$ARM_LIB_STACK$$ZI$$Limit,
169+
(uint32_t) &Image$$ARM_LIB_STACK$$ZI$$Limit,
162170
#elif defined(__ICCARM__)
163171
//(uint32_t) __sfe("CSTACK"),
164172
(uint32_t) &CSTACK$$Limit,
165173
#elif defined(__GNUC__)
166-
&__StackTop,
174+
(uint32_t) &__StackTop,
167175
#endif
168176

169177
(uint32_t) Reset_Handler, // Reset Handler

targets/cmsis/TARGET_NUVOTON/TARGET_M451/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

0 commit comments

Comments
 (0)