]> git.sur5r.net Git - openocd/commitdiff
Conform to C99 integer types format specifiers
authorHsiangkai Wang <hsiangkai@gmail.com>
Mon, 4 Nov 2013 04:43:12 +0000 (12:43 +0800)
committerSpencer Oliver <spen@spen-soft.co.uk>
Wed, 15 Jan 2014 12:40:42 +0000 (12:40 +0000)
Review and modify to conform to C99 integer types format specifiers.
Use arm-none-eabi toolchain to build successfully.

Change-Id: If855072a8f88886809309155ac6d031dcfcbc4b2
Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com>
Signed-off-by: Hsiangkai <hsiangkai@gmail.com>
Reviewed-on: http://openocd.zylin.com/1794
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
21 files changed:
src/jtag/aice/aice_interface.c
src/jtag/aice/aice_pipe.c
src/jtag/aice/aice_usb.c
src/jtag/aice/aice_usb.h
src/jtag/drivers/jlink.c
src/jtag/drivers/opendous.c
src/jtag/drivers/osbdm.c
src/jtag/drivers/stlink_usb.c
src/jtag/drivers/ti_icdi_usb.c
src/jtag/hla/hla_interface.c
src/rtos/linux.c
src/server/gdb_server.c
src/target/nds32.c
src/target/nds32_disassembler.c
src/target/nds32_v2.c
src/target/nds32_v3.c
src/target/nds32_v3_common.c
src/target/nds32_v3m.c
src/target/openrisc/or1k.c
src/target/openrisc/or1k_du_adv.c
src/target/openrisc/or1k_tap_vjtag.c

index aede83a99d11f86d3486f17f8c4d327d8d3bcde3..838b54faaf994ebfab045176fcddcf76ed767d2a 100644 (file)
@@ -98,7 +98,7 @@ int aice_init_targets(void)
 
                if (found == 0) {
                        LOG_ERROR
-                               ("aice_init_targets: target not found: idcode: %x ",
+                               ("aice_init_targets: target not found: idcode: %" PRIx32,
                                 target->tap->idcode);
                        return ERROR_FAIL;
                }
@@ -152,7 +152,7 @@ static int aice_execute_reset(struct jtag_command *cmd)
        static int last_trst;
        int retval = ERROR_OK;
 
-       DEBUG_JTAG_IO("reset trst: %i", cmd->cmd.reset->trst);
+       DEBUG_JTAG_IO("reset trst: %d", cmd->cmd.reset->trst);
 
        if (cmd->cmd.reset->trst != last_trst) {
                if (cmd->cmd.reset->trst)
index 44eade2d536b84a4cf424fba6337946543ca0c74..3180ad008332afc738df08595f251c891b1913d5 100644 (file)
@@ -47,7 +47,7 @@ static int aice_pipe_write(const void *buffer, int count)
 
        success = WriteFile(aice_pipe_output[1], buffer, count, &written, NULL);
        if (!success) {
-               LOG_ERROR("(WIN32) write to pipe failed, error code: 0x%08lx", GetLastError());
+               LOG_ERROR("(WIN32) write to pipe failed, error code: 0x%08l" PRIx32, GetLastError());
                return -1;
        }
 
@@ -61,7 +61,7 @@ static int aice_pipe_read(void *buffer, int count)
 
        success = ReadFile(aice_pipe_input[0], buffer, count, &has_read, NULL);
        if (!success || (has_read == 0)) {
-               LOG_ERROR("(WIN32) read from pipe failed, error code: 0x%08lx", GetLastError());
+               LOG_ERROR("(WIN32) read from pipe failed, error code: 0x%08l" PRIx32, GetLastError());
                return -1;
        }
 
index ccd69975b706877285a58b4173cda80f1803c073..3587721e3dbb0274d420bc36971aac9db2772918 100644 (file)
@@ -41,6 +41,65 @@ static int aice_max_retry_times = 50;
 /* Default endian is little endian. */
 static enum aice_target_endian data_endian;
 
+/* Constants for AICE command format length */
+static const int32_t AICE_FORMAT_HTDA = 3;
+static const int32_t AICE_FORMAT_HTDB  = 6;
+static const int32_t AICE_FORMAT_HTDC  = 7;
+static const int32_t AICE_FORMAT_HTDD  = 10;
+static const int32_t AICE_FORMAT_HTDMA = 4;
+static const int32_t AICE_FORMAT_HTDMB = 8;
+static const int32_t AICE_FORMAT_HTDMC = 8;
+static const int32_t AICE_FORMAT_HTDMD = 12;
+static const int32_t AICE_FORMAT_DTHA  = 6;
+static const int32_t AICE_FORMAT_DTHB  = 2;
+static const int32_t AICE_FORMAT_DTHMA = 8;
+static const int32_t AICE_FORMAT_DTHMB = 4;
+
+/* Constants for AICE command */
+static const uint8_t AICE_CMD_SCAN_CHAIN = 0x00;
+static const uint8_t AICE_CMD_SELECT_TARGET = 0x01;
+static const uint8_t AICE_CMD_READ_DIM = 0x02;
+static const uint8_t AICE_CMD_READ_EDMSR = 0x03;
+static const uint8_t AICE_CMD_READ_DTR = 0x04;
+static const uint8_t AICE_CMD_READ_MEM = 0x05;
+static const uint8_t AICE_CMD_READ_MISC = 0x06;
+static const uint8_t AICE_CMD_FASTREAD_MEM = 0x07;
+static const uint8_t AICE_CMD_WRITE_DIM = 0x08;
+static const uint8_t AICE_CMD_WRITE_EDMSR = 0x09;
+static const uint8_t AICE_CMD_WRITE_DTR = 0x0A;
+static const uint8_t AICE_CMD_WRITE_MEM = 0x0B;
+static const uint8_t AICE_CMD_WRITE_MISC = 0x0C;
+static const uint8_t AICE_CMD_FASTWRITE_MEM    = 0x0D;
+static const uint8_t AICE_CMD_EXECUTE = 0x0E;
+static const uint8_t AICE_CMD_READ_MEM_B = 0x14;
+static const uint8_t AICE_CMD_READ_MEM_H = 0x15;
+static const uint8_t AICE_CMD_T_READ_MISC = 0x20;
+static const uint8_t AICE_CMD_T_READ_EDMSR = 0x21;
+static const uint8_t AICE_CMD_T_READ_DTR = 0x22;
+static const uint8_t AICE_CMD_T_READ_DIM = 0x23;
+static const uint8_t AICE_CMD_T_READ_MEM_B = 0x24;
+static const uint8_t AICE_CMD_T_READ_MEM_H = 0x25;
+static const uint8_t AICE_CMD_T_READ_MEM = 0x26;
+static const uint8_t AICE_CMD_T_FASTREAD_MEM = 0x27;
+static const uint8_t AICE_CMD_T_WRITE_MISC = 0x28;
+static const uint8_t AICE_CMD_T_WRITE_EDMSR    = 0x29;
+static const uint8_t AICE_CMD_T_WRITE_DTR = 0x2A;
+static const uint8_t AICE_CMD_T_WRITE_DIM = 0x2B;
+static const uint8_t AICE_CMD_T_WRITE_MEM_B = 0x2C;
+static const uint8_t AICE_CMD_T_WRITE_MEM_H = 0x2D;
+static const uint8_t AICE_CMD_T_WRITE_MEM = 0x2E;
+static const uint8_t AICE_CMD_T_FASTWRITE_MEM = 0x2F;
+static const uint8_t AICE_CMD_T_GET_TRACE_STATUS = 0x36;
+static const uint8_t AICE_CMD_T_EXECUTE = 0x3E;
+static const uint8_t AICE_CMD_AICE_PROGRAM_READ = 0x40;
+static const uint8_t AICE_CMD_AICE_PROGRAM_WRITE = 0x41;
+static const uint8_t AICE_CMD_AICE_PROGRAM_CONTROL = 0x42;
+static const uint8_t AICE_CMD_READ_CTRL = 0x50;
+static const uint8_t AICE_CMD_WRITE_CTRL = 0x51;
+static const uint8_t AICE_CMD_BATCH_BUFFER_READ = 0x60;
+static const uint8_t AICE_CMD_READ_DTR_TO_BUFFER = 0x61;
+static const uint8_t AICE_CMD_BATCH_BUFFER_WRITE = 0x68;
+static const uint8_t AICE_CMD_WRITE_DTR_FROM_BUFFER = 0x69;
 
 /***************************************************************************/
 /* AICE commands' pack/unpack functions */
@@ -358,7 +417,7 @@ static int aice_usb_write(uint8_t *out_buffer, int out_length)
        int result;
 
        if (out_length > AICE_OUT_BUFFER_SIZE) {
-               LOG_ERROR("aice_write illegal out_length=%d (max=%d)",
+               LOG_ERROR("aice_write illegal out_length=%i (max=%i)",
                                out_length, AICE_OUT_BUFFER_SIZE);
                return -1;
        }
@@ -366,7 +425,7 @@ static int aice_usb_write(uint8_t *out_buffer, int out_length)
        result = usb_bulk_write_ex(aice_handler.usb_handle, aice_handler.usb_write_ep,
                        (char *)out_buffer, out_length, AICE_USB_TIMEOUT);
 
-       DEBUG_JTAG_IO("aice_usb_write, out_length = %d, result = %d",
+       DEBUG_JTAG_IO("aice_usb_write, out_length = %i, result = %i",
                        out_length, result);
 
        return result;
@@ -375,10 +434,10 @@ static int aice_usb_write(uint8_t *out_buffer, int out_length)
 /* Read data from USB into in_buffer. */
 static int aice_usb_read(uint8_t *in_buffer, int expected_size)
 {
-       int result = usb_bulk_read_ex(aice_handler.usb_handle, aice_handler.usb_read_ep,
+       int32_t result = usb_bulk_read_ex(aice_handler.usb_handle, aice_handler.usb_read_ep,
                        (char *)in_buffer, expected_size, AICE_USB_TIMEOUT);
 
-       DEBUG_JTAG_IO("aice_usb_read, result = %d", result);
+       DEBUG_JTAG_IO("aice_usb_read, result = %" PRId32, result);
 
        return result;
 }
@@ -506,7 +565,7 @@ static int aice_reset_box(void)
 
 static int aice_scan_chain(uint32_t *id_codes, uint8_t *num_of_ids)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if ((AICE_COMMAND_MODE_PACK == aice_command_mode) ||
@@ -523,7 +582,7 @@ static int aice_scan_chain(uint32_t *id_codes, uint8_t *num_of_ids)
                /** TODO: modify receive length */
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHA);
                if (AICE_FORMAT_DTHA != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRIu32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHA, result);
                        return ERROR_FAIL;
                }
@@ -535,7 +594,7 @@ static int aice_scan_chain(uint32_t *id_codes, uint8_t *num_of_ids)
                if (cmd_ack_code != AICE_CMD_SCAN_CHAIN) {
 
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_SCAN_CHAIN, cmd_ack_code);
                                return ERROR_FAIL;
                        }
@@ -548,7 +607,7 @@ static int aice_scan_chain(uint32_t *id_codes, uint8_t *num_of_ids)
                        continue;
                }
 
-               LOG_DEBUG("SCAN_CHAIN response, # of IDs: %d", *num_of_ids);
+               LOG_DEBUG("SCAN_CHAIN response, # of IDs: %" PRIu8, *num_of_ids);
 
                if (*num_of_ids == 0xFF) {
                        LOG_ERROR("No target connected");
@@ -566,7 +625,7 @@ static int aice_scan_chain(uint32_t *id_codes, uint8_t *num_of_ids)
 
 int aice_read_ctrl(uint32_t address, uint32_t *data)
 {
-       int result;
+       int32_t result;
 
        if ((AICE_COMMAND_MODE_PACK == aice_command_mode) ||
                (AICE_COMMAND_MODE_BATCH == aice_command_mode))
@@ -576,11 +635,11 @@ int aice_read_ctrl(uint32_t address, uint32_t *data)
 
        aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDA);
 
-       LOG_DEBUG("READ_CTRL, address: 0x%x", address);
+       LOG_DEBUG("READ_CTRL, address: 0x%" PRIx32, address);
 
        result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHA);
        if (AICE_FORMAT_DTHA != result) {
-               LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+               LOG_ERROR("aice_usb_read failed (requested=%" PRIu32 ", result=%" PRId32 ")",
                                AICE_FORMAT_DTHA, result);
                return ERROR_FAIL;
        }
@@ -589,11 +648,11 @@ int aice_read_ctrl(uint32_t address, uint32_t *data)
        uint8_t extra_length;
        aice_unpack_dtha(&cmd_ack_code, &extra_length, data, AICE_LITTLE_ENDIAN);
 
-       LOG_DEBUG("READ_CTRL response, data: 0x%x", *data);
+       LOG_DEBUG("READ_CTRL response, data: 0x%" PRIx32, *data);
 
        if (cmd_ack_code != AICE_CMD_READ_CTRL) {
-               LOG_ERROR("aice command error (command=0x%x, response=0x%x)",
-                               AICE_CMD_READ_CTRL, cmd_ack_code);
+               LOG_ERROR("aice command error (command=0x%" PRIx32 ", response=0x%" PRIx8 ")",
+                               (uint32_t)AICE_CMD_READ_CTRL, cmd_ack_code);
                return ERROR_FAIL;
        }
 
@@ -602,7 +661,7 @@ int aice_read_ctrl(uint32_t address, uint32_t *data)
 
 int aice_write_ctrl(uint32_t address, uint32_t data)
 {
-       int result;
+       int32_t result;
 
        if (AICE_COMMAND_MODE_PACK == aice_command_mode) {
                aice_usb_packet_flush();
@@ -616,11 +675,11 @@ int aice_write_ctrl(uint32_t address, uint32_t data)
 
        aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDC);
 
-       LOG_DEBUG("WRITE_CTRL, address: 0x%x, data: 0x%x", address, data);
+       LOG_DEBUG("WRITE_CTRL, address: 0x%" PRIx32 ", data: 0x%" PRIx32, address, data);
 
        result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHB);
        if (AICE_FORMAT_DTHB != result) {
-               LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+               LOG_ERROR("aice_usb_read failed (requested=%" PRIu32 ", result=%" PRId32 ")",
                                AICE_FORMAT_DTHB, result);
                return ERROR_FAIL;
        }
@@ -632,7 +691,7 @@ int aice_write_ctrl(uint32_t address, uint32_t data)
        LOG_DEBUG("WRITE_CTRL response");
 
        if (cmd_ack_code != AICE_CMD_WRITE_CTRL) {
-               LOG_ERROR("aice command error (command=0x%x, response=0x%x)",
+               LOG_ERROR("aice command error (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                AICE_CMD_WRITE_CTRL, cmd_ack_code);
                return ERROR_FAIL;
        }
@@ -642,7 +701,7 @@ int aice_write_ctrl(uint32_t address, uint32_t data)
 
 int aice_read_dtr(uint8_t target_id, uint32_t *data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if ((AICE_COMMAND_MODE_PACK == aice_command_mode) ||
@@ -654,11 +713,11 @@ int aice_read_dtr(uint8_t target_id, uint32_t *data)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMA);
 
-               LOG_DEBUG("READ_DTR, COREID: %d", target_id);
+               LOG_DEBUG("READ_DTR, COREID: %" PRIu8, target_id);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMA);
                if (AICE_FORMAT_DTHMA != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMA, result);
                        return ERROR_FAIL;
                }
@@ -670,12 +729,12 @@ int aice_read_dtr(uint8_t target_id, uint32_t *data)
                                data, AICE_LITTLE_ENDIAN);
 
                if (cmd_ack_code == AICE_CMD_T_READ_DTR) {
-                       LOG_DEBUG("READ_DTR response, data: 0x%x", *data);
+                       LOG_DEBUG("READ_DTR response, data: 0x%" PRIx32, *data);
                        break;
                } else {
 
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_READ_DTR, cmd_ack_code);
                                return ERROR_FAIL;
                        }
@@ -693,7 +752,7 @@ int aice_read_dtr(uint8_t target_id, uint32_t *data)
 
 int aice_read_dtr_to_buffer(uint8_t target_id, uint32_t buffer_idx)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if (AICE_COMMAND_MODE_PACK == aice_command_mode) {
@@ -709,11 +768,11 @@ int aice_read_dtr_to_buffer(uint8_t target_id, uint32_t buffer_idx)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMA);
 
-               LOG_DEBUG("READ_DTR_TO_BUFFER, COREID: %d", target_id);
+               LOG_DEBUG("READ_DTR_TO_BUFFER, COREID: %" PRIu8, target_id);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                if (AICE_FORMAT_DTHMB != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)", AICE_FORMAT_DTHMB, result);
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")", AICE_FORMAT_DTHMB, result);
                        return ERROR_FAIL;
                }
 
@@ -726,7 +785,7 @@ int aice_read_dtr_to_buffer(uint8_t target_id, uint32_t buffer_idx)
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_READ_DTR_TO_BUFFER, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -745,7 +804,7 @@ int aice_read_dtr_to_buffer(uint8_t target_id, uint32_t buffer_idx)
 
 int aice_write_dtr(uint8_t target_id, uint32_t data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if (AICE_COMMAND_MODE_PACK == aice_command_mode) {
@@ -761,11 +820,11 @@ int aice_write_dtr(uint8_t target_id, uint32_t data)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMC);
 
-               LOG_DEBUG("WRITE_DTR, COREID: %d, data: 0x%x", target_id, data);
+               LOG_DEBUG("WRITE_DTR, COREID: %" PRIu8 ", data: 0x%" PRIx32, target_id, data);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                if (AICE_FORMAT_DTHMB != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)", AICE_FORMAT_DTHMB, result);
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")", AICE_FORMAT_DTHMB, result);
                        return ERROR_FAIL;
                }
 
@@ -779,7 +838,7 @@ int aice_write_dtr(uint8_t target_id, uint32_t data)
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_WRITE_DTR, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -798,7 +857,7 @@ int aice_write_dtr(uint8_t target_id, uint32_t data)
 
 int aice_write_dtr_from_buffer(uint8_t target_id, uint32_t buffer_idx)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if (AICE_COMMAND_MODE_PACK == aice_command_mode) {
@@ -814,11 +873,11 @@ int aice_write_dtr_from_buffer(uint8_t target_id, uint32_t buffer_idx)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMA);
 
-               LOG_DEBUG("WRITE_DTR_FROM_BUFFER, COREID: %d", target_id);
+               LOG_DEBUG("WRITE_DTR_FROM_BUFFER, COREID: %" PRIu8 "", target_id);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                if (AICE_FORMAT_DTHMB != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)", AICE_FORMAT_DTHMB, result);
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")", AICE_FORMAT_DTHMB, result);
                        return ERROR_FAIL;
                }
 
