firmware: Enable -Wformat and resolve all related compiler warnings
There have been tons of format-string related bugs in our code which
we never discovered due to disabling -Wformat. Let's fix that.
Change-Id: I5ec466361bcc526fac1f4897673264ee5af3458b
diff --git a/firmware/libcommon/source/mode_cardemu.c b/firmware/libcommon/source/mode_cardemu.c
index 76b3a01..98818e1 100644
--- a/firmware/libcommon/source/mode_cardemu.c
+++ b/firmware/libcommon/source/mode_cardemu.c
@@ -50,7 +50,7 @@
#endif
struct cardem_inst {
- uint32_t num;
+ unsigned int num;
struct card_handle *ch;
struct llist_head usb_out_queue;
struct ringbuf rb;
@@ -117,7 +117,7 @@
/* wait until last char has been fully transmitted */
while ((usart->US_CSR & (US_CSR_TXEMPTY)) == 0) {
if (!(i%1000000)) {
- TRACE_ERROR("s: %x \r\n", usart->US_CSR);
+ TRACE_ERROR("s: %lx \r\n", usart->US_CSR);
}
i++;
}
@@ -174,7 +174,7 @@
int i = 1;
while ((usart->US_CSR & (US_CSR_TXRDY)) == 0) {
if (!(i%1000000)) {
- TRACE_ERROR("%u: s: %x %02X\r\n",
+ TRACE_ERROR("%u: s: %lx %02lX\r\n",
uart_chan, usart->US_CSR,
usart->US_RHR & 0xFF);
usart->US_CR = US_CR_RSTTX;
@@ -213,7 +213,7 @@
if (csr & (US_CSR_OVRE|US_CSR_FRAME|US_CSR_PARE|
US_CSR_TIMEOUT|US_CSR_NACK|(1<<10))) {
usart->US_CR = US_CR_RSTSTA | US_CR_RSTIT | US_CR_RSTNACK;
- TRACE_ERROR("%u e 0x%x st: 0x%x\n", ci->num, byte, csr);
+ TRACE_ERROR("%u e 0x%x st: 0x%lx\n", ci->num, byte, csr);
}
}