Skip to content

Commit

Permalink
Merge pull request #5 from kendryte/dev
Browse files Browse the repository at this point in the history
[Release] v0.2.2
  • Loading branch information
Alinshans authored Jan 17, 2019
2 parents f4d3ecf + eb862f2 commit 9e5700d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Also you can get them on Kendryte website: https://kendryte.com

## Configuration for K210

We have provided a template configuration for JLink in `tcl/kendryte.cfg`, if you are using other JTAG devices, please modify it yourself.
We have provided a template configuration for J-Link in `tcl/kendryte.cfg`, if you are using other JTAG emulators, please modify it yourself.

## Compiling and build

Expand Down
2 changes: 1 addition & 1 deletion src/openocd.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"| . \\ __/ | | | (_| | | | |_| | || __/ \n" \
"|_|\\_\\___|_| |_|\\__,_|_| \\__, |\\__\\___| \n" \
" |___/ \n" \
"Kendryte Open On-Chip Debugger For RISC-V v0.2.1 (2019-01-09)"
"Kendryte Open On-Chip Debugger For RISC-V v0.2.2 (2019-01-17)"

static const char openocd_startup_tcl[] = {
#include "startup_tcl.inc"
Expand Down
32 changes: 19 additions & 13 deletions src/target/riscv/riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -736,27 +736,30 @@ static int old_or_new_riscv_resume(
return riscv_openocd_resume(target, current, address, handle_breakpoints, debug_execution);
}

static void riscv_select_current_hart(struct target *target)
static int riscv_read_buffer(struct target *target, target_addr_t address,
uint32_t size, uint8_t *buffer)
{
RISCV_INFO(r);
if (r->rtos_hartid != -1 && riscv_rtos_enabled(target))
riscv_set_current_hartid(target, r->rtos_hartid);
else
riscv_set_current_hartid(target, target->coreid);
struct target_type *tt = get_target_type(target);
return tt->read_memory(target, address, 4, size / 4 , buffer);
}

static int riscv_write_buffer(struct target *target, target_addr_t address,
uint32_t size, const uint8_t *buffer)
{
struct target_type *tt = get_target_type(target);
return tt->write_memory(target, address, 4, size / 4, buffer);
}

static int riscv_read_memory(struct target *target, target_addr_t address,
uint32_t size, uint32_t count, uint8_t *buffer)
{
//riscv_select_current_hart(target);
struct target_type *tt = get_target_type(target);
return tt->read_memory(target, address, size, count, buffer);
}

static int riscv_write_memory(struct target *target, target_addr_t address,
uint32_t size, uint32_t count, const uint8_t *buffer)
{
//riscv_select_current_hart(target);
struct target_type *tt = get_target_type(target);
return tt->write_memory(target, address, size, count, buffer);
}
Expand All @@ -768,11 +771,10 @@ static int riscv_get_gdb_reg_list(struct target *target,
RISCV_INFO(r);
KENDRYTE_LOG_D("hartid:%d, type:%s", r->current_hartid, reg_class == REG_CLASS_GENERAL ? "general" : "all");

/*if (!r->is_halted(target))
if (!r->is_halted(target))
{
LOG_INFO("target is not halted, halt all hart");
r->halt_all_hart(target);
}*/
}

LOG_DEBUG("reg_class=%d", reg_class);
LOG_DEBUG("rtos_hartid=%d current_hartid=%d", r->rtos_hartid, r->current_hartid);
Expand Down Expand Up @@ -1139,6 +1141,7 @@ int riscv_openocd_step(
return out;
}


/* Command Handlers */
COMMAND_HANDLER(riscv_set_command_timeout_sec)
{
Expand Down Expand Up @@ -1343,6 +1346,9 @@ struct target_type riscv_target = {
.assert_reset = riscv_assert_reset,
.deassert_reset = riscv_deassert_reset,

.read_buffer = riscv_read_buffer,
.write_buffer = riscv_write_buffer,

.read_memory = riscv_read_memory,
.write_memory = riscv_write_memory,

Expand Down Expand Up @@ -1580,7 +1586,7 @@ int riscv_set_register_on_hart(struct target *target, int hartid,
enum gdb_regno regid, uint64_t value)
{
RISCV_INFO(r);
//LOG_INFO("[%d] %s <- %" PRIx64, hartid, gdb_regno_name(regid), value);
LOG_DEBUG("[%d] %s <- %" PRIx64, hartid, gdb_regno_name(regid), value);
assert(r->set_register);
return r->set_register(target, hartid, regid, value);
}
Expand All @@ -1597,7 +1603,7 @@ int riscv_get_register_on_hart(struct target *target, riscv_reg_t *value,
{
RISCV_INFO(r);
int result = r->get_register(target, value, hartid, regid);
//LOG_INFO("[%d] %s: %" PRIx64, hartid, gdb_regno_name(regid), *value);
LOG_DEBUG("[%d] %s: %" PRIx64, hartid, gdb_regno_name(regid), *value);
return result;
}

Expand Down

0 comments on commit 9e5700d

Please sign in to comment.