@@ -831,7 +890,7 @@ int aice_write_dtr_from_buffer(uint8_t target_id, uint32_t buffer_idx)
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_WRITE_DTR_FROM_BUFFER, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -850,7 +909,7 @@ int aice_write_dtr_from_buffer(uint8_t target_id, uint32_t buffer_idx)
 
 int aice_read_misc(uint8_t target_id, uint32_t address, uint32_t *data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if ((AICE_COMMAND_MODE_PACK == aice_command_mode) ||
@@ -862,11 +921,11 @@ int aice_read_misc(uint8_t target_id, uint32_t address, uint32_t *data)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMA);
 
-               LOG_DEBUG("READ_MISC, COREID: %d, address: 0x%x", target_id, address);
+               LOG_DEBUG("READ_MISC, COREID: %" PRIu8 ", address: 0x%" PRIx32, target_id, address);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMA);
                if (AICE_FORMAT_DTHMA != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMA, result);
                        return ERROR_AICE_DISCONNECT;
                }
@@ -878,11 +937,11 @@ int aice_read_misc(uint8_t target_id, uint32_t address, uint32_t *data)
                                data, AICE_LITTLE_ENDIAN);
 
                if (cmd_ack_code == AICE_CMD_T_READ_MISC) {
-                       LOG_DEBUG("READ_MISC response, data: 0x%x", *data);
+                       LOG_DEBUG("READ_MISC response, data: 0x%" PRIx32, *data);
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_READ_MISC, cmd_ack_code);
                                return ERROR_FAIL;
                        }
@@ -900,7 +959,7 @@ int aice_read_misc(uint8_t target_id, uint32_t address, uint32_t *data)
 
 int aice_write_misc(uint8_t target_id, uint32_t address, uint32_t data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if (AICE_COMMAND_MODE_PACK == aice_command_mode) {
@@ -918,12 +977,12 @@ int aice_write_misc(uint8_t target_id, uint32_t address, uint32_t data)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMC);
 
-               LOG_DEBUG("WRITE_MISC, COREID: %d, address: 0x%x, data: 0x%x",
+               LOG_DEBUG("WRITE_MISC, COREID: %" PRIu8 ", address: 0x%" PRIx32 ", data: 0x%" PRIx32,
                                target_id, address, data);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                if (AICE_FORMAT_DTHMB != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMB, result);
                        return ERROR_FAIL;
                }
@@ -938,7 +997,7 @@ int aice_write_misc(uint8_t target_id, uint32_t address, uint32_t data)
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_WRITE_MISC, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -957,7 +1016,7 @@ int aice_write_misc(uint8_t target_id, uint32_t address, uint32_t data)
 
 int aice_read_edmsr(uint8_t target_id, uint32_t address, uint32_t *data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if ((AICE_COMMAND_MODE_PACK == aice_command_mode) ||
@@ -969,11 +1028,11 @@ int aice_read_edmsr(uint8_t target_id, uint32_t address, uint32_t *data)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMA);
 
-               LOG_DEBUG("READ_EDMSR, COREID: %d, address: 0x%x", target_id, address);
+               LOG_DEBUG("READ_EDMSR, COREID: %" PRIu8 ", address: 0x%" PRIx32, target_id, address);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMA);
                if (AICE_FORMAT_DTHMA != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMA, result);
                        return ERROR_FAIL;
                }
