mips_ejtag.c: disable DMA for all platforms
[openocd.git] / src / target / nds32.c
index 4d2564975d841dfa78a5e45f8dc96d41f43319b9..2295763addc9e9864ae45c5ca33a673e8e70b49a 100644 (file)
@@ -86,7 +86,7 @@ static int nds32_get_core_reg(struct reg *reg)
        }
 
        if (reg->valid) {
-               LOG_DEBUG("reading register(cached) %i(%s), value: 0x%8.8" PRIx32,
+               LOG_DEBUG("reading register(cached) %" PRIi32 "(%s), value: 0x%8.8" PRIx32,
                                reg_arch_info->num, reg->name, reg_arch_info->value);
                return ERROR_OK;
        }
@@ -110,7 +110,7 @@ static int nds32_get_core_reg(struct reg *reg)
                                        mapped_regnum, &(reg_arch_info->value));
                }
 
-               LOG_DEBUG("reading register %i(%s), value: 0x%8.8" PRIx32,
+               LOG_DEBUG("reading register %" PRIi32 "(%s), value: 0x%8.8" PRIx32,
                                reg_arch_info->num, reg->name, reg_arch_info->value);
        }
 
@@ -309,7 +309,7 @@ static int nds32_set_core_reg(struct reg *reg, uint8_t *buf)
        if (nds32_reg_exception(mapped_regnum, value))
                return ERROR_OK;
 
-       LOG_DEBUG("writing register %i(%s) with value 0x%8.8" PRIx32,
+       LOG_DEBUG("writing register %" PRIi32 "(%s) with value 0x%8.8" PRIx32,
                        reg_arch_info->num, reg->name, value);
 
        if ((nds32->fpu_enable == false) &&
@@ -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)
@@ -1572,7 +1572,7 @@ int nds32_edm_config(struct nds32 *nds32)
        aice_read_debug_reg(aice, NDS_EDM_SR_EDM_CFG, &edm_cfg);
 
        nds32->edm.version = (edm_cfg >> 16) & 0xFFFF;
-       LOG_INFO("EDM version 0x%04" PRIx32, nds32->edm.version);
+       LOG_INFO("EDM version 0x%04x", nds32->edm.version);
 
        nds32->edm.breakpoint_num = (edm_cfg & 0x7) + 1;
 
@@ -2008,7 +2008,7 @@ int nds32_login(struct nds32 *nds32)
                        code_str[copy_length] = '\0';
                        code = strtoul(code_str, NULL, 16);
 
-                       sprintf(command_str, "write_misc gen_port0 0x%x;", code);
+                       sprintf(command_str, "write_misc gen_port0 0x%" PRIx32 ";", code);
                        strcat(command_sequence, command_str);
                }
 
@@ -2033,7 +2033,7 @@ int nds32_login(struct nds32 *nds32)
                        else
                                return ERROR_FAIL;
 
-                       sprintf(command_str, "write_misc %s 0x%x;", reg_name, code);
+                       sprintf(command_str, "write_misc %s 0x%" PRIx32 ";", reg_name, code);
                        if (ERROR_OK != aice_program_edm(aice, command_str))
                                return ERROR_FAIL;
                }
@@ -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 %08x  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);
@@ -2164,6 +2166,27 @@ int nds32_resume(struct target *target, int current,
        return ERROR_OK;
 }
 
+static int nds32_soft_reset_halt(struct target *target)
+{
+       /* TODO: test it */
+       struct nds32 *nds32 = target_to_nds32(target);
+       struct aice_port_s *aice = target_to_aice(target);
+
+       aice_assert_srst(aice, AICE_SRST);
+
+       /* halt core and set pc to 0x0 */
+       int retval = target_halt(target);
+       if (retval != ERROR_OK)
+               return retval;
+
+       /* start fetching from IVB */
+       uint32_t value_ir3;
+       nds32_get_mapped_reg(nds32, IR3, &value_ir3);
+       nds32_set_mapped_reg(nds32, PC, value_ir3 & 0xFFFF0000);
+
+       return ERROR_OK;
+}
+
 int nds32_assert_reset(struct target *target)
 {
        struct nds32 *nds32 = target_to_nds32(target);
@@ -2177,7 +2200,7 @@ int nds32_assert_reset(struct target *target)
                                && (cpu_version->revision == 0x1C)
                                && (cpu_version->cpu_id_family == 0xC)
                                && (cpu_version->cpu_id_version == 0x0)))
-                       target->type->soft_reset_halt(target);
+                       nds32_soft_reset_halt(target);
                else
                        aice_assert_srst(aice, AICE_RESET_HOLD);
        } else {
@@ -2198,7 +2221,7 @@ int nds32_assert_reset(struct target *target)
 
 static int nds32_gdb_attach(struct nds32 *nds32)
 {
-       LOG_DEBUG("nds32_gdb_attach, target coreid: %d", nds32->target->coreid);
+       LOG_DEBUG("nds32_gdb_attach, target coreid: %" PRId32, nds32->target->coreid);
 
        if (nds32->attached == false) {
 
@@ -2297,7 +2320,7 @@ int nds32_get_gdb_fileio_info(struct target *target, struct gdb_fileio_info *fil
        syscall_id = (value_ir6 >> 16) & 0x7FFF;
        nds32->active_syscall_id = syscall_id;
 
-       LOG_DEBUG("hit syscall ID: 0x%x", syscall_id);
+       LOG_DEBUG("hit syscall ID: 0x%" PRIx32, syscall_id);
 
        /* free previous identifier storage */
        if (NULL != fileio_info->identifier) {
@@ -2444,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);

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)