mirror of
https://github.com/openocd-org/openocd.git
synced 2025-10-14 02:58:23 +08:00
Compare commits
10 Commits
443139db00
...
56d67dac2e
Author | SHA1 | Date | |
---|---|---|---|
![]() |
56d67dac2e | ||
![]() |
f381945567 | ||
![]() |
65b886812b | ||
![]() |
23ab2062e7 | ||
![]() |
4e493229c6 | ||
![]() |
160e2343bd | ||
![]() |
7e403d9d3b | ||
![]() |
93f16eed4d | ||
![]() |
7effc6f825 | ||
![]() |
fe0080478b |
@@ -113,7 +113,7 @@ FLASH_BANK_COMMAND_HANDLER(max32xxx_flash_bank_command)
|
||||
return ERROR_FLASH_BANK_INVALID;
|
||||
}
|
||||
|
||||
info = calloc(sizeof(struct max32xxx_flash_bank), 1);
|
||||
info = calloc(1, sizeof(struct max32xxx_flash_bank));
|
||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], info->flash_size);
|
||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[6], info->flc_base);
|
||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[7], info->sector_size);
|
||||
|
@@ -45,26 +45,22 @@ static enum command_mode get_command_mode(Jim_Interp *interp, const char *cmd_na
|
||||
/* set of functions to wrap jimtcl internal data */
|
||||
static inline bool jimcmd_is_proc(Jim_Cmd *cmd)
|
||||
{
|
||||
#if defined(JIM_CMD_ISPROC)
|
||||
// JIM_VERSION >= 84
|
||||
return cmd->flags & JIM_CMD_ISPROC;
|
||||
#else
|
||||
return cmd->isproc;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool jimcmd_is_oocd_command(Jim_Cmd *cmd)
|
||||
{
|
||||
return !cmd->isproc && cmd->u.native.cmdProc == jim_command_dispatch;
|
||||
return !jimcmd_is_proc(cmd) && cmd->u.native.cmdProc == jim_command_dispatch;
|
||||
}
|
||||
|
||||
void *jimcmd_privdata(Jim_Cmd *cmd)
|
||||
{
|
||||
return cmd->isproc ? NULL : cmd->u.native.privData;
|
||||
}
|
||||
|
||||
static int command_retval_set(Jim_Interp *interp, int retval)
|
||||
{
|
||||
int *return_retval = Jim_GetAssocData(interp, "retval");
|
||||
if (return_retval)
|
||||
*return_retval = retval;
|
||||
|
||||
return (retval == ERROR_OK) ? JIM_OK : retval;
|
||||
return jimcmd_is_proc(cmd) ? NULL : cmd->u.native.privData;
|
||||
}
|
||||
|
||||
extern struct command_context *global_cmd_ctx;
|
||||
@@ -421,7 +417,7 @@ static bool command_can_run(struct command_context *cmd_ctx, struct command *c,
|
||||
return false;
|
||||
}
|
||||
|
||||
static int exec_command(Jim_Interp *interp, struct command_context *context,
|
||||
static int jim_exec_command(Jim_Interp *interp, struct command_context *context,
|
||||
struct command *c, int argc, Jim_Obj * const *argv)
|
||||
{
|
||||
/* use c->handler */
|
||||
@@ -470,7 +466,15 @@ static int exec_command(Jim_Interp *interp, struct command_context *context,
|
||||
Jim_DecrRefCount(context->interp, cmd.output);
|
||||
|
||||
free(words);
|
||||
return command_retval_set(interp, retval);
|
||||
|
||||
if (retval == ERROR_OK)
|
||||
return JIM_OK;
|
||||
|
||||
// used by telnet server to close one connection
|
||||
if (retval == ERROR_COMMAND_CLOSE_CONNECTION)
|
||||
return JIM_EXIT;
|
||||
|
||||
return JIM_ERR;
|
||||
}
|
||||
|
||||
int command_run_line(struct command_context *context, char *line)
|
||||
@@ -480,7 +484,6 @@ int command_run_line(struct command_context *context, char *line)
|
||||
* results
|
||||
*/
|
||||
/* run the line thru a script engine */
|
||||
int retval = ERROR_FAIL;
|
||||
int retcode;
|
||||
/* Beware! This code needs to be reentrant. It is also possible
|
||||
* for OpenOCD commands to be invoked directly from Tcl. This would
|
||||
@@ -495,20 +498,17 @@ int command_run_line(struct command_context *context, char *line)
|
||||
Jim_DeleteAssocData(interp, "context");
|
||||
retcode = Jim_SetAssocData(interp, "context", NULL, context);
|
||||
if (retcode == JIM_OK) {
|
||||
/* associated the return value */
|
||||
Jim_DeleteAssocData(interp, "retval");
|
||||
retcode = Jim_SetAssocData(interp, "retval", NULL, &retval);
|
||||
if (retcode == JIM_OK) {
|
||||
retcode = Jim_Eval_Named(interp, line, NULL, 0);
|
||||
|
||||
Jim_DeleteAssocData(interp, "retval");
|
||||
}
|
||||
retcode = Jim_Eval_Named(interp, line, NULL, 0);
|
||||
Jim_DeleteAssocData(interp, "context");
|
||||
int inner_retcode = Jim_SetAssocData(interp, "context", NULL, old_context);
|
||||
if (retcode == JIM_OK)
|
||||
retcode = inner_retcode;
|
||||
}
|
||||
context->current_target_override = saved_target_override;
|
||||
|
||||
if (retcode == JIM_RETURN)
|
||||
retcode = interp->returnCode;
|
||||
|
||||
if (retcode == JIM_OK) {
|
||||
const char *result;
|
||||
int reslen;
|
||||
@@ -518,25 +518,19 @@ int command_run_line(struct command_context *context, char *line)
|
||||
command_output_text(context, result);
|
||||
command_output_text(context, "\n");
|
||||
}
|
||||
retval = ERROR_OK;
|
||||
} else if (retcode == JIM_EXIT) {
|
||||
/* ignore.
|
||||
* exit(Jim_GetExitCode(interp)); */
|
||||
} else if (retcode == ERROR_COMMAND_CLOSE_CONNECTION) {
|
||||
return retcode;
|
||||
} else {
|
||||
Jim_MakeErrorMessage(interp);
|
||||
/* error is broadcast */
|
||||
LOG_USER("%s", Jim_GetString(Jim_GetResult(interp), NULL));
|
||||
|
||||
if (retval == ERROR_OK) {
|
||||
/* It wasn't a low level OpenOCD command that failed */
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
return retval;
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
return retval;
|
||||
if (retcode == JIM_EXIT) {
|
||||
// used by telnet server to close one connection
|
||||
return ERROR_COMMAND_CLOSE_CONNECTION;
|
||||
}
|
||||
|
||||
Jim_MakeErrorMessage(interp);
|
||||
/* error is broadcast */
|
||||
LOG_USER("%s", Jim_GetString(Jim_GetResult(interp), NULL));
|
||||
|
||||
return ERROR_FAIL;
|
||||
}
|
||||
|
||||
int command_run_linef(struct command_context *context, const char *format, ...)
|
||||
@@ -863,7 +857,7 @@ static int jim_command_dispatch(Jim_Interp *interp, int argc, Jim_Obj * const *a
|
||||
if (c->jim_override_target)
|
||||
cmd_ctx->current_target_override = c->jim_override_target;
|
||||
|
||||
int retval = exec_command(interp, cmd_ctx, c, argc, argv);
|
||||
int retval = jim_exec_command(interp, cmd_ctx, c, argc, argv);
|
||||
|
||||
if (c->jim_override_target)
|
||||
cmd_ctx->current_target_override = saved_target_override;
|
||||
|
@@ -152,6 +152,21 @@ int win_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct time
|
||||
FD_ZERO(&sock_write);
|
||||
FD_ZERO(&sock_except);
|
||||
|
||||
/* On Windows, if all provided sets are empty/NULL an error code of -1 is returned
|
||||
* and WSAGetLastError() returns WSAEINVAL instead of delaying.
|
||||
* We check for this case, delay and return 0 instead of calling select(). */
|
||||
if (rfds && rfds->fd_count == 0)
|
||||
rfds = NULL;
|
||||
if (wfds && wfds->fd_count == 0)
|
||||
wfds = NULL;
|
||||
if (efds && efds->fd_count == 0)
|
||||
efds = NULL;
|
||||
if (!rfds && !wfds && !efds && tv) {
|
||||
sleep(tv->tv_sec);
|
||||
usleep(tv->tv_usec);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* build an array of handles for non-sockets */
|
||||
for (i = 0; i < max_fd; i++) {
|
||||
if (SAFE_FD_ISSET(i, rfds) || SAFE_FD_ISSET(i, wfds) || SAFE_FD_ISSET(i, efds)) {
|
||||
|
@@ -39,7 +39,7 @@ proc find {filename} {
|
||||
return $t
|
||||
}
|
||||
|
||||
foreach vendor {nordic ti st} {
|
||||
foreach vendor {nordic ti sifive st} {
|
||||
# - path/to/a/certain/config_file
|
||||
# replaced with
|
||||
# - path/to/a/certain/${vendor}/config_file
|
||||
|
@@ -43,10 +43,10 @@ enum shutdown_reason {
|
||||
SHUTDOWN_WITH_ERROR_CODE, /* set by shutdown command; quit with non-zero return code */
|
||||
SHUTDOWN_WITH_SIGNAL_CODE /* set by sig_handler; exec shutdown then exit with signal as return code */
|
||||
};
|
||||
static enum shutdown_reason shutdown_openocd = CONTINUE_MAIN_LOOP;
|
||||
|
||||
static volatile sig_atomic_t shutdown_openocd = CONTINUE_MAIN_LOOP;
|
||||
/* store received signal to exit application by killing ourselves */
|
||||
static int last_signal;
|
||||
static volatile sig_atomic_t last_signal;
|
||||
|
||||
/* set the polling period to 100ms */
|
||||
static int polling_period = 100;
|
||||
@@ -604,6 +604,7 @@ static void sig_handler(int sig)
|
||||
/* store only first signal that hits us */
|
||||
if (shutdown_openocd == CONTINUE_MAIN_LOOP) {
|
||||
shutdown_openocd = SHUTDOWN_WITH_SIGNAL_CODE;
|
||||
assert(sig >= SIG_ATOMIC_MIN && sig <= SIG_ATOMIC_MAX);
|
||||
last_signal = sig;
|
||||
LOG_DEBUG("Terminating on Signal %d", sig);
|
||||
} else
|
||||
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Be sure you include the speed and interface before this file
|
||||
# Example:
|
||||
# -c "adapter speed 5000" -f "interface/ftdi/olimex-arm-usb-tiny-h.cfg" -f "board/sifive-e31arty.cfg"
|
||||
# -c "adapter speed 5000" -f "interface/ftdi/olimex-arm-usb-tiny-h.cfg" -f "board/sifive/e31-arty.cfg"
|
||||
|
||||
set _CHIPNAME riscv
|
||||
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000001
|
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# Be sure you include the speed and interface before this file
|
||||
# Example:
|
||||
# -c "adapter speed 5000" -f "interface/ftdi/olimex-arm-usb-tiny-h.cfg" -f "board/sifive-e51arty.cfg"
|
||||
# -c "adapter speed 5000" -f "interface/ftdi/olimex-arm-usb-tiny-h.cfg" -f "board/sifive/e51-arty.cfg"
|
||||
|
||||
set _CHIPNAME riscv
|
||||
jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x20000001
|
@@ -19,8 +19,5 @@ set _file_renaming {
|
||||
board/nordic_nrf52_dk.cfg board/nordic/nrf52-dk.cfg
|
||||
board/stm32mp13x_dk.cfg board/st/stm32mp135f-dk.cfg
|
||||
board/stm32mp15x_dk2.cfg board/st/stm32mp157f-dk2.cfg
|
||||
target/nrf51.cfg target/nordic/nrf51.cfg
|
||||
target/nrf52.cfg target/nordic/nrf52.cfg
|
||||
target/nrf53.cfg target/nordic/nrf53.cfg
|
||||
target/nrf91.cfg target/nordic/nrf91.cfg
|
||||
board/sifive-hifive1-revb.cfg board/sifive/hifive1-rev-b.cfg
|
||||
}
|
||||
|
48
tcl/target/qualcomm/qcs6490.cfg
Normal file
48
tcl/target/qualcomm/qcs6490.cfg
Normal file
@@ -0,0 +1,48 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#
|
||||
# The QCS6490/QCM6490 is a 6nm processor designed for enterprise and Internet of Things (IOT) applications,
|
||||
# featuring global 5G and Wi-Fi 6E support
|
||||
#
|
||||
# Product Page:
|
||||
# https://www.qualcomm.com/products/internet-of-things/industrial/building-enterprise/qcs6490
|
||||
# https://www.qualcomm.com/products/internet-of-things/industrial/building-enterprise/qcm6490
|
||||
|
||||
source [find target/swj-dp.tcl]
|
||||
|
||||
if { [info exists CHIPNAME] } {
|
||||
set _CHIPNAME $CHIPNAME
|
||||
} else {
|
||||
set _CHIPNAME QCS6490
|
||||
}
|
||||
|
||||
if { [info exists ENDIAN] } {
|
||||
set _ENDIAN $ENDIAN
|
||||
} else {
|
||||
set _ENDIAN little
|
||||
}
|
||||
|
||||
adapter speed 500
|
||||
reset_config trst_and_srst
|
||||
|
||||
# Set CUP TAP ID based on protocol selection
|
||||
if { [using_jtag] } {
|
||||
set _CPUTAPID 0x5ba00477
|
||||
} else {
|
||||
set _CPUTAPID 0x5ba02477
|
||||
}
|
||||
|
||||
swj_newdap $_CHIPNAME cpu -expected-id $_CPUTAPID -irlen 4
|
||||
|
||||
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu -ignore-syspwrupack
|
||||
|
||||
cti create $_CHIPNAME.cti -dap $_CHIPNAME.dap -baseaddr 0x87020000 -ap-num 1
|
||||
|
||||
target create $_CHIPNAME.cpu0 aarch64 -endian $_ENDIAN -dap $_CHIPNAME.dap -coreid 0 \
|
||||
-dbgbase 0x87010000 -cti $_CHIPNAME.cti -event reset-assert-post { dap init }
|
||||
|
||||
$_CHIPNAME.cpu0 configure -event examine-end {
|
||||
eval $_CHIPNAME.cpu0 arp_halt
|
||||
}
|
||||
|
||||
# Default breakpoints to hardware breakpoints
|
||||
gdb_breakpoint_override hard
|
86
tcl/target/rk3588.cfg
Normal file
86
tcl/target/rk3588.cfg
Normal file
@@ -0,0 +1,86 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Rockchip RK3588 Target
|
||||
# https://www.rock-chips.com/a/en/products/RK35_Series/2022/0926/1660.html
|
||||
# Andreas Dannenberg <andre@miauco.com>
|
||||
|
||||
if { [info exists CHIPNAME] } {
|
||||
set _CHIPNAME $CHIPNAME
|
||||
} else {
|
||||
set _CHIPNAME rk3588
|
||||
}
|
||||
|
||||
if { [info exists DAP_TAPID] } {
|
||||
set _DAP_TAPID $DAP_TAPID
|
||||
} else {
|
||||
set _DAP_TAPID 0x2ba01477
|
||||
}
|
||||
|
||||
adapter speed 4000
|
||||
|
||||
transport select swd
|
||||
|
||||
# Declare the one SWD tap to access the DAP
|
||||
swd newdap $_CHIPNAME cpu -expected-id $_DAP_TAPID
|
||||
|
||||
# Create the DAP
|
||||
dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.cpu
|
||||
|
||||
# Create target to allow accessing system memory directly
|
||||
target create $_CHIPNAME.ahb mem_ap -dap $_CHIPNAME.dap -ap-num 0
|
||||
|
||||
# Declare the 8 main application cores (4 little cores + 4 big cores)
|
||||
|
||||
# Little cluster (cores 0..3)
|
||||
set _TARGETNAME $_CHIPNAME.lcore
|
||||
set $_TARGETNAME.base(0) 0x81004000
|
||||
set $_TARGETNAME.base(1) 0x81005000
|
||||
set $_TARGETNAME.base(2) 0x81006000
|
||||
set $_TARGETNAME.base(3) 0x81007000
|
||||
set $_TARGETNAME.cti(0) 0x81014000
|
||||
set $_TARGETNAME.cti(1) 0x81015000
|
||||
set $_TARGETNAME.cti(2) 0x81016000
|
||||
set $_TARGETNAME.cti(3) 0x81017000
|
||||
|
||||
# Big cluster (cores 4..7)
|
||||
set _TARGETNAME $_CHIPNAME.bcore
|
||||
set $_TARGETNAME.base(4) 0x81024000
|
||||
set $_TARGETNAME.base(5) 0x81025000
|
||||
set $_TARGETNAME.base(6) 0x81026000
|
||||
set $_TARGETNAME.base(7) 0x81027000
|
||||
set $_TARGETNAME.cti(4) 0x81034000
|
||||
set $_TARGETNAME.cti(5) 0x81035000
|
||||
set $_TARGETNAME.cti(6) 0x81036000
|
||||
set $_TARGETNAME.cti(7) 0x81037000
|
||||
|
||||
# Build string used to enable SMP mode
|
||||
set _smp_command "target smp"
|
||||
|
||||
set _cores 8
|
||||
for { set _core 0 } { $_core < $_cores } { incr _core 1 } {
|
||||
if {$_core < 4} {
|
||||
set _TARGETNAME $_CHIPNAME.lcore
|
||||
} else {
|
||||
set _TARGETNAME $_CHIPNAME.bcore
|
||||
}
|
||||
|
||||
cti create cti$_core -dap $_CHIPNAME.dap -baseaddr [set $_TARGETNAME.cti($_core)] -ap-num 0
|
||||
|
||||
target create ${_TARGETNAME}$_core aarch64 \
|
||||
-dap $_CHIPNAME.dap -coreid $_core -cti cti$_core \
|
||||
-dbgbase [set $_TARGETNAME.base($_core)]
|
||||
|
||||
if { $_core != 0 } {
|
||||
# non-boot core examination may fail
|
||||
${_TARGETNAME}$_core configure -defer-examine
|
||||
} else {
|
||||
# uncomment to use hardware threads pseudo rtos
|
||||
# ${_TARGETNAME}$_core configure -rtos hwthread
|
||||
}
|
||||
|
||||
set _smp_command "$_smp_command ${_TARGETNAME}$_core"
|
||||
}
|
||||
|
||||
eval $_smp_command
|
||||
|
||||
# Set default target to boot core
|
||||
targets $_CHIPNAME.lcore0
|
@@ -32,7 +32,7 @@ namespace eval testing_helpers {
|
||||
}
|
||||
|
||||
proc check_syntax_err script {
|
||||
tailcall check_for_error -601 {} $script
|
||||
tailcall check_for_error 1 {} $script
|
||||
}
|
||||
|
||||
proc check_matches {pattern script} {
|
||||
|
Reference in New Issue
Block a user