@@ -985,11 +1044,11 @@ int aice_read_edmsr(uint8_t target_id, uint32_t address, uint32_t *data)
                                data, AICE_LITTLE_ENDIAN);
 
                if (cmd_ack_code == AICE_CMD_T_READ_EDMSR) {
-                       LOG_DEBUG("READ_EDMSR response, data: 0x%x", *data);
+                       LOG_DEBUG("READ_EDMSR response, data: 0x%" PRIx32, *data);
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_READ_EDMSR, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -1008,7 +1067,7 @@ int aice_read_edmsr(uint8_t target_id, uint32_t address, uint32_t *data)
 
 int aice_write_edmsr(uint8_t target_id, uint32_t address, uint32_t data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if (AICE_COMMAND_MODE_PACK == aice_command_mode) {
@@ -1026,12 +1085,12 @@ int aice_write_edmsr(uint8_t target_id, uint32_t address, uint32_t data)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMC);
 
-               LOG_DEBUG("WRITE_EDMSR, COREID: %d, address: 0x%x, data: 0x%x",
+               LOG_DEBUG("WRITE_EDMSR, COREID: %" PRIu8 ", address: 0x%" PRIx32 ", data: 0x%" PRIx32,
                                target_id, address, data);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                if (AICE_FORMAT_DTHMB != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMB, result);
                        return ERROR_FAIL;
                }
@@ -1046,7 +1105,7 @@ int aice_write_edmsr(uint8_t target_id, uint32_t address, uint32_t data)
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_WRITE_EDMSR, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -1080,7 +1139,7 @@ static int aice_switch_to_big_endian(uint32_t *word, uint8_t num_of_words)
 
 static int aice_write_dim(uint8_t target_id, uint32_t *word, uint8_t num_of_words)
 {
-       int result;
+       int32_t result;
        uint32_t big_endian_word[4];
        int retry_times = 0;
 
@@ -1105,7 +1164,8 @@ static int aice_write_dim(uint8_t target_id, uint32_t *word, uint8_t num_of_word
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMC + (num_of_words - 1) * 4);
 
-               LOG_DEBUG("WRITE_DIM, COREID: %d, data: 0x%08x, 0x%08x, 0x%08x, 0x%08x",
+               LOG_DEBUG("WRITE_DIM, COREID: %" PRIu8
+                               ", data: 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32,
                                target_id,
                                big_endian_word[0],
                                big_endian_word[1],
@@ -1114,7 +1174,7 @@ static int aice_write_dim(uint8_t target_id, uint32_t *word, uint8_t num_of_word
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                if (AICE_FORMAT_DTHMB != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)", AICE_FORMAT_DTHMB, result);
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")", AICE_FORMAT_DTHMB, result);
                        return ERROR_FAIL;
                }
 
@@ -1129,7 +1189,9 @@ static int aice_write_dim(uint8_t target_id, uint32_t *word, uint8_t num_of_word
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)", AICE_CMD_T_WRITE_DIM, cmd_ack_code);
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8
+                                               ", response=0x%" PRIx8 ")",
+                                               AICE_CMD_T_WRITE_DIM, cmd_ack_code);
 
                                return ERROR_FAIL;
                        }
@@ -1147,7 +1209,7 @@ static int aice_write_dim(uint8_t target_id, uint32_t *word, uint8_t num_of_word
 
 static int aice_do_execute(uint8_t target_id)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if (AICE_COMMAND_MODE_PACK == aice_command_mode) {
@@ -1164,11 +1226,11 @@ static int aice_do_execute(uint8_t target_id)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMC);
 
-               LOG_DEBUG("EXECUTE, COREID: %d", target_id);
+               LOG_DEBUG("EXECUTE, COREID: %" PRIu8 "", target_id);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                if (AICE_FORMAT_DTHMB != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMB, result);
                        return ERROR_FAIL;
                }
@@ -1183,7 +1245,7 @@ static int aice_do_execute(uint8_t target_id)
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_EXECUTE, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -1202,10 +1264,10 @@ static int aice_do_execute(uint8_t target_id)
 
 int aice_write_mem_b(uint8_t target_id, uint32_t address, uint32_t data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
-       LOG_DEBUG("WRITE_MEM_B, COREID: %d, ADDRESS %08" PRIx32 "  VALUE %08" PRIx32,
+       LOG_DEBUG("WRITE_MEM_B, COREID: %" PRIu8 ", ADDRESS %08" PRIx32 "  VALUE %08" PRIx32,
                        target_id,
                        address,
                        data);
@@ -1224,7 +1286,8 @@ int aice_write_mem_b(uint8_t target_id, uint32_t address, uint32_t data)
 
                        result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                        if (AICE_FORMAT_DTHMB != result) {
-                               LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)", AICE_FORMAT_DTHMB, result);
+                               LOG_ERROR("aice_usb_read failed (requested=%" PRId32
+                                               ", result=%" PRId32 ")", AICE_FORMAT_DTHMB, result);
                                return ERROR_FAIL;
                        }
 
@@ -1237,7 +1300,7 @@ int aice_write_mem_b(uint8_t target_id, uint32_t address, uint32_t data)
                                break;
                        } else {
                                if (retry_times > aice_max_retry_times) {
-                                       LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                                       LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                        AICE_CMD_T_WRITE_MEM_B, cmd_ack_code);
 
                                        return ERROR_FAIL;
@@ -1257,10 +1320,10 @@ int aice_write_mem_b(uint8_t target_id, uint32_t address, uint32_t data)
 
 int aice_write_mem_h(uint8_t target_id, uint32_t address, uint32_t data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
-       LOG_DEBUG("WRITE_MEM_H, COREID: %d, ADDRESS %08" PRIx32 "  VALUE %08" PRIx32,
+       LOG_DEBUG("WRITE_MEM_H, COREID: %" PRIu8 ", ADDRESS %08" PRIx32 "  VALUE %08" PRIx32,
                        target_id,
                        address,
                        data);
@@ -1279,7 +1342,7 @@ int aice_write_mem_h(uint8_t target_id, uint32_t address, uint32_t data)
 
                        result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                        if (AICE_FORMAT_DTHMB != result) {
-                               LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                               LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                                AICE_FORMAT_DTHMB, result);
                                return ERROR_FAIL;
                        }
@@ -1293,7 +1356,7 @@ int aice_write_mem_h(uint8_t target_id, uint32_t address, uint32_t data)
                                break;
                        } else {
                                if (retry_times > aice_max_retry_times) {
-                                       LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                                       LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                        AICE_CMD_T_WRITE_MEM_H, cmd_ack_code);
 
                                        return ERROR_FAIL;
@@ -1313,10 +1376,10 @@ int aice_write_mem_h(uint8_t target_id, uint32_t address, uint32_t data)
 
 int aice_write_mem(uint8_t target_id, uint32_t address, uint32_t data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
-       LOG_DEBUG("WRITE_MEM, COREID: %d, ADDRESS %08" PRIx32 "  VALUE %08" PRIx32,
+       LOG_DEBUG("WRITE_MEM, COREID: %" PRIu8 ", ADDRESS %08" PRIx32 "  VALUE %08" PRIx32,
                        target_id,
                        address,
                        data);
@@ -1335,7 +1398,7 @@ int aice_write_mem(uint8_t target_id, uint32_t address, uint32_t data)
 
                        result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                        if (AICE_FORMAT_DTHMB != result) {
-                               LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                               LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                                AICE_FORMAT_DTHMB, result);
                                return ERROR_FAIL;
                        }
@@ -1349,7 +1412,7 @@ int aice_write_mem(uint8_t target_id, uint32_t address, uint32_t data)
                                break;
                        } else {
                                if (retry_times > aice_max_retry_times) {
-                                       LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                                       LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                        AICE_CMD_T_WRITE_MEM, cmd_ack_code);
 
                                        return ERROR_FAIL;
@@ -1369,7 +1432,7 @@ int aice_write_mem(uint8_t target_id, uint32_t address, uint32_t data)
 
 int aice_fastread_mem(uint8_t target_id, uint8_t *word, uint32_t num_of_words)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if ((AICE_COMMAND_MODE_PACK == aice_command_mode) ||
@@ -1381,12 +1444,12 @@ int aice_fastread_mem(uint8_t target_id, uint8_t *word, uint32_t num_of_words)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMB);
 
-               LOG_DEBUG("FASTREAD_MEM, COREID: %d, # of DATA %08" PRIx32,
+               LOG_DEBUG("FASTREAD_MEM, COREID: %" PRIu8 ", # of DATA %08" PRIx32,
                                target_id, num_of_words);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMA + (num_of_words - 1) * 4);
                if (result < 0) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMA + (num_of_words - 1) * 4, result);
                        return ERROR_FAIL;
                }
@@ -1401,7 +1464,7 @@ int aice_fastread_mem(uint8_t target_id, uint8_t *word, uint32_t num_of_words)
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_FASTREAD_MEM, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -1420,7 +1483,7 @@ int aice_fastread_mem(uint8_t target_id, uint8_t *word, uint32_t num_of_words)
 
 int aice_fastwrite_mem(uint8_t target_id, const uint8_t *word, uint32_t num_of_words)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if (AICE_COMMAND_MODE_PACK == aice_command_mode) {
@@ -1439,12 +1502,12 @@ int aice_fastwrite_mem(uint8_t target_id, const uint8_t *word, uint32_t num_of_w
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMD + (num_of_words - 1) * 4);
 
-               LOG_DEBUG("FASTWRITE_MEM, COREID: %d, # of DATA %08" PRIx32,
+               LOG_DEBUG("FASTWRITE_MEM, COREID: %" PRIu8 ", # of DATA %08" PRIx32,
                                target_id, num_of_words);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                if (AICE_FORMAT_DTHMB != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMB, result);
                        return ERROR_FAIL;
                }
@@ -1458,7 +1521,7 @@ int aice_fastwrite_mem(uint8_t target_id, const uint8_t *word, uint32_t num_of_w
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_FASTWRITE_MEM, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -1477,7 +1540,7 @@ int aice_fastwrite_mem(uint8_t target_id, const uint8_t *word, uint32_t num_of_w
 
 int aice_read_mem_b(uint8_t target_id, uint32_t address, uint32_t *data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if ((AICE_COMMAND_MODE_PACK == aice_command_mode) ||
@@ -1489,11 +1552,11 @@ int aice_read_mem_b(uint8_t target_id, uint32_t address, uint32_t *data)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMB);
 
-               LOG_DEBUG("READ_MEM_B, COREID: %d", target_id);
+               LOG_DEBUG("READ_MEM_B, COREID: %" PRIu8 "", target_id);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMA);
                if (AICE_FORMAT_DTHMA != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMA, result);
                        return ERROR_FAIL;
                }
@@ -1505,11 +1568,11 @@ int aice_read_mem_b(uint8_t target_id, uint32_t address, uint32_t *data)
                                data, data_endian);
 
                if (cmd_ack_code == AICE_CMD_T_READ_MEM_B) {
-                       LOG_DEBUG("READ_MEM_B response, data: 0x%02x", *data);
+                       LOG_DEBUG("READ_MEM_B response, data: 0x%02" PRIx32, *data);
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_READ_MEM_B, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -1528,7 +1591,7 @@ int aice_read_mem_b(uint8_t target_id, uint32_t address, uint32_t *data)
 
 int aice_read_mem_h(uint8_t target_id, uint32_t address, uint32_t *data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if ((AICE_COMMAND_MODE_PACK == aice_command_mode) ||
@@ -1540,11 +1603,11 @@ int aice_read_mem_h(uint8_t target_id, uint32_t address, uint32_t *data)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMB);
 
-               LOG_DEBUG("READ_MEM_H, CORE_ID: %d", target_id);
+               LOG_DEBUG("READ_MEM_H, CORE_ID: %" PRIu8 "", target_id);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMA);
                if (AICE_FORMAT_DTHMA != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMA, result);
                        return ERROR_FAIL;
                }
@@ -1556,11 +1619,11 @@ int aice_read_mem_h(uint8_t target_id, uint32_t address, uint32_t *data)
                                data, data_endian);
 
                if (cmd_ack_code == AICE_CMD_T_READ_MEM_H) {
-                       LOG_DEBUG("READ_MEM_H response, data: 0x%x", *data);
+                       LOG_DEBUG("READ_MEM_H response, data: 0x%" PRIx32, *data);
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_READ_MEM_H, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -1579,7 +1642,7 @@ int aice_read_mem_h(uint8_t target_id, uint32_t address, uint32_t *data)
 
 int aice_read_mem(uint8_t target_id, uint32_t address, uint32_t *data)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if ((AICE_COMMAND_MODE_PACK == aice_command_mode) ||
@@ -1592,11 +1655,11 @@ int aice_read_mem(uint8_t target_id, uint32_t address, uint32_t *data)
 
                aice_usb_write(usb_out_buffer, AICE_FORMAT_HTDMB);
 
-               LOG_DEBUG("READ_MEM, COREID: %d", target_id);
+               LOG_DEBUG("READ_MEM, COREID: %" PRIu8 "", target_id);
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMA);
                if (AICE_FORMAT_DTHMA != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMA, result);
                        return ERROR_FAIL;
                }
@@ -1608,11 +1671,11 @@ int aice_read_mem(uint8_t target_id, uint32_t address, uint32_t *data)
                                data, data_endian);
 
                if (cmd_ack_code == AICE_CMD_T_READ_MEM) {
-                       LOG_DEBUG("READ_MEM response, data: 0x%x", *data);
+                       LOG_DEBUG("READ_MEM response, data: 0x%" PRIx32, *data);
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_T_READ_MEM, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -1631,7 +1694,7 @@ int aice_read_mem(uint8_t target_id, uint32_t address, uint32_t *data)
 
 int aice_batch_buffer_read(uint8_t buf_index, uint32_t *word, uint32_t num_of_words)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        do {
@@ -1643,7 +1706,7 @@ int aice_batch_buffer_read(uint8_t buf_index, uint32_t *word, uint32_t num_of_wo
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMA + (num_of_words - 1) * 4);
                if (result < 0) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMA + (num_of_words - 1) * 4, result);
                        return ERROR_FAIL;
                }
@@ -1658,7 +1721,7 @@ int aice_batch_buffer_read(uint8_t buf_index, uint32_t *word, uint32_t num_of_wo
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_BATCH_BUFFER_READ, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -1677,7 +1740,7 @@ int aice_batch_buffer_read(uint8_t buf_index, uint32_t *word, uint32_t num_of_wo
 
 int aice_batch_buffer_write(uint8_t buf_index, const uint8_t *word, uint32_t num_of_words)
 {
-       int result;
+       int32_t result;
        int retry_times = 0;
 
        if (num_of_words == 0)
@@ -1697,7 +1760,7 @@ int aice_batch_buffer_write(uint8_t buf_index, const uint8_t *word, uint32_t num
 
                result = aice_usb_read(usb_in_buffer, AICE_FORMAT_DTHMB);
                if (AICE_FORMAT_DTHMB != result) {
-                       LOG_ERROR("aice_usb_read failed (requested=%d, result=%d)",
+                       LOG_ERROR("aice_usb_read failed (requested=%" PRId32 ", result=%" PRId32 ")",
                                        AICE_FORMAT_DTHMB, result);
                        return ERROR_FAIL;
                }
@@ -1711,7 +1774,7 @@ int aice_batch_buffer_write(uint8_t buf_index, const uint8_t *word, uint32_t num
                        break;
                } else {
                        if (retry_times > aice_max_retry_times) {
-                               LOG_ERROR("aice command timeout (command=0x%x, response=0x%x)",
+                               LOG_ERROR("aice command timeout (command=0x%" PRIx8 ", response=0x%" PRIx8 ")",
                                                AICE_CMD_BATCH_BUFFER_WRITE, cmd_ack_code);
 
                                return ERROR_FAIL;
@@ -1771,8 +1834,8 @@ static int check_suppressed_exception(uint32_t coreid, uint32_t dbger_value)
                 *  | SWID[30:16] | Reserved[15:14] | SUPRS_EXC[13] | IMP_EXC[12]
                 *  | VECTOR[11:5] | INST[4] | Exc Type[3:0] |
                 */
-               LOG_INFO("EVA: 0x%08x", ir4_value);
-               LOG_INFO("ITYPE: 0x%08x", ir6_value);
+               LOG_INFO("EVA: 0x%08" PRIx32, ir4_value);
+               LOG_INFO("ITYPE: 0x%08" PRIx32, ir6_value);
 
                ir6_value = ir6_value & (~0x300); /* for MCU */
                ir6_value = ir6_value & (~0x3000); /* for non-MCU */
@@ -1824,7 +1887,7 @@ static int aice_check_dbger(uint32_t coreid, uint32_t expect_status)
                if (i >= aice_count_to_check_dbger) {
                        if ((timeval_ms() - then) > 1000) {
                                LOG_ERROR("Timeout (1000ms) waiting for $DBGER status "
-                                               "being 0x%08x", expect_status);
+                                               "being 0x%08" PRIx32, expect_status);
                                return ERROR_FAIL;
                        }
                }
@@ -1851,7 +1914,7 @@ static int aice_execute_dim(uint32_t coreid, uint32_t *insts, uint8_t n_inst)
        /** read DBGER.DPED */
        if (aice_check_dbger(coreid, NDS_DBGER_DPED) != ERROR_OK) {
                LOG_ERROR("<-- TARGET ERROR! Debug operations do not finish properly: "
-                               "0x%08x 0x%08x 0x%08x 0x%08x. -->",
+                               "0x%08" PRIx32 "0x%08" PRIx32 "0x%08" PRIx32 "0x%08" PRIx32 ". -->",
                                insts[0],
                                insts[1],
                                insts[2],
@@ -1864,7 +1927,7 @@ static int aice_execute_dim(uint32_t coreid, uint32_t *insts, uint8_t n_inst)
 
 static int aice_read_reg(uint32_t coreid, uint32_t num, uint32_t *val)
 {
-       LOG_DEBUG("aice_read_reg, reg_no: 0x%08x", num);
+       LOG_DEBUG("aice_read_reg, reg_no: 0x%08" PRIx32, num);
 
        uint32_t instructions[4]; /** execute instructions in DIM */
 
@@ -1965,7 +2028,7 @@ static int aice_usb_read_reg(uint32_t coreid, uint32_t num, uint32_t *val)
 
 static int aice_write_reg(uint32_t coreid, uint32_t num, uint32_t val)
 {
-       LOG_DEBUG("aice_write_reg, reg_no: 0x%08x, value: 0x%08x", num, val);
+       LOG_DEBUG("aice_write_reg, reg_no: 0x%08" PRIx32 ", value: 0x%08" PRIx32, num, val);
 
        uint32_t instructions[4]; /** execute instructions in DIM */
        uint32_t value_edmsw;
@@ -2123,7 +2186,7 @@ static int aice_usb_read_reg_64(uint32_t coreid, uint32_t num, uint64_t *val)
 
        aice_read_reg(coreid, R1, &high_value);
 
-       LOG_DEBUG("low: 0x%08x, high: 0x%08x\n", value, high_value);
+       LOG_DEBUG("low: 0x%08" PRIx32 ", high: 0x%08" PRIx32 "\n", value, high_value);
 
        if (data_endian == AICE_BIG_ENDIAN)
                *val = (((uint64_t)high_value) << 32) | value;
@@ -2146,7 +2209,7 @@ static int aice_usb_write_reg_64(uint32_t coreid, uint32_t num, uint64_t val)
                value = (val >> 32) & 0xFFFFFFFF;
        }
 
-       LOG_DEBUG("aice_usb_write_reg_64, %s, low: 0x%08x, high: 0x%08x\n",
+       LOG_DEBUG("aice_usb_write_reg_64, %s, low: 0x%08" PRIx32 ", high: 0x%08" PRIx32 "\n",
                        nds32_reg_simple_name(num), value, high_value);
 
        aice_write_reg(coreid, R1, high_value);
@@ -2168,7 +2231,7 @@ static int aice_get_version_info(void)
        if (aice_read_ctrl(AICE_READ_CTRL_GET_FPGA_VERSION, &fpga_version) != ERROR_OK)
                return ERROR_FAIL;
 
-       LOG_INFO("AICE version: hw_ver = 0x%x, fw_ver = 0x%x, fpga_ver = 0x%x",
+       LOG_INFO("AICE version: hw_ver = 0x%" PRIx32 ", fw_ver = 0x%" PRIx32 ", fpga_ver = 0x%" PRIx32,
                        hardware_version, firmware_version, fpga_version);
 
        return ERROR_OK;
@@ -2336,7 +2399,7 @@ static int aice_init_edm_registers(uint32_t coreid, bool clear_dex_use_psw)
                 * So, clear DEX_USE_PSW by force. */
                host_edm_ctl &= ~(0x40000000);
 
-       LOG_DEBUG("aice_init_edm_registers - EDM_CTL: 0x%08x", host_edm_ctl);
+       LOG_DEBUG("aice_init_edm_registers - EDM_CTL: 0x%08" PRIx32, host_edm_ctl);
 
        int result = aice_write_edmsr(coreid, NDS_EDM_SR_EDM_CTL, host_edm_ctl);
 
@@ -2371,7 +2434,7 @@ static int aice_backup_edm_registers(uint32_t coreid)
        else
                core_info[coreid].dex_use_psw_on = false;
 
-       LOG_DEBUG("aice_backup_edm_registers - EDM_CTL: 0x%08x, DEX_USE_PSW: %s",
+       LOG_DEBUG("aice_backup_edm_registers - EDM_CTL: 0x%08" PRIx32 ", DEX_USE_PSW: %s",
                        core_info[coreid].edm_ctl_backup,
                        core_info[coreid].dex_use_psw_on ? "on" : "off");
 
@@ -2401,7 +2464,7 @@ static int aice_backup_tmp_registers(uint32_t coreid)
                aice_read_dtr(coreid, &core_info[coreid].target_dtr_backup);
                core_info[coreid].target_dtr_valid = true;
 
-               LOG_DEBUG("Backup target DTR: 0x%08x", core_info[coreid].target_dtr_backup);
+               LOG_DEBUG("Backup target DTR: 0x%08" PRIx32, core_info[coreid].target_dtr_backup);
        } else {
                core_info[coreid].target_dtr_valid = false;
        }
@@ -2425,12 +2488,12 @@ static int aice_backup_tmp_registers(uint32_t coreid)
                aice_read_dtr(coreid, &core_info[coreid].host_dtr_backup);
                core_info[coreid].host_dtr_valid = true;
 
-               LOG_DEBUG("Backup host DTR: 0x%08x", core_info[coreid].host_dtr_backup);
+               LOG_DEBUG("Backup host DTR: 0x%08" PRIx32, core_info[coreid].host_dtr_backup);
        } else {
                core_info[coreid].host_dtr_valid = false;
        }
 
-       LOG_DEBUG("r0: 0x%08x, r1: 0x%08x",
+       LOG_DEBUG("r0: 0x%08" PRIx32 ", r1: 0x%08" PRIx32,
                        core_info[coreid].r0_backup, core_info[coreid].r1_backup);
 
        return ERROR_OK;
@@ -2438,7 +2501,7 @@ static int aice_backup_tmp_registers(uint32_t coreid)
 
 static int aice_restore_tmp_registers(uint32_t coreid)
 {
-       LOG_DEBUG("restore_tmp_registers - r0: 0x%08x, r1: 0x%08x",
+       LOG_DEBUG("restore_tmp_registers - r0: 0x%08" PRIx32 ", r1: 0x%08" PRIx32,
                        core_info[coreid].r0_backup, core_info[coreid].r1_backup);
 
        if (core_info[coreid].target_dtr_valid) {
@@ -2456,7 +2519,7 @@ static int aice_restore_tmp_registers(uint32_t coreid)
                instructions[3] = BEQ_MINUS_12;
                aice_execute_dim(coreid, instructions, 4);
 
-               LOG_DEBUG("Restore target DTR: 0x%08x", core_info[coreid].target_dtr_backup);
+               LOG_DEBUG("Restore target DTR: 0x%08" PRIx32, core_info[coreid].target_dtr_backup);
        }
 
        aice_write_reg(coreid, R0, core_info[coreid].r0_backup);
@@ -2465,7 +2528,7 @@ static int aice_restore_tmp_registers(uint32_t coreid)
        if (core_info[coreid].host_dtr_valid) {
                aice_write_dtr(coreid, core_info[coreid].host_dtr_backup);
 
-               LOG_DEBUG("Restore host DTR: 0x%08x", core_info[coreid].host_dtr_backup);
+               LOG_DEBUG("Restore host DTR: 0x%08" PRIx32, core_info[coreid].host_dtr_backup);
        }
 
        return ERROR_OK;
@@ -2669,7 +2732,7 @@ static int aice_usb_state(uint32_t coreid, enum aice_target_state_s *state)
                aice_read_reg(coreid, IR11, &ir11_value);
 
                LOG_ERROR("<-- TARGET ERROR! Reaching the max interrupt stack level; "
-                               "CPU is stalled at 0x%08x for debugging. -->", ir11_value);
+                               "CPU is stalled at 0x%08" PRIx32 " for debugging. -->", ir11_value);
 
                *state = AICE_TARGET_HALTED;
        } else if ((dbger_value & NDS_DBGER_CRST) == NDS_DBGER_CRST) {
@@ -3064,7 +3127,8 @@ static int aice_usb_set_address_dim(uint32_t coreid, uint32_t address)
 static int aice_usb_read_memory_unit(uint32_t coreid, uint32_t addr, uint32_t size,
                uint32_t count, uint8_t *buffer)
 {
-       LOG_DEBUG("aice_usb_read_memory_unit, addr: 0x%08x, size: %d, count: %d",
+       LOG_DEBUG("aice_usb_read_memory_unit, addr: 0x%08" PRIx32
+                       ", size: %" PRIu32 ", count: %" PRIu32 "",
                        addr, size, count);
 
        if (NDS_MEMORY_ACC_CPU == core_info[coreid].access_channel)
@@ -3182,7 +3246,8 @@ static int aice_usb_write_mem_w_dim(uint32_t coreid, uint32_t address, uint32_t
 static int aice_usb_write_memory_unit(uint32_t coreid, uint32_t addr, uint32_t size,
                uint32_t count, const uint8_t *buffer)
 {
-       LOG_DEBUG("aice_usb_write_memory_unit, addr: 0x%08x, size: %d, count: %d",
+       LOG_DEBUG("aice_usb_write_memory_unit, addr: 0x%08" PRIx32
+                       ", size: %" PRIu32 ", count: %" PRIu32 "",
                        addr, size, count);
 
        if (NDS_MEMORY_ACC_CPU == core_info[coreid].access_channel)
@@ -3292,7 +3357,7 @@ static int aice_bulk_write_mem(uint32_t coreid, uint32_t addr, uint32_t count,
 static int aice_usb_bulk_read_mem(uint32_t coreid, uint32_t addr,
                uint32_t length, uint8_t *buffer)
 {
-       LOG_DEBUG("aice_usb_bulk_read_mem, addr: 0x%08x, length: 0x%08x", addr, length);
+       LOG_DEBUG("aice_usb_bulk_read_mem, addr: 0x%08" PRIx32 ", length: 0x%08" PRIx32, addr, length);
 
        int retval;
 
@@ -3310,7 +3375,7 @@ static int aice_usb_bulk_read_mem(uint32_t coreid, uint32_t addr,
 static int aice_usb_bulk_write_mem(uint32_t coreid, uint32_t addr,
                uint32_t length, const uint8_t *buffer)
 {
-       LOG_DEBUG("aice_usb_bulk_write_mem, addr: 0x%08x, length: 0x%08x", addr, length);
+       LOG_DEBUG("aice_usb_bulk_write_mem, addr: 0x%08" PRIx32 ", length: 0x%08" PRIx32, addr, length);
 
        int retval;
 
@@ -3360,7 +3425,7 @@ static int aice_usb_write_debug_reg(uint32_t coreid, uint32_t addr, const uint32
 
 static int aice_usb_memory_access(uint32_t coreid, enum nds_memory_access channel)
 {
-       LOG_DEBUG("aice_usb_memory_access, access channel: %d", channel);
+       LOG_DEBUG("aice_usb_memory_access, access channel: %u", channel);
 
        core_info[coreid].access_channel = channel;
 
@@ -3372,7 +3437,7 @@ static int aice_usb_memory_mode(uint32_t coreid, enum nds_memory_select mem_sele
        if (core_info[coreid].memory_select == mem_select)
                return ERROR_OK;
 
-       LOG_DEBUG("aice_usb_memory_mode, memory select: %d", mem_select);
+       LOG_DEBUG("aice_usb_memory_mode, memory select: %u", mem_select);
 
        core_info[coreid].memory_select = mem_select;
 
@@ -3389,7 +3454,7 @@ static int aice_usb_memory_mode(uint32_t coreid, enum nds_memory_select mem_sele
 static int aice_usb_read_tlb(uint32_t coreid, uint32_t virtual_address,
                uint32_t *physical_address)
 {
-       LOG_DEBUG("aice_usb_read_tlb, virtual address: 0x%08x", virtual_address);
+       LOG_DEBUG("aice_usb_read_tlb, virtual address: 0x%08" PRIx32, virtual_address);
 
        uint32_t instructions[4];
        uint32_t probe_result;
@@ -3470,8 +3535,8 @@ static int aice_usb_init_cache(uint32_t coreid)
                icache->log2_line_size = 0;
        }
 
-       LOG_DEBUG("\ticache set: %d, way: %d, line size: %d, "
-                       "log2(set): %d, log2(line_size): %d",
+       LOG_DEBUG("\ticache set: %" PRIu32 ", way: %" PRIu32 ", line size: %" PRIu32 ", "
+                       "log2(set): %" PRIu32 ", log2(line_size): %" PRIu32 "",
                        icache->set, icache->way, icache->line_size,
                        icache->log2_set, icache->log2_line_size);
 
@@ -3489,8 +3554,8 @@ static int aice_usb_init_cache(uint32_t coreid)
                dcache->log2_line_size = 0;
        }
 
-       LOG_DEBUG("\tdcache set: %d, way: %d, line size: %d, "
-                       "log2(set): %d, log2(line_size): %d",
+       LOG_DEBUG("\tdcache set: %" PRIu32 ", way: %" PRIu32 ", line size: %" PRIu32 ", "
+                       "log2(set): %" PRIu32 ", log2(line_size): %" PRIu32 "",
                        dcache->set, dcache->way, dcache->line_size,
                        dcache->log2_set, dcache->log2_line_size);
 
@@ -3802,7 +3867,7 @@ static int aice_usb_execute(uint32_t coreid, uint32_t *instructions,
                if (aice_check_dbger(coreid, NDS_DBGER_DPED) != ERROR_OK) {
 
                        LOG_ERROR("<-- TARGET ERROR! Debug operations do not finish properly:"
-                                       "0x%08x 0x%08x 0x%08x 0x%08x. -->",
+                                       "0x%08" PRIx32 " 0x%08" PRIx32 " 0x%08" PRIx32 " 0x%08" PRIx32 ". -->",
                                        dim_instructions[0],
                                        dim_instructions[1],
                                        dim_instructions[2],
index 0d133e6f24c9e33819d19895786e1a7c9ca3c475..adb027eaa1a486681554c2a25ff1c7b62bbae740 100644 (file)
 #define AICE_IN_PACK_COMMAND_SIZE              2048
 #define AICE_OUT_PACK_COMMAND_SIZE             2048
 
-/* Constants for AICE command */
-#define AICE_CMD_SCAN_CHAIN                    0x00
-#define AICE_CMD_SELECT_TARGET         0x01
-#define AICE_CMD_READ_DIM                      0x02
-#define AICE_CMD_READ_EDMSR                    0x03
-#define AICE_CMD_READ_DTR                      0x04
-#define AICE_CMD_READ_MEM                      0x05
-#define AICE_CMD_READ_MISC                     0x06
-#define AICE_CMD_FASTREAD_MEM          0x07
-#define AICE_CMD_WRITE_DIM                     0x08
-#define AICE_CMD_WRITE_EDMSR           0x09
-#define AICE_CMD_WRITE_DTR                     0x0A
-#define AICE_CMD_WRITE_MEM                     0x0B
-#define AICE_CMD_WRITE_MISC                    0x0C
-#define AICE_CMD_FASTWRITE_MEM         0x0D
-#define AICE_CMD_EXECUTE                       0x0E
-#define AICE_CMD_READ_MEM_B                    0x14
-#define AICE_CMD_READ_MEM_H                    0x15
-#define AICE_CMD_T_READ_MISC           0x20
-#define AICE_CMD_T_READ_EDMSR          0x21
-#define AICE_CMD_T_READ_DTR                    0x22
-#define AICE_CMD_T_READ_DIM                    0x23
-#define AICE_CMD_T_READ_MEM_B          0x24
-#define AICE_CMD_T_READ_MEM_H          0x25
-#define AICE_CMD_T_READ_MEM                    0x26
-#define AICE_CMD_T_FASTREAD_MEM                0x27
-#define AICE_CMD_T_WRITE_MISC          0x28
-#define AICE_CMD_T_WRITE_EDMSR         0x29
-#define AICE_CMD_T_WRITE_DTR           0x2A
-#define AICE_CMD_T_WRITE_DIM           0x2B
-#define AICE_CMD_T_WRITE_MEM_B         0x2C
-#define AICE_CMD_T_WRITE_MEM_H         0x2D
-#define AICE_CMD_T_WRITE_MEM           0x2E
-#define AICE_CMD_T_FASTWRITE_MEM       0x2F
-#define AICE_CMD_T_GET_TRACE_STATUS    0x36
-#define AICE_CMD_T_EXECUTE                     0x3E
-#define AICE_CMD_AICE_PROGRAM_READ     0x40
-#define AICE_CMD_AICE_PROGRAM_WRITE    0x41
-#define AICE_CMD_AICE_PROGRAM_CONTROL  0x42
-#define AICE_CMD_READ_CTRL                     0x50
-#define AICE_CMD_WRITE_CTRL                    0x51
-#define AICE_CMD_BATCH_BUFFER_READ     0x60
-#define AICE_CMD_READ_DTR_TO_BUFFER    0x61
-#define AICE_CMD_BATCH_BUFFER_WRITE    0x68
-#define AICE_CMD_WRITE_DTR_FROM_BUFFER 0x69
-
-/* Constants for AICE command format length */
-#define AICE_FORMAT_HTDA               3
-#define AICE_FORMAT_HTDB               6
-#define AICE_FORMAT_HTDC               7
-#define AICE_FORMAT_HTDD               10
-#define AICE_FORMAT_HTDMA              4
-#define AICE_FORMAT_HTDMB              8
-#define AICE_FORMAT_HTDMC              8
-#define AICE_FORMAT_HTDMD              12
-#define AICE_FORMAT_DTHA               6
-#define AICE_FORMAT_DTHB               2
-#define AICE_FORMAT_DTHMA              8
-#define AICE_FORMAT_DTHMB              4
-
 /* Constants for AICE command READ_CTRL */
 #define AICE_READ_CTRL_GET_ICE_STATE           0x00
 #define AICE_READ_CTRL_GET_HARDWARE_VERSION    0x01
index ae80eb89b069c721ddab68fc03e0fcc3e9504e0b..728a05b87b4590c4df6beda9a633b46c73a86ccd 100644 (file)
@@ -464,7 +464,7 @@ static int jlink_select_interface(int iface)
        uint32_t iface_mask = buf_get_u32(usb_in_buffer, 0, 32);
 
        if (!(iface_mask & (1<<iface))) {
-               LOG_ERROR("J-Link requesting to select unsupported interface (%x)", iface_mask);
+               LOG_ERROR("J-Link requesting to select unsupported interface (%" PRIx32 ")", iface_mask);
                return ERROR_JTAG_DEVICE_ERROR;
        }
 
@@ -746,7 +746,7 @@ static void jlink_config_kickstart_dump(struct command_context *ctx, struct jlin
        if (!cfg)
                return;
 
-       jlink_dump_printf(ctx, "Kickstart power on JTAG-pin 19: 0x%x",
+       jlink_dump_printf(ctx, "Kickstart power on JTAG-pin 19: 0x%" PRIx32,
                cfg->kickstart_power_on_jtag_pin_19);
 }
 
@@ -920,7 +920,7 @@ static int jlink_get_version_info(void)
                LOG_INFO("J-Link hw version %i", (int)jlink_hw_version);
 
                if (jlink_hw_type >= JLINK_HW_TYPE_MAX)
-                       LOG_INFO("J-Link hw type uknown 0x%x", jlink_hw_type);
+                       LOG_INFO("J-Link hw type uknown 0x%" PRIx32, jlink_hw_type);
                else
                        LOG_INFO("J-Link hw type %s", jlink_hw_type_str[jlink_hw_type]);
        }
index 74be680a99facd617915ede3d7d28e7c4f973106..b4abe8992c7fbef60ffb8f2af279a16c477a3975 100644 (file)
@@ -307,7 +307,7 @@ static int opendous_execute_queue(void)
                                break;
 
                        case JTAG_SLEEP:
-                               DEBUG_JTAG_IO("sleep %i", cmd->cmd.sleep->us);
+                               DEBUG_JTAG_IO("sleep %" PRIi32, cmd->cmd.sleep->us);
                                opendous_tap_execute();
                                jtag_sleep(cmd->cmd.sleep->us);
                                break;
index 4faaa8432d7c043b3ab3abd0931843e5a240fbfb..385730126d490d18b69879002241f79d079826ee 100644 (file)
@@ -431,7 +431,7 @@ static int osbdm_add_statemove(
        int skip_first)
 {
        int len = 0;
-       int tms;
+       int tms = 0;
 
        tap_set_end_state(new_state);
        if (tap_get_end_state() == TAP_RESET) {
index 597df6d00e8b26e47f6b9af977ee5a265af76a29..e9d13d566da44ca389864f3991dff28de6c24e91 100644 (file)
@@ -738,7 +738,7 @@ static int stlink_usb_idcode(void *handle, uint32_t *idcode)
 
        *idcode = le_to_h_u32(h->databuf);
 
-       LOG_DEBUG("IDCODE: 0x%08X", *idcode);
+       LOG_DEBUG("IDCODE: 0x%08" PRIX32, *idcode);
 
        return ERROR_OK;
 }
@@ -1043,7 +1043,7 @@ static int stlink_usb_trace_enable(void *handle)
 
                if (res == ERROR_OK)  {
                        h->trace.enabled = true;
-                       LOG_DEBUG("Tracing: recording at %uHz\n", trace_hz);
+                       LOG_DEBUG("Tracing: recording at %" PRIu32 "Hz\n", trace_hz);
                }
        } else {
                LOG_ERROR("Tracing is not supported by this version.");
index 133f41c29b8b912ff729f0cf2e457e8760437257..20b308179833b08488342d5eb73b07a268c710c1 100644 (file)
@@ -368,12 +368,12 @@ static int icdi_usb_query(void *handle)
                char *separator;
                int max_packet;
 
-               max_packet = strtoul(offset + 11, &separator, 16);
+               max_packet = strtol(offset + 11, &separator, 16);
                if (!max_packet)
                        LOG_ERROR("invalid max packet, using defaults");
                else
                        h->max_packet = max_packet;
-               LOG_DEBUG("max packet supported : %" PRIu32 " bytes", h->max_packet);
+               LOG_DEBUG("max packet supported : %i bytes", h->max_packet);
        }
 
 
@@ -536,7 +536,7 @@ static int icdi_usb_read_mem_int(void *handle, uint32_t addr, uint32_t len, uint
        struct icdi_usb_handle_s *h = handle;
        char cmd[20];
 
-       snprintf(cmd, sizeof(cmd), "x%x,%x", addr, len);
+       snprintf(cmd, sizeof(cmd), "x%" PRIx32 ",%" PRIx32, addr, len);
        result = icdi_send_cmd(handle, cmd);
        if (result != ERROR_OK)
                return result;
@@ -551,7 +551,7 @@ static int icdi_usb_read_mem_int(void *handle, uint32_t addr, uint32_t len, uint
        /* unescape input */
        int read_len = remote_unescape_input(h->read_buffer + 5, h->read_count - 8, (char *)buffer, len);
        if (read_len != (int)len) {
-               LOG_ERROR("read more bytes than expected: actual 0x%" PRIx32 " expected 0x%" PRIx32, read_len, len);
+               LOG_ERROR("read more bytes than expected: actual 0x%x expected 0x%" PRIx32, read_len, len);
                return ERROR_FAIL;
        }
 
@@ -563,7 +563,7 @@ static int icdi_usb_write_mem_int(void *handle, uint32_t addr, uint32_t len, con
        int result;
        struct icdi_usb_handle_s *h = handle;
 
-       size_t cmd_len = snprintf(h->write_buffer, h->max_packet, PACKET_START "X%x,%x:", addr, len);
+       size_t cmd_len = snprintf(h->write_buffer, h->max_packet, PACKET_START "X%" PRIx32 ",%" PRIx32 ":", addr, len);
 
        int out_len;
        cmd_len += remote_escape_output((const char *)buffer, len, h->write_buffer + cmd_len,
@@ -571,7 +571,7 @@ static int icdi_usb_write_mem_int(void *handle, uint32_t addr, uint32_t len, con
 
        if (out_len < (int)len) {
                /* for now issue a error as we have no way of allocating a larger buffer */
-               LOG_ERROR("memory buffer too small: requires 0x%" PRIx32 " actual 0x%" PRIx32, out_len, len);
+               LOG_ERROR("memory buffer too small: requires 0x%x actual 0x%" PRIx32, out_len, len);
                return ERROR_FAIL;
        }
 
index 1b6a3e31dcf1904e1553fb64c75a48d9863b7528..a33be54bf7b8a44e9c4c195a7debaf0ac73db954 100644 (file)
@@ -92,7 +92,7 @@ int hl_interface_init_target(struct target *t)
        }
 
        if (found == 0) {
-               LOG_ERROR("hl_interface_init_target: target not found: idcode: 0x%08x",
+               LOG_ERROR("hl_interface_init_target: target not found: idcode: 0x%08" PRIx32,
                                t->tap->idcode);
                return ERROR_FAIL;
        }
index 2e97a421a93f4f3f10e11c8b4969c86a41497c38..b98cf453157a08ff1895b09ce17590b6a0f2aad2 100644 (file)
@@ -160,7 +160,7 @@ int fill_buffer(struct target *target, uint32_t addr, uint8_t *buffer)
 {
 
        if ((addr & 0xfffffffc) != addr)
-               LOG_INFO("unaligned address %x!!", addr);
+               LOG_INFO("unaligned address %" PRIx32 "!!", addr);
 
        int retval = linux_read_memory(target, addr, 4, 1, buffer);
        return retval;
@@ -217,7 +217,7 @@ static int linux_os_thread_reg_list(struct rtos *rtos,
                if (found == 0) {
                        LOG_ERROR
                        (
-                               "current thread %" PRIx64 ": no target to perform access of core id %x",
+                               "current thread %" PRIx64 ": no target to perform access of core id %" PRIx32,
                                thread_id,
                                next->core_id);
                        return ERROR_FAIL;
@@ -1571,14 +1571,14 @@ static char *linux_ps_command(struct target *target)
                                if (temp->context)
                                        tmp +=
                                                sprintf(tmp,
-                                                       "%d\t\t%d\t\t%x\t\t%s\n",
-                                                       (int)temp->pid, temp->oncpu,
+                                                       "%" PRId32 "\t\t%" PRId32 "\t\t%" PRIx32 "\t\t%s\n",
+                                                       temp->pid, temp->oncpu,
                                                        temp->asid, temp->name);
                                else
                                        tmp +=
                                                sprintf(tmp,
-                                                       "%d\t\t%d\t\t%x\t\t%s\n",
-                                                       (int)temp->pid, temp->oncpu,
+                                                       "%" PRId32 "\t\t%" PRId32 "\t\t%" PRIx32 "\t\t%s\n",
+                                                       temp->pid, temp->oncpu,
                                                        temp->asid, temp->name);
                        }
 
index 28cb3ab71baaa42f2a31f9bb7cfd34a877543e79..6729df3a3387813defeebe0c4cd2d054bc749790 100644 (file)
@@ -728,15 +728,15 @@ static void gdb_signal_reply(struct target *target, struct connection *connectio
                                switch (hit_wp_type) {
                                        case WPT_WRITE:
                                                snprintf(stop_reason, sizeof(stop_reason),
-                                                               "watch:%08x;", hit_wp_address);
+                                                               "watch:%08" PRIx32 ";", hit_wp_address);
                                                break;
                                        case WPT_READ:
                                                snprintf(stop_reason, sizeof(stop_reason),
-                                                               "rwatch:%08x;", hit_wp_address);
+                                                               "rwatch:%08" PRIx32 ";", hit_wp_address);
                                                break;
                                        case WPT_ACCESS:
                                                snprintf(stop_reason, sizeof(stop_reason),
-                                                               "awatch:%08x;", hit_wp_address);
+                                                               "awatch:%08" PRIx32 ";", hit_wp_address);
                                                break;
                                        default:
                                                break;
@@ -761,64 +761,64 @@ static void gdb_fileio_reply(struct target *target, struct connection *connectio
        bool program_exited = false;
 
        if (strcmp(target->fileio_info->identifier, "open") == 0)
-               sprintf(fileio_command, "F%s,%x/%x,%x,%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32 "/%" PRIx32 ",%" PRIx32 ",%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1,
                                target->fileio_info->param_2,
                                target->fileio_info->param_3,
                                target->fileio_info->param_4);
        else if (strcmp(target->fileio_info->identifier, "close") == 0)
-               sprintf(fileio_command, "F%s,%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1);
        else if (strcmp(target->fileio_info->identifier, "read") == 0)
-               sprintf(fileio_command, "F%s,%x,%x,%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32 ",%" PRIx32 ",%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1,
                                target->fileio_info->param_2,
                                target->fileio_info->param_3);
        else if (strcmp(target->fileio_info->identifier, "write") == 0)
-               sprintf(fileio_command, "F%s,%x,%x,%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32 ",%" PRIx32 ",%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1,
                                target->fileio_info->param_2,
                                target->fileio_info->param_3);
        else if (strcmp(target->fileio_info->identifier, "lseek") == 0)
-               sprintf(fileio_command, "F%s,%x,%x,%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32 ",%" PRIx32 ",%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1,
                                target->fileio_info->param_2,
                                target->fileio_info->param_3);
        else if (strcmp(target->fileio_info->identifier, "rename") == 0)
-               sprintf(fileio_command, "F%s,%x/%x,%x/%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32 "/%" PRIx32 ",%" PRIx32 "/%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1,
                                target->fileio_info->param_2,
                                target->fileio_info->param_3,
                                target->fileio_info->param_4);
        else if (strcmp(target->fileio_info->identifier, "unlink") == 0)
-               sprintf(fileio_command, "F%s,%x/%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32 "/%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1,
                                target->fileio_info->param_2);
        else if (strcmp(target->fileio_info->identifier, "stat") == 0)
-               sprintf(fileio_command, "F%s,%x/%x,%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32 "/%" PRIx32 ",%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1,
                                target->fileio_info->param_2,
                                target->fileio_info->param_3);
        else if (strcmp(target->fileio_info->identifier, "fstat") == 0)
-               sprintf(fileio_command, "F%s,%x,%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32 ",%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1,
                                target->fileio_info->param_2);
        else if (strcmp(target->fileio_info->identifier, "gettimeofday") == 0)
-               sprintf(fileio_command, "F%s,%x,%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32 ",%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1,
                                target->fileio_info->param_2);
        else if (strcmp(target->fileio_info->identifier, "isatty") == 0)
-               sprintf(fileio_command, "F%s,%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1);
        else if (strcmp(target->fileio_info->identifier, "system") == 0)
-               sprintf(fileio_command, "F%s,%x/%x", target->fileio_info->identifier,
+               sprintf(fileio_command, "F%s,%" PRIx32 "/%" PRIx32, target->fileio_info->identifier,
                                target->fileio_info->param_1,
                                target->fileio_info->param_2);
        else if (strcmp(target->fileio_info->identifier, "exit") == 0) {
                /* If target hits exit syscall, report to GDB the program is terminated.
                 * In addition, let target run its own exit syscall handler. */
                program_exited = true;
-               sprintf(fileio_command, "W%02x", target->fileio_info->param_1);
+               sprintf(fileio_command, "W%02" PRIx32, target->fileio_info->param_1);
        } else {
                LOG_DEBUG("Unknown syscall: %s", target->fileio_info->identifier);
 
index d2e87721550c9f63ca5bd6055223f4db988a9144..2295763addc9e9864ae45c5ca33a673e8e70b49a 100644 (file)
@@ -1545,8 +1545,8 @@ int nds32_restore_context(struct target *target)
                        if (reg->valid == true) {
 
                                LOG_DEBUG("examining dirty reg: %s", reg->name);
-                               LOG_DEBUG("writing register %i "
-                                               "with value 0x%8.8" PRIx32, i, buf_get_u32(reg->value, 0, 32));
+                               LOG_DEBUG("writing register %d with value 0x%8.8" PRIx32,
+                                               i, buf_get_u32(reg->value, 0, 32));
 
                                reg_arch_info = reg->arch_info;
                                if (FD0 <= reg_arch_info->num && reg_arch_info->num <= FD31)
@@ -2118,7 +2118,9 @@ int nds32_poll(struct target *target)
 int nds32_resume(struct target *target, int current,
                uint32_t address, int handle_breakpoints, int debug_execution)
 {
-       LOG_DEBUG("current %d  address %08" PRIx32 "  handle_breakpoints %d  debug_execution %d",
+       LOG_DEBUG("current %d address %08" PRIx32
+                       " handle_breakpoints %d"
+                       " debug_execution %d",
                        current, address, handle_breakpoints, debug_execution);
 
        struct nds32 *nds32 = target_to_nds32(target);
@@ -2465,7 +2467,7 @@ int nds32_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fil
 
 int nds32_gdb_fileio_end(struct target *target, int retcode, int fileio_errno, bool ctrl_c)
 {
-       LOG_DEBUG("syscall return code: 0x%x, errno: 0x%x, ctrl_c: %s",
+       LOG_DEBUG("syscall return code: 0x%x, errno: 0x%x , ctrl_c: %s",
                        retcode, fileio_errno, ctrl_c ? "true" : "false");
 
        struct nds32 *nds32 = target_to_nds32(target);
index d859e0c6aadf30108afed3d33d253b3dc4ec85ad..761086e1dd2ea0dd1c50a1e51e2f5e9a7a93b921 100644 (file)
@@ -124,7 +124,8 @@ static int nds32_parse_group_0_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 1;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLBI\t$r%d,[$r%d+#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLBI\t$r%" PRIu8 ",[$r%" PRIu8 "+#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -140,7 +141,8 @@ static int nds32_parse_group_0_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 2;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLHI\t$r%d,[$r%d+#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLHI\t$r%" PRIu8 ",[$r%" PRIu8 "+#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -156,7 +158,8 @@ static int nds32_parse_group_0_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 4;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLWI\t$r%d,[$r%d+#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLWI\t$r%" PRIu8 ",[$r%" PRIu8 "+#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -171,7 +174,8 @@ static int nds32_parse_group_0_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 1;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLBI.bi\t$r%d,[$r%d],#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLBI.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -186,7 +190,8 @@ static int nds32_parse_group_0_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 2;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLHI.bi\t$r%d,[$r%d],#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLHI.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -201,7 +206,8 @@ static int nds32_parse_group_0_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 4;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLWI.bi\t$r%d,[$r%d],#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLWI.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],#%" PRId32 "",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -237,7 +243,8 @@ static int nds32_parse_group_1_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 1;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSBI\t$r%d,[$r%d+#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSBI\t$r%" PRIu8 ",[$r%" PRIu8 "+#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -253,7 +260,8 @@ static int nds32_parse_group_1_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 2;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSHI\t$r%d,[$r%d+#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSHI\t$r%" PRIu8 ",[$r%" PRIu8 "+#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -269,7 +277,8 @@ static int nds32_parse_group_1_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 4;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSWI\t$r%d,[$r%d+#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSWI\t$r%" PRIu8 ",[$r%" PRIu8 "+#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -284,7 +293,8 @@ static int nds32_parse_group_1_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 1;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSBI.bi\t$r%d,[$r%d],#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSBI.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -299,7 +309,8 @@ static int nds32_parse_group_1_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 2;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSHI.bi\t$r%d,[$r%d],#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSHI.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -314,7 +325,8 @@ static int nds32_parse_group_1_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 4;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSWI.bi\t$r%d,[$r%d],#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSWI.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -350,7 +362,8 @@ static int nds32_parse_group_2_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 1;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLBSI\t$r%d,[$r%d+#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLBSI\t$r%" PRIu8 ",[$r%" PRIu8 "+#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -366,7 +379,8 @@ static int nds32_parse_group_2_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 2;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLHSI\t$r%d,[$r%d+#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLHSI\t$r%" PRIu8 ",[$r%" PRIu8 "+#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -382,7 +396,8 @@ static int nds32_parse_group_2_insn(struct nds32 *nds32, uint32_t opcode,
                                        instruction->info.imm = (instruction->info.imm << 17) >> 14;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tDPREFI.d\t%d,[$r%d+#%d]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tDPREFI.d\t%" PRIu8 ",[$r%" PRIu8 "+#%" PRId32 "]",
                                                        address,
                                                        opcode, instruction->info.sub_opc,
                                                        instruction->info.ra, instruction->info.imm);
@@ -391,7 +406,8 @@ static int nds32_parse_group_2_insn(struct nds32 *nds32, uint32_t opcode,
                                        instruction->info.imm = (instruction->info.imm << 17) >> 15;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tDPREFI.w\t%d,[$r%d+#%d]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tDPREFI.w\t%" PRIu8 ",[$r%" PRIu8 "+#%" PRId32 "]",
                                                        address,
                                                        opcode, instruction->info.sub_opc,
                                                        instruction->info.ra, instruction->info.imm);
@@ -408,7 +424,8 @@ static int nds32_parse_group_2_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 1;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLBSI.bi\t$r%d,[$r%d],#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLBSI.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -423,7 +440,8 @@ static int nds32_parse_group_2_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->access_end = instruction->access_start + 2;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLHSI.bi\t$r%d,[$r%d],#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLHSI.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -438,7 +456,8 @@ static int nds32_parse_group_2_insn(struct nds32 *nds32, uint32_t opcode,
                                instruction->access_end = instruction->access_start + 1;
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLBSI.gp\t$r%d,[#%d]",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tLBSI.gp\t$r%" PRIu8 ",[#%" PRId32 "]",
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        } else { /* LBI.gp */
@@ -448,7 +467,8 @@ static int nds32_parse_group_2_insn(struct nds32 *nds32, uint32_t opcode,
                                instruction->access_end = instruction->access_start + 1;
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLBI.gp\t$r%d,[#%d]",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tLBI.gp\t$r%" PRIu8 ",[#%" PRId32 "]",
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        }
@@ -485,7 +505,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 1;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLB\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLB\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -503,7 +524,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 2;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLH\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLH\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -521,7 +543,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 4;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLW\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLW\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -537,7 +560,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 1;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLB.bi\t$r%d,[$r%d],($r%d<<%d)",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLB.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],($r%" PRIu8 "<<%" PRId32 ")",
                                                        address,
                                                        opcode, instruction->info.rt,
                                                        instruction->info.ra, instruction->info.rb,
@@ -553,7 +577,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 2;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLH.bi\t$r%d,[$r%d],($r%d<<%d)",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLH.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],($r%" PRIu8 "<<%" PRId32 ")",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -569,7 +594,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 4;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLW.bi\t$r%d,[$r%d],($r%d<<%d)",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLW.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],($r%" PRIu8 "<<%" PRId32 ")",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -591,7 +617,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 1;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSB\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tSB\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt,
                                                        instruction->info.ra, instruction->info.rb,
@@ -609,7 +636,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 2;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSH\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tSH\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -627,7 +655,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 4;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSW\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tSW\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt,
                                                        instruction->info.ra, instruction->info.rb,
@@ -643,7 +672,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 1;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSB.bi\t$r%d,[$r%d],($r%d<<%d)",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tSB.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],($r%" PRIu8 "<<%" PRId32 ")",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -659,7 +689,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 2;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSH.bi\t$r%d,[$r%d],($r%d<<%d)",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tSH.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],($r%" PRIu8 "<<%" PRId32 ")",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -675,7 +706,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 4;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSW.bi\t$r%d,[$r%d],($r%d<<%d)",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tSW.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],($r%" PRIu8 "<<%" PRId32 ")",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -697,7 +729,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 1;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLBS\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLBS\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt,
                                                        instruction->info.ra, instruction->info.rb,
@@ -715,7 +748,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 2;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLHS\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLHS\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -728,7 +762,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->type = NDS32_INSN_MISC;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tDPREF\t#%d,[$r%d+($r%d<<#%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tDPREF\t#%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<#%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.sub_opc,
                                                        instruction->info.ra, instruction->info.rb,
@@ -744,7 +779,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 1;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLBS.bi\t$r%d,[$r%d],($r%d<<%d)",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLBS.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],($r%" PRIu8 "<<%" PRId32 ")",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -760,7 +796,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 2;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLHS.bi\t$r%d,[$r%d],($r%d<<%d)",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLHS.bi\t$r%" PRIu8 ",[$r%" PRIu8 "],($r%" PRIu8 "<<%" PRId32 ")",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -782,7 +819,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 4;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLLW\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLLW\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -800,7 +838,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 4;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSCW\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tSCW\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -822,7 +861,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 1;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLBUP\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLBUP\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -840,7 +880,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 4;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLWUP\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tLWUP\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -862,7 +903,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 1;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSBUP\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tSBUP\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -880,7 +922,8 @@ static int nds32_parse_mem(struct nds32 *nds32, uint32_t opcode, uint32_t addres
                                        instruction->access_end = instruction->access_start + 4;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSWUP\t$r%d,[$r%d+($r%d<<%d)]",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tSWUP\t$r%" PRIu8 ",[$r%" PRIu8 "+($r%" PRIu8 "<<%" PRId32 ")]",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.rb,
@@ -953,7 +996,8 @@ static int nds32_parse_lsmw(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                                nds32_calculate_lsmw_access_range(nds32, instruction);
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSMW\t$r%d,[$r%d],$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tSMW\t$r%" PRIu8 ",[$r%" PRIu8 "],$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rb, instruction->info.ra,
                                                instruction->info.rd,
@@ -967,7 +1011,8 @@ static int nds32_parse_lsmw(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                                nds32_calculate_lsmw_access_range(nds32, instruction);
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSMWA\t$r%d,[$r%d],$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tSMWA\t$r%" PRIu8 ",[$r%" PRIu8 "],$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rb, instruction->info.ra,
                                                instruction->info.rd,
@@ -981,7 +1026,8 @@ static int nds32_parse_lsmw(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                                /* TODO: calculate access_start/access_end */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSMWZB\t$r%d,[$r%d],$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tSMWZB\t$r%" PRIu8 ",[$r%" PRIu8 "],$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rb, instruction->info.ra,
                                                instruction->info.rd,
@@ -1005,7 +1051,8 @@ static int nds32_parse_lsmw(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                                nds32_calculate_lsmw_access_range(nds32, instruction);
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLMW\t$r%d,[$r%d],$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tLMW\t$r%" PRIu8 ",[$r%" PRIu8 "],$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rb, instruction->info.ra,
                                                instruction->info.rd,
@@ -1019,7 +1066,8 @@ static int nds32_parse_lsmw(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                                nds32_calculate_lsmw_access_range(nds32, instruction);
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLMWA\t$r%d,[$r%d],$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tLMWA\t$r%" PRIu8 ",[$r%" PRIu8 "],$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rb, instruction->info.ra,
                                                instruction->info.rd,
@@ -1033,7 +1081,8 @@ static int nds32_parse_lsmw(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                                /* TODO: calculate access_start/access_end */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLMWZB\t$r%d,[$r%d],$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tLMWZB\t$r%" PRIu8 ",[$r%" PRIu8 "],$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rb, instruction->info.ra,
                                                instruction->info.rd,
@@ -1065,7 +1114,8 @@ static int nds32_parse_hwgp(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                        instruction->access_end = instruction->access_start + 2;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLHI.gp\t$r%d,[#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLHI.gp\t$r%" PRIu8 ",[#%" PRId32"]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -1078,7 +1128,8 @@ static int nds32_parse_hwgp(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                        instruction->access_end = instruction->access_start + 2;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLHSI.gp\t$r%d,[#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tLHSI.gp\t$r%" PRIu8 ",[#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -1091,7 +1142,8 @@ static int nds32_parse_hwgp(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                        instruction->access_end = instruction->access_start + 2;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSHI.gp\t$r%d,[#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSHI.gp\t$r%" PRIu8 ",[#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -1107,7 +1159,8 @@ static int nds32_parse_hwgp(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                                instruction->access_end = instruction->access_start + 4;
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSWI.gp\t$r%d,[#%d]",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tSWI.gp\t$r%" PRIu8 ",[#%" PRId32 "]",
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        } else { /* LWI.gp */
@@ -1120,7 +1173,8 @@ static int nds32_parse_hwgp(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                                instruction->access_end = instruction->access_start + 4;
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tLWI.gp\t$r%d,[#%d]",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tLWI.gp\t$r%" PRIu8 ",[#%" PRId32 "]",
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        }
@@ -1151,7 +1205,8 @@ static int nds32_parse_sbgp(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                        instruction->access_end = instruction->access_start + 1;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSBI.gp\t$r%d,[#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSBI.gp\t$r%" PRIu8 ",[#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -1161,7 +1216,8 @@ static int nds32_parse_sbgp(struct nds32 *nds32, uint32_t opcode, uint32_t addre
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tADDI.gp\t$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tADDI.gp\t$r%" PRIu8 ",#%" PRId32 "",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -1221,7 +1277,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        if (instruction->info.imm)
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tADD_SLLI\t$r%d,$r%d,$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tADD_SLLI\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb,
@@ -1229,7 +1286,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        else
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tADD\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tADD\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
@@ -1243,7 +1301,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        if (instruction->info.imm)
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSUB_SLLI\t$r%d,$r%d,$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tSUB_SLLI\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb,
@@ -1251,7 +1310,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        else
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSUB\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tSUB\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 "",
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
@@ -1265,7 +1325,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        if (instruction->info.imm)
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tAND_SLLI\t$r%d,$r%d,$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tAND_SLLI\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb,
@@ -1273,7 +1334,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        else
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tAND\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tAND\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 "",
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
@@ -1287,7 +1349,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        if (instruction->info.imm)
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tXOR_SLLI\t$r%d,$r%d,$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tXOR_SLLI\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb,
@@ -1295,7 +1358,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        else
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tXOR\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tXOR\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
@@ -1309,7 +1373,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        if (instruction->info.imm)
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tOR_SLLI\t$r%d,$r%d,$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tOR_SLLI\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb,
@@ -1317,7 +1382,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        else
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tOR\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tOR\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
@@ -1329,7 +1395,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tNOR\t$r%d,$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tNOR\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.rb);
@@ -1341,7 +1408,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSLT\t$r%d,$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSLT\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.rb);
@@ -1353,7 +1421,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSLTS\t$r%d,$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSLTS\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.rb);
@@ -1368,7 +1437,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                instruction->type = NDS32_INSN_DATA_PROC;
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSLLI\t$r%d,$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tSLLI\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.imm);
@@ -1384,7 +1454,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                instruction->type = NDS32_INSN_DATA_PROC;
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSRLI\t$r%d,$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tSRLI\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.imm);
@@ -1400,7 +1471,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSRAI\t$r%d,$r%d,#%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tSRAI\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.imm);
@@ -1416,7 +1488,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tROTRI\t$r%d,$r%d,#%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tROTRI\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.imm);
@@ -1429,7 +1502,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSLL\t$r%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tSLL\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.rb);
@@ -1442,7 +1516,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSRL\t$r%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tSRL\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.rb);
@@ -1455,7 +1530,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSRA\t$r%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tSRA\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.rb);
@@ -1468,7 +1544,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tROTR\t$r%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tROTR\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.rb);
@@ -1481,7 +1558,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSEB\t$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tSEB\t$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra);
                         }
@@ -1493,7 +1571,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSEH\t$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tSEH\t$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra);
                         }
@@ -1505,7 +1584,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBITC\t$r%d,$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tBITC\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.rb);
@@ -1517,7 +1597,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tZEH\t$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tZEH\t$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra);
                         }
@@ -1529,7 +1610,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tWSBH\t$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tWSBH\t$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra);
                         }
@@ -1543,7 +1625,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        if (instruction->info.imm)
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tOR_SRLI\t$r%d,$r%d,$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tOR_SRLI\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb,
@@ -1551,7 +1634,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        else
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tOR\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tOR\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
@@ -1564,7 +1648,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tDIVSR\t$r%d,$r%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tDIVSR\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.rb,
@@ -1579,7 +1664,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tDIVR\t$r%d,$r%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tDIVR\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.rb,
@@ -1593,7 +1679,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSVA\t$r%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tSVA\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.rb);
@@ -1606,7 +1693,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSVS\t$r%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tSVS\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.rb);
@@ -1619,7 +1707,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_MISC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tCMOVZ\t$r%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tCMOVZ\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.rb);
@@ -1632,7 +1721,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_MISC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tCMOVN\t$r%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tCMOVN\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.rb);
@@ -1647,7 +1737,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        if (instruction->info.imm)
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tADD_SRLI\t$r%d,$r%d,$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tADD_SRLI\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb,
@@ -1655,7 +1746,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        else
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tADD\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tADD\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
@@ -1669,7 +1761,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        if (instruction->info.imm)
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSUB_SRLI\t$r%d,$r%d,$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tSUB_SRLI\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb,
@@ -1677,7 +1770,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        else
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSUB\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tSUB\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
@@ -1691,7 +1785,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        if (instruction->info.imm)
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tAND_SRLI\t$r%d,$r%d,$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tAND_SRLI\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb,
@@ -1699,7 +1794,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        else
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tAND\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tAND\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
@@ -1713,7 +1809,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        if (instruction->info.imm)
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tXOR_SRLI\t$r%d,$r%d,$r%d,%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tXOR_SRLI\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8 ",%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb,
@@ -1721,7 +1818,8 @@ static int nds32_parse_alu_1(uint32_t opcode, uint32_t address,
                        else
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tXOR\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tXOR\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
@@ -1749,7 +1847,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMAX\t$r%d,$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tMAX\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.rb);
@@ -1761,7 +1860,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMIN\t$r%d,$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tMIN\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.rb);
@@ -1773,7 +1873,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tAVE\t$r%d,$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tAVE\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.rb);
@@ -1785,7 +1886,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tAVE\t$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tAVE\t$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra);
                        break;
@@ -1798,7 +1900,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                instruction->type = NDS32_INSN_DATA_PROC;
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tCLIPS\t$r%d,$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tCLIPS\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.imm);
@@ -1813,7 +1916,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                instruction->type = NDS32_INSN_DATA_PROC;
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tCLIP\t$r%d,$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tCLIP\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.imm);
@@ -1826,7 +1930,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tCLO\t$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tCLO\t$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra);
                        break;
@@ -1837,7 +1942,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tCLZ\t$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tCLZ\t$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra);
                        break;
@@ -1850,7 +1956,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                instruction->type = NDS32_INSN_DATA_PROC;
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBSET\t$r%d,$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tBSET\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.imm);
@@ -1865,7 +1972,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                instruction->type = NDS32_INSN_DATA_PROC;
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBCLR\t$r%d,$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tBCLR\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.imm);
@@ -1880,7 +1988,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBTGL\t$r%d,$r%d,#%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tBTGL\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.imm);
@@ -1895,7 +2004,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBTST\t$r%d,$r%d,#%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tBTST\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                 address,
                                                 opcode, instruction->info.rt, instruction->info.ra,
                                                 instruction->info.imm);
@@ -1908,7 +2018,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                         instruction->type = NDS32_INSN_DATA_PROC;
                         snprintf(instruction->text,
                                         128,
-                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBSE\t$r%d,$r%d,$r%d",
+                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                        "\tBSE\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                         address,
                                         opcode, instruction->info.rt, instruction->info.ra,
                                         instruction->info.rb);
@@ -1920,7 +2031,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                         instruction->type = NDS32_INSN_DATA_PROC;
                         snprintf(instruction->text,
                                         128,
-                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBSP\t$r%d,$r%d,$r%d",
+                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                        "\tBSP\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                         address,
                                         opcode, instruction->info.rt, instruction->info.ra,
                                         instruction->info.rb);
@@ -1932,7 +2044,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                         instruction->type = NDS32_INSN_DATA_PROC;
                         snprintf(instruction->text,
                                         128,
-                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tFFB\t$r%d,$r%d,$r%d",
+                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                        "\tFFB\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                         address,
                                         opcode, instruction->info.rt, instruction->info.ra,
                                         instruction->info.rb);
@@ -1944,7 +2057,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                         instruction->type = NDS32_INSN_DATA_PROC;
                         snprintf(instruction->text,
                                         128,
-                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tFFMISM\t$r%d,$r%d,$r%d",
+                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                        "\tFFMISM\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                         address,
                                         opcode, instruction->info.rt, instruction->info.ra,
                                         instruction->info.rb);
@@ -1956,7 +2070,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                         instruction->type = NDS32_INSN_DATA_PROC;
                         snprintf(instruction->text,
                                         128,
-                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tFFZMISM\t$r%d,$r%d,$r%d",
+                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                        "\tFFZMISM\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                         address,
                                         opcode, instruction->info.rt, instruction->info.ra,
                                         instruction->info.rb);
@@ -1967,7 +2082,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                         instruction->type = NDS32_INSN_RESOURCE_ACCESS;
                         snprintf(instruction->text,
                                         128,
-                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMFUSR\t$r%d,#%d",
+                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                        "\tMFUSR\t$r%" PRIu8 ",#%" PRId32,
                                         address,
                                         opcode, instruction->info.rt,
                                         (instruction->info.imm >> 10) & 0x3FF);
@@ -1978,7 +2094,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                         instruction->type = NDS32_INSN_RESOURCE_ACCESS;
                         snprintf(instruction->text,
                                         128,
-                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMTUSR\t$r%d,#%d",
+                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                        "\tMTUSR\t$r%" PRIu8 ",#%" PRId32,
                                         address,
                                         opcode, instruction->info.rt,
                                         (instruction->info.imm >> 10) & 0x3FF);
@@ -1990,7 +2107,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                         instruction->type = NDS32_INSN_DATA_PROC;
                         snprintf(instruction->text,
                                         128,
-                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMUL\t$r%d,$r%d,$r%d",
+                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                        "\tMUL\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                         address,
                                         opcode, instruction->info.rt, instruction->info.ra,
                                         instruction->info.rb);
@@ -2003,7 +2121,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMULTS64\t$D%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tMULTS64\t$D%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, (dt_val >> 1) & 0x1, instruction->info.ra,
                                                 instruction->info.rb);
@@ -2017,7 +2136,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMULT64\t$D%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tMULT64\t$D%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, (dt_val >> 1) & 0x1, instruction->info.ra,
                                                 instruction->info.rb);
@@ -2030,7 +2150,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMADDS64\t$D%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tMADDS64\t$D%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, (dt_val >> 1) & 0x1, instruction->info.ra,
                                                 instruction->info.rb);
@@ -2043,7 +2164,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMADD64\t$D%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tMADD64\t$D%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, (dt_val >> 1) & 0x1, instruction->info.ra,
                                                 instruction->info.rb);
@@ -2056,7 +2178,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMSUBS64\t$D%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tMSUBS64\t$D%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, (dt_val >> 1) & 0x1, instruction->info.ra,
                                                 instruction->info.rb);
@@ -2069,7 +2192,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMSUB64\t$D%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tMSUB64\t$D%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, (dt_val >> 1) & 0x1, instruction->info.ra,
                                                 instruction->info.rb);
@@ -2082,7 +2206,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tDIVS\t$D%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tDIVS\t$D%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, (dt_val >> 1) & 0x1, instruction->info.ra,
                                                 instruction->info.rb);
@@ -2095,7 +2220,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tDIV\t$D%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tDIV\t$D%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, (dt_val >> 1) & 0x1, instruction->info.ra,
                                                 instruction->info.rb);
@@ -2108,7 +2234,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMULT32\t$D%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tMULT32\t$D%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, (dt_val >> 1) & 0x1, instruction->info.ra,
                                                 instruction->info.rb);
@@ -2121,7 +2248,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMADD32\t$D%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tMADD32\t$D%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, (dt_val >> 1) & 0x1, instruction->info.ra,
                                                 instruction->info.rb);
@@ -2134,7 +2262,8 @@ static int nds32_parse_alu_2(uint32_t opcode, uint32_t address,
                                 instruction->type = NDS32_INSN_DATA_PROC;
                                 snprintf(instruction->text,
                                                 128,
-                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMSUB32\t$D%d,$r%d,$r%d",
+                                                "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                "\tMSUB32\t$D%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                 address,
                                                 opcode, (dt_val >> 1) & 0x1, instruction->info.ra,
                                                 instruction->info.rb);
@@ -2174,7 +2303,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMOVI\t$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tMOVI\t$r%" PRIu8 ",#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -2184,7 +2314,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSETHI\t$r%d,0x%8.8" PRIx32,
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSETHI\t$r%" PRIu8 ",0x%8.8" PRIx32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -2196,13 +2327,15 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                        if ((instruction->info.imm >> 24) & 0x1) { /* JAL */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tJAL\t#%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tJAL\t#%" PRId32,
                                                address,
                                                opcode, instruction->info.imm);
                        } else { /* J */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tJ\t#%d",
+                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                               "\tJ\t#%" PRId32,
                                                address,
                                                opcode, instruction->info.imm);
                        }
@@ -2218,13 +2351,15 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                                if (imm & 0x20) { /* RET */
                                                        snprintf(instruction->text,
                                                                        128,
-                                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tRET\t$r%d",
+                                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                                       "\tRET\t$r%" PRIu8,
                                                                        address,
                                                                        opcode, instruction->info.rb);
                                                } else { /* JR */
                                                        snprintf(instruction->text,
                                                                        128,
-                                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tJR\t$r%d",
+                                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                                       "\tJR\t$r%" PRIu8,
                                                                        address,
                                                                        opcode, instruction->info.rb);
                                                }
@@ -2233,14 +2368,16 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->info.rt = (imm >> 20) & 0x1F;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tJRAL\t$r%d,$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tJRAL\t$r%" PRIu8 ",$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.rb);
                                                break;
                                        case 2: /* JRNEZ */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tJRNEZ\t$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tJRNEZ\t$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rb);
                                                break;
@@ -2249,14 +2386,15 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                                if (instruction->info.rt == R30)
                                                        snprintf(instruction->text,
                                                                        128,
-                                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tJRALNEZ\t$r%d",
+                                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                                       "\tJRALNEZ\t$r%" PRIu8,
                                                                        address,
                                                                        opcode, instruction->info.rb);
                                                else
                                                        snprintf(instruction->text,
                                                                        128,
                                                                        "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
-                                                                       "\tJRALNEZ\t$r%d,$r%d",
+                                                                       "\tJRALNEZ\t$r%" PRIu8 ",$r%" PRIu8,
                                                                        address,
                                                                        opcode,
                                                                        instruction->info.rt,
@@ -2277,7 +2415,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                        instruction->info.imm = (instruction->info.imm << 18) >> 18;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBNE\t$r%d,$r%d,#%d",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tBNE\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.ra,
                                                        instruction->info.imm);
@@ -2288,7 +2427,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                        instruction->info.imm = (instruction->info.imm << 18) >> 18;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBEQ\t$r%d,$r%d,#%d",
+                                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                       "\tBEQ\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                        address,
                                                        opcode, instruction->info.rt,
                                                        instruction->info.ra,
@@ -2308,7 +2448,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->info.imm = (instruction->info.imm << 16) >> 16;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBEQZ\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tBEQZ\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.imm);
                                                break;
@@ -2318,7 +2459,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->info.imm = (instruction->info.imm << 16) >> 16;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBNEZ\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tBNEZ\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.imm);
                                                break;
@@ -2328,7 +2470,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->info.imm = (instruction->info.imm << 16) >> 16;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBGEZ\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tBGEZ\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.imm);
                                                break;
@@ -2338,7 +2481,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->info.imm = (instruction->info.imm << 16) >> 16;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBLTZ\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tBLTZ\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.imm);
                                                break;
@@ -2348,7 +2492,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->info.imm = (instruction->info.imm << 16) >> 16;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBGTZ\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tBGTZ\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.imm);
                                                break;
@@ -2358,7 +2503,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->info.imm = (instruction->info.imm << 16) >> 16;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBLEZ\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tBLEZ\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.imm);
                                                break;
@@ -2368,7 +2514,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->info.imm = (instruction->info.imm << 16) >> 16;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBGEZAL\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tBGEZAL\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.imm);
                                                break;
@@ -2378,7 +2525,8 @@ static int nds32_parse_group_4_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->info.imm = (instruction->info.imm << 16) >> 16;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBLTZAL\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tBLTZAL\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.imm);
                                                break;
@@ -2412,7 +2560,8 @@ static int nds32_parse_group_5_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tADDI\t$r%d,$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tADDI\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -2424,7 +2573,8 @@ static int nds32_parse_group_5_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSUBRI\t$r%d,$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSUBRI\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -2435,7 +2585,8 @@ static int nds32_parse_group_5_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tANDI\t$r%d,$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tANDI\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -2446,7 +2597,8 @@ static int nds32_parse_group_5_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tXORI\t$r%d,$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tXORI\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -2457,7 +2609,8 @@ static int nds32_parse_group_5_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tORI\t$r%d,$r%d,0x%8.8" PRIx32,
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tORI\t$r%" PRIu8 ",$r%" PRIu8 ",0x%8.8" PRIx32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -2469,7 +2622,8 @@ static int nds32_parse_group_5_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSLTI\t$r%d,$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSLTI\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -2481,7 +2635,8 @@ static int nds32_parse_group_5_insn(struct nds32 *nds32, uint32_t opcode,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSLTSI\t$r%d,$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                       "\tSLTSI\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -2518,7 +2673,8 @@ static int nds32_parse_group_6_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->type = NDS32_INSN_MISC;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSTANDBY\t#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tSTANDBY\t#%" PRIu32,
                                                                address,
                                                                opcode, (opcode >> 5) & 0x3);
                                                break;
@@ -2539,7 +2695,8 @@ static int nds32_parse_group_6_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->type = NDS32_INSN_RESOURCE_ACCESS;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMFSR\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tMFSR\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.rt,
                                                                (instruction->info.imm >> 10) & 0x3FF);
@@ -2550,7 +2707,8 @@ static int nds32_parse_group_6_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->type = NDS32_INSN_RESOURCE_ACCESS;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMTSR\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tMTSR\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.ra,
                                                                (instruction->info.imm >> 10) & 0x3FF);
@@ -2567,7 +2725,8 @@ static int nds32_parse_group_6_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->type = NDS32_INSN_MISC;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tTRAP\t#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tTRAP\t#%" PRId32,
                                                                address,
                                                                opcode, (imm >> 5) & 0x7FFF);
                                                break;
@@ -2577,7 +2736,8 @@ static int nds32_parse_group_6_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->type = NDS32_INSN_MISC;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tTEQZ\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tTEQZ\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.ra,
                                                                (instruction->info.imm >> 5) & 0x7FFF);
@@ -2588,7 +2748,8 @@ static int nds32_parse_group_6_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->type = NDS32_INSN_MISC;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tTNEZ\t$r%d,#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tTNEZ\t$r%" PRIu8 ",#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.ra,
                                                                (instruction->info.imm >> 5) & 0x7FFF);
@@ -2615,7 +2776,8 @@ static int nds32_parse_group_6_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->info.imm = (imm >> 5) & 0x7FFF;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tBREAK\t#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tBREAK\t#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.imm);
                                                break;
@@ -2623,7 +2785,8 @@ static int nds32_parse_group_6_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->type = NDS32_INSN_MISC;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tSYSCALL\t#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tSYSCALL\t#%" PRId32,
                                                                address,
                                                                opcode, (imm >> 5) & 0x7FFF);
                                                break;
@@ -2631,7 +2794,8 @@ static int nds32_parse_group_6_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->type = NDS32_INSN_MISC;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tMSYNC\t#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tMSYNC\t#%" PRId32,
                                                                address,
                                                                opcode, (imm >> 5) & 0x7);
                                                break;
@@ -2641,7 +2805,8 @@ static int nds32_parse_group_6_insn(struct nds32 *nds32, uint32_t opcode,
                                                instruction->type = NDS32_INSN_MISC;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tISYNC\t$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "\tISYNC\t$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.ra);
                                                break;
@@ -2702,7 +2867,8 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->type = NDS32_INSN_MISC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tMOV55\t$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tMOV55\t$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra);
                        break;
@@ -2713,7 +2879,8 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->type = NDS32_INSN_MISC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tMOVI55\t$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tMOVI55\t$r%" PRIu8 ",#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -2724,13 +2891,15 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                        if (nds32_extract_field_8u(opcode, 9, 1) == 0) { /* ADD45 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tADD45\t$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tADD45\t$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.rb);
                        } else { /* SUB45 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSUB45\t$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tSUB45\t$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.rb);
                        }
@@ -2743,13 +2912,15 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                        if (nds32_extract_field_8u(opcode, 9, 1) == 0) { /* ADDI45 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tADDI45\t$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tADDI45\t$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        } else { /* SUBI45 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSUBI45\t$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tSUBI45\t$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        }
@@ -2761,20 +2932,22 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                        if (nds32_extract_field_8u(opcode, 9, 1) == 0) { /* SRAI45 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSRAI45\t$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tSRAI45\t$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        } else { /* SRLI45 */
                                if ((instruction->info.rt == 0) && (instruction->info.imm == 0)) {
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tNOP",
+                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16 "\t\tNOP",
                                                        address,
                                                        opcode);
                                } else {
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSRLI45\t$r%d,#%d",
+                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                       "\t\tSRLI45\t$r%" PRIu8 ",#%" PRId32,
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.imm);
                                }
@@ -2788,7 +2961,8 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                                instruction->info.imm = nds32_extract_field_8u(opcode, 0, 3);
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSLLI333\t$r%d,$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tSLLI333\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.imm);
@@ -2798,42 +2972,48 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                                        case 0: /* ZEB33 */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tZEB33\t$r%d,$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tZEB33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.ra);
                                                break;
                                        case 1: /* ZEH33 */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tZEH33\t$r%d,$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tZEH33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.ra);
                                                break;
                                        case 2: /* SEB33 */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSEB33\t$r%d,$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tSEB33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.ra);
                                                break;
                                        case 3: /* SEH33 */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSEH33\t$r%d,$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tSEH33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.ra);
                                                break;
                                        case 4: /* XLSB33 */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tXLSB33\t$r%d,$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tXLSB33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.ra);
                                                break;
                                        case 5: /* XLLB33 */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tXLLB33\t$r%d,$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tXLLB33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.ra);
                                                break;
