Actually we define a PRI_avr_cycle_count preprocessor macro in
sim_avr.h in the style of PRI* in inttypes.h.
Signed-off-by: Sami Liedes <sliedes@cc.hut.fi>
2 files changed:
#define __SIM_AVR_H__
#include <stdint.h>
+#include <inttypes.h>
#ifdef __cplusplus
extern "C" {
typedef uint64_t avr_cycle_count_t;
typedef uint16_t avr_io_addr_t;
+// printf() conversion specifier for avr_cycle_count_t
+#define PRI_avr_cycle_count PRIu64
+
struct avr_t;
typedef uint8_t (*avr_io_read_t)(struct avr_t * avr, avr_io_addr_t addr, void * param);
typedef void (*avr_io_write_t)(struct avr_t * avr, avr_io_addr_t addr, uint8_t v, void * param);
#define CRASH() {\
DUMP_REG();\
- printf("*** CYCLE %lld PC %04x\n", avr->cycle, avr->pc);\
+ printf("*** CYCLE %" PRI_avr_cycle_count "PC %04x\n", avr->cycle, avr->pc);\
for (int i = OLD_PC_SIZE-1; i > 0; i--) {\
int pci = (avr->old_pci + i) & 0xf;\
printf("\e[31m*** %04x: %-25s RESET -%d; sp %04x\e[0m\n",\