Skip to content

Commit 94e8701

Browse files
authored
Fixup compilation of printf-like functions with uint32_t args. (qmk#17904)
1 parent 543f54a commit 94e8701

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

drivers/flash/flash_spi.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ flash_status_t flash_erase_sector(uint32_t addr) {
207207

208208
/* Check that the address exceeds the limit. */
209209
if ((addr + (EXTERNAL_FLASH_SECTOR_SIZE)) >= (EXTERNAL_FLASH_SIZE) || ((addr % (EXTERNAL_FLASH_SECTOR_SIZE)) != 0)) {
210-
dprintf("Flash erase sector address over limit! [addr:0x%x]\n", (uint32_t)addr);
210+
dprintf("Flash erase sector address over limit! [addr:0x%lx]\n", (uint32_t)addr);
211211
return FLASH_STATUS_ERROR;
212212
}
213213

@@ -247,7 +247,7 @@ flash_status_t flash_erase_block(uint32_t addr) {
247247

248248
/* Check that the address exceeds the limit. */
249249
if ((addr + (EXTERNAL_FLASH_BLOCK_SIZE)) >= (EXTERNAL_FLASH_SIZE) || ((addr % (EXTERNAL_FLASH_BLOCK_SIZE)) != 0)) {
250-
dprintf("Flash erase block address over limit! [addr:0x%x]\n", (uint32_t)addr);
250+
dprintf("Flash erase block address over limit! [addr:0x%lx]\n", (uint32_t)addr);
251251
return FLASH_STATUS_ERROR;
252252
}
253253

@@ -303,7 +303,7 @@ flash_status_t flash_read_block(uint32_t addr, void *buf, size_t len) {
303303
}
304304

305305
#if defined(CONSOLE_ENABLE) && defined(DEBUG_FLASH_SPI_OUTPUT)
306-
dprintf("[SPI FLASH R] 0x%08lX: ", addr);
306+
dprintf("[SPI FLASH R] 0x%08lx: ", addr);
307307
for (size_t i = 0; i < len; ++i) {
308308
dprintf(" %02X", (int)(((uint8_t *)read_buf)[i]));
309309
}
@@ -339,7 +339,7 @@ flash_status_t flash_write_block(uint32_t addr, const void *buf, size_t len) {
339339
}
340340

341341
#if defined(CONSOLE_ENABLE) && defined(DEBUG_FLASH_SPI_OUTPUT)
342-
dprintf("[SPI FLASH W] 0x%08lX: ", addr);
342+
dprintf("[SPI FLASH W] 0x%08lx: ", addr);
343343
for (size_t i = 0; i < write_length; i++) {
344344
dprintf(" %02X", (int)(uint8_t)(write_buf[i]));
345345
}

platforms/chibios/drivers/eeprom/eeprom_stm32.c

+10-10
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ uint16_t EEPROM_Init(void) {
250250
}
251251
wvalue = ~*log_addr;
252252
if (!wvalue) {
253-
eeprom_printf("Incomplete write at log_addr: 0x%04x;\n", (uint32_t)log_addr);
253+
eeprom_printf("Incomplete write at log_addr: 0x%04lx;\n", (uint32_t)log_addr);
254254
/* Possibly incomplete write. Ignore and continue */
255255
continue;
256256
}
@@ -261,7 +261,7 @@ uint16_t EEPROM_Init(void) {
261261
} else {
262262
/* Reserved for future use */
263263
if (address & FEE_VALUE_RESERVED) {
264-
eeprom_printf("Reserved encoded value at log_addr: 0x%04x;\n", (uint32_t)log_addr);
264+
eeprom_printf("Reserved encoded value at log_addr: 0x%04lx;\n", (uint32_t)log_addr);
265265
continue;
266266
}
267267
/* Optimization for 0 or 1 values. */
@@ -273,7 +273,7 @@ uint16_t EEPROM_Init(void) {
273273
eeprom_printf("DataBuf[0x%04x] = 0x%04x;\n", address, wvalue);
274274
*(uint16_t *)(&DataBuf[address]) = wvalue;
275275
} else {
276-
eeprom_printf("DataBuf[0x%04x] cannot be set to 0x%04x [BAD ADDRESS]\n", address, wvalue);
276+
eeprom_printf("DataBuf[0x%04x] cannot be set to 0x%04lx [BAD ADDRESS]\n", address, wvalue);
277277
}
278278
}
279279
}
@@ -293,14 +293,14 @@ static void eeprom_clear(void) {
293293
FLASH_Unlock();
294294

295295
for (uint16_t page_num = 0; page_num < FEE_PAGE_COUNT; ++page_num) {
296-
eeprom_printf("FLASH_ErasePage(0x%04x)\n", (uint32_t)(FEE_PAGE_BASE_ADDRESS + (page_num * FEE_PAGE_SIZE)));
296+
eeprom_printf("FLASH_ErasePage(0x%04lx)\n", (uint32_t)(FEE_PAGE_BASE_ADDRESS + (page_num * FEE_PAGE_SIZE)));
297297
FLASH_ErasePage(FEE_PAGE_BASE_ADDRESS + (page_num * FEE_PAGE_SIZE));
298298
}
299299

300300
FLASH_Lock();
301301

302302
empty_slot = (uint16_t *)FEE_WRITE_LOG_BASE_ADDRESS;
303-
eeprom_printf("eeprom_clear empty_slot: 0x%08x\n", (uint32_t)empty_slot);
303+
eeprom_printf("eeprom_clear empty_slot: 0x%08lx\n", (uint32_t)empty_slot);
304304
}
305305

306306
/* Erase emulated eeprom */
@@ -328,7 +328,7 @@ static uint8_t eeprom_compact(void) {
328328
for (; dest < FEE_COMPACTED_LAST_ADDRESS; ++src, dest += 2) {
329329
value = *src;
330330
if (value) {
331-
eeprom_printf("FLASH_ProgramHalfWord(0x%04x, 0x%04x)\n", (uint32_t)dest, ~value);
331+
eeprom_printf("FLASH_ProgramHalfWord(0x%04lx, 0x%04x)\n", (uint32_t)dest, ~value);
332332
FLASH_Status status = FLASH_ProgramHalfWord(dest, ~value);
333333
if (status != FLASH_COMPLETE) final_status = status;
334334
}
@@ -355,7 +355,7 @@ static uint8_t eeprom_write_direct_entry(uint16_t Address) {
355355

356356
FLASH_Unlock();
357357

358-
eeprom_printf("FLASH_ProgramHalfWord(0x%08x, 0x%04x) [DIRECT]\n", (uint32_t)directAddress, value);
358+
eeprom_printf("FLASH_ProgramHalfWord(0x%08lx, 0x%04x) [DIRECT]\n", (uint32_t)directAddress, value);
359359
FLASH_Status status = FLASH_ProgramHalfWord(directAddress, value);
360360

361361
FLASH_Lock();
@@ -397,12 +397,12 @@ static uint8_t eeprom_write_log_word_entry(uint16_t Address) {
397397
FLASH_Unlock();
398398

399399
/* address */
400-
eeprom_printf("FLASH_ProgramHalfWord(0x%08x, 0x%04x)\n", (uint32_t)empty_slot, Address);
400+
eeprom_printf("FLASH_ProgramHalfWord(0x%08lx, 0x%04x)\n", (uint32_t)empty_slot, Address);
401401
final_status = FLASH_ProgramHalfWord((uintptr_t)empty_slot++, Address);
402402

403403
/* value */
404404
if (encoding == (FEE_WORD_ENCODING | FEE_VALUE_NEXT)) {
405-
eeprom_printf("FLASH_ProgramHalfWord(0x%08x, 0x%04x)\n", (uint32_t)empty_slot, ~value);
405+
eeprom_printf("FLASH_ProgramHalfWord(0x%08lx, 0x%04x)\n", (uint32_t)empty_slot, ~value);
406406
FLASH_Status status = FLASH_ProgramHalfWord((uintptr_t)empty_slot++, ~value);
407407
if (status != FLASH_COMPLETE) final_status = status;
408408
}
@@ -428,7 +428,7 @@ static uint8_t eeprom_write_log_byte_entry(uint16_t Address) {
428428
uint16_t value = (Address << 8) | DataBuf[Address];
429429

430430
/* write to flash */
431-
eeprom_printf("FLASH_ProgramHalfWord(0x%08x, 0x%04x)\n", (uint32_t)empty_slot, value);
431+
eeprom_printf("FLASH_ProgramHalfWord(0x%08lx, 0x%04x)\n", (uint32_t)empty_slot, value);
432432
FLASH_Status status = FLASH_ProgramHalfWord((uintptr_t)empty_slot++, value);
433433

434434
FLASH_Lock();

0 commit comments

Comments
 (0)