@@ -2842,7 +3022,8 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                                                instruction->info.imm = nds32_extract_field_8u(opcode, 3, 3);
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tBMSKI33\t$r%d,$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tBMSKI33\t$r%" PRIu8 ",$r%" PRId32,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.imm);
                                                break;
@@ -2851,14 +3032,15 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                                                instruction->info.imm = nds32_extract_field_8u(opcode, 3, 3);
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tFEXTI33\t$r%d,$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tFEXTI33\t$r%" PRIu8 ",$r%" PRId32,
                                                                address,
                                                                opcode, instruction->info.rt, instruction->info.imm);
                                                break;
                                        default:
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx16
                                                                "\tUNDEFINED INSTRUCTION",
                                                                address,
                                                                opcode);
@@ -2874,14 +3056,16 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                        if (nds32_extract_field_8u(opcode, 9, 1) == 0) { /* ADD333 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tADD333\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tADD333\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
                        } else { /* SUB333 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSUB333\t$r%d,$r%d,$r%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tSUB333\t$r%" PRIu8 ",$r%" PRIu8 ",$r%" PRIu8,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.rb);
@@ -2895,14 +3079,16 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                        if (nds32_extract_field_8u(opcode, 9, 1) == 0) { /* ADDI333 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tADDI333\t$r%d,$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tADDI333\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.imm);
                        } else { /* SUBI333 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSUBI333\t$r%d,$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tSUBI333\t$r%" PRIu8 ",$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.ra,
                                                instruction->info.imm);
@@ -2911,7 +3097,7 @@ static int nds32_parse_group_0_insn_16(struct nds32 *nds32, uint16_t opcode,
                default:
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tUNDEFINED INSTRUCTION",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx16 "\tUNDEFINED INSTRUCTION",
                                        address,
                                        opcode);
                        return ERROR_FAIL;
@@ -2935,7 +3121,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->access_end = instruction->access_start + 4;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tLWI333\t$r%d,[$r%d+(#%d)]",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tLWI333\t$r%" PRIu8 ",[$r%" PRIu8 "+(#%" PRId32 ")]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -2950,7 +3137,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->access_end = instruction->access_start + 4;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tLWI333.BI\t$r%d,[$r%d],#%d",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tLWI333.BI\t$r%" PRIu8 ",[$r%" PRIu8 "],#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm << 2);
@@ -2966,7 +3154,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->access_end = instruction->access_start + 2;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tLHI333\t$r%d,[$r%d+(#%d)]",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tLHI333\t$r%" PRIu8 ",[$r%" PRIu8 "+(#%" PRId32 ")]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -2982,7 +3171,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->access_end = instruction->access_start + 1;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tLBI333\t$r%d,[$r%d+(#%d)]",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tLBI333\t$r%" PRIu8 ",[$r%" PRIu8 "+(#%" PRId32 ")]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -2998,7 +3188,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->access_end = instruction->access_start + 4;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSWI333\t$r%d,[$r%d+(#%d)]",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tSWI333\t$r%" PRIu8 ",[$r%" PRIu8 "+(#%" PRId32 ")]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -3013,7 +3204,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->access_end = instruction->access_start + 4;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSWI333.BI\t$r%d,[$r%d],#%d",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tSWI333.BI\t$r%" PRIu8 ",[$r%" PRIu8 "],#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -3029,7 +3221,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->access_end = instruction->access_start + 2;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSHI333\t$r%d,[$r%d+(#%d)]",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tSHI333\t$r%" PRIu8 ",[$r%" PRIu8 "+(#%" PRId32 ")]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -3045,7 +3238,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->access_end = instruction->access_start + 1;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSHI333\t$r%d,[$r%d+(#%d)]",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tSHI333\t$r%" PRIu8 ",[$r%" PRIu8 "+(#%" PRId32 ")]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra,
                                        instruction->info.imm);
@@ -3056,7 +3250,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->type = NDS32_INSN_DATA_PROC;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tADDRI36.SP\t$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tADDRI36.SP\t$r%" PRIu8 ",#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -3071,7 +3266,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->access_end = instruction->access_start + 4;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tLWI45.FE\t$r%d,[#%d]",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tLWI45.FE\t$r%" PRIu8 ",[#%" PRId32 "]",
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -3084,7 +3280,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->access_end = instruction->access_start + 4;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tLWI450\t$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tLWI450\t$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra);
                        break;
@@ -3097,7 +3294,8 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->access_end = instruction->access_start + 4;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSWI450\t$r%d,$r%d",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tSWI450\t$r%" PRIu8 ",$r%" PRIu8,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.ra);
                        break;
@@ -3114,13 +3312,15 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                        if (nds32_extract_field_8u(opcode, 7, 1) == 0) { /* LWI37 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tLWI37\t$r%d,[fp+#%d]",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tLWI37\t$r%" PRIu8 ",[fp+#%" PRId32 "]",
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        } else { /* SWI37 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSWI37\t$r%d,[fp+#%d]",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tSWI37\t$r%" PRIu8 ",[fp+#%" PRId32 "]",
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        }
@@ -3128,7 +3328,7 @@ static int nds32_parse_group_1_insn_16(struct nds32 *nds32, uint16_t opcode,
                default: /* ERROR */
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tUNDEFINED INSTRUCTION",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx16 "\tUNDEFINED INSTRUCTION",
                                        address,
                                        opcode);
                        return ERROR_FAIL;
