Skip to content

Commit fc69b78

Browse files
committed
arch/xtensa: fix build errors related to data types on ESP32|S2|S3
Fix format specifier macros after compiler type changes. Signed-off-by: Filipe Cavalcanti <filipe.cavalcanti@espressif.com>
1 parent 2d0cf02 commit fc69b78

50 files changed

Lines changed: 6441 additions & 496 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

arch/xtensa/src/common/espressif/esp_i2s.c

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,8 +2041,8 @@ static void i2s_set_clock(struct esp_i2s_s *priv)
20412041

20422042
mclk_div = sclk / mclk;
20432043

2044-
i2sinfo("Clock division info: [sclk]%" PRIu32 " Hz [mdiv] %d "
2045-
"[mclk] %" PRIu32 " Hz [bdiv] %d [bclk] %" PRIu32 " Hz\n",
2044+
i2sinfo("Clock division info: [sclk]%" PRIu32 " Hz [mdiv] %lu "
2045+
"[mclk] %" PRIu32 " Hz [bdiv] %" PRIu16 " [bclk] %" PRIu32 " Hz\n",
20462046
sclk, mclk_div, mclk, bclk_div, bclk);
20472047

20482048
priv->config->clk_info->bclk = bclk;
@@ -2085,7 +2085,7 @@ static void i2s_tx_channel_start(struct esp_i2s_s *priv)
20852085
{
20862086
if (priv->tx_started)
20872087
{
2088-
i2swarn("TX channel of port %d was previously started\n",
2088+
i2swarn("TX channel of port %" PRIu32 " was previously started\n",
20892089
priv->config->port);
20902090
return;
20912091
}
@@ -2127,7 +2127,8 @@ static void i2s_tx_channel_start(struct esp_i2s_s *priv)
21272127

21282128
priv->tx_started = true;
21292129

2130-
i2sinfo("Started TX channel of port %d\n", priv->config->port);
2130+
i2sinfo("Started TX channel of port %" PRIu32 "\n",
2131+
priv->config->port);
21312132
}
21322133
}
21332134
#endif /* I2S_HAVE_TX */
@@ -2153,7 +2154,7 @@ static void i2s_rx_channel_start(struct esp_i2s_s *priv)
21532154
{
21542155
if (priv->rx_started)
21552156
{
2156-
i2swarn("RX channel of port %d was previously started\n",
2157+
i2swarn("RX channel of port %" PRIu32 " was previously started\n",
21572158
priv->config->port);
21582159
return;
21592160
}
@@ -2195,7 +2196,8 @@ static void i2s_rx_channel_start(struct esp_i2s_s *priv)
21952196

21962197
priv->rx_started = true;
21972198

2198-
i2sinfo("Started RX channel of port %d\n", priv->config->port);
2199+
i2sinfo("Started RX channel of port %" PRIu32 "\n",
2200+
priv->config->port);
21992201
}
22002202
}
22012203
#endif /* I2S_HAVE_RX */
@@ -2221,7 +2223,7 @@ static void i2s_tx_channel_stop(struct esp_i2s_s *priv)
22212223
{
22222224
if (!priv->tx_started)
22232225
{
2224-
i2swarn("TX channel of port %d was previously stopped\n",
2226+
i2swarn("TX channel of port %" PRIu32 " was previously stopped\n",
22252227
priv->config->port);
22262228
return;
22272229
}
@@ -2250,7 +2252,8 @@ static void i2s_tx_channel_stop(struct esp_i2s_s *priv)
22502252

22512253
priv->tx_started = false;
22522254

2253-
i2sinfo("Stopped TX channel of port %d\n", priv->config->port);
2255+
i2sinfo("Stopped TX channel of port %" PRIu32 "\n",
2256+
priv->config->port);
22542257
}
22552258
}
22562259
#endif /* I2S_HAVE_TX */
@@ -2276,7 +2279,7 @@ static void i2s_rx_channel_stop(struct esp_i2s_s *priv)
22762279
{
22772280
if (!priv->rx_started)
22782281
{
2279-
i2swarn("RX channel of port %d was previously stopped\n",
2282+
i2swarn("RX channel of port %" PRIu32 " was previously stopped\n",
22802283
priv->config->port);
22812284
return;
22822285
}
@@ -2305,7 +2308,8 @@ static void i2s_rx_channel_stop(struct esp_i2s_s *priv)
23052308

23062309
priv->rx_started = false;
23072310

2308-
i2sinfo("Stopped RX channel of port %d\n", priv->config->port);
2311+
i2sinfo("Stopped RX channel of port %" PRIu32 "\n",
2312+
priv->config->port);
23092313
}
23102314
}
23112315
#endif /* I2S_HAVE_RX */
@@ -3247,7 +3251,8 @@ struct i2s_dev_s *esp_i2sbus_initialize(int port)
32473251

32483252
/* Success exit */
32493253

3250-
i2sinfo("I2S%d was successfully initialized\n", priv->config->port);
3254+
i2sinfo("I2S%" PRIu32 " was successfully initialized\n",
3255+
priv->config->port);
32513256

32523257
return &priv->dev;
32533258

arch/xtensa/src/common/espressif/esp_loader.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,8 @@ int map_rom_segments(uint32_t app_drom_start, uint32_t app_drom_vaddr,
209209
ram_segments++;
210210
}
211211

212-
ets_printf("%s: lma 0x%08x vma 0x%08x len 0x%-6x (%u)\n",
212+
ets_printf("%s: lma 0x%08x vma 0x%08" PRIx32 " len 0x%-6" PRIx32 ""
213+
" (%" PRIu32 ")\n",
213214
IS_NONE(segment_hdr.load_addr) ? "???" :
214215
IS_RTC_FAST_IRAM(segment_hdr.load_addr) ||
215216
IS_RTC_FAST_DRAM(segment_hdr.load_addr) ||
@@ -266,12 +267,14 @@ int map_rom_segments(uint32_t app_drom_start, uint32_t app_drom_vaddr,
266267
#if defined (CONFIG_ESP32S2_APP_FORMAT_MCUBOOT) || \
267268
defined (CONFIG_ESP32S3_APP_FORMAT_MCUBOOT) || \
268269
defined (CONFIG_ESP32_APP_FORMAT_MCUBOOT)
269-
ets_printf("IROM segment aligned lma 0x%08x vma 0x%08x len 0x%06x (%u)\n",
270-
app_irom_start_aligned, app_irom_vaddr_aligned,
271-
app_irom_size, app_irom_size);
272-
ets_printf("DROM segment aligned lma 0x%08x vma 0x%08x len 0x%06x (%u)\n",
273-
app_drom_start_aligned, app_drom_vaddr_aligned,
274-
app_drom_size, app_drom_size);
270+
ets_printf("IROM segment aligned lma 0x%08" PRIx32 " vma 0x%08" PRIx32 ""
271+
" len 0x%06" PRIx32 " "\
272+
"(%" PRIu32 ")\n", app_irom_start_aligned,
273+
app_irom_vaddr_aligned, app_irom_size, app_irom_size);
274+
ets_printf("DROM segment aligned lma 0x%08" PRIx32 " vma 0x%08" PRIx32 ""
275+
" len 0x%06" PRIx32 " "\
276+
"(%" PRIu32 ")\n", app_drom_start_aligned,
277+
app_drom_vaddr_aligned, app_drom_size, app_drom_size);
275278
#endif
276279

277280
#ifdef CONFIG_ARCH_CHIP_ESP32

arch/xtensa/src/common/espressif/esp_mcpwm.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ static int esp_motor_fault_configure(struct mcpwm_motor_lowerhalf_s *lower,
11431143

11441144
#ifdef CONFIG_ESP_MCPWM_MOTOR
11451145
static int esp_motor_set_duty_cycle(struct mcpwm_motor_lowerhalf_s *lower,
1146-
float duty)
1146+
float duty)
11471147
{
11481148
DEBUGASSERT(lower != NULL);
11491149

@@ -1158,7 +1158,7 @@ static int esp_motor_set_duty_cycle(struct mcpwm_motor_lowerhalf_s *lower,
11581158
uint32_t pwm_count = -1 * lower->counter_peak * (duty - 1.0);
11591159
mcpwm_ll_operator_set_compare_value(hal->dev, lower->operator_id,
11601160
MCPWM_GENERATOR_0, pwm_count);
1161-
mtrinfo("Duty %f compare value set: %u\n", duty, pwm_count);
1161+
mtrinfo("Duty %f compare value set: %" PRIu32 "\n", duty, pwm_count);
11621162

11631163
return OK;
11641164
}
@@ -1924,7 +1924,7 @@ struct motor_lowerhalf_s *esp_motor_bdc_initialize(int channel,
19241924
return NULL;
19251925
}
19261926

1927-
mtrinfo("Channel %d initialized. GPIO: PWM_A: %d | PWM_B: %d | Freq: %d\n",
1927+
mtrinfo("Ch %d initialized GPIO: PWM_A %d | PWM_B %d | Freq %" PRIu32 "\n",
19281928
lower->channel_id, lower->generator_pins[MCPWM_GENERATOR_0],
19291929
lower->generator_pins[MCPWM_GENERATOR_1], lower->pwm_frequency);
19301930
return (struct motor_lowerhalf_s *) lower;

arch/xtensa/src/common/espressif/esp_nxdiag.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ static ssize_t esp_nxdiag_read(struct file *filep,
258258
}
259259
else
260260
{
261-
snprintf(tmp, tmp_arr_size, "Flash status: 0x%lx\n\n",
261+
snprintf(tmp, tmp_arr_size, "Flash status: 0x%" PRIx32 "\n\n",
262262
(long unsigned int)flash_status);
263263
strcat(buffer, tmp);
264264
}

arch/xtensa/src/common/espressif/esp_openeth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ static IRAM_ATTR int openeth_isr_handler(int irq, void *context, void *arg)
250250

251251
if (status & OPENETH_INT_BUSY)
252252
{
253-
ninfo("RX frame dropped (0x%x)", status);
253+
ninfo("RX frame dropped (0x%" PRIx32 ")", status);
254254
}
255255

256256
/* Clear interrupt */

arch/xtensa/src/common/espressif/esp_pcnt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static int esp_pcnt_ioctl(struct cap_lowerhalf_s *dev, int cmd,
351351
ret = esp_pcnt_unit_register_event_callback(dev, handler);
352352
if (ret != OK)
353353
{
354-
cperr("Could not register callback-%x to pcnt-%d!\n",
354+
cperr("Could not register callback-%" PRIx32 " to pcnt-%d!\n",
355355
(uint32_t)handler, priv->unit_id);
356356
}
357357

arch/xtensa/src/common/espressif/esp_rmt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ static int IRAM_ATTR rmt_driver_isr_default(int irq, void *context,
14371437

14381438
rmt_ll_rx_reset_pointer(g_rmtdev_common.hal.regs, channel);
14391439
rmtinfo("RMT RX channel %d error", channel);
1440-
rmtinfo("status: 0x%08x",
1440+
rmtinfo("status: 0x%08" PRIx32 "",
14411441
rmt_ll_rx_get_status_word(g_rmtdev_common.hal.regs,
14421442
channel));
14431443
}
@@ -1462,7 +1462,7 @@ static int IRAM_ATTR rmt_driver_isr_default(int irq, void *context,
14621462

14631463
rmt_ll_tx_reset_pointer(g_rmtdev_common.hal.regs, channel);
14641464
rmtinfo("RMT TX channel %d error", channel);
1465-
rmtinfo("status: 0x%08x",
1465+
rmtinfo("status: 0x%08" PRIx32 "",
14661466
rmt_ll_tx_get_status_word(g_rmtdev_common.hal.regs,
14671467
channel));
14681468
}

arch/xtensa/src/common/espressif/esp_wireless.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,8 +1074,8 @@ int esp_phy_update_country_info(const char *country)
10741074
*
10751075
****************************************************************************/
10761076

1077-
int32_t esp_timer_create(const esp_timer_create_args_t *create_args,
1078-
esp_timer_handle_t *out_handle)
1077+
int esp_timer_create(const esp_timer_create_args_t *create_args,
1078+
esp_timer_handle_t *out_handle)
10791079
{
10801080
int ret;
10811081
struct rt_timer_args_s rt_timer_args;
@@ -1111,7 +1111,7 @@ int32_t esp_timer_create(const esp_timer_create_args_t *create_args,
11111111
*
11121112
****************************************************************************/
11131113

1114-
int32_t esp_timer_start_once(esp_timer_handle_t timer, uint64_t timeout_us)
1114+
int esp_timer_start_once(esp_timer_handle_t timer, uint64_t timeout_us)
11151115
{
11161116
struct rt_timer_s *rt_timer = (struct rt_timer_s *)timer;
11171117

@@ -1135,7 +1135,7 @@ int32_t esp_timer_start_once(esp_timer_handle_t timer, uint64_t timeout_us)
11351135
*
11361136
****************************************************************************/
11371137

1138-
int32_t esp_timer_start_periodic(esp_timer_handle_t timer, uint64_t period)
1138+
int esp_timer_start_periodic(esp_timer_handle_t timer, uint64_t period)
11391139
{
11401140
struct rt_timer_s *rt_timer = (struct rt_timer_s *)timer;
11411141

@@ -1158,7 +1158,7 @@ int32_t esp_timer_start_periodic(esp_timer_handle_t timer, uint64_t period)
11581158
*
11591159
****************************************************************************/
11601160

1161-
int32_t esp_timer_stop(esp_timer_handle_t timer)
1161+
int esp_timer_stop(esp_timer_handle_t timer)
11621162
{
11631163
struct rt_timer_s *rt_timer = (struct rt_timer_s *)timer;
11641164

@@ -1181,7 +1181,7 @@ int32_t esp_timer_stop(esp_timer_handle_t timer)
11811181
*
11821182
****************************************************************************/
11831183

1184-
int32_t esp_timer_delete(esp_timer_handle_t timer)
1184+
int esp_timer_delete(esp_timer_handle_t timer)
11851185
{
11861186
struct rt_timer_s *rt_timer = (struct rt_timer_s *)timer;
11871187

@@ -1499,7 +1499,7 @@ int esp_wireless_deinit(void)
14991499
*
15001500
****************************************************************************/
15011501

1502-
int32_t esp_wifi_init(const wifi_init_config_t *config)
1502+
int esp_wifi_init(const wifi_init_config_t *config)
15031503
{
15041504
int32_t ret;
15051505

@@ -1520,7 +1520,7 @@ int32_t esp_wifi_init(const wifi_init_config_t *config)
15201520
ret = coex_init();
15211521
if (ret)
15221522
{
1523-
wlerr("ERROR: Failed to initialize coex error=%d\n", ret);
1523+
wlerr("ERROR: Failed to initialize coex error=%ld\n", ret);
15241524
return ret;
15251525
}
15261526
#endif
@@ -1534,7 +1534,7 @@ int32_t esp_wifi_init(const wifi_init_config_t *config)
15341534
ret = esp_wifi_init_internal(config);
15351535
if (ret)
15361536
{
1537-
wlerr("Failed to initialize Wi-Fi error=%d\n", ret);
1537+
wlerr("Failed to initialize Wi-Fi error=%ld\n", ret);
15381538
return ret;
15391539
}
15401540

@@ -1551,7 +1551,7 @@ int32_t esp_wifi_init(const wifi_init_config_t *config)
15511551
ret = esp_supplicant_init();
15521552
if (ret)
15531553
{
1554-
wlerr("Failed to initialize WPA supplicant error=%d\n", ret);
1554+
wlerr("Failed to initialize WPA supplicant error=%ld\n", ret);
15551555
esp_wifi_deinit_internal();
15561556
return ret;
15571557
}
@@ -1573,7 +1573,7 @@ int32_t esp_wifi_init(const wifi_init_config_t *config)
15731573
*
15741574
****************************************************************************/
15751575

1576-
int32_t esp_wifi_deinit(void)
1576+
int esp_wifi_deinit(void)
15771577
{
15781578
int ret;
15791579

arch/xtensa/src/common/espressif/esp_wireless.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,8 @@ int phy_printf(const char *format, ...) printf_like(1, 2);
195195
*
196196
****************************************************************************/
197197

198-
int32_t esp_timer_create(const esp_timer_create_args_t *create_args,
199-
esp_timer_handle_t *out_handle);
198+
int esp_timer_create(const esp_timer_create_args_t *create_args,
199+
esp_timer_handle_t *out_handle);
200200

201201
/****************************************************************************
202202
* Name: esp_timer_start_once
@@ -213,7 +213,7 @@ int32_t esp_timer_create(const esp_timer_create_args_t *create_args,
213213
*
214214
****************************************************************************/
215215

216-
int32_t esp_timer_start_once(esp_timer_handle_t timer, uint64_t timeout_us);
216+
int esp_timer_start_once(esp_timer_handle_t timer, uint64_t timeout_us);
217217

218218
/****************************************************************************
219219
* Name: esp_timer_start_periodic
@@ -230,7 +230,7 @@ int32_t esp_timer_start_once(esp_timer_handle_t timer, uint64_t timeout_us);
230230
*
231231
****************************************************************************/
232232

233-
int32_t esp_timer_start_periodic(esp_timer_handle_t timer, uint64_t period);
233+
int esp_timer_start_periodic(esp_timer_handle_t timer, uint64_t period);
234234

235235
/****************************************************************************
236236
* Name: esp_timer_stop
@@ -246,7 +246,7 @@ int32_t esp_timer_start_periodic(esp_timer_handle_t timer, uint64_t period);
246246
*
247247
****************************************************************************/
248248

249-
int32_t esp_timer_stop(esp_timer_handle_t timer);
249+
int esp_timer_stop(esp_timer_handle_t timer);
250250

251251
/****************************************************************************
252252
* Name: esp_timer_delete
@@ -262,7 +262,7 @@ int32_t esp_timer_stop(esp_timer_handle_t timer);
262262
*
263263
****************************************************************************/
264264

265-
int32_t esp_timer_delete(esp_timer_handle_t timer);
265+
int esp_timer_delete(esp_timer_handle_t timer);
266266

267267
/****************************************************************************
268268
* Name: esp_phy_update_country_info

arch/xtensa/src/common/espressif/esp_ws2812.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ static ssize_t esp_write(struct file *filep, const char *data, size_t len)
471471
if (((position + len) / WS2812_RW_PIXEL_SIZE) > dev->nleds)
472472
{
473473
ledwarn("esp_ws2812 write truncated:\n\t\tLED position: %d\n"
474-
"\t\tLED requested to be written: %d\n"
474+
"\t\tLED requested to be written: %" PRIu32 "\n"
475475
"\t\tLED strip LED count: %d\n"
476476
"\t\tLED being written: %d\n",
477477
position / WS2812_RW_PIXEL_SIZE,

0 commit comments

Comments
 (0)