You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(75) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(70) |
Feb
(20) |
Mar
(52) |
Apr
(149) |
May
(387) |
Jun
(466) |
Jul
(133) |
Aug
(87) |
Sep
(122) |
Oct
(140) |
Nov
(185) |
Dec
(105) |
2010 |
Jan
(85) |
Feb
(45) |
Mar
(75) |
Apr
(17) |
May
(41) |
Jun
(52) |
Jul
(33) |
Aug
(29) |
Sep
(36) |
Oct
(15) |
Nov
(26) |
Dec
(34) |
2011 |
Jan
(26) |
Feb
(25) |
Mar
(26) |
Apr
(29) |
May
(20) |
Jun
(27) |
Jul
(15) |
Aug
(32) |
Sep
(13) |
Oct
(64) |
Nov
(60) |
Dec
(10) |
2012 |
Jan
(64) |
Feb
(63) |
Mar
(39) |
Apr
(43) |
May
(54) |
Jun
(11) |
Jul
(30) |
Aug
(45) |
Sep
(11) |
Oct
(70) |
Nov
(24) |
Dec
(23) |
2013 |
Jan
(17) |
Feb
(8) |
Mar
(35) |
Apr
(40) |
May
(20) |
Jun
(24) |
Jul
(36) |
Aug
(25) |
Sep
(42) |
Oct
(40) |
Nov
(9) |
Dec
(21) |
2014 |
Jan
(29) |
Feb
(24) |
Mar
(60) |
Apr
(22) |
May
(22) |
Jun
(46) |
Jul
(11) |
Aug
(23) |
Sep
(26) |
Oct
(10) |
Nov
(14) |
Dec
(2) |
2015 |
Jan
(28) |
Feb
(47) |
Mar
(33) |
Apr
(58) |
May
(5) |
Jun
(1) |
Jul
|
Aug
(8) |
Sep
(12) |
Oct
(25) |
Nov
(58) |
Dec
(21) |
2016 |
Jan
(12) |
Feb
(40) |
Mar
(2) |
Apr
(1) |
May
(67) |
Jun
(2) |
Jul
(5) |
Aug
(36) |
Sep
|
Oct
(24) |
Nov
(17) |
Dec
(50) |
2017 |
Jan
(14) |
Feb
(16) |
Mar
(2) |
Apr
(35) |
May
(14) |
Jun
(16) |
Jul
(3) |
Aug
(3) |
Sep
|
Oct
(19) |
Nov
|
Dec
(16) |
2018 |
Jan
(55) |
Feb
(11) |
Mar
(34) |
Apr
(14) |
May
(4) |
Jun
(20) |
Jul
(39) |
Aug
(16) |
Sep
(17) |
Oct
(16) |
Nov
(20) |
Dec
(30) |
2019 |
Jan
(29) |
Feb
(24) |
Mar
(37) |
Apr
(26) |
May
(19) |
Jun
(21) |
Jul
(2) |
Aug
(3) |
Sep
(9) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
2020 |
Jan
(47) |
Feb
(36) |
Mar
(54) |
Apr
(44) |
May
(37) |
Jun
(19) |
Jul
(32) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(32) |
Dec
(11) |
2021 |
Jan
(14) |
Feb
(5) |
Mar
(40) |
Apr
(32) |
May
(42) |
Jun
(31) |
Jul
(29) |
Aug
(47) |
Sep
(38) |
Oct
(17) |
Nov
(74) |
Dec
(33) |
2022 |
Jan
(11) |
Feb
(15) |
Mar
(40) |
Apr
(21) |
May
(39) |
Jun
(44) |
Jul
(19) |
Aug
(46) |
Sep
(79) |
Oct
(35) |
Nov
(21) |
Dec
(15) |
2023 |
Jan
(56) |
Feb
(13) |
Mar
(43) |
Apr
(28) |
May
(60) |
Jun
(15) |
Jul
(29) |
Aug
(28) |
Sep
(32) |
Oct
(21) |
Nov
(42) |
Dec
(39) |
2024 |
Jan
(35) |
Feb
(17) |
Mar
(28) |
Apr
(7) |
May
(14) |
Jun
(35) |
Jul
(30) |
Aug
(35) |
Sep
(30) |
Oct
(28) |
Nov
(38) |
Dec
(18) |
2025 |
Jan
(21) |
Feb
(28) |
Mar
(36) |
Apr
(35) |
May
(34) |
Jun
(58) |
Jul
(9) |
Aug
(37) |
Sep
|
Oct
|
Nov
|
Dec
|
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-11 17:45:23
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d674018432033ba28f43f22b55d9cd84d3268387 (commit) from 654c18a4089a98afbc788de23b90e6b4b2b49ec4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d674018432033ba28f43f22b55d9cd84d3268387 Author: Joerg Wunsch <op...@ur...> Date: Tue Nov 23 20:49:30 2021 +0100 Add Microchip SAME51 Curiosity Nano board This board is (software wise) similar to the existing SAME54 Xplained Pro board, with just a slightly different MCU. (Hardware wise, it features a vastly different form factor.) Signed-off-by: Jörg Wunsch <op...@ur...> Change-Id: I5e5435d49d333fb74471994ee84de59ed983153c Reviewed-on: https://review.openocd.org/c/openocd/+/6747 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> Reviewed-by: Axel W. Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/tcl/board/microchip_same51_curiosity_nano.cfg b/tcl/board/microchip_same51_curiosity_nano.cfg new file mode 100644 index 000000000..32e288549 --- /dev/null +++ b/tcl/board/microchip_same51_curiosity_nano.cfg @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Microchip SAME51 Curiosity Nano evaluation kit. +# +# https://www.microchip.com/en-us/development-tool/EV76S68A +# + +source [find interface/cmsis-dap.cfg] + +set CHIPNAME same51 + +source [find target/atsame5x.cfg] + +reset_config srst_only ----------------------------------------------------------------------- Summary of changes: tcl/board/microchip_same51_curiosity_nano.cfg | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tcl/board/microchip_same51_curiosity_nano.cfg hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-11 17:44:49
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 654c18a4089a98afbc788de23b90e6b4b2b49ec4 (commit) from d8f64f8e356600557dc03283cce514fc6e75aac5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 654c18a4089a98afbc788de23b90e6b4b2b49ec4 Author: Jan Matyas <ma...@co...> Date: Mon Nov 22 14:50:30 2021 +0100 doc: Updated RISC-V memory-related cmds in documentation - "riscv set_prefer_sba" - removed from the doc, superseded by the latter - "riscv set_mem_access" - new command, new entry added into the doc This change only addresses the documentation. The corresponding implementation of the RISC-V commands is already merged. Change-Id: I3c07672cde94324407cf667504dba5402f63a543 Signed-off-by: Jan Matyas <ma...@co...> Reviewed-on: https://review.openocd.org/c/openocd/+/6743 Reviewed-by: Antonio Borneo <bor...@gm...> Tested-by: jenkins diff --git a/doc/openocd.texi b/doc/openocd.texi index a441e5e36..61d398738 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -10272,9 +10272,27 @@ Set the maximum time to wait for a hart to come out of reset after reset is deasserted. @end deffn -@deffn {Command} {riscv set_prefer_sba} on|off -When on, prefer to use System Bus Access to access memory. When off (default), -prefer to use the Program Buffer to access memory. +@deffn {Command} {riscv set_scratch_ram} none|[address] +Set the address of 16 bytes of scratch RAM the debugger can use, or 'none'. +This is used to access 64-bit floating point registers on 32-bit targets. +@end deffn + +@deffn Command {riscv set_mem_access} method1 [method2] [method3] +Specify which RISC-V memory access method(s) shall be used, and in which order +of priority. At least one method must be specified. + +Available methods are: +@itemize +@item @code{progbuf} - Use RISC-V Debug Program Buffer to access memory. +@item @code{sysbus} - Access memory via RISC-V Debug System Bus interface. +@item @code{abstract} - Access memory via RISC-V Debug abstract commands. +@end itemize + +By default, all memory access methods are enabled in the following order: +@code{progbuf sysbus abstract}. + +This command can be used to change the memory access methods if the default +behavior is not suitable for a particular target. @end deffn @deffn {Command} {riscv set_enable_virtual} on|off ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-11 17:44:07
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d8f64f8e356600557dc03283cce514fc6e75aac5 (commit) from e5a93e3e7adbc0a394df9953695f7bc27eab18ce (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d8f64f8e356600557dc03283cce514fc6e75aac5 Author: Jan Matyas <ma...@co...> Date: Mon Nov 22 10:16:27 2021 +0100 doc: Update doc for commands "riscv expose_csrs" and "riscv expose_custom" These commands were extended/improved in the last drop of RISC-V target updates. Update also the documentation to properly describe how the commands should be used now. Change-Id: I9e2ba6adbe1a4c032b96f5f8ff2d4791fa4c2527 Signed-off-by: Jan Matyas <ma...@co...> Reviewed-on: https://review.openocd.org/c/openocd/+/6738 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> Reviewed-by: Tim Newsome <ti...@si...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 1a336a75a..a441e5e36 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -10214,22 +10214,52 @@ OpenOCD exposes each hart as a separate core. @subsection RISC-V Debug Configuration Commands -@deffn {Command} {riscv expose_csrs} n0[-m0][,n1[-m1]]... -Configure a list of inclusive ranges for CSRs to expose in addition to the -standard ones. This must be executed before `init`. +@deffn {Config Command} {riscv expose_csrs} n[-m|=name] [...] +Configure which CSRs to expose in addition to the standard ones. The CSRs to expose +can be specified as individual register numbers or register ranges (inclusive). For the +individually listed CSRs, a human-readable name can optionally be set using the @code{n=name} +syntax, which will get @code{csr_} prepended to it. If no name is provided, the register will be +named @code{csr<n>}. By default OpenOCD attempts to expose only CSRs that are mentioned in a spec, and then only if the corresponding extension appears to be implemented. This -command can be used if OpenOCD gets this wrong, or a target implements custom +command can be used if OpenOCD gets this wrong, or if the target implements custom CSRs. + +@example +# Expose a single RISC-V CSR number 128 under the name "csr128": +$_TARGETNAME expose_csrs 128 + +# Expose multiple RISC-V CSRs 128..132 under names "csr128" through "csr132": +$_TARGETNAME expose_csrs 128-132 + +# Expose a single RISC-V CSR number 1996 under custom name "csr_myregister": +$_TARGETNAME expose_csrs 1996=myregister +@end example @end deffn -@deffn {Command} {riscv expose_custom} n0[-m0][,n1[-m1]]... +@deffn {Config Command} {riscv expose_custom} n[-m|=name] [...] The RISC-V Debug Specification allows targets to expose custom registers through abstract commands. (See Section 3.5.1.1 in that document.) This command -configures a list of inclusive ranges of those registers to expose. Number 0 -indicates the first custom register, whose abstract command number is 0xc000. -This command must be executed before `init`. +configures individual registers or register ranges (inclusive) that shall be exposed. +Number 0 indicates the first custom register, whose abstract command number is 0xc000. +For individually listed registers, a human-readable name can be optionally provided +using the @code{n=name} syntax, which will get @code{custom_} prepended to it. If no +name is provided, the register will be named @code{custom<n>}. + +@example +# Expose one RISC-V custom register with number 0xc010 (0xc000 + 16) +# under the name "custom16": +$_TARGETNAME expose_custom 16 + +# Expose a range of RISC-V custom registers with numbers 0xc010 .. 0xc018 +# (0xc000+16 .. 0xc000+24) under the names "custom16" through "custom24": +$_TARGETNAME expose_custom 16-24 + +# Expose one RISC-V custom register with number 0xc020 (0xc000 + 32) under +# user-defined name "custom_myregister": +$_TARGETNAME expose_custom 32=myregister +@end example @end deffn @deffn {Command} {riscv set_command_timeout_sec} [seconds] ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-11 17:43:21
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via e5a93e3e7adbc0a394df9953695f7bc27eab18ce (commit) from 37407f4a7b711896ff5fdc1dd98740ebd013cb2c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e5a93e3e7adbc0a394df9953695f7bc27eab18ce Author: Yasushi SHOJI <ya...@sp...> Date: Mon Nov 22 08:48:26 2021 +0900 doc/openocd.texi: Document find and ocd_find command Document both find and ocd_find command under Config File Guidelines -> Interface Config Files. find command is used in the previous section as well but the previous section is more about using OpenOCD. The section added is "aimed at any user who needs to write a config file". Change-Id: I698207fe58d564c615a15b50756aa5547a5f40b7 Signed-off-by: Yasushi SHOJI <ya...@sp...> Reviewed-on: https://review.openocd.org/c/openocd/+/6737 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/doc/openocd.texi b/doc/openocd.texi index fa1b8da05..1a336a75a 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -1359,6 +1359,16 @@ Read the OpenOCD source code (and Developer's Guide) if you have a new kind of hardware interface and need to provide a driver for it. +@deffn {Command} {find} 'filename' +Prints full path to @var{filename} according to OpenOCD search rules. +@end deffn + +@deffn {Command} {ocd_find} 'filename' +Prints full path to @var{filename} according to OpenOCD search rules. This +is a low level function used by the @command{find}. Usually you want +to use @command{find}, instead. +@end deffn + @section Board Config Files @cindex config file, board @cindex board config file ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 10 ++++++++++ 1 file changed, 10 insertions(+) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-11 17:43:03
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 37407f4a7b711896ff5fdc1dd98740ebd013cb2c (commit) from d7142a57271079eca8e1c15034b74499ff4e3ef5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 37407f4a7b711896ff5fdc1dd98740ebd013cb2c Author: Yasushi SHOJI <ya...@sp...> Date: Mon Nov 22 08:23:32 2021 +0900 doc/openocd.texi: Document command mode command Document "command mode" command Server Configuration -> Configuration Stage. The text is taken from command's help string. In addition to the help string, this commit explain the words mismatch, the doc uses "stage" but the command and source code uses "mode" to describe the same thing. Change-Id: I1d5fc8c64a3a0b07ea8430bf016bcbd54e52da1c Signed-off-by: Yasushi SHOJI <ya...@sp...> Reviewed-on: https://review.openocd.org/c/openocd/+/6736 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/doc/openocd.texi b/doc/openocd.texi index cceba7926..fa1b8da05 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -2040,6 +2040,19 @@ may access or activate TAPs. After it leaves this stage, configuration commands may no longer be issued. +@deffn {Command} {command mode} [command_name] +Returns the command modes allowed by a command: 'any', 'config', or +'exec'. If no command is specified, returns the current command +mode. Returns 'unknown' if an unknown command is given. Command can be +multiple tokens. (command valid any time) + +In this document, the modes are described as stages, 'config' and +'exec' mode correspond configuration stage and run stage. 'any' means +the command can be executed in either +stages. @xref{configurationstage,,Configuration Stage}, and +@xref{enteringtherunstage,,Entering the Run Stage}. +@end deffn + @anchor{enteringtherunstage} @section Entering the Run Stage ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 13 +++++++++++++ 1 file changed, 13 insertions(+) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-11 17:42:14
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via d7142a57271079eca8e1c15034b74499ff4e3ef5 (commit) from 2753c9868e28467e700799a8584b589af9e88600 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d7142a57271079eca8e1c15034b74499ff4e3ef5 Author: Yasushi SHOJI <ya...@sp...> Date: Mon Nov 29 22:33:27 2021 +0900 target/target: Check checksum_memory before call Make sure checksum_memory is present. Otherwise it'll segfault. Change-Id: If31123323bd8a03282da43505c9604fde735ad0e Signed-off-by: Yasushi SHOJI <ya...@sp...> Reviewed-on: https://review.openocd.org/c/openocd/+/6758 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/target/target.c b/src/target/target.c index 27888a83e..e9cbe39b7 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2530,6 +2530,10 @@ int target_checksum_memory(struct target *target, target_addr_t address, uint32_ LOG_ERROR("Target not examined yet"); return ERROR_FAIL; } + if (!target->type->checksum_memory) { + LOG_ERROR("Target %s doesn't support checksum_memory", target_name(target)); + return ERROR_FAIL; + } retval = target->type->checksum_memory(target, address, size, &checksum); if (retval != ERROR_OK) { ----------------------------------------------------------------------- Summary of changes: src/target/target.c | 4 ++++ 1 file changed, 4 insertions(+) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-11 17:41:30
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 2753c9868e28467e700799a8584b589af9e88600 (commit) from dfc9b8e90d91b387ced8e98de64434bad2c9a552 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2753c9868e28467e700799a8584b589af9e88600 Author: Tomas Vanek <va...@fb...> Date: Wed Dec 1 12:58:19 2021 +0100 doc: document noinit command Change-Id: I915c7d3231935fd44407b5fa65d86d4cb93e8db5 Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/6761 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 40ff65ccb..cceba7926 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -2093,6 +2093,13 @@ corresponding subsystems: @end deffn @end deffn +@deffn {Config Command} {noinit} +Prevent OpenOCD from implicit @command{init} call at the end of startup. +Allows issuing configuration commands over telnet or Tcl connection. +When you are done with configuration use @command{init} to enter +the run stage. +@end deffn + @deffn {Overridable Procedure} {jtag_init} This is invoked at server startup to verify that it can talk to the scan chain (list of TAPs) which has been configured. ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 7 +++++++ 1 file changed, 7 insertions(+) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-11 17:41:12
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via dfc9b8e90d91b387ced8e98de64434bad2c9a552 (commit) from 68ec9d2175f3bad53cd7f1a259e54420047321d6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dfc9b8e90d91b387ced8e98de64434bad2c9a552 Author: Tomas Vanek <va...@fb...> Date: Wed Dec 1 10:41:08 2021 +0100 doc: list internal commands called by init Change-Id: I5534c94a983906533a1b38c30ec3eb982e62dee7 Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/6760 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/doc/openocd.texi b/doc/openocd.texi index e0234e577..40ff65ccb 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -2075,11 +2075,22 @@ If this command does not appear in any startup/configuration file OpenOCD executes the command for you after processing all configuration files and/or command line options. -@b{NOTE:} This command normally occurs at or near the end of your +@b{NOTE:} This command normally occurs near the end of your openocd.cfg file to force OpenOCD to ``initialize'' and make the targets ready. For example: If your openocd.cfg file needs to read/write memory on your target, @command{init} must occur before the memory read/write commands. This includes @command{nand probe}. + +@command{init} calls the following internal OpenOCD commands to initialize +corresponding subsystems: +@deffn {Config Command} {target init} +@deffnx {Command} {transport init} +@deffnx {Command} {dap init} +@deffnx {Config Command} {flash init} +@deffnx {Config Command} {nand init} +@deffnx {Config Command} {pld init} +@deffnx {Command} {tpiu init} +@end deffn @end deffn @deffn {Overridable Procedure} {jtag_init} ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-11 17:40:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 68ec9d2175f3bad53cd7f1a259e54420047321d6 (commit) from 8a448573fb2804a9abe3e0922648dbbf99224aa9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 68ec9d2175f3bad53cd7f1a259e54420047321d6 Author: Antonio Borneo <bor...@gm...> Date: Thu Nov 11 23:28:33 2021 +0100 adi_v5_swd: add jtag-to-swd through dormant ARM IHI 0031A does not support SWJ-DP, so no switch between JTAG and SWD is considered. ARM IHI 0031B is not publicly available and it's reported as "Confidential Beta" in the history list in following doc versions. From ARM IHI 0031C the direct switch between JTAG and SWD is already deprecated in favor of passing through dormant mode. With no access to IHI 0031B we haven't info if any device strictly requires the direct switch. OpenOCD implements only the deprecated direct switch, so changing it could cause regression on devices that do not implement dormant mode. Plus, not all the adapters support dormant mode. Nevertheless there are already target devices that only allow entering in SWD by passing through dormant. Let the code try both method, alternating one tentative with the deprecated legacy direct switch, then another tentative passing through dormant, and repeat till timeout. This would work on any device that don't support dormant, on new devices that require switch through dormant and will work with adapters that don't support dormant. Change-Id: Ib8619635277d497872079a33fa4e38be9beb84a0 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/6695 Tested-by: jenkins diff --git a/src/target/adi_v5_swd.c b/src/target/adi_v5_swd.c index c23cee157..683504243 100644 --- a/src/target/adi_v5_swd.c +++ b/src/target/adi_v5_swd.c @@ -315,7 +315,12 @@ static int swd_connect_single(struct adiv5_dap *dap) int64_t timeout = timeval_ms() + 500; do { - swd_send_sequence(dap, JTAG_TO_SWD); + if (dap->switch_through_dormant) { + swd_send_sequence(dap, JTAG_TO_DORMANT); + swd_send_sequence(dap, DORMANT_TO_SWD); + } else { + swd_send_sequence(dap, JTAG_TO_SWD); + } /* Clear link state, including the SELECT cache. */ dap->do_reconnect = false; @@ -330,6 +335,7 @@ static int swd_connect_single(struct adiv5_dap *dap) alive_sleep(1); + dap->switch_through_dormant = !dap->switch_through_dormant; } while (timeval_ms() < timeout); if (retval != ERROR_OK) { @@ -568,7 +574,12 @@ static void swd_quit(struct adiv5_dap *dap) * swd->switch_seq(DORMANT_TO_JTAG); */ } else { - swd->switch_seq(SWD_TO_JTAG); + if (dap->switch_through_dormant) { + swd->switch_seq(SWD_TO_DORMANT); + swd->switch_seq(DORMANT_TO_JTAG); + } else { + swd->switch_seq(SWD_TO_JTAG); + } } /* flush the queue to shift out the sequence before exit */ diff --git a/src/target/arm_adi_v5.h b/src/target/arm_adi_v5.h index 758cfa096..5c598f16e 100644 --- a/src/target/arm_adi_v5.h +++ b/src/target/arm_adi_v5.h @@ -342,6 +342,11 @@ struct adiv5_dap { bool multidrop_dp_id_valid; /** TINSTANCE field of multidrop_targetsel has been configured */ bool multidrop_instance_id_valid; + + /** + * Record if enter in SWD required passing through DORMANT + */ + bool switch_through_dormant; }; /** ----------------------------------------------------------------------- Summary of changes: src/target/adi_v5_swd.c | 15 +++++++++++++-- src/target/arm_adi_v5.h | 5 +++++ 2 files changed, 18 insertions(+), 2 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-11 17:34:02
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 8a448573fb2804a9abe3e0922648dbbf99224aa9 (commit) from b1de11616099fe97f3534fa0f268c10dfd6ecf2b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8a448573fb2804a9abe3e0922648dbbf99224aa9 Author: Antonio Borneo <bor...@gm...> Date: Thu Nov 11 23:11:03 2021 +0100 cortex_m: remove last references to debugport_init() The function debugport_init() has never existed in OpenOCD code, but few comments erroneously references it in place of the existing function ahbap_debugport_init(). Commit 00dbc185ee56 ("arm_adi_v5: Split ahbap_debugport_init") splits the function ahbap_debugport_init() in dap_dp_init() and mem_ap_init(), but did not removed all the incorrect comments about debugport_init(). Few of such comments has been removed in later patches. Remove the last comment that references debugport_init(). Change-Id: Ibd1f125475386e5653340fedf706903a0ee15897 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/6694 Tested-by: jenkins diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index 649ee32f2..5605dd080 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -2292,7 +2292,6 @@ int cortex_m_examine(struct target *target) armv7m->debug_ap = dap_ap(swjdp, cortex_m->apsel); } - /* Leave (only) generic DAP stuff for debugport_init(); */ armv7m->debug_ap->memaccess_tck = 8; retval = mem_ap_init(armv7m->debug_ap); ----------------------------------------------------------------------- Summary of changes: src/target/cortex_m.c | 1 - 1 file changed, 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 22:00:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via b1de11616099fe97f3534fa0f268c10dfd6ecf2b (commit) from f735faa9319af324b94e4257444419c8dfec6592 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b1de11616099fe97f3534fa0f268c10dfd6ecf2b Author: Jan Matyas <ma...@co...> Date: Thu Jun 3 17:13:41 2021 +0200 gdb_server: added and improved several debug prints Added and improved several prints related to the GDB connection and various error states that may occur in relation to this connection. Change-Id: I233246190b613cc925b783561cfa3aa5267360fd Signed-off-by: Jan Matyas <ma...@co...> Reviewed-on: https://review.openocd.org/c/openocd/+/6288 Reviewed-by: Tim Newsome <ti...@si...> Reviewed-by: Antonio Borneo <bor...@gm...> Tested-by: jenkins diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index a16b4ccbe..0d2d1ae2c 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -227,6 +227,7 @@ static int gdb_get_char_inner(struct connection *connection, int *next_char) if (gdb_con->buf_cnt > 0) break; if (gdb_con->buf_cnt == 0) { + LOG_DEBUG("GDB connection closed by the remote client"); gdb_con->closed = true; return ERROR_SERVER_REMOTE_CLOSED; } @@ -348,11 +349,15 @@ static int gdb_putback_char(struct connection *connection, int last_char) static int gdb_write(struct connection *connection, void *data, int len) { struct gdb_connection *gdb_con = connection->priv; - if (gdb_con->closed) + if (gdb_con->closed) { + LOG_DEBUG("GDB socket marked as closed, cannot write to it."); return ERROR_SERVER_REMOTE_CLOSED; + } if (connection_write(connection, data, len) == len) return ERROR_OK; + + LOG_WARNING("Error writing to GDB socket. Dropping the connection."); gdb_con->closed = true; return ERROR_SERVER_REMOTE_CLOSED; } @@ -1351,7 +1356,7 @@ static int gdb_get_register_packet(struct connection *connection, return gdb_error(connection, retval); if (reg_list_size <= reg_num) { - LOG_ERROR("gdb requested a non-existing register"); + LOG_ERROR("gdb requested a non-existing register (reg_num=%d)", reg_num); return ERROR_SERVER_REMOTE_CLOSED; } @@ -1413,7 +1418,7 @@ static int gdb_set_register_packet(struct connection *connection, } if (reg_list_size <= reg_num) { - LOG_ERROR("gdb requested a non-existing register"); + LOG_ERROR("gdb requested a non-existing register (reg_num=%d)", reg_num); free(bin_buf); free(reg_list); return ERROR_SERVER_REMOTE_CLOSED; ----------------------------------------------------------------------- Summary of changes: src/server/gdb_server.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 21:59:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via f735faa9319af324b94e4257444419c8dfec6592 (commit) from 35f284fe7c51d29768156cfec172152d2539d98a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f735faa9319af324b94e4257444419c8dfec6592 Author: Tomas Vanek <va...@fb...> Date: Thu Nov 18 09:37:23 2021 +0100 target,flash: allow target_free_working_area on NULL area pointer Standard C library free() allows NULL pointer as a parameter. Change target_free_working_area() to conform this convention. Remove NULL pointer tests before target_free_working_area() calls. While on it add missing setting pointer to NULL after target_free_working_area(). Change-Id: I7c692ab04a9933398ba5bc614723ad0bdecb87b3 Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/6712 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/cc26xx.c b/src/flash/nor/cc26xx.c index f6b563279..7e526492b 100644 --- a/src/flash/nor/cc26xx.c +++ b/src/flash/nor/cc26xx.c @@ -140,8 +140,9 @@ static int cc26xx_init(struct flash_bank *bank) return retval; /* Check for working area to use for flash helper algorithm */ - if (cc26xx_bank->working_area) - target_free_working_area(target, cc26xx_bank->working_area); + target_free_working_area(target, cc26xx_bank->working_area); + cc26xx_bank->working_area = NULL; + retval = target_alloc_working_area(target, cc26xx_bank->algo_working_size, &cc26xx_bank->working_area); if (retval != ERROR_OK) @@ -158,6 +159,7 @@ static int cc26xx_init(struct flash_bank *bank) LOG_ERROR("%s: Failed to load flash helper algorithm", cc26xx_bank->family_name); target_free_working_area(target, cc26xx_bank->working_area); + cc26xx_bank->working_area = NULL; return retval; } @@ -172,6 +174,7 @@ static int cc26xx_init(struct flash_bank *bank) LOG_ERROR("%s: Failed to start flash helper algorithm", cc26xx_bank->family_name); target_free_working_area(target, cc26xx_bank->working_area); + cc26xx_bank->working_area = NULL; return retval; } diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c index e3fb6c8ff..85115869d 100644 --- a/src/flash/nor/cfi.c +++ b/src/flash/nor/cfi.c @@ -1359,9 +1359,7 @@ static int cfi_intel_write_block(struct flash_bank *bank, const uint8_t *buffer, /* free up resources */ cleanup: - if (source) - target_free_working_area(target, source); - + target_free_working_area(target, source); target_free_working_area(target, write_algorithm); destroy_reg_param(®_params[0]); diff --git a/src/flash/nor/fespi.c b/src/flash/nor/fespi.c index 11da81854..5474ffae4 100644 --- a/src/flash/nor/fespi.c +++ b/src/flash/nor/fespi.c @@ -661,10 +661,8 @@ static int fespi_write(struct flash_bank *bank, const uint8_t *buffer, return ERROR_OK; err: - if (algorithm_wa) { - target_free_working_area(target, data_wa); - target_free_working_area(target, algorithm_wa); - } + target_free_working_area(target, data_wa); + target_free_working_area(target, algorithm_wa); /* Switch to HW mode before return to prompt */ if (fespi_enable_hw_mode(bank) != ERROR_OK) diff --git a/src/flash/nor/msp432.c b/src/flash/nor/msp432.c index 667349f28..61741c8d6 100644 --- a/src/flash/nor/msp432.c +++ b/src/flash/nor/msp432.c @@ -335,8 +335,9 @@ static int msp432_init(struct flash_bank *bank) } /* Check for working area to use for flash helper algorithm */ - if (msp432_bank->working_area) - target_free_working_area(target, msp432_bank->working_area); + target_free_working_area(target, msp432_bank->working_area); + msp432_bank->working_area = NULL; + retval = target_alloc_working_area(target, ALGO_WORKING_SIZE, &msp432_bank->working_area); if (retval != ERROR_OK) diff --git a/src/flash/nor/npcx.c b/src/flash/nor/npcx.c index af623e577..a4d639524 100644 --- a/src/flash/nor/npcx.c +++ b/src/flash/nor/npcx.c @@ -80,10 +80,8 @@ static int npcx_init(struct flash_bank *bank) struct npcx_flash_bank *npcx_bank = bank->driver_priv; /* Check for working area to use for flash helper algorithm */ - if (npcx_bank->working_area) { - target_free_working_area(target, npcx_bank->working_area); - npcx_bank->working_area = NULL; - } + target_free_working_area(target, npcx_bank->working_area); + npcx_bank->working_area = NULL; int retval = target_alloc_working_area(target, npcx_bank->algo_working_size, &npcx_bank->working_area); diff --git a/src/flash/nor/psoc6.c b/src/flash/nor/psoc6.c index 198dff5c8..c6166aff8 100644 --- a/src/flash/nor/psoc6.c +++ b/src/flash/nor/psoc6.c @@ -182,10 +182,8 @@ destroy_rp_free_wa: /* Something went wrong, do some cleanup */ destroy_reg_param(®_params); - if (g_stack_area) { - target_free_working_area(target, g_stack_area); - g_stack_area = NULL; - } + target_free_working_area(target, g_stack_area); + g_stack_area = NULL; return hr; } diff --git a/src/flash/nor/sh_qspi.c b/src/flash/nor/sh_qspi.c index a1598449c..02af17acd 100644 --- a/src/flash/nor/sh_qspi.c +++ b/src/flash/nor/sh_qspi.c @@ -703,11 +703,14 @@ static int sh_qspi_upload_helper(struct flash_bank *bank) }; int ret; - if (info->source) - target_free_working_area(target, info->source); - if (info->io_algorithm) - target_free_working_area(target, info->io_algorithm); + target_free_working_area(target, info->source); + target_free_working_area(target, info->io_algorithm); + /* FIXME: Working areas are allocated during flash probe + * and eventual target_free_all_working_areas() called in case + * of target reset or run is not handled at all. + * Not a big problem if area backp is off. + */ /* flash write code */ if (target_alloc_working_area(target, sizeof(sh_qspi_io_code), &info->io_algorithm) != ERROR_OK) { diff --git a/src/target/riscv/riscv-013.c b/src/target/riscv/riscv-013.c index 006266a90..7af460241 100644 --- a/src/target/riscv/riscv-013.c +++ b/src/target/riscv/riscv-013.c @@ -1199,10 +1199,7 @@ static int scratch_reserve(struct target *target, static int scratch_release(struct target *target, scratch_mem_t *scratch) { - if (scratch->area) - return target_free_working_area(target, scratch->area); - - return ERROR_OK; + return target_free_working_area(target, scratch->area); } static int scratch_read64(struct target *target, scratch_mem_t *scratch, diff --git a/src/target/target.c b/src/target/target.c index ed6f655ea..27888a83e 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -2148,11 +2148,10 @@ static int target_restore_working_area(struct target *target, struct working_are /* Restore the area's backup memory, if any, and return the area to the allocation pool */ static int target_free_working_area_restore(struct target *target, struct working_area *area, int restore) { - int retval = ERROR_OK; - - if (area->free) - return retval; + if (!area || area->free) + return ERROR_OK; + int retval = ERROR_OK; if (restore) { retval = target_restore_working_area(target, area); /* REVISIT: Perhaps the area should be freed even if restoring fails. */ @@ -6401,8 +6400,7 @@ next: out: free(test_pattern); - if (wa) - target_free_working_area(target, wa); + target_free_working_area(target, wa); /* Test writes */ num_bytes = test_size + 4 + 4 + 4; @@ -6486,8 +6484,7 @@ nextw: free(test_pattern); - if (wa) - target_free_working_area(target, wa); + target_free_working_area(target, wa); return retval; } diff --git a/src/target/target.h b/src/target/target.h index 99ec2be10..6ef8f10e0 100644 --- a/src/target/target.h +++ b/src/target/target.h @@ -726,6 +726,13 @@ int target_alloc_working_area(struct target *target, */ int target_alloc_working_area_try(struct target *target, uint32_t size, struct working_area **area); +/** + * Free a working area. + * Restore target data if area backup is configured. + * @param target + * @param area Pointer to the area to be freed or NULL + * @returns ERROR_OK if successful; error code if restore failed + */ int target_free_working_area(struct target *target, struct working_area *area); void target_free_all_working_areas(struct target *target); uint32_t target_get_working_area_avail(struct target *target); ----------------------------------------------------------------------- Summary of changes: src/flash/nor/cc26xx.c | 7 +++++-- src/flash/nor/cfi.c | 4 +--- src/flash/nor/fespi.c | 6 ++---- src/flash/nor/msp432.c | 5 +++-- src/flash/nor/npcx.c | 6 ++---- src/flash/nor/psoc6.c | 6 ++---- src/flash/nor/sh_qspi.c | 11 +++++++---- src/target/riscv/riscv-013.c | 5 +---- src/target/target.c | 13 +++++-------- src/target/target.h | 7 +++++++ 10 files changed, 35 insertions(+), 35 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 21:59:21
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 35f284fe7c51d29768156cfec172152d2539d98a (commit) from 15110b2b5bf3459d038e6142d151c3856760e387 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 35f284fe7c51d29768156cfec172152d2539d98a Author: Tim Newsome <ti...@si...> Date: Mon Nov 8 09:26:51 2021 -0800 flash/nor/fespi: algorithm, large address, errors * Move more smarts into the target algorithm code, and rewrite that in C so it's easier to understand/maintain. * Support >24-bit addresses. * Check for errors. Change-Id: I3b1a143589fe6defafb8f95820aa682acc9646e7 Signed-off-by: Tim Newsome <ti...@si...> Reviewed-on: https://review.openocd.org/c/openocd/+/6679 Tested-by: jenkins Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/contrib/loaders/flash/fespi/Makefile b/contrib/loaders/flash/fespi/Makefile index 4d2ab51d7..edecf0a72 100644 --- a/contrib/loaders/flash/fespi/Makefile +++ b/contrib/loaders/flash/fespi/Makefile @@ -2,27 +2,50 @@ BIN2C = ../../../../src/helper/bin2char.sh CROSS_COMPILE ?= riscv64-unknown-elf- -CC=$(CROSS_COMPILE)gcc -OBJCOPY=$(CROSS_COMPILE)objcopy -OBJDUMP=$(CROSS_COMPILE)objdump +RISCV_CC=$(CROSS_COMPILE)gcc +RISCV_OBJCOPY=$(CROSS_COMPILE)objcopy +RISCV_OBJDUMP=$(CROSS_COMPILE)objdump -CFLAGS = -march=rv32i -mabi=ilp32 -x assembler-with-cpp -nostdlib -nostartfiles +CFLAGS = -nostdlib -nostartfiles -Wall -Werror -Os -fPIC -Wunused-result -g +RISCV32_CFLAGS = -march=rv32e -mabi=ilp32e $(CFLAGS) +RISCV64_CFLAGS = -march=rv64i -mabi=lp64 $(CFLAGS) -all: fespi.inc +all: riscv32_fespi.inc riscv64_fespi.inc .PHONY: clean -%.elf: %.S - $(CC) $(CFLAGS) $< -o $@ +# .c -> .o +riscv32_%.o: riscv_%.c + $(RISCV_CC) -c $(RISCV32_CFLAGS) $^ -o $@ -%.lst: %.elf - $(OBJDUMP) -S $< > $@ +riscv64_%.o: riscv_%.c + $(RISCV_CC) -c $(RISCV64_CFLAGS) $< -o $@ + +# .S -> .o +riscv32_%.o: riscv_%.S + $(RISCV_CC) -c $(RISCV32_CFLAGS) $^ -o $@ + +riscv64_%.o: riscv_%.S + $(RISCV_CC) -c $(RISCV64_CFLAGS) $^ -o $@ + +# .o -> .elf +riscv32_%.elf: riscv32_%.o riscv32_wrapper.o + $(RISCV_CC) -T riscv.lds $(RISCV32_CFLAGS) $^ -o $@ +riscv64_%.elf: riscv64_%.o riscv64_wrapper.o + $(RISCV_CC) -T riscv.lds $(RISCV64_CFLAGS) $^ -o $@ + +# .elf -> .bin %.bin: %.elf - $(OBJCOPY) -Obinary $< $@ + $(RISCV_OBJCOPY) -Obinary $< $@ +# .bin -> .inc %.inc: %.bin $(BIN2C) < $< > $@ +# utility +%.lst: %.elf + $(RISCV_OBJDUMP) -S $< > $@ + clean: - -rm -f *.elf *.lst *.bin *.inc + -rm -f *.elf *.o *.lst *.bin *.inc diff --git a/contrib/loaders/flash/fespi/fespi.S b/contrib/loaders/flash/fespi/fespi.S deleted file mode 100644 index d68e65ef8..000000000 --- a/contrib/loaders/flash/fespi/fespi.S +++ /dev/null @@ -1,99 +0,0 @@ -#define SPIFLASH_READ_STATUS 0x05 // Read Status Register -#define SPIFLASH_BSY_BIT 0x00000001 // WIP Bit of SPI SR on SMI SR - -// Register offsets -#define FESPI_REG_FMT 0x40 -#define FESPI_REG_TXFIFO 0x48 -#define FESPI_REG_RXFIFO 0x4c -#define FESPI_REG_IP 0x74 - -// Fields -#define FESPI_IP_TXWM 0x1 -#define FESPI_FMT_DIR(x) (((x) & 0x1) << 3) - -// To enter, jump to the start of command_table (ie. offset 0). -// a0 - FESPI base address -// a1 - start address of buffer - -// The buffer contains a "program" in byte sequences. The first byte in a -// sequence determines the operation. Some operation will read more data from -// the program, while some will not. The operation byte is the offset into -// command_table, so eg. 4 means exit, 8 means transmit, and so on. - - .global _start -_start: -command_table: - j main // 0 - ebreak // 4 - j tx // 8 - j txwm_wait // 12 - j write_reg // 16 - j wip_wait // 20 - j set_dir // 24 - -// Execute the program. -main: - lbu t0, 0(a1) - addi a1, a1, 1 - la t1, command_table - add t0, t0, t1 - jr t0 - -// Read 1 byte the contains the number of bytes to transmit. Then read those -// bytes from the program and transmit them one by one. -tx: - lbu t1, 0(a1) // read number of bytes to transmit - addi a1, a1, 1 -1: lw t0, FESPI_REG_TXFIFO(a0) // wait for FIFO clear - bltz t0, 1b - lbu t0, 0(a1) // Load byte to write - sw t0, FESPI_REG_TXFIFO(a0) - addi a1, a1, 1 - addi t1, t1, -1 - bgtz t1, 1b - j main - -// Wait until TXWM is set. -txwm_wait: -1: lw t0, FESPI_REG_IP(a0) - andi t0, t0, FESPI_IP_TXWM - beqz t0, 1b - j main - -// Read 1 byte that contains the offset of the register to write, and 1 byte -// that contains the data to write. -write_reg: - lbu t0, 0(a1) // read register to write - add t0, t0, a0 - lbu t1, 1(a1) // read value to write - addi a1, a1, 2 - sw t1, 0(t0) - j main - -wip_wait: - li a2, SPIFLASH_READ_STATUS - jal txrx_byte - // discard first result -1: li a2, 0 - jal txrx_byte - andi t0, a2, SPIFLASH_BSY_BIT - bnez t0, 1b - j main - -txrx_byte: // transmit the byte in a2, receive a bit into a2 - lw t0, FESPI_REG_TXFIFO(a0) // wait for FIFO clear - bltz t0, txrx_byte - sw a2, FESPI_REG_TXFIFO(a0) -1: lw a2, FESPI_REG_RXFIFO(a0) - bltz a2, 1b - ret - -set_dir: - lw t0, FESPI_REG_FMT(a0) - li t1, ~(FESPI_FMT_DIR(0xFFFFFFFF)) - and t0, t0, t1 - lbu t1, 0(a1) // read value to OR in - addi a1, a1, 1 - or t0, t0, t1 - sw t0, FESPI_REG_FMT(a0) - j main diff --git a/contrib/loaders/flash/fespi/fespi.inc b/contrib/loaders/flash/fespi/fespi.inc deleted file mode 100644 index 768bdc598..000000000 --- a/contrib/loaders/flash/fespi/fespi.inc +++ /dev/null @@ -1,15 +0,0 @@ -/* Autogenerated with ../../../../src/helper/bin2char.sh */ -0x6f,0x00,0xc0,0x01,0x73,0x00,0x10,0x00,0x6f,0x00,0xc0,0x02,0x6f,0x00,0x00,0x05, -0x6f,0x00,0xc0,0x05,0x6f,0x00,0x00,0x07,0x6f,0x00,0x00,0x0a,0x83,0xc2,0x05,0x00, -0x93,0x85,0x15,0x00,0x17,0x03,0x00,0x00,0x13,0x03,0xc3,0xfd,0xb3,0x82,0x62,0x00, -0x67,0x80,0x02,0x00,0x03,0xc3,0x05,0x00,0x93,0x85,0x15,0x00,0x83,0x22,0x85,0x04, -0xe3,0xce,0x02,0xfe,0x83,0xc2,0x05,0x00,0x23,0x24,0x55,0x04,0x93,0x85,0x15,0x00, -0x13,0x03,0xf3,0xff,0xe3,0x44,0x60,0xfe,0x6f,0xf0,0x5f,0xfc,0x83,0x22,0x45,0x07, -0x93,0xf2,0x12,0x00,0xe3,0x8c,0x02,0xfe,0x6f,0xf0,0x5f,0xfb,0x83,0xc2,0x05,0x00, -0xb3,0x82,0xa2,0x00,0x03,0xc3,0x15,0x00,0x93,0x85,0x25,0x00,0x23,0xa0,0x62,0x00, -0x6f,0xf0,0xdf,0xf9,0x13,0x06,0x50,0x00,0xef,0x00,0x80,0x01,0x13,0x06,0x00,0x00, -0xef,0x00,0x00,0x01,0x93,0x72,0x16,0x00,0xe3,0x9a,0x02,0xfe,0x6f,0xf0,0x1f,0xf8, -0x83,0x22,0x85,0x04,0xe3,0xce,0x02,0xfe,0x23,0x24,0xc5,0x04,0x03,0x26,0xc5,0x04, -0xe3,0x4e,0x06,0xfe,0x67,0x80,0x00,0x00,0x83,0x22,0x05,0x04,0x13,0x03,0x70,0xff, -0xb3,0xf2,0x62,0x00,0x03,0xc3,0x05,0x00,0x93,0x85,0x15,0x00,0xb3,0xe2,0x62,0x00, -0x23,0x20,0x55,0x04,0x6f,0xf0,0x9f,0xf4, diff --git a/contrib/loaders/flash/fespi/riscv.lds b/contrib/loaders/flash/fespi/riscv.lds new file mode 100644 index 000000000..77fe0e558 --- /dev/null +++ b/contrib/loaders/flash/fespi/riscv.lds @@ -0,0 +1,12 @@ +OUTPUT_ARCH( "riscv" ) + +SECTIONS +{ + . = 0x12340000; + .text : + { + *(.text.entry) + *(.text) + } + .data : { *(.data) } +} diff --git a/contrib/loaders/flash/fespi/riscv32_fespi.inc b/contrib/loaders/flash/fespi/riscv32_fespi.inc new file mode 100644 index 000000000..44e04482f --- /dev/null +++ b/contrib/loaders/flash/fespi/riscv32_fespi.inc @@ -0,0 +1,51 @@ +/* Autogenerated with ../../../../src/helper/bin2char.sh */ +0x17,0x01,0x00,0x00,0x13,0x01,0xc1,0x31,0xef,0x00,0x80,0x10,0x73,0x00,0x10,0x00, +0x93,0x07,0x90,0x3e,0x93,0x87,0xf7,0xff,0x63,0x96,0x07,0x00,0x13,0x05,0x10,0x00, +0x67,0x80,0x00,0x00,0x03,0x27,0x45,0x07,0x13,0x77,0x17,0x00,0xe3,0x04,0x07,0xfe, +0x13,0x05,0x00,0x00,0x67,0x80,0x00,0x00,0x93,0x07,0x90,0x3e,0x93,0x87,0xf7,0xff, +0x63,0x96,0x07,0x00,0x13,0x05,0x10,0x00,0x67,0x80,0x00,0x00,0x03,0x27,0x85,0x04, +0xe3,0x46,0x07,0xfe,0x23,0x24,0xb5,0x04,0x13,0x05,0x00,0x00,0x67,0x80,0x00,0x00, +0x83,0x27,0x05,0x04,0x13,0x01,0x41,0xff,0x23,0x22,0x81,0x00,0x23,0x24,0x11,0x00, +0x23,0x20,0x91,0x00,0x93,0xf7,0x77,0xff,0x23,0x20,0xf5,0x04,0x93,0x07,0x20,0x00, +0x23,0x2c,0xf5,0x00,0x93,0x05,0x50,0x00,0x13,0x04,0x05,0x00,0xef,0xf0,0xdf,0xfa, +0x93,0x07,0x90,0x3e,0x63,0x00,0x05,0x02,0x83,0x20,0x81,0x00,0x03,0x24,0x41,0x00, +0x83,0x24,0x01,0x00,0x13,0x01,0xc1,0x00,0x67,0x80,0x00,0x00,0x03,0x27,0xc4,0x04, +0x63,0x5a,0x07,0x00,0x93,0x87,0xf7,0xff,0xe3,0x9a,0x07,0xfe,0x13,0x05,0x10,0x00, +0x6f,0xf0,0x9f,0xfd,0x93,0x04,0x90,0x3e,0x93,0x84,0xf4,0xff,0xe3,0x88,0x04,0xfe, +0x93,0x05,0x00,0x00,0x13,0x05,0x04,0x00,0xef,0xf0,0x1f,0xf6,0xe3,0x1e,0x05,0xfa, +0x13,0x07,0x90,0x3e,0x13,0x07,0xf7,0xff,0xe3,0x0a,0x07,0xfc,0x83,0x27,0xc4,0x04, +0xe3,0xca,0x07,0xfe,0x93,0xf7,0x17,0x00,0xe3,0x98,0x07,0xfc,0x23,0x2c,0x04,0x00, +0x83,0x27,0x04,0x04,0x93,0xe7,0x87,0x00,0x23,0x20,0xf4,0x04,0x6f,0xf0,0xdf,0xf8, +0x13,0x01,0x41,0xfd,0x23,0x22,0x81,0x02,0x23,0x20,0x91,0x02,0x23,0x24,0x11,0x02, +0x13,0x04,0x05,0x00,0x23,0x26,0xb1,0x00,0x23,0x28,0xc1,0x00,0x23,0x20,0xd1,0x00, +0x23,0x22,0xe1,0x00,0x23,0x2a,0xf1,0x00,0xef,0xf0,0x9f,0xed,0x93,0x04,0x05,0x00, +0x63,0x16,0x05,0x04,0x83,0x27,0x04,0x06,0x13,0x05,0x04,0x00,0x93,0xf7,0xe7,0xff, +0x23,0x20,0xf4,0x06,0xef,0xf0,0xdf,0xf0,0x93,0x04,0x05,0x00,0x63,0x12,0x05,0x02, +0x83,0x27,0xc1,0x00,0x03,0x27,0x01,0x00,0x93,0x87,0xf7,0xff,0xb3,0xf7,0xe7,0x00, +0x03,0x47,0x41,0x01,0x23,0x2c,0xe1,0x00,0x03,0x27,0x41,0x00,0x63,0x14,0x07,0x02, +0x83,0x27,0x04,0x06,0x93,0xe7,0x17,0x00,0x23,0x20,0xf4,0x06,0x83,0x20,0x81,0x02, +0x03,0x24,0x41,0x02,0x13,0x85,0x04,0x00,0x83,0x24,0x01,0x02,0x13,0x01,0xc1,0x02, +0x67,0x80,0x00,0x00,0x83,0x26,0x41,0x00,0x03,0x27,0x41,0x00,0x23,0x24,0xd1,0x00, +0x83,0x26,0xc1,0x00,0x33,0x07,0xf7,0x00,0x63,0xf6,0xe6,0x00,0xb3,0x87,0xf6,0x40, +0x23,0x24,0xf1,0x00,0x93,0x05,0x60,0x00,0x13,0x05,0x04,0x00,0xef,0xf0,0xdf,0xe6, +0x63,0x1e,0x05,0x0c,0x13,0x05,0x04,0x00,0xef,0xf0,0x9f,0xe3,0x63,0x18,0x05,0x0c, +0x83,0x25,0x81,0x01,0x93,0x07,0x20,0x00,0x23,0x2c,0xf4,0x00,0x13,0x05,0x04,0x00, +0xef,0xf0,0x9f,0xe4,0x63,0x1c,0x05,0x0a,0x83,0x27,0x41,0x01,0x93,0xf7,0x07,0x10, +0x63,0x9c,0x07,0x08,0x83,0x27,0x01,0x00,0x13,0x05,0x04,0x00,0x93,0xd5,0x07,0x01, +0x93,0xf5,0xf5,0x0f,0xef,0xf0,0x5f,0xe2,0x63,0x1a,0x05,0x08,0x83,0x27,0x01,0x00, +0x13,0x05,0x04,0x00,0x93,0xd5,0x87,0x00,0x93,0xf5,0xf5,0x0f,0xef,0xf0,0xdf,0xe0, +0x63,0x1e,0x05,0x06,0x83,0x45,0x01,0x00,0x13,0x05,0x04,0x00,0xef,0xf0,0xdf,0xdf, +0x63,0x16,0x05,0x06,0x03,0x26,0x01,0x01,0x83,0x27,0x81,0x00,0xb3,0x07,0xf6,0x00, +0x63,0x12,0xf6,0x06,0x13,0x05,0x04,0x00,0x23,0x28,0xc1,0x00,0xef,0xf0,0x5f,0xdb, +0x63,0x16,0x05,0x04,0x23,0x2c,0x04,0x00,0x13,0x05,0x04,0x00,0xef,0xf0,0x5f,0xdf, +0x63,0x1e,0x05,0x02,0x83,0x27,0x01,0x00,0x03,0x27,0x81,0x00,0xb3,0x87,0xe7,0x00, +0x23,0x20,0xf1,0x00,0x83,0x27,0x41,0x00,0xb3,0x87,0xe7,0x40,0x23,0x22,0xf1,0x00, +0x93,0x07,0x00,0x00,0x6f,0xf0,0x5f,0xee,0x83,0x27,0x01,0x00,0x13,0x05,0x04,0x00, +0x93,0xd5,0x87,0x01,0xef,0xf0,0x5f,0xd9,0xe3,0x0e,0x05,0xf4,0x93,0x04,0x05,0x00, +0x6f,0xf0,0x1f,0xed,0x83,0x45,0x06,0x00,0x13,0x05,0x04,0x00,0x23,0x2e,0xf1,0x00, +0x23,0x28,0xc1,0x00,0xef,0xf0,0x5f,0xd7,0x03,0x26,0x01,0x01,0x83,0x27,0xc1,0x01, +0x13,0x06,0x16,0x00,0xe3,0x0e,0x05,0xf6,0x6f,0xf0,0x5f,0xfd,0x09,0x53,0x67,0x08, +0x09,0x53,0x67,0x08,0x09,0x53,0x67,0x08,0x09,0x53,0x67,0x08,0x09,0x53,0x67,0x08, +0x09,0x53,0x67,0x08,0x09,0x53,0x67,0x08,0x09,0x53,0x67,0x08,0x09,0x53,0x67,0x08, +0x09,0x53,0x67,0x08,0x09,0x53,0x67,0x08,0x09,0x53,0x67,0x08,0x09,0x53,0x67,0x08, +0x09,0x53,0x67,0x08,0x09,0x53,0x67,0x08,0x09,0x53,0x67,0x08, diff --git a/contrib/loaders/flash/fespi/riscv64_fespi.inc b/contrib/loaders/flash/fespi/riscv64_fespi.inc new file mode 100644 index 000000000..97a860fe3 --- /dev/null +++ b/contrib/loaders/flash/fespi/riscv64_fespi.inc @@ -0,0 +1,58 @@ +/* Autogenerated with ../../../../src/helper/bin2char.sh */ +0x17,0x01,0x00,0x00,0x13,0x01,0x81,0x38,0xef,0x00,0x40,0x12,0x73,0x00,0x10,0x00, +0x93,0x07,0x90,0x3e,0x9b,0x87,0xf7,0xff,0x63,0x96,0x07,0x00,0x13,0x05,0x10,0x00, +0x67,0x80,0x00,0x00,0x03,0x27,0x45,0x07,0x13,0x77,0x17,0x00,0xe3,0x04,0x07,0xfe, +0x13,0x05,0x00,0x00,0x67,0x80,0x00,0x00,0x93,0x07,0x90,0x3e,0x9b,0x87,0xf7,0xff, +0x63,0x96,0x07,0x00,0x13,0x05,0x10,0x00,0x67,0x80,0x00,0x00,0x03,0x27,0x85,0x04, +0x93,0x16,0x07,0x02,0xe3,0xc4,0x06,0xfe,0x9b,0x85,0x05,0x00,0x23,0x24,0xb5,0x04, +0x13,0x05,0x00,0x00,0x67,0x80,0x00,0x00,0x83,0x27,0x05,0x04,0x13,0x01,0x01,0xfe, +0x23,0x38,0x81,0x00,0x9b,0x87,0x07,0x00,0x23,0x3c,0x11,0x00,0x23,0x34,0x91,0x00, +0x93,0xf7,0x77,0xff,0x23,0x20,0xf5,0x04,0x93,0x07,0x20,0x00,0x23,0x2c,0xf5,0x00, +0x93,0x05,0x50,0x00,0x13,0x04,0x05,0x00,0xef,0xf0,0x1f,0xfa,0x93,0x07,0x90,0x3e, +0x63,0x02,0x05,0x02,0x83,0x30,0x81,0x01,0x03,0x34,0x01,0x01,0x83,0x34,0x81,0x00, +0x13,0x01,0x01,0x02,0x67,0x80,0x00,0x00,0x03,0x27,0xc4,0x04,0x93,0x16,0x07,0x02, +0x63,0xda,0x06,0x00,0x9b,0x87,0xf7,0xff,0xe3,0x98,0x07,0xfe,0x13,0x05,0x10,0x00, +0x6f,0xf0,0x5f,0xfd,0x93,0x04,0x90,0x3e,0x9b,0x84,0xf4,0xff,0xe3,0x88,0x04,0xfe, +0x93,0x05,0x00,0x00,0x13,0x05,0x04,0x00,0xef,0xf0,0x1f,0xf5,0xe3,0x1c,0x05,0xfa, +0x93,0x07,0x90,0x3e,0x9b,0x87,0xf7,0xff,0xe3,0x8a,0x07,0xfc,0x83,0x26,0xc4,0x04, +0x13,0x96,0x06,0x02,0x1b,0x87,0x06,0x00,0xe3,0x46,0x06,0xfe,0x93,0x77,0x17,0x00, +0xe3,0x94,0x07,0xfc,0x23,0x2c,0x04,0x00,0x83,0x27,0x04,0x04,0x9b,0x87,0x07,0x00, +0x93,0xe7,0x87,0x00,0x23,0x20,0xf4,0x04,0x6f,0xf0,0xdf,0xf7,0x13,0x01,0x01,0xfa, +0x23,0x38,0x81,0x04,0x23,0x34,0x91,0x04,0x23,0x30,0x21,0x05,0x23,0x3c,0x31,0x03, +0x23,0x38,0x41,0x03,0x23,0x34,0x51,0x03,0x23,0x30,0x61,0x03,0x23,0x3c,0x11,0x04, +0x23,0x3c,0x71,0x01,0x23,0x38,0x81,0x01,0x23,0x34,0x91,0x01,0x23,0x30,0xa1,0x01, +0x13,0x04,0x05,0x00,0x93,0x8a,0x05,0x00,0x13,0x0b,0x06,0x00,0x13,0x89,0x06,0x00, +0x13,0x0a,0x07,0x00,0x93,0x89,0x07,0x00,0xef,0xf0,0x9f,0xe9,0x93,0x04,0x05,0x00, +0x63,0x1a,0x05,0x04,0x83,0x27,0x04,0x06,0x13,0x05,0x04,0x00,0x9b,0x87,0x07,0x00, +0x93,0xf7,0xe7,0xff,0x23,0x20,0xf4,0x06,0xef,0xf0,0x1f,0xed,0x93,0x04,0x05,0x00, +0x63,0x12,0x05,0x02,0x9b,0x86,0xfa,0xff,0xb3,0x76,0xd9,0x00,0x93,0xfc,0xf9,0x0f, +0x93,0xf9,0x09,0x10,0x9b,0x86,0x06,0x00,0x13,0x0c,0x20,0x00,0x9b,0x89,0x09,0x00, +0x63,0x18,0x0a,0x04,0x83,0x27,0x04,0x06,0x9b,0x87,0x07,0x00,0x93,0xe7,0x17,0x00, +0x23,0x20,0xf4,0x06,0x83,0x30,0x81,0x05,0x03,0x34,0x01,0x05,0x03,0x39,0x01,0x04, +0x83,0x39,0x81,0x03,0x03,0x3a,0x01,0x03,0x83,0x3a,0x81,0x02,0x03,0x3b,0x01,0x02, +0x83,0x3b,0x81,0x01,0x03,0x3c,0x01,0x01,0x83,0x3c,0x81,0x00,0x03,0x3d,0x01,0x00, +0x13,0x85,0x04,0x00,0x83,0x34,0x81,0x04,0x13,0x01,0x01,0x06,0x67,0x80,0x00,0x00, +0xbb,0x07,0xda,0x00,0x93,0x0b,0x0a,0x00,0x63,0xf4,0xfa,0x00,0xbb,0x8b,0xda,0x40, +0x93,0x05,0x60,0x00,0x13,0x05,0x04,0x00,0xef,0xf0,0x1f,0xe1,0x63,0x1a,0x05,0x0a, +0x13,0x05,0x04,0x00,0xef,0xf0,0xdf,0xdd,0x63,0x14,0x05,0x0a,0x23,0x2c,0x84,0x01, +0x93,0x85,0x0c,0x00,0x13,0x05,0x04,0x00,0xef,0xf0,0x1f,0xdf,0x63,0x1a,0x05,0x08, +0x63,0x90,0x09,0x08,0x9b,0x55,0x09,0x01,0x93,0xf5,0xf5,0x0f,0x13,0x05,0x04,0x00, +0xef,0xf0,0x9f,0xdd,0x63,0x1e,0x05,0x06,0x9b,0x55,0x89,0x00,0x93,0xf5,0xf5,0x0f, +0x13,0x05,0x04,0x00,0xef,0xf0,0x5f,0xdc,0x63,0x14,0x05,0x06,0x93,0x75,0xf9,0x0f, +0x13,0x05,0x04,0x00,0xef,0xf0,0x5f,0xdb,0x63,0x1c,0x05,0x04,0x13,0x0d,0x00,0x00, +0x9b,0x07,0x0d,0x00,0x63,0xea,0x77,0x05,0x13,0x05,0x04,0x00,0xef,0xf0,0x5f,0xd7, +0x63,0x10,0x05,0x04,0x23,0x2c,0x04,0x00,0x13,0x05,0x04,0x00,0xef,0xf0,0xdf,0xdb, +0x63,0x18,0x05,0x02,0x93,0x97,0x0b,0x02,0x93,0xd7,0x07,0x02,0x33,0x0b,0xfb,0x00, +0x3b,0x09,0x79,0x01,0x3b,0x0a,0x7a,0x41,0x93,0x06,0x00,0x00,0x6f,0xf0,0x5f,0xef, +0x9b,0x55,0x89,0x01,0x13,0x05,0x04,0x00,0xef,0xf0,0x1f,0xd6,0xe3,0x0c,0x05,0xf6, +0x93,0x04,0x05,0x00,0x6f,0xf0,0x1f,0xee,0xb3,0x07,0xab,0x01,0x83,0xc5,0x07,0x00, +0x13,0x05,0x04,0x00,0x13,0x0d,0x1d,0x00,0xef,0xf0,0x1f,0xd4,0xe3,0x0a,0x05,0xf8, +0x6f,0xf0,0x1f,0xfe,0x00,0x00,0x00,0x00,0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00, +0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00,0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00, +0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00,0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00, +0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00,0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00, +0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00,0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00, +0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00,0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00, +0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00,0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00, +0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00,0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00, +0x09,0x53,0x67,0x08,0x00,0x00,0x00,0x00, diff --git a/contrib/loaders/flash/fespi/riscv_fespi.c b/contrib/loaders/flash/fespi/riscv_fespi.c new file mode 100644 index 000000000..b6164330d --- /dev/null +++ b/contrib/loaders/flash/fespi/riscv_fespi.c @@ -0,0 +1,321 @@ +#include <stdbool.h> +#include <stdint.h> +#include <stdio.h> + +#include "../../../../src/flash/nor/spi.h" + +/* Register offsets */ + +#define FESPI_REG_SCKDIV 0x00 +#define FESPI_REG_SCKMODE 0x04 +#define FESPI_REG_CSID 0x10 +#define FESPI_REG_CSDEF 0x14 +#define FESPI_REG_CSMODE 0x18 + +#define FESPI_REG_DCSSCK 0x28 +#define FESPI_REG_DSCKCS 0x2a +#define FESPI_REG_DINTERCS 0x2c +#define FESPI_REG_DINTERXFR 0x2e + +#define FESPI_REG_FMT 0x40 +#define FESPI_REG_TXFIFO 0x48 +#define FESPI_REG_RXFIFO 0x4c +#define FESPI_REG_TXCTRL 0x50 +#define FESPI_REG_RXCTRL 0x54 + +#define FESPI_REG_FCTRL 0x60 +#define FESPI_REG_FFMT 0x64 + +#define FESPI_REG_IE 0x70 +#define FESPI_REG_IP 0x74 + +/* Fields */ + +#define FESPI_SCK_POL 0x1 +#define FESPI_SCK_PHA 0x2 + +#define FESPI_FMT_PROTO(x) ((x) & 0x3) +#define FESPI_FMT_ENDIAN(x) (((x) & 0x1) << 2) +#define FESPI_FMT_DIR(x) (((x) & 0x1) << 3) +#define FESPI_FMT_LEN(x) (((x) & 0xf) << 16) + +/* TXCTRL register */ +#define FESPI_TXWM(x) ((x) & 0xffff) +/* RXCTRL register */ +#define FESPI_RXWM(x) ((x) & 0xffff) + +#define FESPI_IP_TXWM 0x1 +#define FESPI_IP_RXWM 0x2 + +#define FESPI_FCTRL_EN 0x1 + +#define FESPI_INSN_CMD_EN 0x1 +#define FESPI_INSN_ADDR_LEN(x) (((x) & 0x7) << 1) +#define FESPI_INSN_PAD_CNT(x) (((x) & 0xf) << 4) +#define FESPI_INSN_CMD_PROTO(x) (((x) & 0x3) << 8) +#define FESPI_INSN_ADDR_PROTO(x) (((x) & 0x3) << 10) +#define FESPI_INSN_DATA_PROTO(x) (((x) & 0x3) << 12) +#define FESPI_INSN_CMD_CODE(x) (((x) & 0xff) << 16) +#define FESPI_INSN_PAD_CODE(x) (((x) & 0xff) << 24) + +/* Values */ + +#define FESPI_CSMODE_AUTO 0 +#define FESPI_CSMODE_HOLD 2 +#define FESPI_CSMODE_OFF 3 + +#define FESPI_DIR_RX 0 +#define FESPI_DIR_TX 1 + +#define FESPI_PROTO_S 0 +#define FESPI_PROTO_D 1 +#define FESPI_PROTO_Q 2 + +#define FESPI_ENDIAN_MSB 0 +#define FESPI_ENDIAN_LSB 1 + +/* Timeouts we use, in number of status checks. */ +#define TIMEOUT 1000 + +/* #define DEBUG to make the return error codes provide enough information to + * reconstruct the stack from where the error occurred. This is not enabled + * usually to reduce the program size. */ +#ifdef DEBUG +#define ERROR_STACK(x) (x) +#define ERROR_FESPI_TXWM_WAIT 0x10 +#define ERROR_FESPI_TX 0x100 +#define ERROR_FESPI_RX 0x1000 +#define ERROR_FESPI_WIP 0x50000 +#else +#define ERROR_STACK(x) 0 +#define ERROR_FESPI_TXWM_WAIT 1 +#define ERROR_FESPI_TX 1 +#define ERROR_FESPI_RX 1 +#define ERROR_FESPI_WIP 1 +#endif + +#define ERROR_OK 0 + +static int fespi_txwm_wait(volatile uint32_t *ctrl_base); +static void fespi_disable_hw_mode(volatile uint32_t *ctrl_base); +static void fespi_enable_hw_mode(volatile uint32_t *ctrl_base); +static int fespi_wip(volatile uint32_t *ctrl_base); +static int fespi_write_buffer(volatile uint32_t *ctrl_base, + const uint8_t *buffer, unsigned offset, unsigned len, + uint32_t flash_info); + +/* Can set bits 3:0 in result. */ +/* flash_info contains: + * bits 7:0 -- pprog_cmd + * bit 8 -- 0 means send 3 bytes after pprog_cmd, 1 means send 4 bytes + * after pprog_cmd + */ +int flash_fespi(volatile uint32_t *ctrl_base, uint32_t page_size, + const uint8_t *buffer, unsigned offset, uint32_t count, + uint32_t flash_info) +{ + int result; + + result = fespi_txwm_wait(ctrl_base); + if (result != ERROR_OK) + return result | ERROR_STACK(0x1); + + /* Disable Hardware accesses*/ + fespi_disable_hw_mode(ctrl_base); + + /* poll WIP */ + result = fespi_wip(ctrl_base); + if (result != ERROR_OK) { + result |= ERROR_STACK(0x2); + goto err; + } + + /* Assume page_size is a power of two so we don't need the modulus code. */ + uint32_t page_offset = offset & (page_size - 1); + + /* central part, aligned words */ + while (count > 0) { + uint32_t cur_count; + /* clip block at page boundary */ + if (page_offset + count > page_size) + cur_count = page_size - page_offset; + else + cur_count = count; + + result = fespi_write_buffer(ctrl_base, buffer, offset, cur_count, flash_info); + if (result != ERROR_OK) { + result |= ERROR_STACK(0x3); + goto err; + } + + page_offset = 0; + buffer += cur_count; + offset += cur_count; + count -= cur_count; + } + +err: + /* Switch to HW mode before return to prompt */ + fespi_enable_hw_mode(ctrl_base); + + return result; +} + +static uint32_t fespi_read_reg(volatile uint32_t *ctrl_base, unsigned address) +{ + return ctrl_base[address / 4]; +} + +static void fespi_write_reg(volatile uint32_t *ctrl_base, unsigned address, uint32_t value) +{ + ctrl_base[address / 4] = value; +} + +static void fespi_disable_hw_mode(volatile uint32_t *ctrl_base) +{ + uint32_t fctrl = fespi_read_reg(ctrl_base, FESPI_REG_FCTRL); + fespi_write_reg(ctrl_base, FESPI_REG_FCTRL, fctrl & ~FESPI_FCTRL_EN); +} + +static void fespi_enable_hw_mode(volatile uint32_t *ctrl_base) +{ + uint32_t fctrl = fespi_read_reg(ctrl_base, FESPI_REG_FCTRL); + fespi_write_reg(ctrl_base, FESPI_REG_FCTRL, fctrl | FESPI_FCTRL_EN); +} + +/* Can set bits 7:4 in result. */ +static int fespi_txwm_wait(volatile uint32_t *ctrl_base) +{ + unsigned timeout = TIMEOUT; + + while (timeout--) { + uint32_t ip = fespi_read_reg(ctrl_base, FESPI_REG_IP); + if (ip & FESPI_IP_TXWM) + return ERROR_OK; + } + + return ERROR_FESPI_TXWM_WAIT; +} + +static void fespi_set_dir(volatile uint32_t *ctrl_base, bool dir) +{ + uint32_t fmt = fespi_read_reg(ctrl_base, FESPI_REG_FMT); + fespi_write_reg(ctrl_base, FESPI_REG_FMT, + (fmt & ~(FESPI_FMT_DIR(0xFFFFFFFF))) | FESPI_FMT_DIR(dir)); +} + +/* Can set bits 11:8 in result. */ +static int fespi_tx(volatile uint32_t *ctrl_base, uint8_t in) +{ + unsigned timeout = TIMEOUT; + + while (timeout--) { + uint32_t txfifo = fespi_read_reg(ctrl_base, FESPI_REG_TXFIFO); + if (!(txfifo >> 31)) { + fespi_write_reg(ctrl_base, FESPI_REG_TXFIFO, in); + return ERROR_OK; + } + } + return ERROR_FESPI_TX; +} + +/* Can set bits 15:12 in result. */ +static int fespi_rx(volatile uint32_t *ctrl_base, uint8_t *out) +{ + unsigned timeout = TIMEOUT; + + while (timeout--) { + uint32_t value = fespi_read_reg(ctrl_base, FESPI_REG_RXFIFO); + if (!(value >> 31)) { + if (out) + *out = value & 0xff; + return ERROR_OK; + } + } + + return ERROR_FESPI_RX; +} + +/* Can set bits 19:16 in result. */ +static int fespi_wip(volatile uint32_t *ctrl_base) +{ + fespi_set_dir(ctrl_base, FESPI_DIR_RX); + + fespi_write_reg(ctrl_base, FESPI_REG_CSMODE, FESPI_CSMODE_HOLD); + + int result = fespi_tx(ctrl_base, SPIFLASH_READ_STATUS); + if (result != ERROR_OK) + return result | ERROR_STACK(0x10000); + result = fespi_rx(ctrl_base, NULL); + if (result != ERROR_OK) + return result | ERROR_STACK(0x20000); + + unsigned timeout = TIMEOUT; + while (timeout--) { + result = fespi_tx(ctrl_base, 0); + if (result != ERROR_OK) + return result | ERROR_STACK(0x30000); + uint8_t rx; + result = fespi_rx(ctrl_base, &rx); + if (result != ERROR_OK) + return result | ERROR_STACK(0x40000); + if ((rx & SPIFLASH_BSY_BIT) == 0) { + fespi_write_reg(ctrl_base, FESPI_REG_CSMODE, FESPI_CSMODE_AUTO); + fespi_set_dir(ctrl_base, FESPI_DIR_TX); + return ERROR_OK; + } + } + + return ERROR_FESPI_WIP; +} + +/* Can set bits 23:20 in result. */ +static int fespi_write_buffer(volatile uint32_t *ctrl_base, + const uint8_t *buffer, unsigned offset, unsigned len, + uint32_t flash_info) +{ + int result = fespi_tx(ctrl_base, SPIFLASH_WRITE_ENABLE); + if (result != ERROR_OK) + return result | ERROR_STACK(0x100000); + result = fespi_txwm_wait(ctrl_base); + if (result != ERROR_OK) + return result | ERROR_STACK(0x200000); + + fespi_write_reg(ctrl_base, FESPI_REG_CSMODE, FESPI_CSMODE_HOLD); + + result = fespi_tx(ctrl_base, flash_info & 0xff); + if (result != ERROR_OK) + return result | ERROR_STACK(0x300000); + + if (flash_info & 0x100) { + result = fespi_tx(ctrl_base, offset >> 24); + if (result != ERROR_OK) + return result | ERROR_STACK(0x400000); + } + result = fespi_tx(ctrl_base, offset >> 16); + if (result != ERROR_OK) + return result | ERROR_STACK(0x400000); + result = fespi_tx(ctrl_base, offset >> 8); + if (result != ERROR_OK) + return result | ERROR_STACK(0x500000); + result = fespi_tx(ctrl_base, offset); + if (result != ERROR_OK) + return result | ERROR_STACK(0x600000); + + for (unsigned i = 0; i < len; i++) { + result = fespi_tx(ctrl_base, buffer[i]); + if (result != ERROR_OK) + return result | ERROR_STACK(0x700000); + } + + result = fespi_txwm_wait(ctrl_base); + if (result != ERROR_OK) + return result | ERROR_STACK(0x800000); + + fespi_write_reg(ctrl_base, FESPI_REG_CSMODE, FESPI_CSMODE_AUTO); + + result = fespi_wip(ctrl_base); + if (result != ERROR_OK) + return result | ERROR_STACK(0x900000); + return ERROR_OK; +} diff --git a/contrib/loaders/flash/fespi/riscv_wrapper.S b/contrib/loaders/flash/fespi/riscv_wrapper.S new file mode 100644 index 000000000..4f632a76e --- /dev/null +++ b/contrib/loaders/flash/fespi/riscv_wrapper.S @@ -0,0 +1,22 @@ +#if __riscv_xlen == 64 +# define LREG ld +# define SREG sd +# define REGBYTES 8 +#else +# define LREG lw +# define SREG sw +# define REGBYTES 4 +#endif + + .section .text.entry + .global _start +_start: + lla sp, stack_end + jal flash_fespi + ebreak + + .section .data + .balign REGBYTES +stack: + .fill 16, REGBYTES, 0x8675309 +stack_end: diff --git a/src/flash/nor/fespi.c b/src/flash/nor/fespi.c index 150e91a1c..11da81854 100644 --- a/src/flash/nor/fespi.c +++ b/src/flash/nor/fespi.c @@ -337,6 +337,11 @@ static int fespi_erase_sector(struct flash_bank *bank, int sector) if (retval != ERROR_OK) return retval; sector = bank->sectors[sector].offset; + if (bank->size > 0x1000000) { + retval = fespi_tx(bank, sector >> 24); + if (retval != ERROR_OK) + return retval; + } retval = fespi_tx(bank, sector >> 16); if (retval != ERROR_OK) return retval; @@ -435,32 +440,38 @@ static int fespi_protect(struct flash_bank *bank, int set, static int slow_fespi_write_buffer(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t len) { + struct fespi_flash_bank *fespi_info = bank->driver_priv; uint32_t ii; - if (offset & 0xFF000000) { - LOG_ERROR("FESPI interface does not support greater than 3B addressing, can't write to offset 0x%" PRIx32, - offset); - return ERROR_FAIL; - } - /* TODO!!! assert that len < page size */ - fespi_tx(bank, SPIFLASH_WRITE_ENABLE); - fespi_txwm_wait(bank); + if (fespi_tx(bank, SPIFLASH_WRITE_ENABLE) != ERROR_OK) + return ERROR_FAIL; + if (fespi_txwm_wait(bank) != ERROR_OK) + return ERROR_FAIL; if (fespi_write_reg(bank, FESPI_REG_CSMODE, FESPI_CSMODE_HOLD) != ERROR_OK) return ERROR_FAIL; - fespi_tx(bank, SPIFLASH_PAGE_PROGRAM); + if (fespi_tx(bank, fespi_info->dev->pprog_cmd) != ERROR_OK) + return ERROR_FAIL; - fespi_tx(bank, offset >> 16); - fespi_tx(bank, offset >> 8); - fespi_tx(bank, offset); + if (bank->size > 0x1000000 && fespi_tx(bank, offset >> 24) != ERROR_OK) + return ERROR_FAIL; + if (fespi_tx(bank, offset >> 16) != ERROR_OK) + return ERROR_FAIL; + if (fespi_tx(bank, offset >> 8) != ERROR_OK) + return ERROR_FAIL; + if (fespi_tx(bank, offset) != ERROR_OK) + return ERROR_FAIL; - for (ii = 0; ii < len; ii++) - fespi_tx(bank, buffer[ii]); + for (ii = 0; ii < len; ii++) { + if (fespi_tx(bank, buffer[ii]) != ERROR_OK) + return ERROR_FAIL; + } - fespi_txwm_wait(bank); + if (fespi_txwm_wait(bank) != ERROR_OK) + return ERROR_FAIL; if (fespi_write_reg(bank, FESPI_REG_CSMODE, FESPI_CSMODE_AUTO) != ERROR_OK) return ERROR_FAIL; @@ -470,273 +481,24 @@ static int slow_fespi_write_buffer(struct flash_bank *bank, return ERROR_OK; } -static const uint8_t algorithm_bin[] = { -#include "../../../contrib/loaders/flash/fespi/fespi.inc" -}; -#define STEP_EXIT 4 -#define STEP_TX 8 -#define STEP_TXWM_WAIT 12 -#define STEP_WRITE_REG 16 -#define STEP_WIP_WAIT 20 -#define STEP_SET_DIR 24 -#define STEP_NOP 0xff - -struct algorithm_steps { - unsigned size; - unsigned used; - uint8_t **steps; +static const uint8_t riscv32_bin[] = { +#include "../../../contrib/loaders/flash/fespi/riscv32_fespi.inc" }; -static struct algorithm_steps *as_new(void) -{ - struct algorithm_steps *as = calloc(1, sizeof(struct algorithm_steps)); - as->size = 8; - as->steps = malloc(as->size * sizeof(as->steps[0])); - return as; -} - -static struct algorithm_steps *as_delete(struct algorithm_steps *as) -{ - for (unsigned step = 0; step < as->used; step++) { - free(as->steps[step]); - as->steps[step] = NULL; - } - free(as->steps); - free(as); - return NULL; -} - -static int as_empty(struct algorithm_steps *as) -{ - for (unsigned s = 0; s < as->used; s++) { - if (as->steps[s][0] != STEP_NOP) - return 0; - } - return 1; -} - -/* Return size of compiled program. */ -static unsigned as_compile(struct algorithm_steps *as, uint8_t *target, - unsigned target_size) -{ - unsigned offset = 0; - bool finish_early = false; - for (unsigned s = 0; s < as->used && !finish_early; s++) { - unsigned bytes_left = target_size - offset; - switch (as->steps[s][0]) { - case STEP_NOP: - break; - case STEP_TX: - { - unsigned size = as->steps[s][1]; - if (size + 3 > bytes_left) { - finish_early = true; - break; - } - memcpy(target + offset, as->steps[s], size + 2); - offset += size + 2; - break; - } - case STEP_WRITE_REG: - if (bytes_left < 4) { - finish_early = true; - break; - } - memcpy(target + offset, as->steps[s], 3); - offset += 3; - break; - case STEP_SET_DIR: - if (bytes_left < 3) { - finish_early = true; - break; - } - memcpy(target + offset, as->steps[s], 2); - offset += 2; - break; - case STEP_TXWM_WAIT: - case STEP_WIP_WAIT: - if (bytes_left < 2) { - finish_early = true; - break; - } - memcpy(target + offset, as->steps[s], 1); - offset += 1; - break; - default: - assert(0); - } - if (!finish_early) - as->steps[s][0] = STEP_NOP; - } - assert(offset + 1 <= target_size); - target[offset++] = STEP_EXIT; - - LOG_DEBUG("%d-byte program:", offset); - for (unsigned i = 0; i < offset;) { - char buf[80]; - for (unsigned x = 0; i < offset && x < 16; x++, i++) - sprintf(buf + x*3, "%02x ", target[i]); - LOG_DEBUG("%s", buf); - } - - return offset; -} - -static void as_add_step(struct algorithm_steps *as, uint8_t *step) -{ - if (as->used == as->size) { - as->size *= 2; - as->steps = realloc(as->steps, sizeof(as->steps[0]) * as->size); - LOG_DEBUG("Increased size to 0x%x", as->size); - } - as->steps[as->used] = step; - as->used++; -} - -static void as_add_tx(struct algorithm_steps *as, unsigned count, const uint8_t *data) -{ - LOG_DEBUG("count=%d", count); - while (count > 0) { - unsigned step_count = MIN(count, 255); - uint8_t *step = malloc(step_count + 2); - step[0] = STEP_TX; - step[1] = step_count; - memcpy(step + 2, data, step_count); - as_add_step(as, step); - data += step_count; - count -= step_count; - } -} - -static void as_add_tx1(struct algorithm_steps *as, uint8_t byte) -{ - uint8_t data[1]; - data[0] = byte; - as_add_tx(as, 1, data); -} - -static void as_add_write_reg(struct algorithm_steps *as, uint8_t offset, uint8_t data) -{ - uint8_t *step = malloc(3); - step[0] = STEP_WRITE_REG; - step[1] = offset; - step[2] = data; - as_add_step(as, step); -} - -static void as_add_txwm_wait(struct algorithm_steps *as) -{ - uint8_t *step = malloc(1); - step[0] = STEP_TXWM_WAIT; - as_add_step(as, step); -} - -static void as_add_wip_wait(struct algorithm_steps *as) -{ - uint8_t *step = malloc(1); - step[0] = STEP_WIP_WAIT; - as_add_step(as, step); -} - -static void as_add_set_dir(struct algorithm_steps *as, bool dir) -{ - uint8_t *step = malloc(2); - step[0] = STEP_SET_DIR; - step[1] = FESPI_FMT_DIR(dir); - as_add_step(as, step); -} - -/* This should write something less than or equal to a page.*/ -static int steps_add_buffer_write(struct algorithm_steps *as, - const uint8_t *buffer, uint32_t chip_offset, uint32_t len) -{ - if (chip_offset & 0xFF000000) { - LOG_ERROR("FESPI interface does not support greater than 3B addressing, can't write to offset 0x%" PRIx32, - chip_offset); - return ERROR_FAIL; - } - - as_add_tx1(as, SPIFLASH_WRITE_ENABLE); - as_add_txwm_wait(as); - as_add_write_reg(as, FESPI_REG_CSMODE, FESPI_CSMODE_HOLD); - - uint8_t setup[] = { - SPIFLASH_PAGE_PROGRAM, - chip_offset >> 16, - chip_offset >> 8, - chip_offset, - }; - as_add_tx(as, sizeof(setup), setup); - - as_add_tx(as, len, buffer); - as_add_txwm_wait(as); - as_add_write_reg(as, FESPI_REG_CSMODE, FESPI_CSMODE_AUTO); - - /* fespi_wip() */ - as_add_set_dir(as, FESPI_DIR_RX); - as_add_write_reg(as, FESPI_REG_CSMODE, FESPI_CSMODE_HOLD); - as_add_wip_wait(as); - as_add_write_reg(as, FESPI_REG_CSMODE, FESPI_CSMODE_AUTO); - as_add_set_dir(as, FESPI_DIR_TX); - - return ERROR_OK; -} - -static int steps_execute(struct algorithm_steps *as, - struct flash_bank *bank, struct working_area *algorithm_wa, - struct working_area *data_wa) -{ - struct target *target = bank->target; - struct fespi_flash_bank *fespi_info = bank->driver_priv; - uint32_t ctrl_base = fespi_info->ctrl_base; - int xlen = riscv_xlen(target); - - struct reg_param reg_params[2]; - init_reg_param(®_params[0], "a0", xlen, PARAM_OUT); - init_reg_param(®_params[1], "a1", xlen, PARAM_OUT); - buf_set_u64(reg_params[0].value, 0, xlen, ctrl_base); - buf_set_u64(reg_params[1].value, 0, xlen, data_wa->address); - - int retval = ERROR_OK; - while (!as_empty(as)) { - keep_alive(); - uint8_t *data_buf = malloc(data_wa->size); - unsigned bytes = as_compile(as, data_buf, data_wa->size); - retval = target_write_buffer(target, data_wa->address, bytes, - data_buf); - free(data_buf); - if (retval != ERROR_OK) { - LOG_ERROR("Failed to write data to " TARGET_ADDR_FMT ": %d", - data_wa->address, retval); - goto exit; - } - - retval = target_run_algorithm(target, 0, NULL, 2, reg_params, - algorithm_wa->address, algorithm_wa->address + 4, - 10000, NULL); - if (retval != ERROR_OK) { - LOG_ERROR("Failed to execute algorithm at " TARGET_ADDR_FMT ": %d", - algorithm_wa->address, retval); - goto exit; - } - } - -exit: - destroy_reg_param(®_params[1]); - destroy_reg_param(®_params[0]); - return retval; -} +static const uint8_t riscv64_bin[] = { +#include "../../../contrib/loaders/flash/fespi/riscv64_fespi.inc" +}; static int fespi_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset, uint32_t count) { struct target *target = bank->target; struct fespi_flash_bank *fespi_info = bank->driver_priv; - uint32_t cur_count, page_size, page_offset; + uint32_t cur_count, page_size; int retval = ERROR_OK; - LOG_DEBUG("%s: offset=0x%08" PRIx32 " count=0x%08" PRIx32, - __func__, offset, count); + LOG_DEBUG("bank->size=0x%x offset=0x%08" PRIx32 " count=0x%08" PRIx32, + bank->size, offset, count); if (target->state != TARGET_HALTED) { LOG_ERROR("Target not halted"); @@ -761,80 +523,142 @@ static int fespi_write(struct flash_bank *bank, const uint8_t *buffer, } } - struct working_area *algorithm_wa; - if (target_alloc_working_area(target, sizeof(algorithm_bin), - &algorithm_wa) != ERROR_OK) { - LOG_WARNING("Couldn't allocate %zd-byte working area.", - sizeof(algorithm_bin)); - algorithm_wa = NULL; + unsigned int xlen = riscv_xlen(target); + struct working_area *algorithm_wa = NULL; + struct working_area *data_wa = NULL; + const uint8_t *bin; + size_t bin_size; + if (xlen == 32) { + bin = riscv32_bin; + bin_size = sizeof(riscv32_bin); } else { + bin = riscv64_bin; + bin_size = sizeof(riscv64_bin); + } + + unsigned data_wa_size = 0; + if (target_alloc_working_area(target, bin_size, &algorithm_wa) == ERROR_OK) { retval = target_write_buffer(target, algorithm_wa->address, - sizeof(algorithm_bin), algorithm_bin); + bin_size, bin); if (retval != ERROR_OK) { LOG_ERROR("Failed to write code to " TARGET_ADDR_FMT ": %d", algorithm_wa->address, retval); target_free_working_area(target, algorithm_wa); algorithm_wa = NULL; - } - } - struct working_area *data_wa = NULL; - unsigned data_wa_size = 2 * count; - while (1) { - if (data_wa_size < 128) { - LOG_WARNING("Couldn't allocate data working area."); - target_free_working_area(target, algorithm_wa); - algorithm_wa = NULL; - } - if (target_alloc_working_area_try(target, data_wa_size, &data_wa) == - ERROR_OK) { - break; + } else { + data_wa_size = MIN(target_get_working_area_avail(target), count); + if (data_wa_size < 128) { + LOG_WARNING("Couldn't allocate data working area."); + target_free_working_area(target, algorithm_wa); + algorithm_wa = NULL; + } else if (target_alloc_working_area(target, data_wa_size, &data_wa) != ERROR_OK) { + target_free_working_area(target, algorithm_wa); + algorithm_wa = NULL; + } } - - data_wa_size /= 2; + } else { + LOG_WARNING("Couldn't allocate %zd-byte working area.", bin_size); + algorithm_wa = NULL; } /* If no valid page_size, use reasonable default. */ page_size = fespi_info->dev->pagesize ? fespi_info->dev->pagesize : SPIFLASH_DEF_PAGESIZE; - fespi_txwm_wait(bank); + if (algorithm_wa) { + struct reg_param reg_params[6]; + init_reg_param(®_params[0], "a0", xlen, PARAM_IN_OUT); + init_reg_param(®_params[1], "a1", xlen, PARAM_OUT); + init_reg_param(®_params[2], "a2", xlen, PARAM_OUT); + init_reg_param(®_params[3], "a3", xlen, PARAM_OUT); + init_reg_param(®_params[4], "a4", xlen, PARAM_OUT); + init_reg_param(®_params[5], "a5", xlen, PARAM_OUT); + + while (count > 0) { + cur_count = MIN(count, data_wa_size); + buf_set_u64(reg_params[0].value, 0, xlen, fespi_info->ctrl_base); + buf_set_u64(reg_params[1].value, 0, xlen, page_size); + buf_set_u64(reg_params[2].value, 0, xlen, data_wa->address); + buf_set_u64(reg_params[3].value, 0, xlen, offset); + buf_set_u64(reg_params[4].value, 0, xlen, cur_count); + buf_set_u64(reg_params[5].value, 0, xlen, + fespi_info->dev->pprog_cmd | (bank->size > 0x1000000 ? 0x100 : 0)); + + retval = target_write_buffer(target, data_wa->address, cur_count, + buffer); + if (retval != ERROR_OK) { + LOG_DEBUG("Failed to write %d bytes to " TARGET_ADDR_FMT ": %d", + cur_count, data_wa->address, retval); + goto err; + } + + LOG_DEBUG("write(ctrl_base=0x%" TARGET_PRIxADDR ", page_size=0x%x, " + "address=0x%" TARGET_PRIxADDR ", offset=0x%" PRIx32 + ", count=0x%" PRIx32 "), buffer=%02x %02x %02x %02x %02x %02x ..." PRIx32, + fespi_info->ctrl_base, page_size, data_wa->address, offset, cur_count, + buffer[0], buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]); + retval = target_run_algorithm(target, 0, NULL, + ARRAY_SIZE(reg_params), reg_params, + algorithm_wa->address, 0, cur_count * 2, NULL); + if (retval != ERROR_OK) { + LOG_ERROR("Failed to execute algorithm at " TARGET_ADDR_FMT ": %d", + algorithm_wa->address, retval); + goto err; + } + + uint64_t algorithm_result = buf_get_u64(reg_params[0].value, 0, xlen); + if (algorithm_result != 0) { + LOG_ERROR("Algorithm returned error %" PRId64, algorithm_result); + retval = ERROR_FAIL; + goto err; + } + + buffer += cur_count; + offset += cur_count; + count -= cur_count; + } - /* Disable Hardware accesses*/ - if (fespi_disable_hw_mode(bank) != ERROR_OK) - return ERROR_FAIL; + target_free_working_area(target, data_wa); + target_free_working_area(target, algorithm_wa); - struct algorithm_steps *as = as_new(); + } else { + fespi_txwm_wait(bank); - /* poll WIP */ - retval = fespi_wip(bank, FESPI_PROBE_TIMEOUT); - if (retval != ERROR_OK) - goto err; - - page_offset = offset % page_size; - /* central part, aligned words */ - while (count > 0) { - /* clip block at page boundary */ - if (page_offset + count > page_size) - cur_count = page_size - page_offset; - else - cur_count = count; - - if (algorithm_wa) - retval = steps_add_buffer_write(as, buffer, offset, cur_count); - else - retval = slow_fespi_write_buffer(bank, buffer, offset, cur_count); + /* Disable Hardware accesses*/ + if (fespi_disable_hw_mode(bank) != ERROR_OK) + return ERROR_FAIL; + + /* poll WIP */ + retval = fespi_wip(bank, FESPI_PROBE_TIMEOUT); if (retval != ERROR_OK) goto err; - page_offset = 0; - buffer += cur_count; - offset += cur_count; - count -= cur_count; + uint32_t page_offset = offset % page_size; + /* central part, aligned words */ + while (count > 0) { + /* clip block at page boundary */ + if (page_offset + count > page_size) + cur_count = page_size - page_offset; + else + cur_count = count; + + retval = slow_fespi_write_buffer(bank, buffer, offset, cur_count); + if (retval != ERROR_OK) + goto err; + + page_offset = 0; + buffer += cur_count; + offset += cur_count; + count -= cur_count; + } + + /* Switch to HW mode before return to prompt */ + if (fespi_enable_hw_mode(bank) != ERROR_OK) + return ERROR_FAIL; } - if (algorithm_wa) - retval = steps_execute(as, bank, algorithm_wa, data_wa); + return ERROR_OK; err: if (algorithm_wa) { @@ -842,11 +666,10 @@ err: target_free_working_area(target, algorithm_wa); } - as_delete(as); - /* Switch to HW mode before return to prompt */ if (fespi_enable_hw_mode(bank) != ERROR_OK) return ERROR_FAIL; + return retval; } @@ -976,8 +799,6 @@ static int fespi_probe(struct flash_bank *bank) if (bank->size <= (1UL << 16)) LOG_WARNING("device needs 2-byte addresses - not implemented"); - if (bank->size > (1UL << 24)) - LOG_WARNING("device needs paging or 4-byte addresses - not implemented"); /* if no sectors, treat whole bank as single sector */ sectorsize = fespi_info->dev->sectorsize ? ----------------------------------------------------------------------- Summary of changes: contrib/loaders/flash/fespi/Makefile | 45 ++- contrib/loaders/flash/fespi/fespi.S | 99 ------ contrib/loaders/flash/fespi/fespi.inc | 15 - contrib/loaders/flash/fespi/riscv.lds | 12 + contrib/loaders/flash/fespi/riscv32_fespi.inc | 51 +++ contrib/loaders/flash/fespi/riscv64_fespi.inc | 58 ++++ contrib/loaders/flash/fespi/riscv_fespi.c | 321 +++++++++++++++++ contrib/loaders/flash/fespi/riscv_wrapper.S | 22 ++ src/flash/nor/fespi.c | 475 ++++++++------------------ 9 files changed, 646 insertions(+), 452 deletions(-) delete mode 100644 contrib/loaders/flash/fespi/fespi.S delete mode 100644 contrib/loaders/flash/fespi/fespi.inc create mode 100644 contrib/loaders/flash/fespi/riscv.lds create mode 100644 contrib/loaders/flash/fespi/riscv32_fespi.inc create mode 100644 contrib/loaders/flash/fespi/riscv64_fespi.inc create mode 100644 contrib/loaders/flash/fespi/riscv_fespi.c create mode 100644 contrib/loaders/flash/fespi/riscv_wrapper.S hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 21:56:12
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 15110b2b5bf3459d038e6142d151c3856760e387 (commit) from 39197e3e5345964686b7d5e2c3fce3d63563a7e9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 15110b2b5bf3459d038e6142d151c3856760e387 Author: Yasushi SHOJI <ya...@sp...> Date: Mon Nov 22 08:21:50 2021 +0900 doc/openocd.texi: Document usage command Document usage command under General Commands -> Server Commands. The text is taken from the command's help string. Change-Id: I957cb46cca98181c3c5e676228c5c103e47bb655 Signed-off-by: Yasushi SHOJI <ya...@sp...> Reviewed-on: https://review.openocd.org/c/openocd/+/6735 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 2c612e0a3..e0234e577 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -8250,6 +8250,13 @@ In most cases, no such restriction is listed; this indicates commands which are only available after the configuration stage has completed. @end deffn +@deffn {Command} {usage} [string] +With no parameters, prints usage text for all commands. Otherwise, +prints all usage text of which command, help text, and usage text +containing @var{string}. +Not every command provides helptext. +@end deffn + @deffn {Command} {sleep} msec [@option{busy}] Wait for at least @var{msec} milliseconds before resuming. If @option{busy} is passed, busy-wait instead of sleeping. ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 7 +++++++ 1 file changed, 7 insertions(+) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 21:55:32
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 39197e3e5345964686b7d5e2c3fce3d63563a7e9 (commit) from 6179d9f848a78908e9ca245c775a510ed1b6ac17 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 39197e3e5345964686b7d5e2c3fce3d63563a7e9 Author: Yasushi SHOJI <ya...@sp...> Date: Mon Nov 22 08:18:22 2021 +0900 doc/openocd.texi: Document add_help_text and add_usage_text Document add_help_text and add_usage_text under Genral Commands -> Misc Commands. The text are taken from command's help strings. Change-Id: I2bbbee8e5faa8d9654227c304e0528f5144275e8 Signed-off-by: Yasushi SHOJI <ya...@sp...> Reviewed-on: https://review.openocd.org/c/openocd/+/6734 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 4923a872b..2c612e0a3 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -8739,6 +8739,14 @@ Requests the current target to map the specified @var{virtual_address} to its corresponding physical address, and displays the result. @end deffn +@deffn {Command} {add_help_text} 'command_name' 'help-string' +Add or replace help text on the given @var{command_name}. +@end deffn + +@deffn {Command} {add_usage_text} 'command_name' 'help-string' +Add or replace usage text on the given @var{command_name}. +@end deffn + @node Architecture and Core Commands @chapter Architecture and Core Commands @cindex Architecture Specific Commands ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 8 ++++++++ 1 file changed, 8 insertions(+) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 21:54:30
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 6179d9f848a78908e9ca245c775a510ed1b6ac17 (commit) from bbe8b0df176a12ca1248134ee26ca13d61903094 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6179d9f848a78908e9ca245c775a510ed1b6ac17 Author: Tomas Vanek <va...@fb...> Date: Sat Nov 20 17:53:03 2021 +0100 doc: document 'cmsis-dap cmd' command Change-Id: I90b7f020ee2bf078fdf22e3d21423f333ae061ac Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/6732 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 7962093e4..4923a872b 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -2447,6 +2447,16 @@ interface string or for user class interface. @deffn {Command} {cmsis-dap info} Display various device information, like hardware version, firmware version, current bus status. @end deffn + +@deffn {Command} {cmsis-dap cmd} number number ... +Execute an arbitrary CMSIS-DAP command. Use for adapter testing or for handling +of an adapter vendor specific command from a Tcl script. + +Take given numbers as bytes, assemble a CMSIS-DAP protocol command packet +from them and send it to the adapter. The first 4 bytes of the adapter response +are logged. +See @url{https://arm-software.github.io/CMSIS_5/DAP/html/group__DAP__Commands__gr.html} +@end deffn @end deffn @deffn {Interface Driver} {dummy} ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 10 ++++++++++ 1 file changed, 10 insertions(+) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 21:54:06
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via bbe8b0df176a12ca1248134ee26ca13d61903094 (commit) via 21d11f13ec533dab4d810ba631bb860768ee2cee (commit) from c07e4b37829067a872e2a52f9a490bd8903e66da (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bbe8b0df176a12ca1248134ee26ca13d61903094 Author: Tomas Vanek <va...@fb...> Date: Sat Nov 20 17:07:31 2021 +0100 doc: fix list of supported nRF52 devices Change-Id: I64d6d851dd9333689556b7062b1ff38d41b5ad32 Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/6731 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/doc/openocd.texi b/doc/openocd.texi index ccad381b2..7962093e4 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -6829,9 +6829,11 @@ flash bank $_FLASHNAME npcx 0x64000000 0 0 0 $_TARGETNAME @deffn {Flash Driver} {nrf5} All members of the nRF51 microcontroller families from Nordic Semiconductor -include internal flash and use ARM Cortex-M0 core. -Also, the nRF52832 microcontroller from Nordic Semiconductor, which include -internal flash and use an ARM Cortex-M4F core. +include internal flash and use ARM Cortex-M0 core. nRF52 family powered +by ARM Cortex-M4 or M4F core is supported too. nRF52832 is fully supported +including BPROT flash protection scheme. nRF52833 and nRF52840 devices are +supported with the exception of security extensions (flash access control list +- ACL). @example flash bank $_FLASHNAME nrf5 0 0x00000000 0 0 $_TARGETNAME commit 21d11f13ec533dab4d810ba631bb860768ee2cee Author: Tomas Vanek <va...@fb...> Date: Sat Nov 20 14:27:45 2021 +0100 flash/nor/at91samd: remove 'at91samd info' command The command is a stub only, does nothing. Change-Id: Ib3b8c2122a9f6f2e179bee34ac56d0adf367bfcc Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/6730 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/at91samd.c b/src/flash/nor/at91samd.c index a8fab486c..5f314d82b 100644 --- a/src/flash/nor/at91samd.c +++ b/src/flash/nor/at91samd.c @@ -946,11 +946,6 @@ FLASH_BANK_COMMAND_HANDLER(samd_flash_bank_command) return ERROR_OK; } -COMMAND_HANDLER(samd_handle_info_command) -{ - return ERROR_OK; -} - COMMAND_HANDLER(samd_handle_chip_erase_command) { struct target *target = get_current_target(CMD_CTX); @@ -1211,14 +1206,6 @@ static const struct command_registration at91samd_exec_command_handlers[] = { .help = "Deassert internal reset held by DSU.", .usage = "", }, - { - .name = "info", - .handler = samd_handle_info_command, - .mode = COMMAND_EXEC, - .help = "Print information about the current at91samd chip " - "and its flash configuration.", - .usage = "", - }, { .name = "chip-erase", .handler = samd_handle_chip_erase_command, ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 8 +++++--- src/flash/nor/at91samd.c | 13 ------------- 2 files changed, 5 insertions(+), 16 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 21:53:35
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via c07e4b37829067a872e2a52f9a490bd8903e66da (commit) via abd94b832524e84e1500aa9dac85e0423a62b32d (commit) from 55da5b47cba1de8e99bda8d71c721da24d1bf1d4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c07e4b37829067a872e2a52f9a490bd8903e66da Author: Tomas Vanek <va...@fb...> Date: Sat Nov 20 13:36:00 2021 +0100 doc: document 'atsamv gpnvm' command Change-Id: I922c75e2d074447558f85bfda5421aa24a850be1 Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/6729 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/doc/openocd.texi b/doc/openocd.texi index 4b93a896c..ccad381b2 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -6184,6 +6184,21 @@ USER PAGE: 0xAEECFF80FE9A9239 All members of the ATSAMV7x, ATSAMS70, and ATSAME70 families from Atmel include internal flash and use ARM's Cortex-M7 core. This driver uses the same command names/syntax as @xref{at91sam3}. + +@example +flash bank $_FLASHNAME atsamv 0x00400000 0 0 0 $_TARGETNAME +@end example + +@deffn {Command} {atsamv gpnvm} [@option{show} [@option{all}|number]] +@deffnx {Command} {atsamv gpnvm} (@option{clr}|@option{set}) number +With no parameters, @option{show} or @option{show all}, +shows the status of all GPNVM bits. +With @option{show} @var{number}, displays that bit. + +With @option{set} @var{number} or @option{clear} @var{number}, +modifies that GPNVM bit. +@end deffn + @end deffn @deffn {Flash Driver} {at91sam7} commit abd94b832524e84e1500aa9dac85e0423a62b32d Author: Tomas Vanek <va...@fb...> Date: Sat Nov 20 11:44:55 2021 +0100 flash/nor/kinetis_ke: remove 'kinetis mdm test_securing' cmd The command might be a leftover from development of the driver. There is no documentation what it does. Change-Id: Iaa5aa1ac51638bd6acce172a5dd03846a165dc27 Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/6728 Tested-by: jenkins Reviewed-by: Ivan-Artekit <iv...@ar...> diff --git a/src/flash/nor/kinetis_ke.c b/src/flash/nor/kinetis_ke.c index 225dc6f07..48749e617 100644 --- a/src/flash/nor/kinetis_ke.c +++ b/src/flash/nor/kinetis_ke.c @@ -933,39 +933,6 @@ static int kinetis_ke_ftmrx_command(struct flash_bank *bank, uint8_t count, return ERROR_OK; } -COMMAND_HANDLER(kinetis_ke_securing_test) -{ - int result; - struct target *target = get_current_target(CMD_CTX); - struct flash_bank *bank = NULL; - uint32_t address; - - uint8_t FCCOBIX[2], FCCOBHI[2], FCCOBLO[2], fstat; - - result = get_flash_bank_by_addr(target, 0x00000000, true, &bank); - if (result != ERROR_OK) - return result; - - assert(bank); - - if (target->state != TARGET_HALTED) { - LOG_ERROR("Target not halted"); - return ERROR_TARGET_NOT_HALTED; - } - - address = bank->base + 0x00000400; - - FCCOBIX[0] = 0; - FCCOBHI[0] = FTMRX_CMD_ERASESECTOR; - FCCOBLO[0] = address >> 16; - - FCCOBIX[1] = 1; - FCCOBHI[1] = address >> 8; - FCCOBLO[1] = address; - - return kinetis_ke_ftmrx_command(bank, 2, FCCOBIX, FCCOBHI, FCCOBLO, &fstat); -} - static int kinetis_ke_erase(struct flash_bank *bank, unsigned int first, unsigned int last) { @@ -1252,13 +1219,6 @@ static const struct command_registration kinetis_ke_security_command_handlers[] .usage = "", .handler = kinetis_ke_mdm_mass_erase, }, - { - .name = "test_securing", - .mode = COMMAND_EXEC, - .help = "", - .usage = "", - .handler = kinetis_ke_securing_test, - }, COMMAND_REGISTRATION_DONE }; ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 15 +++++++++++++++ src/flash/nor/kinetis_ke.c | 40 ---------------------------------------- 2 files changed, 15 insertions(+), 40 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 21:53:25
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 55da5b47cba1de8e99bda8d71c721da24d1bf1d4 (commit) from af723387be87fadd02abb1f01a2734d004cbb5bc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 55da5b47cba1de8e99bda8d71c721da24d1bf1d4 Author: Tomas Vanek <va...@fb...> Date: Sat Nov 20 11:50:48 2021 +0100 flash/nor/kinetis_ke: add .help fields for tcl commands Add help texts from similar driver kinetis.c While on it fix one existing help: the flash is obviously not NAND Change-Id: Ibd295105586b008aaabf2fb4e4a75bf551266e38 Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/6727 Tested-by: jenkins Reviewed-by: Antonio Borneo <bor...@gm...> diff --git a/src/flash/nor/kinetis_ke.c b/src/flash/nor/kinetis_ke.c index dc3b37ecb..225dc6f07 100644 --- a/src/flash/nor/kinetis_ke.c +++ b/src/flash/nor/kinetis_ke.c @@ -1241,14 +1241,14 @@ static const struct command_registration kinetis_ke_security_command_handlers[] { .name = "check_security", .mode = COMMAND_EXEC, - .help = "", + .help = "Check status of device security lock", .usage = "", .handler = kinetis_ke_check_flash_security_status, }, { .name = "mass_erase", .mode = COMMAND_EXEC, - .help = "", + .help = "Issue a complete flash erase via the MDM-AP", .usage = "", .handler = kinetis_ke_mdm_mass_erase, }, @@ -1266,7 +1266,7 @@ static const struct command_registration kinetis_ke_exec_command_handlers[] = { { .name = "mdm", .mode = COMMAND_ANY, - .help = "", + .help = "MDM-AP command group", .usage = "", .chain = kinetis_ke_security_command_handlers, }, @@ -1284,7 +1284,7 @@ static const struct command_registration kinetis_ke_command_handler[] = { { .name = "kinetis_ke", .mode = COMMAND_ANY, - .help = "Kinetis KE NAND flash controller commands", + .help = "Kinetis KE flash controller commands", .usage = "", .chain = kinetis_ke_exec_command_handlers, }, ----------------------------------------------------------------------- Summary of changes: src/flash/nor/kinetis_ke.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 21:52:39
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via af723387be87fadd02abb1f01a2734d004cbb5bc (commit) from 57d9fd9bbc79e0bf7d642754f41390f17987d8cc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit af723387be87fadd02abb1f01a2734d004cbb5bc Author: Tomas Vanek <va...@fb...> Date: Tue Nov 23 13:17:47 2021 +0100 doc: mention SWD multidrop Change-Id: I361dc351c407b67613eadef4d29e27ed0e00bd05 Signed-off-by: Tomas Vanek <va...@fb...> Reviewed-on: https://review.openocd.org/c/openocd/+/6744 Reviewed-by: Antonio Borneo <bor...@gm...> Tested-by: jenkins diff --git a/doc/openocd.texi b/doc/openocd.texi index 337328187..4b93a896c 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -3433,6 +3433,17 @@ Parameters are currently the same as "jtag newtap" but this is expected to change. @end deffn +@cindex SWD multi-drop +The newer SWD devices (SW-DP v2 or SWJ-DP v2) support the multi-drop extension +of SWD protocol: two or more devices can be connected to one SWD adapter. +SWD transport works in multi-drop mode if @ref{dap_create,DAP} is configured +with both @code{-dp-id} and @code{-instance-id} parameters regardless how many +DAPs are created. + +Not all adapters and adapter drivers support SWD multi-drop. Only the following +adapter drivers are SWD multi-drop capable: +cmsis_dap (use an adapter with CMSIS-DAP version 2.0), ftdi, all bitbang based. + @subsection SPI Transport @cindex SPI @cindex Serial Peripheral Interface @@ -4346,6 +4357,7 @@ instead of "@option{-chain-position} @var{dotted.name}" when the target is creat The @command{dap} command group supports the following sub-commands: +@anchor{dap_create} @deffn {Command} {dap create} dap_name @option{-chain-position} dotted.name configparams... Declare a DAP instance named @var{dap_name} linked to the JTAG tap @var{dotted.name}. This also creates a new command (@command{dap_name}) ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 12 ++++++++++++ 1 file changed, 12 insertions(+) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 21:51:29
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 57d9fd9bbc79e0bf7d642754f41390f17987d8cc (commit) from cb0be63b12653defd5a0c33f06613411135166ec (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 57d9fd9bbc79e0bf7d642754f41390f17987d8cc Author: Antonio Borneo <bor...@gm...> Date: Mon Aug 23 16:41:43 2021 +0200 tcl: stm32mp13x: add target and board config files The stm32mp13x has one core Cortex-A7. The board Discovery Kit includes an on-board STLink-V3 with SWD connection. The webpage of the board is not active yet. Change-Id: I8836b26612a160ead79766955ebefaf3d21a329c Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/6675 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tar...@gm...> diff --git a/tcl/board/stm32mp13x_dk.cfg b/tcl/board/stm32mp13x_dk.cfg new file mode 100644 index 000000000..6993b1bc0 --- /dev/null +++ b/tcl/board/stm32mp13x_dk.cfg @@ -0,0 +1,10 @@ +# board MB1635x +# http://www.st.com/en/evaluation-tools/stm32mp135f-dk.html + +source [find interface/stlink-dap.cfg] + +transport select dapdirect_swd + +source [find target/stm32mp13x.cfg] + +reset_config srst_only diff --git a/tcl/target/stm32mp13x.cfg b/tcl/target/stm32mp13x.cfg new file mode 100644 index 000000000..0c464b411 --- /dev/null +++ b/tcl/target/stm32mp13x.cfg @@ -0,0 +1,100 @@ +# STMicroelectronics STM32MP13x (Single Cortex-A7) +# http://www.st.com/stm32mp1 + +# HLA does not support custom CSW nor AP other than 0 +if { [using_hla] } { + echo "ERROR: HLA transport cannot work with this target." + echo "ERROR: To use STLink switch to DAP mode, as in \"board/stm32mp13x_dk.cfg\"." + shutdown +} + +source [find target/swj-dp.tcl] + +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME stm32mp13x +} + +if { [info exists CPUTAPID] } { + set _CPUTAPID $CPUTAPID +} else { + if { [using_jtag] } { + set _CPUTAPID 0x6ba00477 + } else { + set _CPUTAPID 0x6ba02477 + } +} + +# Chip Level TAP Controller, only in jtag mode +if { [info exists CLCTAPID] } { + set _CLCTAPID $CLCTAPID +} else { + set _CLCTAPID 0x06501041 +} + +swj_newdap $_CHIPNAME tap -expected-id $_CPUTAPID -irlen 4 +if { [using_jtag] } { + jtag newtap $_CHIPNAME.clc tap -expected-id $_CLCTAPID -irlen 5 +} + +dap create $_CHIPNAME.dap -chain-position $_CHIPNAME.tap -ignore-syspwrupack + +# NOTE: keep ap-num and dbgbase to speed-up examine after reset +# NOTE: do not change the order of target create +target create $_CHIPNAME.ap1 mem_ap -dap $_CHIPNAME.dap -ap-num 1 +target create $_CHIPNAME.axi mem_ap -dap $_CHIPNAME.dap -ap-num 0 +target create $_CHIPNAME.cpu cortex_a -dap $_CHIPNAME.dap -ap-num 1 -coreid 0 -dbgbase 0xE00D0000 + +$_CHIPNAME.cpu cortex_a maskisr on +$_CHIPNAME.cpu cortex_a dacrfixup on + +# interface does not work while srst is asserted +# this is target specific, valid for every board +# srst resets the debug unit, behavior equivalent to "srst_pulls_trst" +reset_config srst_gates_jtag srst_pulls_trst + +adapter speed 5000 +adapter srst pulse_width 200 +# bootrom has an internal timeout of 1 second for detecting the boot flash. +# wait at least 1 second to guarantee we are out of bootrom +adapter srst delay 1100 + +add_help_text axi_secure "Set secure mode for following AXI accesses" +proc axi_secure {} { + $::_CHIPNAME.dap apsel 0 + $::_CHIPNAME.dap apcsw 0x10006000 +} + +add_help_text axi_nsecure "Set non-secure mode for following AXI accesses" +proc axi_nsecure {} { + $::_CHIPNAME.dap apsel 0 + $::_CHIPNAME.dap apcsw 0x30006000 +} + +axi_secure + +proc dbgmcu_enable_debug {} { + # keep clock enabled in low-power + ## catch {$::_CHIPNAME.ap1 mww 0xe0081004 0x00000004} + # freeze watchdog 1 and 2 on core halted + catch {$::_CHIPNAME.ap1 mww 0xe008102c 0x00000004} + catch {$::_CHIPNAME.ap1 mww 0xe008104c 0x00000008} +} + +proc toggle_cpu_dbg_claim0 {} { + # toggle CPU0 DBG_CLAIM[0] + $::_CHIPNAME.ap1 mww 0xe00d0fa0 1 + $::_CHIPNAME.ap1 mww 0xe00d0fa4 1 +} + +# FIXME: most of handlers below will be removed once reset framework get merged +$_CHIPNAME.ap1 configure -event reset-deassert-pre { + adapter deassert srst deassert trst + catch {dap init} + catch {$::_CHIPNAME.dap apid 1} +} +$_CHIPNAME.cpu configure -event reset-deassert-pre {$::_CHIPNAME.cpu arp_examine} +$_CHIPNAME.cpu configure -event reset-deassert-post {toggle_cpu_dbg_claim0; dbgmcu_enable_debug} +$_CHIPNAME.ap1 configure -event examine-start {dap init} +$_CHIPNAME.ap1 configure -event examine-end {dbgmcu_enable_debug} ----------------------------------------------------------------------- Summary of changes: tcl/board/stm32mp13x_dk.cfg | 10 +++++ tcl/target/stm32mp13x.cfg | 100 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 tcl/board/stm32mp13x_dk.cfg create mode 100644 tcl/target/stm32mp13x.cfg hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-12-03 21:47:53
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via cb0be63b12653defd5a0c33f06613411135166ec (commit) from 1ad6ed38b6da09b1d5d9e56d1344fced2dce12bc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit cb0be63b12653defd5a0c33f06613411135166ec Author: Antonio Borneo <bor...@gm...> Date: Sun Nov 28 11:36:58 2021 +0100 jimtcl: update to version 0.81 (2021-11-28) Change-Id: I374348047331b88e35b6584a5c65d8a73240b8a1 Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/6757 Tested-by: jenkins Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/jimtcl b/jimtcl index 70b007b63..a77ef1a62 160000 --- a/jimtcl +++ b/jimtcl @@ -1 +1 @@ -Subproject commit 70b007b63669a709b0e8aef34a22658047815cc2 +Subproject commit a77ef1a6218fad4c928ddbdc03c1aedc41007e70 ----------------------------------------------------------------------- Summary of changes: jimtcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-11-29 09:52:07
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 1ad6ed38b6da09b1d5d9e56d1344fced2dce12bc (commit) from 1d1386e31ed47dcdd9b433b810b27a0f28928bc7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1ad6ed38b6da09b1d5d9e56d1344fced2dce12bc Author: Doug Brunner <dou...@gm...> Date: Mon Oct 25 12:21:34 2021 -0700 flash/nor/efm32: fixed BG1x identification The EFM32 flash driver misidentifies the EFR32BG1B on my board as EFR32MG1B. Looks like this was caused by a copy-paste error, fixed. Signed-off-by: Doug Brunner <dou...@gm...> Change-Id: I3067f7ba132c2562487da8c2371f63a4843230c1 Reviewed-on: https://review.openocd.org/c/openocd/+/6666 Tested-by: jenkins Reviewed-by: Fredrik Hederstierna <fre...@gm...> Reviewed-by: Tomas Vanek <va...@fb...> diff --git a/src/flash/nor/efm32.c b/src/flash/nor/efm32.c index ab0186d7d..fb4b09624 100644 --- a/src/flash/nor/efm32.c +++ b/src/flash/nor/efm32.c @@ -119,9 +119,9 @@ static const struct efm32_family_data efm32_families[] = { { 16, "EFR32MG1P Mighty", .series = 1 }, { 17, "EFR32MG1B Mighty", .series = 1 }, { 18, "EFR32MG1V Mighty", .series = 1 }, - { 19, "EFR32MG1P Blue", .series = 1 }, - { 20, "EFR32MG1B Blue", .series = 1 }, - { 21, "EFR32MG1V Blue", .series = 1 }, + { 19, "EFR32BG1P Blue", .series = 1 }, + { 20, "EFR32BG1B Blue", .series = 1 }, + { 21, "EFR32BG1V Blue", .series = 1 }, { 25, "EFR32FG1P Flex", .series = 1 }, { 26, "EFR32FG1B Flex", .series = 1 }, { 27, "EFR32FG1V Flex", .series = 1 }, ----------------------------------------------------------------------- Summary of changes: src/flash/nor/efm32.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-11-28 11:01:58
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 1d1386e31ed47dcdd9b433b810b27a0f28928bc7 (commit) from c6460ea36d7eeaf4a0fe4fb1a4c65bb21547afbe (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1d1386e31ed47dcdd9b433b810b27a0f28928bc7 Author: Antonio Borneo <bor...@gm...> Date: Tue Oct 19 13:09:25 2021 +0200 drivers: call adapter_get_required_serial() in jtag_libusb_open() Now that adapter serial is handled independently from the adapter drivers, move inside jtag_libusb_open() the call to adapter_get_required_serial(), so every adapter that uses libusb will automagically get USB serial support. Extend the documentation to list the adapters involved. Change-Id: I75b3482d38f8ed3418329f3106c5e8b689fd460b Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/6663 Tested-by: jenkins diff --git a/doc/openocd.texi b/doc/openocd.texi index 19ec31b34..337328187 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -2371,7 +2371,8 @@ This command is only available if your libusb1 is at least version 1.0.16. Specifies the @var{serial_string} of the adapter to use. If this command is not specified, serial strings are not checked. Only the following adapter drivers use the serial string from this command: -cmsis_dap, ft232r, ftdi, hla, jlink, kitprog, presto, st-link, vsllink, xds110. +aice (aice_usb), arm-jtag-ew, cmsis_dap, ft232r, ftdi, hla (stlink, ti-icdi), jlink, kitprog, opendus, +openjtag, osbdm, presto, rlink, st-link, usb_blaster (ublast2), usbprog, vsllink, xds110. @end deffn @section Interface Drivers diff --git a/src/jtag/aice/aice_usb.c b/src/jtag/aice/aice_usb.c index a943bb8b0..5d586763c 100644 --- a/src/jtag/aice/aice_usb.c +++ b/src/jtag/aice/aice_usb.c @@ -2085,7 +2085,7 @@ static int aice_usb_open(struct aice_port_param_s *param) const uint16_t pids[] = { param->pid, 0 }; struct libusb_device_handle *devh; - if (jtag_libusb_open(vids, pids, NULL, &devh, NULL) != ERROR_OK) + if (jtag_libusb_open(vids, pids, &devh, NULL) != ERROR_OK) return ERROR_FAIL; /* BE ***VERY CAREFUL*** ABOUT MAKING CHANGES IN THIS @@ -2109,7 +2109,7 @@ static int aice_usb_open(struct aice_port_param_s *param) /* reopen jlink after usb_reset * on win32 this may take a second or two to re-enumerate */ int retval; - while ((retval = jtag_libusb_open(vids, pids, NULL, &devh, NULL)) != ERROR_OK) { + while ((retval = jtag_libusb_open(vids, pids, &devh, NULL)) != ERROR_OK) { usleep(1000); timeout--; if (!timeout) diff --git a/src/jtag/drivers/arm-jtag-ew.c b/src/jtag/drivers/arm-jtag-ew.c index 5b5a9669e..703378940 100644 --- a/src/jtag/drivers/arm-jtag-ew.c +++ b/src/jtag/drivers/arm-jtag-ew.c @@ -688,7 +688,7 @@ static struct armjtagew *armjtagew_usb_open(void) const uint16_t pids[] = { USB_PID, 0 }; struct libusb_device_handle *dev; - if (jtag_libusb_open(vids, pids, NULL, &dev, NULL) != ERROR_OK) + if (jtag_libusb_open(vids, pids, &dev, NULL) != ERROR_OK) return NULL; struct armjtagew *result = malloc(sizeof(struct armjtagew)); diff --git a/src/jtag/drivers/ft232r.c b/src/jtag/drivers/ft232r.c index fc3cdbae2..c930d8c4c 100644 --- a/src/jtag/drivers/ft232r.c +++ b/src/jtag/drivers/ft232r.c @@ -257,8 +257,8 @@ static int ft232r_init(void) { uint16_t avids[] = {ft232r_vid, 0}; uint16_t apids[] = {ft232r_pid, 0}; - const char *ft232r_serial_desc = adapter_get_required_serial(); - if (jtag_libusb_open(avids, apids, ft232r_serial_desc, &adapter, NULL)) { + if (jtag_libusb_open(avids, apids, &adapter, NULL)) { + const char *ft232r_serial_desc = adapter_get_required_serial(); LOG_ERROR("ft232r not found: vid=%04x, pid=%04x, serial=%s\n", ft232r_vid, ft232r_pid, (!ft232r_serial_desc) ? "[any]" : ft232r_serial_desc); return ERROR_JTAG_INIT_FAILED; diff --git a/src/jtag/drivers/kitprog.c b/src/jtag/drivers/kitprog.c index 0c5ccc6a7..5e2168eea 100644 --- a/src/jtag/drivers/kitprog.c +++ b/src/jtag/drivers/kitprog.c @@ -39,7 +39,6 @@ #include <hidapi.h> -#include <jtag/adapter.h> #include <jtag/interface.h> #include <jtag/swd.h> #include <jtag/commands.h> @@ -271,8 +270,7 @@ static int kitprog_usb_open(void) const uint16_t vids[] = { VID, 0 }; const uint16_t pids[] = { PID, 0 }; - if (jtag_libusb_open(vids, pids, adapter_get_required_serial(), - &kitprog_handle->usb_handle, NULL) != ERROR_OK) { + if (jtag_libusb_open(vids, pids, &kitprog_handle->usb_handle, NULL) != ERROR_OK) { LOG_ERROR("Failed to open or find the device"); return ERROR_FAIL; } diff --git a/src/jtag/drivers/libusb_helper.c b/src/jtag/drivers/libusb_helper.c index b8f1124e3..fc961cb91 100644 --- a/src/jtag/drivers/libusb_helper.c +++ b/src/jtag/drivers/libusb_helper.c @@ -157,7 +157,6 @@ static bool jtag_libusb_match_serial(struct libusb_device_handle *device, } int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[], - const char *serial, struct libusb_device_handle **out, adapter_get_alternate_serial_fn adapter_get_alternate_serial) { @@ -165,6 +164,7 @@ int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[], int retval = ERROR_FAIL; bool serial_mismatch = false; struct libusb_device_handle *libusb_handle = NULL; + const char *serial = adapter_get_required_serial(); if (libusb_init(&jtag_libusb_context) < 0) return ERROR_FAIL; diff --git a/src/jtag/drivers/libusb_helper.h b/src/jtag/drivers/libusb_helper.h index 6087128d2..2ddb246b3 100644 --- a/src/jtag/drivers/libusb_helper.h +++ b/src/jtag/drivers/libusb_helper.h @@ -28,7 +28,6 @@ typedef char * (*adapter_get_alternate_serial_fn)(struct libusb_device_handle *d struct libusb_device_descriptor *dev_desc); int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[], - const char *serial, struct libusb_device_handle **out, adapter_get_alternate_serial_fn adapter_get_alternate_serial); void jtag_libusb_close(struct libusb_device_handle *dev); diff --git a/src/jtag/drivers/opendous.c b/src/jtag/drivers/opendous.c index 6881959c3..ae21cf2b9 100644 --- a/src/jtag/drivers/opendous.c +++ b/src/jtag/drivers/opendous.c @@ -706,7 +706,7 @@ struct opendous_jtag *opendous_usb_open(void) struct opendous_jtag *result; struct libusb_device_handle *devh; - if (jtag_libusb_open(opendous_probe->VID, opendous_probe->PID, NULL, &devh, NULL) != ERROR_OK) + if (jtag_libusb_open(opendous_probe->VID, opendous_probe->PID, &devh, NULL) != ERROR_OK) return NULL; jtag_libusb_set_configuration(devh, 0); diff --git a/src/jtag/drivers/openjtag.c b/src/jtag/drivers/openjtag.c index 7340119a1..771b6e6f3 100644 --- a/src/jtag/drivers/openjtag.c +++ b/src/jtag/drivers/openjtag.c @@ -449,7 +449,7 @@ static int openjtag_init_cy7c65215(void) int ret; usbh = NULL; - ret = jtag_libusb_open(cy7c65215_vids, cy7c65215_pids, NULL, &usbh, NULL); + ret = jtag_libusb_open(cy7c65215_vids, cy7c65215_pids, &usbh, NULL); if (ret != ERROR_OK) { LOG_ERROR("unable to open cy7c65215 device"); goto err; diff --git a/src/jtag/drivers/osbdm.c b/src/jtag/drivers/osbdm.c index 5c43d3244..f7665eb12 100644 --- a/src/jtag/drivers/osbdm.c +++ b/src/jtag/drivers/osbdm.c @@ -374,7 +374,7 @@ static int osbdm_flush(struct osbdm *osbdm, struct queue *queue) static int osbdm_open(struct osbdm *osbdm) { (void)memset(osbdm, 0, sizeof(*osbdm)); - if (jtag_libusb_open(osbdm_vid, osbdm_pid, NULL, &osbdm->devh, NULL) != ERROR_OK) + if (jtag_libusb_open(osbdm_vid, osbdm_pid, &osbdm->devh, NULL) != ERROR_OK) return ERROR_FAIL; if (libusb_claim_interface(osbdm->devh, 0) != ERROR_OK) diff --git a/src/jtag/drivers/rlink.c b/src/jtag/drivers/rlink.c index f75a38b5d..73be3c57e 100644 --- a/src/jtag/drivers/rlink.c +++ b/src/jtag/drivers/rlink.c @@ -1461,7 +1461,7 @@ static int rlink_init(void) const uint16_t vids[] = { USB_IDVENDOR, 0 }; const uint16_t pids[] = { USB_IDPRODUCT, 0 }; - if (jtag_libusb_open(vids, pids, NULL, &hdev, NULL) != ERROR_OK) + if (jtag_libusb_open(vids, pids, &hdev, NULL) != ERROR_OK) return ERROR_FAIL; struct libusb_device_descriptor descriptor; diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index 4c0e025fc..2f61bf946 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -3364,7 +3364,7 @@ static int stlink_usb_usb_open(void *handle, struct hl_interface_param_s *param) in order to become operational. */ do { - if (jtag_libusb_open(param->vid, param->pid, adapter_get_required_serial(), + if (jtag_libusb_open(param->vid, param->pid, &h->usb_backend_priv.fd, stlink_usb_get_alternate_serial) != ERROR_OK) { LOG_ERROR("open failed"); return ERROR_FAIL; diff --git a/src/jtag/drivers/ti_icdi_usb.c b/src/jtag/drivers/ti_icdi_usb.c index a359dd17d..c94a1102f 100644 --- a/src/jtag/drivers/ti_icdi_usb.c +++ b/src/jtag/drivers/ti_icdi_usb.c @@ -686,7 +686,7 @@ static int icdi_usb_open(struct hl_interface_param_s *param, void **fd) /* TI (Stellaris) ICDI provides its serial number in the USB descriptor; no need to provide a callback here. */ - jtag_libusb_open(param->vid, param->pid, adapter_get_required_serial(), &h->usb_dev, NULL); + jtag_libusb_open(param->vid, param->pid, &h->usb_dev, NULL); if (!h->usb_dev) { LOG_ERROR("open failed"); diff --git a/src/jtag/drivers/usb_blaster/ublast2_access_libusb.c b/src/jtag/drivers/usb_blaster/ublast2_access_libusb.c index d55bf85cd..21f9ae72b 100644 --- a/src/jtag/drivers/usb_blaster/ublast2_access_libusb.c +++ b/src/jtag/drivers/usb_blaster/ublast2_access_libusb.c @@ -210,7 +210,7 @@ static int ublast2_libusb_init(struct ublast_lowlevel *low) bool renumeration = false; int ret; - if (jtag_libusb_open(vids, pids, NULL, &temp, NULL) == ERROR_OK) { + if (jtag_libusb_open(vids, pids, &temp, NULL) == ERROR_OK) { LOG_INFO("Altera USB-Blaster II (uninitialized) found"); LOG_INFO("Loading firmware..."); ret = load_usb_blaster_firmware(temp, low); @@ -224,15 +224,13 @@ static int ublast2_libusb_init(struct ublast_lowlevel *low) const uint16_t pids_renum[] = { low->ublast_pid, 0 }; if (renumeration == false) { - if (jtag_libusb_open(vids_renum, pids_renum, NULL, - &low->libusb_dev, NULL) != ERROR_OK) { + if (jtag_libusb_open(vids_renum, pids_renum, &low->libusb_dev, NULL) != ERROR_OK) { LOG_ERROR("Altera USB-Blaster II not found"); return ERROR_FAIL; } } else { int retry = 10; - while (jtag_libusb_open(vids_renum, pids_renum, NULL, - &low->libusb_dev, NULL) != ERROR_OK && retry--) { + while (jtag_libusb_open(vids_renum, pids_renum, &low->libusb_dev, NULL) != ERROR_OK && retry--) { usleep(1000000); LOG_INFO("Waiting for reenumerate..."); } diff --git a/src/jtag/drivers/usbprog.c b/src/jtag/drivers/usbprog.c index 44db61ec0..a2ebdbc86 100644 --- a/src/jtag/drivers/usbprog.c +++ b/src/jtag/drivers/usbprog.c @@ -354,7 +354,7 @@ struct usbprog_jtag *usbprog_jtag_open(void) const uint16_t pids[] = { PID, 0 }; struct libusb_device_handle *dev; - if (jtag_libusb_open(vids, pids, NULL, &dev, NULL) != ERROR_OK) + if (jtag_libusb_open(vids, pids, &dev, NULL) != ERROR_OK) return NULL; struct usbprog_jtag *tmp = malloc(sizeof(struct usbprog_jtag)); ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 3 ++- src/jtag/aice/aice_usb.c | 4 ++-- src/jtag/drivers/arm-jtag-ew.c | 2 +- src/jtag/drivers/ft232r.c | 4 ++-- src/jtag/drivers/kitprog.c | 4 +--- src/jtag/drivers/libusb_helper.c | 2 +- src/jtag/drivers/libusb_helper.h | 1 - src/jtag/drivers/opendous.c | 2 +- src/jtag/drivers/openjtag.c | 2 +- src/jtag/drivers/osbdm.c | 2 +- src/jtag/drivers/rlink.c | 2 +- src/jtag/drivers/stlink_usb.c | 2 +- src/jtag/drivers/ti_icdi_usb.c | 2 +- src/jtag/drivers/usb_blaster/ublast2_access_libusb.c | 8 +++----- src/jtag/drivers/usbprog.c | 2 +- 15 files changed, 19 insertions(+), 23 deletions(-) hooks/post-receive -- Main OpenOCD repository |
From: OpenOCD-Gerrit <ope...@us...> - 2021-11-28 11:01:47
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via c6460ea36d7eeaf4a0fe4fb1a4c65bb21547afbe (commit) from ad18c1a47fb8f3eaae66a7314700a1f186391359 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c6460ea36d7eeaf4a0fe4fb1a4c65bb21547afbe Author: Antonio Borneo <bor...@gm...> Date: Fri Oct 8 12:37:19 2021 +0200 jtag/hla, jtag/stlink: switch to command 'adapter serial' The driver hla defines the command 'hla_serial' to specify the serial string of the adapter. The driver st-link defines the command 'st-link serial' to specify the serial string of the adapter. Remove and deprecate the driver commands and use 'adapter serial'. Change-Id: I9505c398a77125b1ebf4ba71da7baf4d663b75be Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/6657 Tested-by: jenkins diff --git a/doc/openocd.texi b/doc/openocd.texi index 58e533f62..19ec31b34 100644 --- a/doc/openocd.texi +++ b/doc/openocd.texi @@ -2371,9 +2371,7 @@ This command is only available if your libusb1 is at least version 1.0.16. Specifies the @var{serial_string} of the adapter to use. If this command is not specified, serial strings are not checked. Only the following adapter drivers use the serial string from this command: -cmsis_dap, ft232r, ftdi, jlink, kitprog, presto, vsllink, xds110. -The following adapters have their own command to specify the serial string: -hla, st-link. +cmsis_dap, ft232r, ftdi, hla, jlink, kitprog, presto, st-link, vsllink, xds110. @end deffn @section Interface Drivers @@ -3040,10 +3038,6 @@ version reported is V2.J21.S4. Currently Not Supported. @end deffn -@deffn {Config Command} {hla_serial} serial -Specifies the serial number of the adapter. -@end deffn - @deffn {Config Command} {hla_layout} (@option{stlink}|@option{icdi}|@option{nulink}) Specifies the adapter layout to use. @end deffn @@ -3092,10 +3086,6 @@ ST-LINK server software module}. @emph{Note:} ST-Link TCP server does not support the SWIM transport. @end deffn -@deffn {Config Command} {st-link serial} serial -Specifies the serial number of the adapter. -@end deffn - @deffn {Config Command} {st-link vid_pid} [vid pid]+ Pairs of vendor IDs and product IDs of the device. @end deffn diff --git a/src/jtag/drivers/nulink_usb.c b/src/jtag/drivers/nulink_usb.c index 3eea9de58..d4b8b53bc 100644 --- a/src/jtag/drivers/nulink_usb.c +++ b/src/jtag/drivers/nulink_usb.c @@ -22,6 +22,7 @@ /* project specific includes */ #include <helper/binarybuffer.h> +#include <jtag/adapter.h> #include <jtag/interface.h> #include <jtag/hla/hla_layout.h> #include <jtag/hla/hla_transport.h> @@ -1054,8 +1055,9 @@ static int nulink_usb_open(struct hl_interface_param_s *param, void **fd) goto error_open; } - if (param->serial) { - size_t len = mbstowcs(NULL, param->serial, 0); + const char *serial = adapter_get_required_serial(); + if (serial) { + size_t len = mbstowcs(NULL, serial, 0); target_serial = calloc(len + 1, sizeof(wchar_t)); if (!target_serial) { @@ -1063,7 +1065,7 @@ static int nulink_usb_open(struct hl_interface_param_s *param, void **fd) goto error_open; } - if (mbstowcs(target_serial, param->serial, len + 1) == (size_t)(-1)) { + if (mbstowcs(target_serial, serial, len + 1) == (size_t)(-1)) { LOG_WARNING("unable to convert serial"); free(target_serial); target_serial = NULL; diff --git a/src/jtag/drivers/stlink_usb.c b/src/jtag/drivers/stlink_usb.c index 87e6ddc20..4c0e025fc 100644 --- a/src/jtag/drivers/stlink_usb.c +++ b/src/jtag/drivers/stlink_usb.c @@ -38,6 +38,7 @@ #include <helper/bits.h> #include <helper/system.h> #include <helper/time_support.h> +#include <jtag/adapter.h> #include <jtag/interface.h> #include <jtag/hla/hla_layout.h> #include <jtag/hla/hla_transport.h> @@ -3363,7 +3364,7 @@ static int stlink_usb_usb_open(void *handle, struct hl_interface_param_s *param) in order to become operational. */ do { - if (jtag_libusb_open(param->vid, param->pid, param->serial, + if (jtag_libusb_open(param->vid, param->pid, adapter_get_required_serial(), &h->usb_backend_priv.fd, stlink_usb_get_alternate_serial) != ERROR_OK) { LOG_ERROR("open failed"); return ERROR_FAIL; @@ -3574,7 +3575,8 @@ static int stlink_tcp_open(void *handle, struct hl_interface_param_s *param) char serial[STLINK_TCP_SERIAL_SIZE + 1] = {0}; uint8_t stlink_used; bool stlink_id_matched = false; - bool stlink_serial_matched = (!param->serial); + const char *adapter_serial = adapter_get_required_serial(); + bool stlink_serial_matched = !adapter_serial; for (uint32_t stlink_id = 0; stlink_id < connected_stlinks; stlink_id++) { /* get the stlink info */ @@ -3604,27 +3606,28 @@ static int stlink_tcp_open(void *handle, struct hl_interface_param_s *param) continue; /* check the serial if specified */ - if (param->serial) { + if (adapter_serial) { /* ST-Link server fixes the buggy serial returned by old ST-Link DFU * for further details refer to stlink_usb_get_alternate_serial * so if the user passes the buggy serial, we need to fix it before * comparing with the serial returned by ST-Link server */ - if (strlen(param->serial) == STLINK_SERIAL_LEN / 2) { + if (strlen(adapter_serial) == STLINK_SERIAL_LEN / 2) { char fixed_serial[STLINK_SERIAL_LEN + 1]; for (unsigned int i = 0; i < STLINK_SERIAL_LEN; i += 2) - sprintf(fixed_serial + i, "%02X", param->serial[i / 2]); + sprintf(fixed_serial + i, "%02X", adapter_serial[i / 2]); fixed_serial[STLINK_SERIAL_LEN] = '\0'; stlink_serial_matched = strcmp(fixed_serial, serial) == 0; - } else - stlink_serial_matched = strcmp(param->serial, serial) == 0; + } else { + stlink_serial_matched = strcmp(adapter_serial, serial) == 0; + } } if (!stlink_serial_matched) LOG_DEBUG("Device serial number '%s' doesn't match requested serial '%s'", - serial, param->serial); + serial, adapter_serial); else /* exit the search loop if there is match */ break; } @@ -3693,7 +3696,7 @@ static int stlink_open(struct hl_interface_param_s *param, enum stlink_mode mode for (unsigned i = 0; param->vid[i]; i++) { LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s", h->st_mode, param->vid[i], param->pid[i], - param->serial ? param->serial : ""); + adapter_get_required_serial() ? adapter_get_required_serial() : ""); } if (param->use_stlink_tcp) @@ -4916,25 +4919,6 @@ static int stlink_dap_trace_read(uint8_t *buf, size_t *size) return stlink_usb_trace_read(stlink_dap_handle, buf, size); } -/** */ -COMMAND_HANDLER(stlink_dap_serial_command) -{ - LOG_DEBUG("stlink_dap_serial_command"); - - if (CMD_ARGC != 1) { - LOG_ERROR("Expected exactly one argument for \"st-link serial <serial-number>\"."); - return ERROR_COMMAND_SYNTAX_ERROR; - } - - if (stlink_dap_param.serial) { - LOG_WARNING("Command \"st-link serial\" already used. Replacing previous value"); - free((void *)stlink_dap_param.serial); - } - - stlink_dap_param.serial = strdup(CMD_ARGV[0]); - return ERROR_OK; -} - /** */ COMMAND_HANDLER(stlink_dap_vid_pid) { @@ -5025,13 +5009,6 @@ COMMAND_HANDLER(stlink_dap_cmd_command) /** */ static const struct command_registration stlink_dap_subcommand_handlers[] = { - { - .name = "serial", - .handler = stlink_dap_serial_command, - .mode = COMMAND_CONFIG, - .help = "set the serial number of the adapter", - .usage = "<serial_number>", - }, { .name = "vid_pid", .handler = stlink_dap_vid_pid, @@ -5112,9 +5089,6 @@ static int stlink_dap_quit(void) { LOG_DEBUG("stlink_dap_quit()"); - free((void *)stlink_dap_param.serial); - stlink_dap_param.serial = NULL; - return stlink_close(stlink_dap_handle); } diff --git a/src/jtag/drivers/ti_icdi_usb.c b/src/jtag/drivers/ti_icdi_usb.c index d911fdacb..a359dd17d 100644 --- a/src/jtag/drivers/ti_icdi_usb.c +++ b/src/jtag/drivers/ti_icdi_usb.c @@ -23,6 +23,7 @@ /* project specific includes */ #include <helper/binarybuffer.h> +#include <jtag/adapter.h> #include <jtag/interface.h> #include <jtag/hla/hla_layout.h> #include <jtag/hla/hla_transport.h> @@ -681,11 +682,11 @@ static int icdi_usb_open(struct hl_interface_param_s *param, void **fd) for (uint8_t i = 0; param->vid[i] && param->pid[i]; ++i) LOG_DEBUG("transport: %d vid: 0x%04x pid: 0x%04x serial: %s", param->transport, - param->vid[i], param->pid[i], param->serial ? param->serial : ""); + param->vid[i], param->pid[i], adapter_get_required_serial() ? adapter_get_required_serial() : ""); /* TI (Stellaris) ICDI provides its serial number in the USB descriptor; no need to provide a callback here. */ - jtag_libusb_open(param->vid, param->pid, param->serial, &h->usb_dev, NULL); + jtag_libusb_open(param->vid, param->pid, adapter_get_required_serial(), &h->usb_dev, NULL); if (!h->usb_dev) { LOG_ERROR("open failed"); diff --git a/src/jtag/hla/hla_interface.c b/src/jtag/hla/hla_interface.c index fc362c040..074e3c2fb 100644 --- a/src/jtag/hla/hla_interface.c +++ b/src/jtag/hla/hla_interface.c @@ -38,7 +38,6 @@ static struct hl_interface_s hl_if = { .param = { .device_desc = NULL, - .serial = NULL, .vid = { 0 }, .pid = { 0 }, .transport = HL_TRANSPORT_UNKNOWN, @@ -136,7 +135,6 @@ static int hl_interface_quit(void) jtag_command_queue_reset(); free((void *)hl_if.param.device_desc); - free((void *)hl_if.param.serial); return ERROR_OK; } @@ -238,19 +236,6 @@ COMMAND_HANDLER(hl_interface_handle_device_desc_command) return ERROR_OK; } -COMMAND_HANDLER(hl_interface_handle_serial_command) -{ - LOG_DEBUG("hl_interface_handle_serial_command"); - - if (CMD_ARGC == 1) { - hl_if.param.serial = strdup(CMD_ARGV[0]); - } else { - LOG_ERROR("expected exactly one argument to hl_serial <serial-number>"); - } - - return ERROR_OK; -} - COMMAND_HANDLER(hl_interface_handle_layout_command) { LOG_DEBUG("hl_interface_handle_layout_command"); @@ -354,13 +339,6 @@ static const struct command_registration hl_interface_command_handlers[] = { .help = "set the device description of the adapter", .usage = "description_string", }, - { - .name = "hla_serial", - .handler = &hl_interface_handle_serial_command, - .mode = COMMAND_CONFIG, - .help = "set the serial number of the adapter", - .usage = "serial_string", - }, { .name = "hla_layout", .handler = &hl_interface_handle_layout_command, diff --git a/src/jtag/hla/hla_interface.h b/src/jtag/hla/hla_interface.h index c882acf48..31d055a3c 100644 --- a/src/jtag/hla/hla_interface.h +++ b/src/jtag/hla/hla_interface.h @@ -34,8 +34,6 @@ extern const char *hl_transports[]; struct hl_interface_param_s { /** */ const char *device_desc; - /** */ - const char *serial; /** List of recognised VIDs */ uint16_t vid[HLA_MAX_USB_IDS + 1]; /** List of recognised PIDs */ diff --git a/src/jtag/startup.tcl b/src/jtag/startup.tcl index 199ca04d6..ee116269e 100644 --- a/src/jtag/startup.tcl +++ b/src/jtag/startup.tcl @@ -759,6 +759,12 @@ proc "ftdi serial" {args} { eval adapter serial $args } +lappend _telnet_autocomplete_skip hla_serial +proc hla_serial args { + echo "DEPRECATED! use 'adapter serial' not 'hla_serial'" + eval adapter serial $args +} + lappend _telnet_autocomplete_skip "jlink serial" proc "jlink serial" {args} { echo "DEPRECATED! use 'adapter serial' not 'jlink serial'" @@ -777,6 +783,12 @@ proc "presto serial" {args} { eval adapter serial $args } +lappend _telnet_autocomplete_skip "st-link serial" +proc "st-link serial" {args} { + echo "DEPRECATED! use 'adapter serial' not 'st-link serial'" + eval adapter serial $args +} + lappend _telnet_autocomplete_skip "vsllink usb_serial" proc "vsllink usb_serial" {args} { echo "DEPRECATED! use 'adapter serial' not 'vsllink usb_serial'" diff --git a/tcl/interface/stlink-dap.cfg b/tcl/interface/stlink-dap.cfg index d912a5560..5a7d2e9ae 100644 --- a/tcl/interface/stlink-dap.cfg +++ b/tcl/interface/stlink-dap.cfg @@ -17,4 +17,4 @@ st-link vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0 # Optionally specify the serial number of usb device # e.g. -# st-link serial "\xaa\xbc\x6e\x06\x50\x75\xff\x55\x17\x42\x19\x3f" +# adapter serial "\xaa\xbc\x6e\x06\x50\x75\xff\x55\x17\x42\x19\x3f" diff --git a/tcl/interface/stlink.cfg b/tcl/interface/stlink.cfg index cb8e00494..8ac9b579f 100644 --- a/tcl/interface/stlink.cfg +++ b/tcl/interface/stlink.cfg @@ -13,4 +13,4 @@ hla_vid_pid 0x0483 0x3744 0x0483 0x3748 0x0483 0x374b 0x0483 0x374d 0x0483 0x374 # firmware version >= V2.J21.S4 recommended to avoid issues with adapter serial # number reset issues. # eg. -#hla_serial "\xaa\xbc\x6e\x06\x50\x75\xff\x55\x17\x42\x19\x3f" +# adapter serial "\xaa\xbc\x6e\x06\x50\x75\xff\x55\x17\x42\x19\x3f" diff --git a/tcl/interface/ti-icdi.cfg b/tcl/interface/ti-icdi.cfg index 8561a3182..5cf6e37be 100644 --- a/tcl/interface/ti-icdi.cfg +++ b/tcl/interface/ti-icdi.cfg @@ -14,4 +14,4 @@ hla_vid_pid 0x1cbe 0x00fd # Optionally specify the serial number of TI-ICDI devices, for when using # multiple devices. Serial numbers can be obtained using lsusb -v # Ex. -#hla_serial "0F003065" +# adapter serial "0F003065" ----------------------------------------------------------------------- Summary of changes: doc/openocd.texi | 12 +--------- src/jtag/drivers/nulink_usb.c | 8 ++++--- src/jtag/drivers/stlink_usb.c | 50 ++++++++++-------------------------------- src/jtag/drivers/ti_icdi_usb.c | 5 +++-- src/jtag/hla/hla_interface.c | 22 ------------------- src/jtag/hla/hla_interface.h | 2 -- src/jtag/startup.tcl | 12 ++++++++++ tcl/interface/stlink-dap.cfg | 2 +- tcl/interface/stlink.cfg | 2 +- tcl/interface/ti-icdi.cfg | 2 +- 10 files changed, 36 insertions(+), 81 deletions(-) hooks/post-receive -- Main OpenOCD repository |