@@ -3148,7 +3348,8 @@ static int nds32_parse_group_2_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->type = NDS32_INSN_JUMP_BRANCH;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tBEQZ38\t$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tBEQZ38\t$r%" PRIu8 ",#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -3159,7 +3360,8 @@ static int nds32_parse_group_2_insn_16(struct nds32 *nds32, uint16_t opcode,
                        instruction->type = NDS32_INSN_JUMP_BRANCH;
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tBNEZ38\t$r%d,#%d",
+                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                       "\t\tBNEZ38\t$r%" PRIu8 ",#%" PRId32,
                                        address,
                                        opcode, instruction->info.rt, instruction->info.imm);
                        break;
@@ -3171,13 +3373,15 @@ static int nds32_parse_group_2_insn_16(struct nds32 *nds32, uint16_t opcode,
                        if (instruction->info.rt == 5) { /* J8 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tJ8\t#%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tJ8\t#%" PRId32,
                                                address,
                                                opcode, instruction->info.imm);
                        } else { /* BEQS38 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tBEQS38\t$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tBEQS38\t$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        }
@@ -3194,14 +3398,16 @@ static int nds32_parse_group_2_insn_16(struct nds32 *nds32, uint16_t opcode,
                                        case 0: /* JR5 */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tJR5\t$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tJR5\t$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rb);
                                                break;
                                        case 1: /* JRAL5 */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tJRAL5\t$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tJRAL5\t$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rb);
                                                break;
@@ -3211,14 +3417,16 @@ static int nds32_parse_group_2_insn_16(struct nds32 *nds32, uint16_t opcode,
                                                /* TODO: implement real instruction semantics */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tEX9.IT\t#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tEX9.IT\t#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.imm);
                                                break;
                                        case 4: /* RET5 */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tRET5\t$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tRET5\t$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rb);
                                                break;
@@ -3228,14 +3436,15 @@ static int nds32_parse_group_2_insn_16(struct nds32 *nds32, uint16_t opcode,
                                                instruction->type = NDS32_INSN_DATA_PROC;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tADD5.PC\t$r%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tADD5.PC\t$r%" PRIu8,
                                                                address,
                                                                opcode, instruction->info.rt);
                                                break;
                                        default:
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx32
+                                                               "0x%8.8" PRIx32 "\t0x%8.8" PRIx16
                                                                "\tUNDEFINED INSTRUCTION",
                                                                address,
                                                                opcode);
@@ -3244,7 +3453,8 @@ static int nds32_parse_group_2_insn_16(struct nds32 *nds32, uint16_t opcode,
                        } else { /* BNES38 */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tBNES38\t$r%d,#%d",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tBNES38\t$r%" PRIu8 ",#%" PRId32,
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        }
@@ -3266,7 +3476,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                        instruction->type = NDS32_INSN_DATA_PROC;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSLTS45\t$r%d,$r%d",
+                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                       "\t\tSLTS45\t$r%" PRIu8 ",$r%" PRIu8,
                                                        address,
                                                        opcode, instruction->info.ra, instruction->info.rb);
                                        break;
@@ -3276,7 +3487,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                        instruction->type = NDS32_INSN_DATA_PROC;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSLT45\t$r%d,$r%d",
+                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                       "\t\tSLT45\t$r%" PRIu8 ",$r%" PRIu8,
                                                        address,
                                                        opcode, instruction->info.ra, instruction->info.rb);
                                        break;
@@ -3286,7 +3498,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                        instruction->type = NDS32_INSN_DATA_PROC;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSLTSI45\t$r%d,#%d",
+                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                       "\t\tSLTSI45\t$r%" PRIu8 ",#%" PRId32,
                                                        address,
                                                        opcode, instruction->info.ra, instruction->info.imm);
                                        break;
@@ -3296,7 +3509,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                        instruction->type = NDS32_INSN_DATA_PROC;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSLTI45\t$r%d,#%d",
+                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                       "\t\tSLTI45\t$r%" PRIu8 ",#%" PRId32,
                                                        address,
                                                        opcode, instruction->info.ra, instruction->info.imm);
                                        break;
@@ -3311,13 +3525,15 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                        if (nds32_extract_field_8u(opcode, 8, 1) == 0) { /* BEQZS8 */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tBEQZS8\t#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tBEQZS8\t#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.imm);
                                        } else { /* BNEZS8 */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tBNEZS8\t#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tBNEZS8\t#%" PRId32,
                                                                address,
                                                                opcode, instruction->info.imm);
                                        }
@@ -3327,7 +3543,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                                instruction->type = NDS32_INSN_MISC;
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tBREAK16\t#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tBREAK16\t#%" PRId16,
                                                                address,
                                                                opcode, opcode & 0x1F);
                                        } else { /* EX9.IT */
@@ -3335,7 +3552,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                                /* TODO: implement real instruction semantics */
                                                snprintf(instruction->text,
                                                                128,
-                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tEX9.IT\t#%d",
+                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                               "\t\tEX9.IT\t#%" PRId16,
                                                                address,
                                                                opcode, opcode & 0x1FF);
                                        }
@@ -3347,7 +3565,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                        instruction->type = NDS32_INSN_DATA_PROC;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tADDI10.SP\t#%d",
+                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                       "\t\tADDI10.SP\t#%" PRId32,
                                                        address,
                                                        opcode, instruction->info.imm);
                                        break;
@@ -3363,13 +3582,15 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                        if (nds32_extract_field_8u(opcode, 7, 1) == 0) { /* LWI37.SP */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tLWI37.SP\t$r%d,[+#%d]",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tLWI37.SP\t$r%" PRIu8 ",[+#%" PRId32 "]",
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        } else { /* SWI37.SP */
                                snprintf(instruction->text,
                                                128,
-                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tSWI37.SP\t$r%d,[+#%d]",
+                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                               "\t\tSWI37.SP\t$r%" PRIu8 ",[+#%" PRId32 "]",
                                                address,
                                                opcode, instruction->info.rt, instruction->info.imm);
                        }
@@ -3381,7 +3602,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                        instruction->type = NDS32_INSN_JUMP_BRANCH;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tIFCALL9\t#%d",
+                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                       "\t\tIFCALL9\t#%" PRId32 "",
                                                        address,
                                                        opcode, instruction->info.imm);
                                        break;
@@ -3391,7 +3613,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                        instruction->type = NDS32_INSN_MISC;
                                        snprintf(instruction->text,
                                                        128,
-                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32 "\t\tMOVPI45\t$r%d,#%d",
+                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                       "\t\tMOVPI45\t$r%" PRIu8 ",#%" PRId32 "",
                                                        address,
                                                        opcode, instruction->info.rt, instruction->info.imm);
                                        break;
@@ -3427,8 +3650,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
 
                                                                snprintf(instruction->text,
                                                                                128,
-                                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32
-                                                                               "\t\tPUSH25\t$r%d,#%d",
+                                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                                               "\t\tPUSH25\t$r%" PRIu8 ",#%" PRId32,
                                                                                address,
                                                                                opcode, instruction->info.rd,
                                                                                instruction->info.imm);
@@ -3465,8 +3688,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
 
                                                                snprintf(instruction->text,
                                                                                128,
-                                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx32
-                                                                               "\t\tPOP25\t$r%d,#%d",
+                                                                               "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                                               "\t\tPOP25\t$r%" PRIu8 ",#%" PRId32,
                                                                                address,
                                                                                opcode, instruction->info.rd,
                                                                                instruction->info.imm);
@@ -3481,8 +3704,8 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                                        instruction->type = NDS32_INSN_MISC;
                                                        snprintf(instruction->text,
                                                                        128,
-                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32
-                                                                       "\t\tMOVD44\t$r%d,$r%d",
+                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                                       "\t\tMOVD44\t$r%" PRIu8 ",$r%" PRIu8,
                                                                        address,
                                                                        opcode, instruction->info.rt, instruction->info.ra);
                                                        break;
@@ -3496,48 +3719,48 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                                                case 2: /* NEG33 */
                                                        snprintf(instruction->text,
                                                                        128,
-                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32
-                                                                       "\t\tNEG33\t$r%d,$r%d",
+                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                                       "\t\tNEG33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                        address,
                                                                        opcode, instruction->info.rt, instruction->info.ra);
                                                        break;
                                                case 3: /* NOT33 */
                                                        snprintf(instruction->text,
                                                                        128,
-                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32
-                                                                       "\t\tNOT33\t$r%d,$r%d",
+                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                                       "\t\tNOT33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                        address,
                                                                        opcode, instruction->info.rt, instruction->info.ra);
                                                        break;
                                                case 4: /* MUL33 */
                                                        snprintf(instruction->text,
                                                                        128,
-                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32
-                                                                       "\t\tMUL33\t$r%d,$r%d",
+                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                                       "\t\tMUL33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                        address,
                                                                        opcode, instruction->info.rt, instruction->info.ra);
                                                        break;
                                                case 5: /* XOR33 */
                                                        snprintf(instruction->text,
                                                                        128,
-                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32
-                                                                       "\t\tXOR33\t$r%d,$r%d",
+                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                                       "\t\tXOR33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                        address,
                                                                        opcode, instruction->info.rt, instruction->info.ra);
                                                        break;
                                                case 6: /* AND33 */
                                                        snprintf(instruction->text,
                                                                        128,
-                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32
-                                                                       "\t\tAND33\t$r%d,$r%d",
+                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                                       "\t\tAND33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                        address,
                                                                        opcode, instruction->info.rt, instruction->info.ra);
                                                        break;
                                                case 7: /* OR33 */
                                                        snprintf(instruction->text,
                                                                        128,
-                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx32
-                                                                       "\t\tOR33\t$r%d,$r%d",
+                                                                       "0x%8.8" PRIx32 "\t0x%4.4" PRIx16
+                                                                       "\t\tOR33\t$r%" PRIu8 ",$r%" PRIu8,
                                                                        address,
                                                                        opcode, instruction->info.rt, instruction->info.ra);
                                                        break;
@@ -3548,7 +3771,7 @@ static int nds32_parse_group_3_insn_16(struct nds32 *nds32, uint16_t opcode,
                default:
                        snprintf(instruction->text,
                                        128,
-                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx32 "\tUNDEFINED INSTRUCTION",
+                                       "0x%8.8" PRIx32 "\t0x%8.8" PRIx16 "\tUNDEFINED INSTRUCTION",
                                        address,
                                        opcode);
                        return ERROR_FAIL;
index 24f5108ccb2d2b07dedfbd6374985efb8a9726c2..ac2aad0b85931f10b1e4ffcf73c9006b32187c7e 100644 (file)
@@ -114,7 +114,7 @@ static int nds32_v2_activate_hardware_breakpoint(struct target *target)
                                /* enable breakpoint (physical address) */
                                aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + hbr_index, 0xA);
 
-                       LOG_DEBUG("Add hardware BP %d at %08" PRIx32, hbr_index,
+                       LOG_DEBUG("Add hardware BP %" PRId32 " at %08" PRIx32, hbr_index,
                                        bp->address);
 
                        hbr_index++;
@@ -141,7 +141,7 @@ static int nds32_v2_deactivate_hardware_breakpoint(struct target *target)
                else
                        return ERROR_FAIL;
 
-               LOG_DEBUG("Remove hardware BP %d at %08" PRIx32, hbr_index,
+               LOG_DEBUG("Remove hardware BP %" PRId32 " at %08" PRIx32, hbr_index,
                                bp->address);
 
                hbr_index++;
@@ -186,7 +186,7 @@ static int nds32_v2_activate_hardware_watchpoint(struct target *target)
                /* set value */
                aice_write_debug_reg(aice, NDS_EDM_SR_BPV0 + wp_num, 0);
 
-               LOG_DEBUG("Add hardware wathcpoint %d at %08" PRIx32 " mask %08" PRIx32, wp_num,
+               LOG_DEBUG("Add hardware wathcpoint %" PRId32 " at %08" PRIx32 " mask %08" PRIx32, wp_num,
                                wp->address, wp->mask);
 
        }
@@ -206,7 +206,7 @@ static int nds32_v2_deactivate_hardware_watchpoint(struct target *target)
                /* disable watchpoint */
                aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + wp_num, 0x0);
 
-               LOG_DEBUG("Remove hardware wathcpoint %d at %08" PRIx32 " mask %08" PRIx32,
+               LOG_DEBUG("Remove hardware wathcpoint %" PRId32 " at %08" PRIx32 " mask %08" PRIx32,
                                wp_num, wp->address, wp->mask);
        }
 
@@ -231,7 +231,7 @@ static int nds32_v2_check_interrupt_stack(struct nds32_v2_common *nds32_v2)
        nds32->current_interrupt_level = (val_ir0 >> 1) & 0x3;
 
        if (nds32_reach_max_interrupt_level(nds32)) {
-               LOG_ERROR("<-- TARGET ERROR! Reaching the max interrupt stack level %d. -->",
+               LOG_ERROR("<-- TARGET ERROR! Reaching the max interrupt stack level %" PRIu32 ". -->",
                                nds32->current_interrupt_level);
 
                /* decrease interrupt level */
@@ -427,7 +427,7 @@ static int nds32_v2_add_breakpoint(struct target *target,
                        LOG_WARNING("<-- TARGET WARNING! Insert too many hardware "
                                        "breakpoints/watchpoints!  The limit of "
                                        "combined hardware breakpoints/watchpoints "
-                                       "is %d. -->", nds32_v2->n_hbr);
+                                       "is %" PRId32 ". -->", nds32_v2->n_hbr);
                        return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
                }
 
@@ -486,7 +486,7 @@ static int nds32_v2_add_watchpoint(struct target *target,
        if (nds32_v2->n_hbr <= nds32_v2->next_hbr_index) {
                LOG_WARNING("<-- TARGET WARNING! Insert too many hardware "
                                "breakpoints/watchpoints!  The limit of "
-                               "combined hardware breakpoints/watchpoints is %d. -->", nds32_v2->n_hbr);
+                               "combined hardware breakpoints/watchpoints is %" PRId32 ". -->", nds32_v2->n_hbr);
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
        }
 
@@ -626,7 +626,7 @@ static int nds32_v2_examine(struct target *target)
 
        nds32_v2->next_hbr_index = 0;
 
-       LOG_INFO("%s: total hardware breakpoint %d", target_name(target),
+       LOG_INFO("%s: total hardware breakpoint %" PRId32, target_name(target),
                        nds32_v2->n_hbr);
 
        nds32->target->state = TARGET_RUNNING;
index ea9252e4cc0d3ce36b3b617a9fc9357649ece800..224665010a18ab0f8911c14cccef235f8dd2e5c3 100644 (file)
@@ -55,7 +55,7 @@ static int nds32_v3_activate_hardware_breakpoint(struct target *target)
                                /* enable breakpoint (physical address) */
                                aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + hbr_index, 0xA);
 
-                       LOG_DEBUG("Add hardware BP %d at %08" PRIx32, hbr_index,
+                       LOG_DEBUG("Add hardware BP %" PRId32 " at %08" PRIx32, hbr_index,
                                        bp->address);
                } else {
                        return ERROR_FAIL;
@@ -83,7 +83,7 @@ static int nds32_v3_deactivate_hardware_breakpoint(struct target *target)
                        return ERROR_FAIL;
                }
 
-               LOG_DEBUG("Remove hardware BP %d at %08" PRIx32, hbr_index,
+               LOG_DEBUG("Remove hardware BP %" PRId32 " at %08" PRIx32, hbr_index,
                                bp->address);
        }
 
@@ -130,7 +130,7 @@ static int nds32_v3_activate_hardware_watchpoint(struct target *target)
                        /* set value */
                        aice_write_debug_reg(aice, NDS_EDM_SR_BPV0 + wp_num, 0);
 
-                       LOG_DEBUG("Add hardware wathcpoint %d at %08" PRIx32 " mask %08" PRIx32,
+                       LOG_DEBUG("Add hardware wathcpoint %" PRId32 " at %08" PRIx32 " mask %08" PRIx32,
                                        wp_num, wp->address, wp->mask);
 
                        wp_num++;
@@ -171,7 +171,7 @@ static int nds32_v3_deactivate_hardware_watchpoint(struct target *target)
                        /* disable watchpoint */
                        aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + wp_num, 0x0);
 
-                       LOG_DEBUG("Remove hardware wathcpoint %d at %08" PRIx32
+                       LOG_DEBUG("Remove hardware wathcpoint %" PRId32 " at %08" PRIx32
                                        " mask %08" PRIx32, wp_num,
                                        wp->address, wp->mask);
                        wp_num++;
@@ -200,7 +200,7 @@ static int nds32_v3_check_interrupt_stack(struct nds32 *nds32)
        nds32->current_interrupt_level = (val_ir0 >> 1) & 0x3;
 
        if (nds32_reach_max_interrupt_level(nds32))
-               LOG_ERROR("<-- TARGET ERROR! Reaching the max interrupt stack level %d. -->",
+               LOG_ERROR("<-- TARGET ERROR! Reaching the max interrupt stack level %" PRIu32 ". -->",
                                nds32->current_interrupt_level);
 
        /* backup $ir4 & $ir6 to avoid suppressed exception overwrite */
@@ -295,11 +295,11 @@ static int nds32_v3_add_breakpoint(struct target *target,
                        LOG_WARNING("<-- TARGET WARNING! Insert too many "
                                        "hardware breakpoints/watchpoints! "
                                        "The limit of combined hardware "
-                                       "breakpoints/watchpoints is %d. -->",
+                                       "breakpoints/watchpoints is %" PRId32 ". -->",
                                        nds32_v3->n_hbr);
                        LOG_WARNING("<-- TARGET STATUS: Inserted number of "
-                                       "hardware breakpoint: %d, hardware "
-                                       "watchpoints: %d. -->",
+                                       "hardware breakpoint: %" PRId32 ", hardware "
+                                       "watchpoints: %" PRId32 ". -->",
                                        nds32_v3->next_hbr_index - nds32_v3->used_n_wp,
                                        nds32_v3->used_n_wp);
                        return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
@@ -369,11 +369,11 @@ static int nds32_v3_add_watchpoint(struct target *target,
 
                LOG_WARNING("<-- TARGET WARNING! Insert too many hardware "
                                "breakpoints/watchpoints! The limit of combined "
-                               "hardware breakpoints/watchpoints is %d. -->",
+                               "hardware breakpoints/watchpoints is %" PRId32 ". -->",
                                nds32_v3->n_hbr);
                LOG_WARNING("<-- TARGET STATUS: Inserted number of "
-                               "hardware breakpoint: %d, hardware "
-                               "watchpoints: %d. -->",
+                               "hardware breakpoint: %" PRId32 ", hardware "
+                               "watchpoints: %" PRId32 ". -->",
                                nds32_v3->next_hbr_index - nds32_v3->used_n_wp,
                                nds32_v3->used_n_wp);
 
@@ -458,7 +458,7 @@ static int nds32_v3_examine(struct target *target)
        nds32_v3->next_hbr_index = 0;
        nds32_v3->used_n_wp = 0;
 
-       LOG_INFO("%s: total hardware breakpoint %d", target_name(target),
+       LOG_INFO("%s: total hardware breakpoint %" PRId32, target_name(target),
                        nds32_v3->n_hbr);
 
        nds32->target->state = TARGET_RUNNING;
index 531cab09452e0ecccfeed918c065e002418b41ca..6dc20982d19bc607c38479df285c86072514a722 100644 (file)
@@ -281,8 +281,8 @@ static int nds32_v3_get_exception_address(struct nds32 *nds32,
                nds32_read_opcode(nds32, val_pc, &opcode);
                nds32_evaluate_opcode(nds32, opcode, val_pc, &instruction);
 
-               LOG_DEBUG("PC: 0x%08x, access start: 0x%08x, end: 0x%08x", val_pc,
-                               instruction.access_start, instruction.access_end);
+               LOG_DEBUG("PC: 0x%08" PRIx32 ", access start: 0x%08" PRIx32 ", end: 0x%08" PRIx32,
+                               val_pc, instruction.access_start, instruction.access_end);
 
                /* check if multiple hits in the access range */
                uint32_t in_range_watch_count = 0;
index 2c0d255743f9385ae1b3b94611b82cad75b592e4..accc8d0564a5cf3864e09a33c87577ae3b0e9dc8 100644 (file)
@@ -52,7 +52,7 @@ static int nds32_v3m_activate_hardware_breakpoint(struct target *target)
                                /* enable breakpoint (physical address) */
                                aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + brp_num, 0xA);
 
-                       LOG_DEBUG("Add hardware BP %d at %08" PRIx32, brp_num,
+                       LOG_DEBUG("Add hardware BP %u at %08" PRIx32, brp_num,
                                        bp->address);
 
                        brp_num--;
@@ -80,7 +80,7 @@ static int nds32_v3m_deactivate_hardware_breakpoint(struct target *target)
                else
                        return ERROR_FAIL;
 
-               LOG_DEBUG("Remove hardware BP %d at %08" PRIx32, brp_num,
+               LOG_DEBUG("Remove hardware BP %u at %08" PRIx32, brp_num,
                                bp->address);
 
                brp_num--;
@@ -127,9 +127,8 @@ static int nds32_v3m_activate_hardware_watchpoint(struct target *target)
                        /* enable watchpoint */
                        aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + wp_num, wp_config);
 
-                       LOG_DEBUG("Add hardware wathcpoint %d at %08" PRIx32
-                                       " mask %08" PRIx32, wp_num,
-                                       wp->address, wp->mask);
+                       LOG_DEBUG("Add hardware wathcpoint %" PRId32 " at %08" PRIx32
+                                       " mask %08" PRIx32, wp_num, wp->address, wp->mask);
 
                        wp_num++;
                } else if (nds32_v3m->nds32.global_stop) {
@@ -169,9 +168,8 @@ static int nds32_v3m_deactivate_hardware_watchpoint(struct target *target)
                        /* disable watchpoint */
                        aice_write_debug_reg(aice, NDS_EDM_SR_BPC0 + wp_num, 0x0);
 
-                       LOG_DEBUG("Remove hardware wathcpoint %d at %08" PRIx32
-                                       " mask %08" PRIx32, wp_num,
-                                       wp->address, wp->mask);
+                       LOG_DEBUG("Remove hardware wathcpoint %" PRId32 " at %08" PRIx32
+                                       " mask %08" PRIx32, wp_num, wp->address, wp->mask);
                        wp_num++;
                } else if (nds32_v3m->nds32.global_stop) {
                        clean_global_stop = true;
@@ -198,7 +196,7 @@ static int nds32_v3m_check_interrupt_stack(struct nds32 *nds32)
        nds32->current_interrupt_level = (val_ir0 >> 1) & 0x3;
 
        if (nds32_reach_max_interrupt_level(nds32))
-               LOG_ERROR("<-- TARGET ERROR! Reaching the max interrupt stack level %d. -->",
+               LOG_ERROR("<-- TARGET ERROR! Reaching the max interrupt stack level %" PRIu32 ". -->",
                                nds32->current_interrupt_level);
 
        /* backup $ir6 to avoid suppressed exception overwrite */
@@ -254,11 +252,11 @@ static int nds32_v3m_add_breakpoint(struct target *target,
                        LOG_WARNING("<-- TARGET WARNING! Insert too many "
                                        "hardware breakpoints/watchpoints! "
                                        "The limit of combined hardware "
-                                       "breakpoints/watchpoints is %d. -->",
+                                       "breakpoints/watchpoints is %" PRId32 ". -->",
                                        nds32_v3m->n_hbr);
                        LOG_WARNING("<-- TARGET STATUS: Inserted number of "
-                                       "hardware breakpoint: %d, hardware "
-                                       "watchpoints: %d. -->",
+                                       "hardware breakpoint: %" PRId32 ", hardware "
+                                       "watchpoints: %" PRId32 ". -->",
                                        nds32_v3m->n_hbr - nds32_v3m->next_hbr_index - 1,
                                        nds32_v3m->used_n_wp);
                        return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
@@ -328,9 +326,9 @@ static int nds32_v3m_add_watchpoint(struct target *target,
 
                LOG_WARNING("<-- TARGET WARNING! Insert too many hardware "
                                "watchpoints! The limit of hardware watchpoints "
-                               "is %d. -->", nds32_v3m->n_hwp);
+                               "is %" PRId32 ". -->", nds32_v3m->n_hwp);
                LOG_WARNING("<-- TARGET STATUS: Inserted number of "
-                               "hardware watchpoint: %d. -->",
+                               "hardware watchpoint: %" PRId32 ". -->",
                                nds32_v3m->used_n_wp);
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
        }
@@ -347,11 +345,11 @@ static int nds32_v3m_add_watchpoint(struct target *target,
 
                LOG_WARNING("<-- TARGET WARNING! Insert too many hardware "
                                "breakpoints/watchpoints! The limit of combined "
-                               "hardware breakpoints/watchpoints is %d. -->",
+                               "hardware breakpoints/watchpoints is %" PRId32 ". -->",
                                nds32_v3m->n_hbr);
                LOG_WARNING("<-- TARGET STATUS: Inserted number of "
-                               "hardware breakpoint: %d, hardware "
-                               "watchpoints: %d. -->",
+                               "hardware breakpoint: %" PRId32 ", hardware "
+                               "watchpoints: %" PRId32 ". -->",
                                nds32_v3m->n_hbr - nds32_v3m->next_hbr_index - 1,
                                nds32_v3m->used_n_wp);
                return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
@@ -446,9 +444,9 @@ static int nds32_v3m_examine(struct target *target)
        /* hardware watchpoint is inserted from low index to high index */
        nds32_v3m->next_hwp_index = 0;
 
-       LOG_INFO("%s: total hardware breakpoint %d (simple breakpoint %d)",
+       LOG_INFO("%s: total hardware breakpoint %" PRId32 " (simple breakpoint %" PRId32 ")",
                        target_name(target), nds32_v3m->n_hbr, nds32_v3m->n_hbr - nds32_v3m->n_hwp);
-       LOG_INFO("%s: total hardware watchpoint %d", target_name(target), nds32_v3m->n_hwp);
+       LOG_INFO("%s: total hardware watchpoint %" PRId32, target_name(target), nds32_v3m->n_hwp);
 
        nds32->target->state = TARGET_RUNNING;
        nds32->target->debug_reason = DBG_REASON_NOTHALTED;
index 8d65d4606edcb3c813a43be3bb91e707fa0339ea..a7b3ed278675c24ffc89f47ada23b34c6538179f 100644 (file)
@@ -424,7 +424,7 @@ static int or1k_read_core_reg(struct target *target, int num)
        if ((num >= 0) && (num < OR1KNUMCOREREGS)) {
                reg_value = or1k->core_regs[num];
                buf_set_u32(or1k->core_cache->reg_list[num].value, 0, 32, reg_value);
-               LOG_DEBUG("Read core reg %i value 0x%08x", num , reg_value);
+               LOG_DEBUG("Read core reg %i value 0x%08" PRIx32, num , reg_value);
                or1k->core_cache->reg_list[num].valid = 1;
                or1k->core_cache->reg_list[num].dirty = 0;
        } else {
@@ -432,11 +432,11 @@ static int or1k_read_core_reg(struct target *target, int num)
                int retval = du_core->or1k_jtag_read_cpu(&or1k->jtag,
                                                         or1k->arch_info[num].spr_num, 1, &reg_value);
                if (retval != ERROR_OK) {
-                       LOG_ERROR("Error while reading spr 0x%08x", or1k->arch_info[num].spr_num);
+                       LOG_ERROR("Error while reading spr 0x%08" PRIx32, or1k->arch_info[num].spr_num);
                        return retval;
                }
                buf_set_u32(or1k->core_cache->reg_list[num].value, 0, 32, reg_value);
-               LOG_DEBUG("Read spr reg %i value 0x%08x", num , reg_value);
+               LOG_DEBUG("Read spr reg %i value 0x%08" PRIx32, num , reg_value);
        }
 
        return ERROR_OK;
@@ -453,7 +453,7 @@ static int or1k_write_core_reg(struct target *target, int num)
 
        uint32_t reg_value = buf_get_u32(or1k->core_cache->reg_list[num].value, 0, 32);
        or1k->core_regs[num] = reg_value;
-       LOG_DEBUG("Write core reg %i value 0x%08x", num , reg_value);
+       LOG_DEBUG("Write core reg %i value 0x%08" PRIx32, num , reg_value);
        or1k->core_cache->reg_list[num].valid = 1;
        or1k->core_cache->reg_list[num].dirty = 0;
 
@@ -495,7 +495,7 @@ static int or1k_set_core_reg(struct reg *reg, uint8_t *buf)
                int retval = du_core->or1k_jtag_write_cpu(&or1k->jtag,
                                                          or1k_reg->spr_num, 1, &value);
                if (retval != ERROR_OK) {
-                       LOG_ERROR("Error while writing spr 0x%08x", or1k_reg->spr_num);
+                       LOG_ERROR("Error while writing spr 0x%08" PRIx32, or1k_reg->spr_num);
                        return retval;
                }
        }
@@ -797,7 +797,7 @@ static int or1k_resume_or_step(struct target *target, int current,
        uint32_t resume_pc;
        uint32_t debug_reg_list[OR1K_DEBUG_REG_NUM];
 
-       LOG_DEBUG("Addr: 0x%x, stepping: %s, handle breakpoints %s\n",
+       LOG_DEBUG("Addr: 0x%" PRIx32 ", stepping: %s, handle breakpoints %s\n",
                  address, step ? "yes" : "no", handle_breakpoints ? "yes" : "no");
 
        if (target->state != TARGET_HALTED) {
@@ -862,7 +862,7 @@ static int or1k_resume_or_step(struct target *target, int current,
                /* Single step past breakpoint at current address */
                breakpoint = breakpoint_find(target, resume_pc);
                if (breakpoint) {
-                       LOG_DEBUG("Unset breakpoint at 0x%08x", breakpoint->address);
+                       LOG_DEBUG("Unset breakpoint at 0x%08" PRIx32, breakpoint->address);
                        retval = or1k_remove_breakpoint(target, breakpoint);
                        if (retval != ERROR_OK)
                                return retval;
@@ -887,11 +887,11 @@ static int or1k_resume_or_step(struct target *target, int current,
        if (!debug_execution) {
                target->state = TARGET_RUNNING;
                target_call_event_callbacks(target, TARGET_EVENT_RESUMED);
-               LOG_DEBUG("Target resumed at 0x%08x", resume_pc);
+               LOG_DEBUG("Target resumed at 0x%08" PRIx32, resume_pc);
        } else {
                target->state = TARGET_DEBUG_RUNNING;
                target_call_event_callbacks(target, TARGET_EVENT_DEBUG_RESUMED);
-               LOG_DEBUG("Target debug resumed at 0x%08x", resume_pc);
+               LOG_DEBUG("Target debug resumed at 0x%08" PRIx32, resume_pc);
        }
 
        return ERROR_OK;
@@ -923,7 +923,7 @@ static int or1k_add_breakpoint(struct target *target,
        struct or1k_du *du_core = or1k_to_du(or1k);
        uint8_t data;
 
-       LOG_DEBUG("Adding breakpoint: addr 0x%08x, len %d, type %d, set: %d, id: %d",
+       LOG_DEBUG("Adding breakpoint: addr 0x%08" PRIx32 ", len %d, type %d, set: %d, id: %" PRId32,
                  breakpoint->address, breakpoint->length, breakpoint->type,
                  breakpoint->set, breakpoint->unique_id);
 
@@ -938,7 +938,7 @@ static int or1k_add_breakpoint(struct target *target,
                                         1,
                                         &data);
        if (retval != ERROR_OK) {
-               LOG_ERROR("Error while reading the instruction at 0x%08x",
+               LOG_ERROR("Error while reading the instruction at 0x%08" PRIx32,
                           breakpoint->address);
                return retval;
        }
@@ -958,7 +958,7 @@ static int or1k_add_breakpoint(struct target *target,
                                          (uint8_t *)&or1k_trap_insn);
 
        if (retval != ERROR_OK) {
-               LOG_ERROR("Error while writing OR1K_TRAP_INSTR at 0x%08x",
+               LOG_ERROR("Error while writing OR1K_TRAP_INSTR at 0x%08" PRIx32,
                           breakpoint->address);
                return retval;
        }
@@ -980,7 +980,7 @@ static int or1k_remove_breakpoint(struct target *target,
        struct or1k_common *or1k = target_to_or1k(target);
        struct or1k_du *du_core = or1k_to_du(or1k);
 
-       LOG_DEBUG("Removing breakpoint: addr 0x%08x, len %d, type %d, set: %d, id: %d",
+       LOG_DEBUG("Removing breakpoint: addr 0x%08" PRIx32 ", len %d, type %d, set: %d, id: %" PRId32,
                  breakpoint->address, breakpoint->length, breakpoint->type,
                  breakpoint->set, breakpoint->unique_id);
 
@@ -996,7 +996,7 @@ static int or1k_remove_breakpoint(struct target *target,
                                          breakpoint->orig_instr);
 
        if (retval != ERROR_OK) {
-               LOG_ERROR("Error while writing back the instruction at 0x%08x",
+               LOG_ERROR("Error while writing back the instruction at 0x%08" PRIx32,
                           breakpoint->address);
                return retval;
        }
@@ -1032,7 +1032,7 @@ static int or1k_read_memory(struct target *target, uint32_t address,
        struct or1k_common *or1k = target_to_or1k(target);
        struct or1k_du *du_core = or1k_to_du(or1k);
 
-       LOG_DEBUG("Read memory at 0x%08x, size: %d, count: 0x%08x", address, size, count);
+       LOG_DEBUG("Read memory at 0x%08" PRIx32 ", size: %" PRIu32 ", count: 0x%08" PRIx32, address, size, count);
 
        if (target->state != TARGET_HALTED) {
                LOG_ERROR("Target not halted");
@@ -1090,7 +1090,7 @@ static int or1k_write_memory(struct target *target, uint32_t address,
        struct or1k_common *or1k = target_to_or1k(target);
        struct or1k_du *du_core = or1k_to_du(or1k);
 
-       LOG_DEBUG("Write memory at 0x%08x, size: %d, count: 0x%08x", address, size, count);
+       LOG_DEBUG("Write memory at 0x%08" PRIx32 ", size: %" PRIu32 ", count: 0x%08" PRIx32, address, size, count);
 
        if (target->state != TARGET_HALTED) {
                LOG_WARNING("Target not halted");
@@ -1377,7 +1377,7 @@ COMMAND_HANDLER(or1k_addreg_command_handler)
 
        or1k_add_reg(target, &new_reg);
 
-       LOG_DEBUG("Add reg \"%s\" @ 0x%08x, group \"%s\", feature \"%s\"",
+       LOG_DEBUG("Add reg \"%s\" @ 0x%08" PRIx32 ", group \"%s\", feature \"%s\"",
                  new_reg.name, addr, new_reg.group, new_reg.feature);
 
        return ERROR_OK;
index d0cc7f88b13dc3d1678c62e032431560840f621b..c3aceff1443facd8dd992b3d19051396d299897f 100644 (file)
@@ -283,7 +283,7 @@ static int adbg_ctrl_write(struct or1k_jtag *jtag_info, uint8_t regidx,
        uint32_t opcode;
        uint32_t opcode_len;
 
-       LOG_DEBUG("Write control register %d: 0x%08x", regidx, cmd_data[0]);
+       LOG_DEBUG("Write control register %" PRId8 ": 0x%08" PRIx32, regidx, cmd_data[0]);
 
        int retval = adbg_select_ctrl_reg(jtag_info, regidx);
        if (retval != ERROR_OK) {
@@ -419,7 +419,7 @@ static int adbg_wb_burst_read(struct or1k_jtag *jtag_info, int size,
        int retval;
        uint8_t opcode;
 
-       LOG_DEBUG("Doing burst read, word size %d, word count %d, start address 0x%08x",
+       LOG_DEBUG("Doing burst read, word size %d, word count %d, start address 0x%08" PRIx32,
                  size, count, start_address);
 
        /* Select the appropriate opcode */
@@ -508,7 +508,7 @@ retry_read_full:
                crc_calc = adbg_compute_crc(crc_calc, data[i], 8);
 
        if (crc_calc != crc_read) {
-               LOG_WARNING("CRC ERROR! Computed 0x%08x, read CRC 0x%08x", crc_calc, crc_read);
+               LOG_WARNING("CRC ERROR! Computed 0x%08" PRIx32 ", read CRC 0x%08" PRIx32, crc_calc, crc_read);
                if (retry_full_crc++ < MAX_READ_CRC_RETRY)
                        goto retry_read_full;
                else {
@@ -540,7 +540,7 @@ retry_read_full:
                                goto out;
 
                        addr = (err_data[0] >> 1) | (err_data[1] << 31);
-                       LOG_WARNING("WB bus error during burst read, address 0x%08x, retrying!", addr);
+                       LOG_WARNING("WB bus error during burst read, address 0x%08" PRIx32 ", retrying!", addr);
 
                        bus_error_retries++;
                        if (bus_error_retries > MAX_BUS_ERRORS) {
@@ -656,7 +656,7 @@ retry_full_write:
                return retval;
 
        if (!value) {
-               LOG_WARNING("CRC ERROR! match bit after write is %i (computed CRC 0x%08x)", value, crc_calc);
+               LOG_WARNING("CRC ERROR! match bit after write is %" PRIi8 " (computed CRC 0x%08" PRIx32 ")", value, crc_calc);
                if (retry_full_crc++ < MAX_WRITE_CRC_RETRY)
                        goto retry_full_write;
                else
@@ -684,7 +684,7 @@ retry_full_write:
                                return retval;
 
                        addr = (err_data[0] >> 1) | (err_data[1] << 31);
-                       LOG_WARNING("WB bus error during burst write, address 0x%08x, retrying!", addr);
+                       LOG_WARNING("WB bus error during burst write, address 0x%08" PRIx32 ", retrying!", addr);
 
                        bus_error_retries++;
                        if (bus_error_retries > MAX_BUS_ERRORS) {
@@ -831,7 +831,7 @@ static int or1k_adv_cpu_reset(struct or1k_jtag *jtag_info, int action)
 static int or1k_adv_jtag_read_memory(struct or1k_jtag *jtag_info,
                            uint32_t addr, uint32_t size, int count, uint8_t *buffer)
 {
-       LOG_DEBUG("Reading WB%d at 0x%08x", size * 8, addr);
+       LOG_DEBUG("Reading WB%" PRId32 " at 0x%08" PRIx32, size * 8, addr);
 
        int retval;
        if (!jtag_info->or1k_jtag_inited) {
@@ -869,7 +869,7 @@ static int or1k_adv_jtag_read_memory(struct or1k_jtag *jtag_info,
 static int or1k_adv_jtag_write_memory(struct or1k_jtag *jtag_info,
                             uint32_t addr, uint32_t size, int count, const uint8_t *buffer)
 {
-       LOG_DEBUG("Writing WB%d at 0x%08x", size * 8, addr);
+       LOG_DEBUG("Writing WB%" PRId32 " at 0x%08" PRIx32, size * 8, addr);
 
        int retval;
        if (!jtag_info->or1k_jtag_inited) {
index 7d262720985ba83c2f4b721c2180bc862831eb5a..513d8a74cf273ab7d1f9c49897815fc63c704af1 100644 (file)
@@ -218,9 +218,9 @@ static int or1k_tap_vjtag_init(struct or1k_jtag *jtag_info)
        LOG_DEBUG("SLD HUB Configuration register");
        LOG_DEBUG("------------------------------");
        LOG_DEBUG("m_width         = %d", m_width);
-       LOG_DEBUG("manufacturer_id = 0x%02x", MANUF(hub_info));
+       LOG_DEBUG("manufacturer_id = 0x%02" PRIx32, MANUF(hub_info));
        LOG_DEBUG("nb_of_node      = %d", nb_nodes);
-       LOG_DEBUG("version         = %d", VER(hub_info));
+       LOG_DEBUG("version         = %" PRId32, VER(hub_info));
        LOG_DEBUG("VIR length      = %d", guess_addr_width(nb_nodes) + m_width);
 
        /* Because the number of SLD nodes is now known, the Nodes on the hub can be
@@ -259,11 +259,11 @@ static int or1k_tap_vjtag_init(struct or1k_jtag *jtag_info)
 
                LOG_DEBUG("Node info register");
                LOG_DEBUG("--------------------");
-               LOG_DEBUG("instance_id     = %d", ID(node_info));
-               LOG_DEBUG("manufacturer_id = 0x%02x", MANUF(node_info));
-               LOG_DEBUG("node_id         = %d (%s)", ID(node_info),
+               LOG_DEBUG("instance_id     = %" PRId32, ID(node_info));
+               LOG_DEBUG("manufacturer_id = 0x%02" PRIx32, MANUF(node_info));
+               LOG_DEBUG("node_id         = %" PRId32 " (%s)", ID(node_info),
                                                       id_to_string(ID(node_info)));
-               LOG_DEBUG("version         = %d", VER(node_info));
+               LOG_DEBUG("version         = %" PRId32, VER(node_info));
 
                if (ID(node_info) == VJTAG_NODE_ID)
                        vjtag_node_address = node_index + 1;