Compare commits

...

631 Commits

Author SHA1 Message Date
Evgeniy Naydanov 67082829da
Merge pull request #1225 from JanMatCodasip/jm-codasip/fix-datatypes-around-program
Fix data types around opcodes.h and program.{c,h}
2025-03-07 12:57:57 +03:00
Evgeniy Naydanov e88edb71a5
Merge pull request #1171 from lz-bro/handle-all-trigger-halt
target/riscv: Fix SMP group is in inconsistent state
2025-03-07 11:26:16 +03:00
liangzhen d5969d5f43 target/riscv: Fix SMP group is in inconsistent state
If the harts are just in the process of halting due to
being members of the halt group, we should wait until
they finish halting, so that the true halt reason can
be discovered  (e.g. semihosting request, and then
handled correctly).
2025-03-04 16:29:04 +08:00
Jan Matyas 64f30dc279 Clean up return type of riscv_progbuf_size() + related
SSIA

Change-Id: I3e0b2fad84411c530f56cdbe33f3d8b4dbf81cf6
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2025-02-28 12:10:41 +01:00
Jan Matyas b272470dff riscv-011: Fix datatypes to correspond to opcodes.h
Callers of functions from opcodes.h need to be updated accordingly, too.

Change-Id: Ic42156b2843be682bc1cf9c720b73687008a2aa6
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2025-02-26 15:27:14 +01:00
Jan Matyas c133dbef03 opcodes.h: Do not use casts in MIN_* and MAX_* macros
This is to make it consistent with stdint.h.

Change-Id: Ibba824dad431b3a1675700ad4cc15f3e39a187f7
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2025-02-26 15:27:14 +01:00
Jan Matyas 068f566fb8 Fix datatypes around opcodes.h and program.{c,h}
- Fix and clean-up datatypes in opcodes.h and program.{c,h}.
  Some of the changes were pointed by -Wconversion, others
  come from manual code inspection.

- Remove commented code from opcodes.h (unused for very long time).

- Add assertions to opcodes.h to check that instruction
  immediates (and other fields) don't exceed their range.

Change-Id: I7fc7c30ac2fdb00a93158d63d1379e7f16b1d168
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2025-02-26 15:27:14 +01:00
Evgeniy Naydanov fa7e2351c8
Merge pull request #1227 from fk-sc/fk-sc/type-safe-enum
target/riscv: make mem_access_result_t enum type safe
2025-02-26 14:12:34 +03:00
Evgeniy Naydanov f32f17831e
Merge pull request #1231 from en-sc/en-sc/from_upstream
Merge up to 1f3f635693 from  upstream
2025-02-21 13:48:38 +03:00
Farid Khaydari c14d9b6d1d target/riscv: make mem_access_result_t enum type safe
Make mem_access_result_t enum type safe and fix related problems

Checkpatch-ignore: MACRO_ARG_PRECEDENCE, MULTISTATEMENT_MACRO_USE_DO_WHILE
Checkpatch-ignore: TRAILING_SEMICOLON
Change-Id: Ie5a8c71f3a8ad803f1660114c399c5a4dd0f7414
Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2025-02-21 13:45:49 +03:00
Farid Khaydari 7335759845 target/riscv: set appropriate memory access result codes
Set appropriate memory access result codes

Checkpatch-ignore: MACRO_ARG_PRECEDENCE, MULTISTATEMENT_MACRO_USE_DO_WHILE
Checkpatch-ignore: TRAILING_SEMICOLON
Change-Id: Ib73b5a041e5f15aef150b80fdd45f107de19d3a6
Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2025-02-21 13:44:47 +03:00
Evgeniy Naydanov 56b7830d65
Merge pull request #1194 from fk-sc/fk-sc/merge-read-write
target/riscv: merged read/write functions to one access function
2025-02-21 13:42:19 +03:00
Farid Khaydari dce6182d4b target/riscv: merged read/write functions to one access function
Commit merges read/write functions to access function.
It allows to decrease amount of code duplication.

Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2025-02-17 19:09:33 +03:00
Evgeniy Naydanov 95cb368095 Merge up to 1f3f635693 from upstream
Conflict in `src/rtos/hwthread.c` between commit
57dbcb1d02 ("Improve a couple of
user/debug messages. (#763)") and commit
7f2db80ebc ("rtos/hwthread: Use
LOG_TARGET_xxx()"). Resolved by using `LOG_TARGET_xxx()` without
changing the message.

Change-Id: I1c1ab321b54f2ef8267f0dca63e16ca8ed6b4655
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2025-02-17 17:38:44 +03:00
Evgeniy Naydanov fac1412ace
Merge pull request #1218 from fk-sc/fk-sc/ref-mem-acc-res
target/riscv: refactored memory access result codes
2025-02-17 15:13:45 +03:00
Evgeniy Naydanov e1fe15ff76
Merge pull request #1209 from en-sc/en-sc/riscv-info-mtopx
target/riscv: drop `mtopi_readable/mtopei_readable`  `riscv_info` fields
2025-02-17 15:11:08 +03:00
Evgeniy Naydanov dd72250c63
Merge pull request #1208 from en-sc/en-sc/pass-tap
target/riscv: pass `jtag_tap` instead of `target`
2025-02-17 15:09:22 +03:00
Antonio Borneo 1f3f635693 build: drop space after 'angie' folder name
The makefile consider the two white spaces between the end of the
folder name and the '#' character for the beginning of the comment
as part of the folder name.
This cause 'make install' to create a folder named  'angie  ' that
is not welcome on all the OS.

Drop the comment and the space after the folder name.

Reported-by: Liviu Ionescu <ilg@livius.net>
Change-Id: Iadd6803431edb83d0d84f4e4dc6d36b454f912ac
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 0ed03df6e9 ("amend angie build definitions to fix make dist")
Reviewed-on: https://review.openocd.org/c/openocd/+/8740
Reviewed-by: Liviu Ionescu
Tested-by: jenkins
Reviewed-by: Adrien Charruel <acharruel@nanoxplore.com>
2025-02-16 16:31:39 +00:00
Tomas Vanek ed4e584104 jtag/core: fix segfault when adapter driver has no reset method
xlnx-pcie-xvc and linuxspidev adapter drivers does not implement
the reset method.
Although it is likely both adapters will implement the method in
the near future, avoid segfault and return an error instead.

Change-Id: If8ddf165dbc563cf6d64b2094968151075778ba7
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Fixes: commit 8850eb8f2c ("swd: get rid of jtag queue to assert/deassert srst")
Reviewed-on: https://review.openocd.org/c/openocd/+/8735
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-02-16 16:31:06 +00:00
Tomas Vanek 71f92c9446 target/cortex_m: call adapter_deassert_reset() only if srst is configured
Deasserting is useless if reset was not asserted except the very corner
case: changed reset_config during reset processing.

Change-Id: I1d1ea142980d67293daa348a2869b68ffd78d0eb
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8734
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-02-16 16:30:28 +00:00
R. Diez dcf02f46ff Makefile.am: DISTCHECK_CONFIGURE_FLAGS -> AM_DISTCHECK_CONFIGURE_FLAGS
The Automake manual states: "The user can still extend or override
the flags provided there by defining the DISTCHECK_CONFIGURE_FLAGS
variable". Overriding variable DISTCHECK_CONFIGURE_FLAGS in Makefile.am
makes it impossible for the user to do that. I discovered this
when trying to pass --enable-internal-jimtcl to distcheck.

Change-Id: Ibe5b1f23ccf3fbaa21c48b574a1b3f3e9f6fb916
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>

Reviewed-on: https://review.openocd.org/c/openocd/+/8724
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-02-16 16:29:00 +00:00
R. Diez 5e4ad24ba6 configure.ac: show vdebug in the config summary
Also enable this adapter by default (auto).

Change-Id: Id011168b93c4cdc602ab78eabfb9a64ca8d8a7df
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>

Reviewed-on: https://review.openocd.org/c/openocd/+/8601
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-02-16 16:28:34 +00:00
R. Diez 4deb76fc9d options.c: option --help should yield exit code 0
--help is supported and there is no reason to signal failure

Change-Id: I59fda5336df47ec0b8172541a5fbfe60014bba7e
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>

Reviewed-on: https://review.openocd.org/c/openocd/+/8723
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-02-16 16:28:07 +00:00
Antonio Borneo a71f2b7089 README: report dependency from libjim
The support for jimtcl submodule is deprecated.
Report libjim as a dependency for building OpenOCD.

Change-Id: Iaaeb03dc810451c0d72add281016c81b8cbf7059
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8722
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:27:19 +00:00
Daniel DeGrasse 44e782d55b target/arc: allow reading memory while target runs
There is no reason that ARC can't support reading from memory over JTAG
while the target is executing, and this is in fact required for RTT
support. Remove this check from arc_mem_read and arc_mem_write

Change-Id: I2accfb4b99bf77c5473d133623e0eb0632cb45f6
Signed-off-by: Daniel DeGrasse <ddegrasse@tenstorrent.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8721
Tested-by: jenkins
Reviewed-by: Evgeniy Didin <didin@synopsys.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-02-16 16:26:42 +00:00
Chris Friedt 9bb0a4558b target/arc: add RTT commands
Since RTT is architecture agnostic, add support for using it on
the ARC architecture as well.

Change-Id: Icd0dec105177a1a224bfb1a63f0be5f03561b166
Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8720
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-02-16 16:24:41 +00:00
Antonio Borneo 9ccd6265dd checkpatch: enable check for new typedefs
We should strictly check for every new typedef.
Let checkpatch detect them and let developer use
	Checkpatch-ignore: NEW_TYPEDEFS
if it's really needed to add a new typedef.
With this change chackpatch will not complain for typedef on
function's type but only on enum, struct, variable's type.

Change-Id: I644a753e97de877d892af3a0219716f022fb1c59
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8710
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:23:22 +00:00
Antonio Borneo 4895a556fa jtag: drop useless typedef tap_state_t
No need to use a typedef for an enum.
Drop it.

Change-Id: I9eb2dc4f926671c5bb44e61453d92880e3036848
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8709
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:23:03 +00:00
Antonio Borneo 0d1932520b jtag: openjtag: drop useless typedef openjtag_tap_state_t
No need to use a typedef for an enum.
Drop it.

Change-Id: I31531b80eaf7f3d0ee6cd22844e60a05c6b748dc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8708
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:22:47 +00:00
Antonio Borneo 54d07de86e jtag: bitbang: drop useless typedef bb_value_t
No need to use a typedef for an enum.
Drop it.

Change-Id: I8800c95f97d2bafe27c699d7d451fb9b54286d99
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8707
Tested-by: jenkins
2025-02-16 16:22:33 +00:00
Antonio Borneo 8a5c331831 jtag: remote_bitbang: drop useless typedef flush_bool_t
No need to use a typedef for an enum.
Drop it.

Change-Id: I122784ddd7b81ccd86da258b08526685c3d70033
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8706
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:22:18 +00:00
Antonio Borneo 894a39eda3 target_request: drop useless typedef target_req_cmd_t
No need to use a typedef for an enum.
Drop it.

Change-Id: Ib5a872b52a6f3d7379d2662e4ff84f32c2bd2ef8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8705
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:22:03 +00:00
Antonio Borneo c50b541471 target: trace: drop useless typedef trace_status_t
No need to use a typedef for an enum.
Drop it.

Change-Id: I31e0e3869c7277bcb14e05cfcac82c9655963ae6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8704
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:21:48 +00:00
Antonio Borneo ff5fb8f610 target: etm: drop useless typedefs
No need to use a typedef for an enum.
Drop etmv1_pipestat_t and etmv1_branch_reason_t.

Change-Id: I03ae4de3efe699d9635fc4f162649f6bedcef4c0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8703
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:21:31 +00:00
Antonio Borneo b023c4c6c5 nor: lpc2000: drop useless typedef lpc2000_variant
No need to use a typedef for an enum.
Drop it.

Change-Id: Iec690ebf6704f346d010cad1e6c65496f7bcc218
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8702
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:21:16 +00:00
Antonio Borneo e325b482b1 target: esp_algorithm: drop useless typedefs
There is no need to use extra typedef for the functions in struct
esp_algorithm_run_data.
Declare the type of the functions in the struct.
Split the comment lines to stay in the line limits.

Change-Id: I0afa6242e57133f8bf1b13ba541abd6b067350b0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8701
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
2025-02-16 16:20:58 +00:00
Antonio Borneo 4140fa2a81 drivers: rshim: drop useless typedef
Use 'struct name' instead of typedef.

Change-Id: Ifff56811f53a260c314c8f5473d368599e0912e6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8700
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:20:42 +00:00
Antonio Borneo 3e4512d62d openocd: drop useless typedef
There is no need to use typedef for the array of functions.
Drop it.

While there, move the declaration outside the function and use the
array size to drop the error-prone sentinel to NULL.

Change-Id: I424964a6ef82ed1a7b27e78fbd19aa9f985b52c7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8699
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-02-16 16:20:30 +00:00
Antonio Borneo 6e39af3b0e rtt: drop useless typedefs
There is no need to use extra typedef for the rtt functions.
Declare the type of the functions in the struct.

Change-Id: Idf2fee6e63ec3b3add38d042bbebe8d74613627c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8698
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2025-02-16 16:20:12 +00:00
Samuel Obuch 73e9b7898f github/workflow: build jimtcl from sources
JimTCL submodule was deprecated, this patch modifies
the GitHub snapshot action to build from sources instead.

Change-Id: Ie9ab20dbfd70506992d11a91489e82a9fa6e13ce
Signed-off-by: Samuel Obuch <samuel.obuch@espressif.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8751
Reviewed-by: Marc Schink <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
2025-02-12 16:49:24 +00:00
Richard Pasek d09f53a930 driver/linuxspidev: Clear queue on allocation
SWD idle clocks are added to the queue by advancing the queue index
assuming the queue is zeroed. If the queue isn't zeroed, these idle
clocks end up being filled with junk data. Lets clear the queue and
associated buffers on queue allocation.

TEST: Connects successfully and ran the following TCL command:
  dump_image /dev/null 0x20000000 0x42000
  Host: Unnamed Qualcomm SoC with QUPv3 based SPI port
  Target: RT500

Signed-off-by: Richard Pasek <rpasek@google.com>
Change-Id: Ie660c10c27c4d0937ab0629138935ddbf5aeb0ae
Fixes: 83e0293f7b ("Add Linux SPI device SWD adapter support")
Reviewed-on: https://review.openocd.org/c/openocd/+/8730
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Jonathon Reinhart <jrreinhart@google.com>
Tested-by: jenkins
2025-02-11 11:57:58 +00:00
Tomas Vanek 82277462b9 drivers/linuxspidev: fix use of uninitialized speed variable
Valgrind reported
== Syscall param ioctl(generic) points to uninitialised byte(s)
==    at 0x4ABF990: ioctl (ioctl.S:26)
==    by 0x19D00B: spidev_speed (linuxspidev.c:181)
==    by 0x19D00B: spidev_init (linuxspidev.c:307)

Indeed, spidev_init() uses adapter_get_speed(), it calls
adapter_khz_to_speed() and it returns early without setting
the output parameter if adapter is not initialized.
Of course the adapter initialized flag is not set until
spidev_init() returns.

Simply drop this code as the adapter infrastructure initializes
adapter speed just after spidev_init() return.

Change-Id: I26f011ae59fc942a34d9bb517f467c22f735091d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Fixes: 83e0293f7b ("Add Linux SPI device SWD adapter support")
Reviewed-on: https://review.openocd.org/c/openocd/+/8733
Tested-by: jenkins
Reviewed-by: Richard Pasek <rpasek@google.com>
2025-02-11 11:56:39 +00:00
Tomas Vanek 7dd875900e drivers/linuxspidev: fix minor memory leak
free() strduped spi_path on quit.
Found by valgrind.

Change-Id: Iaa59c7258c920b5e60d615df790dfe815831b925
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Fixes: 83e0293f7b ("Add Linux SPI device SWD adapter support")
Reviewed-on: https://review.openocd.org/c/openocd/+/8732
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Richard Pasek <rpasek@google.com>
2025-02-11 11:56:09 +00:00
Marc Schink 7f2db80ebc rtos/hwthread: Use LOG_TARGET_xxx()
Use LOG_TARGET_xxx() to indicate which target the message belongs to.

While at it, fix some coding style issues.

Change-Id: Iac0296498557a689468a4a19d0bc64f03178a0d0
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8727
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2025-02-11 11:53:59 +00:00
Evgeniy Naydanov 06e673ebc6 target/riscv: drop `mtopi_readable/mtopei_readable` `riscv_info` fields
These fields duplicate the info in the corresponding register cache
entries.

Change-Id: Ic0d264e78c527e92bb069258ce39b614d8f5bcde
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2025-02-07 12:43:38 +03:00
Evgeniy Naydanov 8309288831 target/riscv: pass `jtag_tap` instead of `target`
For some functions, passing `target` is excessive. The corresponding
`tap` provides all the necessary data.

Change-Id: Ie5836024a15222bda7c2b727f5dbaac38f459b3c
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2025-02-07 12:30:50 +03:00
Farid Khaydari 0bd8aaa46c target/riscv: refactored memory access result codes
Slightly refactored memory access result codes:
* Changed enum formatting
* Changed status handlers to decrease boilerplate

Checkpatch-ignore: MACRO_ARG_PRECEDENCE, MULTISTATEMENT_MACRO_USE_DO_WHILE
Checkpatch-ignore: TRAILING_SEMICOLON
Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2025-02-03 15:17:20 +03:00
Evgeniy Naydanov 8f59570468
Merge pull request #1217 from sobuch/not_cachable_mcause_mstatus
target/riscv: dont set mcause and mstatus as cachable
2025-01-31 15:10:33 +03:00
Evgeniy Naydanov 9d431c3ec2
Merge pull request #1207 from en-sc/en-sc/fix-011-init-regs
target/riscv: set VLENB/MTOPI/MTOPEI existence on 0.11 targets
2025-01-31 15:09:46 +03:00
Evgeniy Naydanov 495f144a1d
Merge pull request #1215 from en-sc/en-sc/from_upstream
Merge up to a510d51a78 from  upstream
2025-01-31 15:07:01 +03:00
Sergey Matsievskiy eb6f2745b7 flash/nor: add DesignWare SPI controller driver
Driver for DesignWare SPI controller, found on many SoCs (see compatible
list in Linux device tree bindings
Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml). This
implementation only supports MIPS as it was the only one available for the
tests, however, adding support for other architectures should require only
few adjustments. Driver relies on flash/nor/spi.h to find Flash chip info.
Driver internal functions support 24bit addressing mode, but due to
limitations of flash/nor/spi.h, it is not used. The reported writing speed
is about 60kb/s.
Lint, sanitizer and valgrind reported warnings were not related to the
driver.

Change-Id: Id3df5626ab88055f034f74f274823051dedefeb1
Signed-off-by: Sergey Matsievskiy <matsievskiysv@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8400
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-01-31 03:25:53 +00:00
Paul Fertser ce38758e3d rtos: chibios: replace malloc+sprintf with alloc_printf
This makes it safer and simpler at the same time.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: Ie294f1f6033ffc9f46b39210e2f7fc2f648e80ac
Reviewed-on: https://review.openocd.org/c/openocd/+/8598
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-01-31 03:21:32 +00:00
Evgeniy Naydanov 5de7310881
Merge pull request #1190 from lz-bro/enable-hardware-translation
target/riscv: move the dcsr modification out of program buffer
2025-01-29 18:47:41 +03:00
Evgeniy Naydanov 550df1603d
Merge pull request #1192 from cetygamer/patch-1
Makefile.am: fixed missing includes for make dist targets
2025-01-29 18:43:32 +03:00
Evgeniy Naydanov 309c25f5e2 Merge up to a510d51a78 from upstream
Changed `.github/workflows` due to internall `jimtcl` deprecation.

Change-Id: I628922a843a7116955cd6b48c48b0cd104bcaf20
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2025-01-28 22:13:08 +03:00
Samuel Obuch 94d739ac9a target/riscv: dont set mcause and mstatus as cachable
With CLIC extension (smclic), mcause and mstatus CSRs
share mirrored fields for mpp and mpie. Therefore, neither
can be assumed cachable.

Signed-off-by: Samuel Obuch <samuel.obuch@espressif.com>
2025-01-27 17:54:39 +01:00
Evgeniy Naydanov e870c5f2de
Merge pull request #1206 from JanMatCodasip/jm-codasip/remove-asm-h
Remove target/riscv/asm.h
2025-01-27 15:56:12 +03:00
Evgeniy Naydanov 57b58b7832
Merge pull request #1202 from JanMatCodasip/fix-datatypes-around-batch
Fix data types around batch.{c,h}
2025-01-27 15:55:21 +03:00
Evgeniy Naydanov 77b85757c5
Merge pull request #1200 from JanMatCodasip/jm-codasip/semihosting-3-warn-if-encountered-but-disabled
RISC-V Semihosting 3 of 3: Warn if encountered but disabled
2025-01-27 15:54:57 +03:00
Evgeniy Naydanov 1d623819e9
Merge pull request #1193 from en-sc/en-sc/not-busy
target/riscv: clear `abstract_cmd_maybe_busy` after commands
2025-01-27 15:54:38 +03:00
Evgeniy Naydanov 058891a62a
Merge pull request #1210 from en-sc/en-sc/from_upstream
Merge up to 26f2df80c3 from  upstream
2025-01-27 14:04:18 +03:00
Evgeniy Naydanov dd69b78fed
Merge pull request #1204 from sobuch/esp-riscv-cfg-fix
Fix esp RISC-V configs
2025-01-27 13:59:09 +03:00
Marc Schink a510d51a78 bootstrap: Do not set up Git submodules by default
Building OpenOCD with jimtcl and libjaylink Git submodules is deprecated
and will be removed in the upcoming releases. The remaining 'git2cl'
submodule is only required during the OpenOCD release process.

Only set up Git submodules when the 'with-submodules' argument is used,
for example during the OpenOCD release process or for the transition
period until all submodules are replaced by external dependencies.

We keep the existing 'nosubmodule' argument in order to not break
automatic testing with Jenkins.

Change-Id: Ia4fd765e3a2d6b2c40b084a1ffdf919d5f4f35bb
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8381
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
2025-01-25 16:17:00 +00:00
Marc Schink 77c904fd13 Deprecate jimtcl Git submodule
jimtcl was integrated as Git submodule for convenience and probably also
because packages were not widely available at the time. Today, jimtcl is
available in many popular package repositories [1] and the integration
as Git submodule adds unnecessary complexity to the OpenOCD build
process. For details, see the discussion on the mailing list in [2].

Disable the jimtcl Git submodule by default and announce it as
deprecated feature that will be removed in the next release. This gives
package maintainers time to adapt to the change and, if necessary,
build a package for jimtcl.

[1] https://repology.org/project/jimtcl/versions
[2] https://sourceforge.net/p/openocd/mailman/message/58786630/

Change-Id: I07930ac07f7d7a6317c08b21dc118f4f128b331c
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8380
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-01-25 16:16:26 +00:00
Antonio Borneo fceccde0b3 helper/log: Fix build using _DEBUG_FREE_SPACE_
The glibc API 'mallinfo' is deprecated and the new 'mallinfo2'
should be used from glibc 2.33 (2021-02-01).

Throw an error when '--enable-malloc-logging' is used on systems
that compile without glibc.
Detect the glibc version and, for backward compatibility, define
'mallinfo2' as the old 'mallinfo'. Define a macro for the format
of 'fordblks'.

Change-Id: I68bff7b1b58f0ec2669db0b911f19c1c5a26ed30
Reported-by: Steven J. Hill <steven.hill@konsulko.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8589
Tested-by: jenkins
2025-01-25 10:36:51 +00:00
Antonio Borneo 8038e2f754 configure: allow --enable-malloc-logging only with glibc
The feature for 'malloc-logging' uses functionalities that are
available only in GNU libc.

Detect in 'configure' if OpenOCD is being compiled with glibc.
Set the macro '_DEBUG_FREE_SPACE_' only in case of glibc.

Change-Id: I43e9b87c7ad47171cfe3e7c1e5f96f11e19f98d0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8592
Tested-by: jenkins
2025-01-25 10:36:28 +00:00
Antonio Borneo ac18b8cd6a configure: make more robust the check for elf 64
The check if 'elf.h' defines the type 'Elf64_Ehdr' is currently
done through 'grep' on the file. While there is no false positive,
so far, such test could incorrectly find the text inside a comment
or in a block guarded by #if/#endif.

Use the autoconf macro AC_CHECK_TYPE() to detect if the type is
properly declared.

Change-Id: Ibb74db3d90ac6d1589b9dc1e5a7ae59e47945e78
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8591
Tested-by: jenkins
2025-01-25 10:36:11 +00:00
Evgeniy Naydanov 345473f3ce helper/options: handle errors in `-l`
Before the patch an error in opening the log file (e.g. can't write a
file) was ignored when specified via `-l`.
E.g.:
```
> touch log
> chmod -w log
> openocd -l log -c shutdown
...
failed to open output log "log"
shutdown command invoked
> echo $?
0
```

After the patch:
```
...
> openocd -l log -c shutdown
...
failed to open output log "log"
> echo $?
1
```

Change-Id: Ibab45f580dc46a499bf967c4afad071f9c2972a2
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8666
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-01-25 10:34:15 +00:00
Evgeniy Naydanov 778d2dc4bb helper/options: drop redundant argument checks
In case the option is passed with a single `:` in `optstring` argument,
the call to `getopt_long()` should return `?`.

Therefore the check on `optarg` is redundand in case of `l` and `c`.

Change-Id: I1ac176fdae449a34db0a0496b69a9ea65ccd6aec
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reported-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8718
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-01-25 10:33:56 +00:00
Marek Vrbka 0b97973bfb vdebug: Fix socket comparison warning on Windows
On GCC version 13.2,
the previous code emitted the following warning on Windows:

openocd/src/jtag/drivers/vdebug.c:254:19: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare]
  254 |         if (hsock == INVALID_SOCKET)

This patch fixes it and brings it in line with other socket handling code.

Change-Id: I7e05f83c6905cfaf66b68e8988c783e80cee4a48
Signed-off-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8717
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
2025-01-25 10:33:23 +00:00
Tomas Vanek 77f9da7626 flash/nor/kinetis: fix assertion during flash write
If the device has at lest one FlexNVM bank and it is set as EE backup
only, the bank has no protection blocks.

kinetis_fill_fcf() collects protection data from all banks before
flash write of the sector containing FCF block. In case it encountered
a FlexNVM bank with no protection blocks assert failed.

Failed flash write of previously erased FCF block could cause
engaging debugging lock (if the device was run or reset).

Skip banks with zero protection blocks.
Replace assert() by LOG_ERROR() as we have to finish FCF write.

Change-Id: Ibe7e7ec6d0db4453b8a53c8256987621b809c99d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Suggested-by: Jasper v. Blanckenburg <jazzpi@users.sourceforge.net>
Fixes: https://sourceforge.net/p/openocd/tickets/448/
Reviewed-on: https://review.openocd.org/c/openocd/+/8719
Tested-by: jenkins
Reviewed-by: Jasper v. Blanckenburg <jasper@mezzo.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-01-25 10:32:45 +00:00
Antonio Borneo 3099547069 OpenOCD: fix code indentation
Fix checkpatch errors

	ERROR:SUSPECT_CODE_INDENT: suspect code indent for
	conditional statements

Change-Id: I94d4fa5720c25dd2fb0334a824cd9026babcce4e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8497
Tested-by: jenkins
2025-01-25 10:31:06 +00:00
Antonio Borneo 8e89a8af63 target: cortex_m: add support of ARMv8.1-M register 'vpr'
The register 'vpr' is present when MVFR1.MVE is not zero.
For the moment, reuse the existing flag 'fp_feature'. To be
reviewed for the case of MVE supported without floating point.

The documentation of GDB [1] reports that the register 'vpr'
should be represented as 3 fields.

Tested on Cortex-M55 based STM32N6570.

Change-Id: I8737a24d01a13eeb09a0f2075b96be400f9f91c6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Link: [1] https://sourceware.org/gdb/download/onlinedocs/gdb.html/ARM-Features.html#M_002dprofile-Vector-Extension-_0028MVE_0029
Reviewed-on: https://review.openocd.org/c/openocd/+/8681
Tested-by: jenkins
2025-01-25 10:30:37 +00:00
Antonio Borneo 41f7d18161 target: armv7m: add support of per register data_type
Extend the struct armv7m_regs to include the optional pointer
to a struct reg_data_type.

Update armv7m_build_reg_cache() to check for the new optional
field and to use it.

Change-Id: I57c7f9abefd614308be8aa8419d687477b44679d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8680
Tested-by: jenkins
2025-01-25 10:30:15 +00:00
Evgeniy Naydanov 8513d6edcc target/riscv: set VLENB/MTOPI/MTOPEI existence on 0.11 targets
commit 5f45b5bd73 ("target/riscv: reg cache
entry is initialized before access") introduced an assertion in
`riscv_reg_impl_gdb_regno_exist()`.
Link: f82c5a7c04/src/target/riscv/riscv_reg.c (L385-L389)
This assertion fails on RISC-V Debug Spec. 0.11 targets.
The commit is intended to fix this.

Change-Id: I20b56df1517f4071f4b6e39c83178a29a9cf95b0
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2025-01-24 22:15:31 +03:00
liangzhen 05d377af75 target/riscv: move the dcsr modification out of program buffer
when riscv virt2phys_mode is hw, reduce the use of
unnecessary program buffers.
2025-01-25 00:45:19 +08:00
Alexander Rumyantsev 4ff476ca47 Makefile.am: fixed missing includes for make dist targets
Due to missing includes, make dist archives could not be built.

Signed-off-by: Alexander Rumyantsev <cetygamer@gmail.com>
2025-01-23 16:30:50 +03:00
Richard Pasek 83e0293f7b Add Linux SPI device SWD adapter support
To alleviate the need to bitbang SWD, I've written a SWD SPI
implementation. This code is inspired by the work of luppy@appkaki.com
as shown at github.com/lupyuen/openocd-spi but with the desire to be
more generic. This implementation makes use of the more common 4 wire
SPI port using full duplex transfers to be able to capture the SWD ACK
bits when a SWD TX operation is in progress.

TEST:
  Connects successfully with the following combinations:
  Hosts:
    Raspberry Pi 4B
    Unnamed Qualcomm SoC with QUPv3 based SPI port
  Targets:
    Raspberry Pi 2040
    Nordic nRF52840
    NXP RT500

Change-Id: Ic2f38a1806085d527e6f999a3d15aea6f32d1019
Signed-off-by: Richard Pasek <rpasek@google.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8645
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2025-01-22 15:21:10 +00:00
Evgeniy Naydanov 182092a364 Merge up to 26f2df80c3 from upstream
Conflicts:
* `src/target/target.c` due to commit
  4004db5d3a ("Make polling_interval
  unsigned.")

Change-Id: I0a691dbebe300f3a53fb31bd1097a9aff5551a52
2025-01-22 17:47:14 +03:00
Jan Matyas b7d9ab5d1e RISC-V Semihosting 3 of 3: Warn if encountered but disabled
If semihosting is disabled but there is a semihosting request
encountered in the program, provide a clear hint to the user
what happened and what can be done about it.

Change-Id: I8fa7b821ca9a853cbc884f38d138fa5c8946c84c
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2025-01-22 11:59:38 +01:00
Evgeniy Naydanov 88fe56828a
Merge pull request #1199 from JanMatCodasip/jm-codasip/semihosting-2-refactor-magic-seq-detection
RISC-V Semihosting 2 of 3: Refactor magic sequence detection
2025-01-22 11:23:11 +03:00
Jan Matyas a450a7d496 Fix data types around batch.{c,h}
Check that the value of dtmcs.abits is in the expected range.

Make corrections of data types in batch.{c,h} and in related code.
Some of the issues were found by activating "-Wconversion" in GCC,
others by inspecting the code manually.

This is an initial step towards being able to use "-Wconversion" on
RISC-V target code, which will give us bit more confidence when
refactoring or merging new patches.

Changes made:

- Check `dtmcs.abits` during examination.

- DMI address is no larger than 32-bits per the debug spec.
  Changed address parameters of multiple functions from uint64_t
  to uint32_t.

- The value passed to jtag_add_runtest() is now `unsigned int`,
  not `int`. No need for `assert(idle <= INT_MAX)` anymore.

- `get_delay()` in batch.c can return an unsigned value.

- Added few assertions around `field->num_bits` in batch.c.

Change-Id: Ibfccd62d552063df6ab9b5a2d4ea4ed23617d3db
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2025-01-21 16:09:29 +01:00
Jan Matyas c1dfb0d50e Remove target/riscv/asm.h
The file asm.h is only used by riscv-011.c.

Remove the whole asm.h file and inline the two functions into
riscv-011.c which is the only place of use.

Change-Id: Ifa4b2b87ab9f3f50c78a75361003ce478bfd9d5f
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2025-01-20 09:16:30 +01:00
Jan Matyas 8c0a1cde78 RISC-V Semihosting 2 of 3: Refactor magic sequence detection
Refactor (clean up) the code in riscv_semihosting.c by moving
the magic sequence detection to its own function.

Cleanup the debug prints denoting the semihosting outcome
so that they are easier to understand when reading the OpenOCD's
verbose (debug) log.

Use le_to_h_u32() to convert memory buffer to instruction code
because RISC-V instructions are always little endian.
(target_buffer_get_u32() was incorrect for that reason.)

Change-Id: I3a3ce991336ceeeff023d459d0e28558059554e0
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2025-01-20 08:28:17 +01:00
Evgeniy Naydanov 22108977c0
Merge pull request #1168 from en-sc/en-sc/ebreak
target/riscv: new `ebreak` controls
2025-01-17 14:29:04 +03:00
Evgeniy Naydanov b9d9d1a6a2 target/riscv: new `ebreak` controls
* Deprecate `riscv set_ebreak*` commands.
* Introduce RISC-V-sepecific `configure` parameter `-ebreak` instead.
* Separate controls for VS and VU modes.

Change-Id: I0ff88318dcb52af6923eb9f20f9d0c056ad09cf0
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2025-01-15 19:49:05 +03:00
Evgeniy Naydanov eb9ba216e1
Merge pull request #1198 from JanMatCodasip/jm-codasip/semihosting-1-remove-dead-code
RISC-V Semihosting 1 of 3: Remove dead code
2025-01-13 22:49:24 +03:00
Samuel Obuch fb16cb5e67 tcl: fix esp riscv configs
Fixes tcl configs to enable esp RISC-V boards

Signed-off-by: Samuel Obuch <samuel.obuch@espressif.com>
2025-01-13 17:32:52 +01:00
Antonio Borneo 26f2df80c3 helper: list: rename macro clashing with sys/queue.h
The macro named LIST_HEAD() clashed with a macro of same name in
the GNU libc file sys/queue.h.
This causes a warning in MacOS build due to some other system file
including sys/queue.h.

Rename LIST_HEAD() as OOCD_LIST_HEAD().

Checkpatch-ignore: MACRO_ARG_REUSE
Change-Id: Ic653edec77425a58251d64f56c9f5f6c645ba0cd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Andrew Shelley <ashelley@btinternet.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8683
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Andy <andrewjohnshelley@gmail.com>
2025-01-12 11:09:31 +00:00
R. Diez 0ed03df6e9 amend angie build definitions to fix make dist
"make dist" was broken because GNU Make was using a built-in rule
to try to build angie from angie.c . This is a limitation in Automake
when you add a whole subdir with the same name to EXTRA_DIST.
The Automake doc actually discourages adding whole subdirs.

Change-Id: I85ea4ecbd529b060c70f83bcfda7522e1730480d
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8600
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2025-01-12 11:09:12 +00:00
R. Diez 8b5ea720da make bitbang_interface const
Change-Id: I5e187250d231aeefc7a206b7f7917c3b2e858d5a
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8535
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2025-01-12 11:08:38 +00:00
Tomas Vanek d4b3b4ea82 target: free private_config if target initialisation fails
Fixes private_config memory leak when xx_deinit_target() is not called

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ie7cce7f24af24695e7d2c1cd1882474c6863b80d
Reviewed-on: https://review.openocd.org/c/openocd/+/8642
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2025-01-09 20:16:22 +00:00
Tomas Vanek cf115c1e2b drivers/cmsis_dap_usb_bulk: allow waiting for bulk write
No driver directly working with the USB hardware needs additional
time to complete the write op, they always return transfer complete
status immediately after submitting the transfer.

Although there is implemented correct waiting path in cmsis_dap_usb_write()
it was marked by error logs to catch any suspicious behaviour during
debugging of asynchronous libusb transfers.

However there are drivers which need waiting to finish write op:
at least usbipd-win, IP tunnelled USB driver, was reported
to flood the log with the related errors.

Change LOG_ERROR to LOG_DEBUG_IO in the code waiting to finish write op.

Reported-by: Quentis Ghyll <quentisgh@gmail.com>
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Iedf2c96d851f22e694efaf13a2d6a2a408cee1ad
Reviewed-on: https://review.openocd.org/c/openocd/+/8640
Tested-by: jenkins
2025-01-09 20:15:59 +00:00
Tomas Vanek 23796efa38 drivers/cmsis_dap: use blocking flag instead of wait timeout
CMSIS-DAP bulk backend read op used two timeouts: transfer timeout
used in libusb_fill_bulk_transfer() and wait timeout used optionally
in libusb_handle_events_timeout_completed().

The real usage is limited to two cases only:
1) blocking read: the same timeout is used for both transfer
and wait
2) non-blocking read: transfer timeout is used in
libusb_fill_bulk_transfer(),
libusb_handle_events_timeout_completed() is called with zero timeout.

Use blocking flag as read op parameter to distinguish between
these two cases.

See also [1]

Link: [1] 8596: jtag: cmsis_dap: include helper/time_support.h | https://review.openocd.org/c/openocd/+/8596
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ia755f17dc72bb9ce8e02065fee6a064f8eec6661
Reviewed-on: https://review.openocd.org/c/openocd/+/8639
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2025-01-09 20:15:33 +00:00
Jan Matyas ecb2ad4a8a RISC-V Semihosting 1 of 3: Remove dead code
Variable `target->semihosting` is always initialized
in risv_init_target() to a non-NULL value.

For that reason, checks like `if (target->semihosting)`
are redundant (dead code).

Remove them to not confuse code readers. Replace them by assertions.

Change-Id: I85ef52300e240cfcb0119db6169993bc4767de8f
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2025-01-07 08:39:34 +01:00
David (Pololu) 250ab1008b flash/stm32l4x: add STM32C071xx support
I successfully programmed a NUCLEO-C071RB with these changes.

Change-Id: Ib57a77fa18f8a0e8c882e2250d6111c588d76887
Signed-off-by: David (Pololu) <dev-david@pololu.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8525
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2025-01-06 05:01:21 +00:00
Antonio Borneo 5233312ea5 configure: fix dependency of bitbang from dummy adapter
The commit bb2fc63357 ("configure.ac: enable the Dummy adapter
by default") breaks the building dependency between bitbang code
and dummy adapter.

Fix it.

Change-Id: I47587ef61d6b57b2547f6c2600d8404cad87f584
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Jonathan Forrest <jonyscathe@gmail.com>
Fixes: bb2fc63357 ("configure.ac: enable the Dummy adapter by default")
BugLink: https://sourceforge.net/p/openocd/tickets/446/
Reviewed-on: https://review.openocd.org/c/openocd/+/8682
Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
Tested-by: jenkins
Reviewed-by: Andy <andrewjohnshelley@gmail.com>
2025-01-02 14:15:02 +00:00
Marc Schink 4f2744d0fe target/arc: Use LOG_TARGET_xxx()
Use LOG_TARGET_xxx() for log messages as it is used for other targets.

While at it, rework the log messages, for example by removing spaces
or punctuation marks at the end of the message.

Change-Id: I3dd4314d354b5628144f98325540926981778616
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8665
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-12-30 15:58:26 +00:00
Marc Schink a75feb0bfd target/armv7m: Use LOG_TARGET_xxx()
Use LOG_TARGET_xxx() to indicate which target the message belongs to.

Change-Id: Ib1cd37fe6eca2ea42095d2d371116446a936e20a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8664
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-12-30 15:58:10 +00:00
Marc Schink 78bc6f34d4 target/esirisc: Use LOG_TARGET_xxx()
Use LOG_TARGET_xxx() for log messages as it is used for other targets.

Change-Id: Ia7e9629d89f2e6cb3f9c156e74ac1a02960f9373
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8663
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-12-30 15:57:45 +00:00
Marc Schink 4193322315 target/mem_ap: Use LOG_TARGET_xxx()
Use LOG_TARGET_xxx() for log messages as it is used for other targets.

Change-Id: I2f937c937a5c09d91dc82b4323be3276ab60b01a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8662
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-12-30 15:57:27 +00:00
Marc Schink e4ad10e0a1 helper/log: Add LOG_TARGET_USER()
Add a target-related log function for user messages as it already
exists for other log levels.

Change-Id: I9076677d6451b900332583e748bab3f83df56d3b
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8661
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-12-30 15:57:01 +00:00
Tomas Vanek 5284a5f3ec tcl/interface: Find proper alias for RP1 on Raspberry Pi 5
Previously, Linux assigned gpiochip numbers sequentially depending on
when the chip driver was probed. As RP1 is on the end of a PCIe link, it
is probed later than the on-board chips (including expanders connected
over SPI/I2C). This meant that RP1's gpiochip assignment was at an
offset that could potentially change.

A downstream kernel patch now assigns fixed offsets for RP1 and the
onboard gpiochips. Query the device tree to get proper GPIO_CHIP index.

Change-Id: I759978d4b3021c815a7d9febb41961cd1d3d185c
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8650
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
Tested-by: jenkins
2024-12-29 07:27:45 +00:00
Marc Schink 15d90dd21c tcl/target: Add config for STM32U0x
Tested with NUCLEO-U083RC development board.

Change-Id: Iec668b45166543adcd1fa5077d41c57a35d3becf
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8648
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-12-29 07:26:13 +00:00
Marc Schink 66faa420a4 flash/nor/stm32l4x: Add support for STM32U0 series
Tested flash programming / erasing and write protection feature on the
STM32U083RC microcontroller.

Change-Id: I3af51452f76d1f046d34d61b22d51abe2d0db3e8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8647
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-12-29 07:25:36 +00:00
Evgeniy Naydanov 83dc8a6446 target/riscv: clear `abstract_cmd_maybe_busy` after commands
If a sufficient delay was used before reading `abstractcs` during the
batch execution, `dm->abstract_cmd_maybe_busy` was not cleared and the
following call to `wait_for_idle_if_needed()` (e.g. on `resume`), would
result in a call to `wait_for_idle()` performing a redundant read of
`abstractcs`.
While this is not a bug, it impedes the performance.

Change-Id: I9d234ef6d53af96c60892d71247c10e631dfcc3b
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-12-25 17:31:51 +03:00
Marc Schink 7d5a0b6a27 tcl/board: Add nRF54L15-DK config file
This patch adds support for the nRF54L15 development kit from Nordic
Semiconductor.

Change-Id: I5e362227fed3982ef21f36e41aade196e0ac7031
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8610
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-12-22 09:57:21 +00:00
Marc Schink 4d1b3cbafc tcl/target: Add support for Nordic nRF54L series
The RISC-V coprocessor is currently not supported. It is attached to the
DAP via AP#2 but the AP implementation is unknown.

The nRFL54L series uses resistive RAM (RRAM) as non-volatile memory
which can be programmed directly. Since it does not fit in the current
flash memory infrastructure of OpenOCD there is no NVM support so far.

Change-Id: I9934af4fd3bb8b7272954fc4b17638c7dabbbee0
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8609
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-12-22 09:57:09 +00:00
Marc Schink 1f2db5d59a rtos/rtos: Remove 'ERROR: ' prefix in error log
Remove the prefix since it is redundant.

Change-Id: Ib064d1031f5ad14ed7711c09bb5f5254d0054d59
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8633
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-12-22 09:55:56 +00:00
Marc Schink 3be1bee753 target/mips: Remove 'ERROR: ' prefix in error log
Remove the prefix since it is redundant.

Change-Id: Ieecfb3583d484847514f1298e819ccf6d26abd84
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8632
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-12-22 09:55:35 +00:00
Marc Schink 9cd0b37112 target/xtensa: Remove 'ERROR: ' prefix in error log
Remove the prefix since it is redundant. While at it, also
get rid of the useless exclamation mark.

Change-Id: I16fd6a88b533fac19b4c622cf9740fd32ba7892c
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8611
Reviewed-by: Richard Allen <rsaxvc@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-12-22 09:55:22 +00:00
R. Diez 7f9d25d58a configure.ac: switch from $host to $host_os
Suggested during review https://review.openocd.org/c/openocd/+/8533
Only the OS part was being checked anyway.
The aim is to facilitate merging all $host_os checks in the future.

Change-Id: Idce1d5872cf19ef423429fa0c3b2ff7ee3945332
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8607
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-12-22 09:54:54 +00:00
R. Diez bb2fc63357 configure.ac: enable the Dummy adapter by default
The Dummy adapter is useful when developing generic JimTcl code.
Besides, the distributed BUGS file states that you should
try to reproduce any crashes with the Dummy adapter, so
it does not make sense that it is not enabled by default.

Change-Id: I145de06de4d2c0011619b1b941200b63e200db23
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8608
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2024-12-22 09:54:35 +00:00
Antonio Borneo cd9e64a25a rtos: mqx: minor rework to avoid a cast
Change the type of task_name[] to char in order to drop a cast.

Change-Id: I233fc862e972e52130fd4ffcb29a3da36f4f8923
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8599
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: jenkins
2024-12-22 09:52:32 +00:00
Paul Fertser dca76cd5da rtos: mqx: replace malloc+strcpy with strdup
Using strcpy is potentially dangerous so just use a safer and easier way
to do the same.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: Id85f3b7f8af1eaf14c9951ae710546d2437c70b5
Reviewed-on: https://review.openocd.org/c/openocd/+/8597
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-12-22 09:52:20 +00:00
Antonio Borneo 42f70a3b95 target: aarch64: fix out-of-bound access to array
The command 'arm core_state' uses the enum in 'arm->core_state' as
an index in the table of strings to print the core state.

With [1] the enum has been extended with the new state for AArch64
but not the corresponding table of strings.
This causes an access after the limit of arm_state_strings[].

Rewrite the table using c99 array designators to better show the
link between the enum list and the table.
Add the function arm_core_state_string() to check for out-of-bound
values allover the file.

Change-Id: I06473c2c8088b38ee07118bcc9e49bc8eafbc6e2
Fixes: [1] 9cbfc9feb3 ("arm_dpm: Add new state ARM_STATE_AARCH64")
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8594
Tested-by: jenkins
2024-12-22 09:50:50 +00:00
Marc Schink 1710954977 doc/manual: Add section about logging
The log messages are very inconsistent across the code base. Add a
guideline for log messages to help improve consistency. The guideline is
based on the most commonly used style in the current code base.

Change-Id: I076d68abe588dd04b59580379e97b82d537def23
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8576
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-12-22 09:45:53 +00:00
fanoush cc02bd752c rtt server: fix for dropped data when target has no space
rtt_write_channel may write less data than requested,
default device buffer size for channel 0 is 16 bytes,
so currently anything larger than this is dropped.

This fix implements per connection buffer and uses the
connection->input_pending flag to retry writes.

Change-Id: I00c845fccb0248550ad0f0fd9cda7bac7976b92b
Signed-off-by: fanoush <fanoush@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8360
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-12-22 09:43:37 +00:00
Pete Moore cb3b8afe47 jimtcl: Fix command not found
During the ./configure build stage, error './configure.gnu: line 1: -e:
command not found' can occur.

Problem: the -e flag with echo is not portable. While some shells support
it (e.g., Bash), others (e.g., POSIX /bin/sh on some systems) do not.

Solution: replacing echo -e with printf, since printf is POSIX-compliant
and works consistently across different shells.

Change-Id: I9efbba662599a61bbe1fc56a33dc1ee7ad58826c
Signed-off-by: Pete Moore <pmoore@mozilla.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8653
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2024-12-22 00:40:33 +00:00
Pete Moore d60e1f6693 flash/nor/sfdp: Fix broken DEBUG log line on macOS
https://review.openocd.org/c/openocd/+/8439 changed variable `words`
from uint8_t to unsigned int in sfdp.c but failed to update the
LOG_DEBUG line to reflect the new type. On macOS this caused:

src/flash/nor/sfdp.c:107:28: error: format specifies type 'unsigned
char' but the argument has type 'unsigned int' [-Werror,-Wformat]

The formatting of the debug line has been updated to reflect the updated
type.

Change-Id: Ifc7ddb1279ab2603901c969d9c09af847f3a3caf
Signed-off-by: Pete Moore <pmoore@mozilla.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8660
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-12-21 10:25:58 +00:00
Evgeniy Naydanov f82c5a7c04
Merge pull request #1186 from en-sc/en-sc/from_upstream
Merge up to 133dd9d669 from  upstream
2024-12-20 12:08:03 +03:00
Evgeniy Naydanov 4b9fb1972f Merge up to 133dd9d669 from upstream
Change-Id: Iaaf234da839cbed61684f4615135c9a42213c56a
2024-12-18 12:41:19 +03:00
Evgeniy Naydanov cf9963ad81
Merge pull request #1181 from en-sc/en-sc/reg-invalidate
target/riscv: clean-up register invalidation
2024-12-11 16:40:20 +03:00
Evgeniy Naydanov 8dfc806fe3
Merge pull request #1183 from fk-sc/fk-sc/ternary-operator
target/riscv: replaced repeating ternary operator with variable
2024-12-11 16:39:54 +03:00
Evgeniy Naydanov de20c2ad5f target/riscv: clean-up register invalidation
* Registers were not invalidated if the hart became unavailable.
* Improved logging in the case register invalidation involves loss of
  information.

Change-Id: Icfb5e190dd6dcb1a97e4d314d802466cab7a01e4
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-12-10 15:25:22 +03:00
Farid Khaydari d5c2604418 target/riscv: replaced repeating ternary operator with variable
Replaced repeating ternary operator with variable

Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2024-12-10 13:40:08 +03:00
Evgeniy Naydanov ea8f9d5195
Merge pull request #1173 from fk-sc/buf-get
target/riscv: use buf_get_uXX instead of manual bit shift
2024-12-06 15:03:47 +03:00
Farid Khaydari 4dcd80164a target/riscv: use buf_get_uXX instead of manual bit shift
Replaced manual bit shift with buf_get_u64/buf_get_u32

Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2024-12-04 22:56:05 +03:00
Anatoly Parshintsev c430c24330
Merge pull request #1167 from fk-sc/fk-sc/rwargs
target/riscv: pass memory access info in struct, move write_memory pointer
2024-12-04 21:04:56 +03:00
Anatoly Parshintsev ca80920157
Merge pull request #1176 from aap-sc/aap-sc/csr_as_hex_regression_fixup
fix incorrect parsing of names for custom csr registers
2024-11-29 18:26:19 +03:00
Farid Khaydari eb4e717a3b target/riscv: pass memory access info in struct, move write_memory pointer
This changes will allow to unite read_memory/write_memory fucntions
to one access function

(1) Replaced read/write functions arguments with one structure
(2) Unified read_memory/write_memory function pointers
    to be stored in same structure

Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2024-11-29 18:12:53 +03:00
Anatoly Parshintsev 0f0302b029
Merge pull request #1174 from fk-sc/fk-sc/checker-fix
target/riscv: fix memory access result type checker function return in case of assertion
2024-11-29 01:23:37 +03:00
Parshintsev Anatoly 109646c09d fix incorrect parsing of names for custom csr registers
this commit fixes a regression introduced in
ba8c1eef5a.

The regression was caused by removal of these lines:

```
-                       /* Register prefix: "csr_" or "custom_" */
-                       strcpy(name, reg_type);
-                       name[strlen(reg_type)] = '_';
```

causing all CSR names with custom names to be parsed as empty strings.
2024-11-27 22:08:20 +03:00
Evgeniy Naydanov eb1ecd7d10
Merge pull request #1170 from fk-sc/fk-sc/priv-mod
target/riscv: decrease modify_privilege function nesting level
2024-11-26 17:26:49 +03:00
Farid Khaydari c8ae081979 target/riscv: fix memory access result type checker function return in case of assertion
Fix memory access result type checker return in case of assertion

Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2024-11-26 12:56:36 +03:00
Anatoly Parshintsev 658766858d
Merge pull request #1162 from aap-sc/aap-sc/csr_as_hex
target/riscv: allow hexadecimal values to expose_csr-like commands
2024-11-25 23:00:32 +03:00
Henrik Mau 133dd9d669 target/xtensa: add maskisr command support for NX
Add maskisr command support to Xtensa NX targets allowing masking
of interrupts during single stepping.

Change-Id: I3835479de8015f1a2842afd1aeab24829e385031
Signed-off-by: Henrik Mau <henrik.mau@analog.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8575
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-23 13:54:44 +00:00
Marc Schink 76e228f733 target/cortex_m: Use LOG_TARGET_xxx()
Use LOG_TARGET_xxx() for the remaining log messages.

Change-Id: If52e3935b57e4c39212ce6b5111ff65159de1373
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8580
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-23 13:54:03 +00:00
Marc Schink c837beaf5d target/breakpoints: Use LOG_TARGET_ERROR()
Use LOG_TARGET_xxx() for the remaining log messages.

Change-Id: I4b86b206d17dead0662388e827204b40a7d29edd
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8579
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-23 13:53:42 +00:00
Marc Schink 6973613175 rtos: Remove 'ERROR: ' prefix in error log
Remove the prefix since it is redundant. While at it, also
get rid of the useless exclamation mark.

Change-Id: I8707342c602cea735c5a423b37ebe40a3aafb137
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8578
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-23 13:53:24 +00:00
Marc Schink f5036aff3a target/xtensa: Remove 'ERROR: ' prefix in error log
Remove the prefix since it is redundant.

Change-Id: I9c23c0479ba40be24e471309e720060cd03763ee
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8577
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-23 13:52:56 +00:00
R. Diez 11f24fc2f2 configure.ac: improve validation of some --enable-xxx options
Catch an invalid option like "--enable-buspirate=rubbish".
Also mention all valid values in the help text for those options.

Change-Id: Ib0fb8904132d07cc5cde421aa816ca6971a08769
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8540
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-23 13:51:20 +00:00
R. Diez 2627f8ce6d configure.ac: show the linuxgpiod adapter in the configuration summary
List AC_ARG_ADAPTERS was missing a comma separating two of the elements.

Also verify that each adapter is set to either 'auto', 'yes' or 'no',
which should prevent such issues from going unnoticed in the future.

Change-Id: I0d407e03b1e5a3edc61d7dc93d5ffa70fe079b3c
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8534
Tested-by: jenkins
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-23 13:50:34 +00:00
R. Diez 9ff79fd61f enable the Bus Pirate adapter by default on most systems
Also convert the Bus Pirate to the common PROCESS_ADAPTERS logic.

Change-Id: Ifa8ebcee380c16d7e308ba7a75dbffdb74208285
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8533
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Tested-by: jenkins
2024-11-23 13:49:42 +00:00
Antonio Borneo c582cfbf75 driver: stlink: get adapter speed through adapter_get_speed_khz()
The stlink driver, both in dapdirect and in HLA modes, pretends to
store locally the value of the adapter speed in order to use it
later-on during adapter initialization.
It doesn't work in dapdirect mode since the code to store locally
the value will not be executed until the adapter is already fully
initialized.

This cause an issue in dapdirect mode:
- due to the local value, still kept at -1, the adapter will be
  initialized to the lowest clock speed (5 KHz on stlink v2 in SWD
  mode);
- after the adapter initialization the framework will again set
  the speed with the value requested by the user.

Some target, like nRF51822, only accepts JTAG/SWD speed in a
defined range of frequencies. The initial speed of 5 KHz used by
dapdirect can be out of range, making the target debug port not
working.

The adapter framework already stores the value of speed and makes
it available through adapter_get_speed_khz().

Drop struct hl_interface_param::initial_interface_speed.
Let the code to use adapter_get_speed_khz().

Change-Id: Ie11bf0234574f2a9180d3d3a16efb78e08dfcd86
Reported-by: Andrzej Sierżęga <asier70@gmail.com>
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8574
Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
Tested-by: jenkins
2024-11-23 13:49:16 +00:00
Marc Schink 8c739a45a0 helper/jim-nvp.h: Rework 'isconfigure' variable
Change the variable name to 'is_configure' to be compatible with the
coding style and use 'bool' as data type.

Change-Id: I8609f9807c8bd14eaf6c93acf63fd51b55c9bbbb
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8573
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-23 13:48:52 +00:00
Antonio Borneo 61fbcbeca8 semihosting: make local functions static
The functions:
- semihosting_opcode_to_str();
- semihosting_write_fields();
- semihosting_set_field();
are not referenced outside the file.

Make them static.

Change-Id: Ia8d35554673145fdfe0e501543eb18919863039f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8551
Tested-by: jenkins
2024-11-23 13:48:25 +00:00
Antonio Borneo b04a58e3fc target: esirisc: make local functions static
The function esirisc_jtag_get_eid() is not used outside the file.
Make it static.

The function esirisc_jtag_disable_debug() is never used.
Make it static and mark it as unused.

Change-Id: I5c99cbf77cc9c527b6e18a3f67caa24f8551d09c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8550
Tested-by: jenkins
2024-11-23 13:48:12 +00:00
Antonio Borneo df42faf51d target: aarch64: drop unused armv8_mmu_translate_va()
The function is not used.
Drop it!

Change-Id: I1625e03714b5a842f668098191c39cce34f815e8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8549
Tested-by: jenkins
2024-11-23 13:47:55 +00:00
Antonio Borneo c5babec794 target: x86_32: make x86_32_common_read_io() static
The function is not referenced outside the file.
Make it static.

Change-Id: Ic2552c040b6b46c0334851a4fc0fdaa400e11e4c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8548
Tested-by: jenkins
2024-11-23 13:47:33 +00:00
Antonio Borneo f3aeb3d676 target: dsp563xx: make dsp563xx_once_reg_read_ex() static
The function is not referenced outside the file.
Make it static.

Change-Id: Ifeccc5e38f3da4b4111422860bc1c1447d00f7fe
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8547
Tested-by: jenkins
2024-11-23 13:47:15 +00:00
Antonio Borneo a34d4b8cb4 pld: make get_pld_device_by_num() static
The function is not referenced outside the file.
Make it static.

Change-Id: I5f2a2c70085b9158df8806432bb9ed09bb256ab5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8546
Tested-by: jenkins
2024-11-23 13:46:59 +00:00
Antonio Borneo 4da8f6d27a rtt: drop unused function rtt_started()
The function is not used.
Drop it!

Change-Id: I176c9d6ba077e36b762c14f9b877d5152992763c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8545
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-11-23 13:46:35 +00:00
Antonio Borneo 644742b4b2 driver: mpsse: make local functions static
The functions:
- mpsse_divide_by_5_config();
- mpsse_purge();
- mpsse_rtck_config();
- mpsse_set_divisor();
are not referenced outside the file.

Make them static.

Change-Id: Id6930183a3ce26693b2113f622046168ba289df8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8544
Tested-by: jenkins
2024-11-23 13:46:20 +00:00
Antonio Borneo f4ac0c7022 jtag: driver: make local functions static
The functions:
- interface_jtag_add_callback();
- interface_jtag_add_callback4();
are not referenced outside the file.

Make them static.

Change-Id: I84f738309d23c8d0b5329aa04436db750cf185e5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8543
Tested-by: jenkins
2024-11-23 13:46:01 +00:00
Antonio Borneo f82664ff82 jtag: core: make local functions static
The functions:
- jtag_error_clear();
- jtag_tap_count();
are not referenced outside the file.

Make them static.

Change-Id: I00fcf06b1838b9f6c955c19772f1d41d486459e9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8542
Tested-by: jenkins
2024-11-23 13:45:42 +00:00
Antonio Borneo 2465f18515 adapter: make adapter_config_khz() static
The function is not referenced outside the file.
Make it static.

Change-Id: I72e96624749ae4cc7f4566d737a88186e899616a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8541
Tested-by: jenkins
2024-11-23 13:45:19 +00:00
Antonio Borneo 989e9e8b54 gitignore: drop ignoring files not generated anymore
With the drop of the code for the probe zy1000 [1] and then the
drop of minidriver code [2], there are no more auto-generated
source files.

Remove them from the list of generated files to be ignored.

Change-Id: Iee65e21528674ea4cc94018e52126f882da4f07c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
[1] b0fe92dba7 ("zy1000: drop the code, deprecated in v0.10.0")
[2] 25218e8935 ("jtag: remove minidriver code and minidriver-dummy")
Reviewed-on: https://review.openocd.org/c/openocd/+/8522
Tested-by: jenkins
2024-11-23 13:41:02 +00:00
Evgeniy Naydanov 1bf7efb2d5
Merge pull request #1144 from sunnyzhu-learning/resume-before-step-develop
target/riscv:Perform single step before resume if necessary
2024-11-21 12:37:59 +03:00
Farid Khaydari 8b7013028c target/riscv: decrease modify_privilege function nesting level
Restructured modify_privilege function to decrease nesting level

Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2024-11-21 00:04:15 +03:00
Parshintsev Anatoly ba8c1eef5a target/riscv: allow hexadecimal values to expose_csr-like commands
hexadecimal values are often used in the documentation. Forcing user to
convert CSRs addresses to decimal is unnecessary.
2024-11-19 22:28:57 +03:00
Evgeniy Naydanov f51900b4a2
Merge pull request #1165 from aap-sc/aap-sc/resume_debug_errors
target/riscv: detailed error messages for cases when resume operation fails
2024-11-18 13:17:25 +03:00
Evgeniy Naydanov 463d1b0866
Merge pull request #1157 from zqb-all/support-disable-auto-fence
target/riscv: support disable auto fence
2024-11-18 13:16:54 +03:00
Evgeniy Naydanov c53f9319c8
Merge pull request #1163 from en-sc/en-sc/from_upstream
Merge up to fd62626dff from  upstream
2024-11-18 13:16:18 +03:00
Antonio Borneo 8a37230226 checkpatch: exclude gerrit's Change-Id line from commit description
Checkpatch rejects patches that have empty commit description and
logs them with:
	WARNING:COMMIT_MESSAGE: Missing commit description - Add an appropriate one
But if the patch has a gerrit's Change-Id line placed before the
line Signed-off-by, then checkpatch considers the Change-Id line
as a valid commit description text.

Use the Change-Id tag as a marker of the end of the commit message,
thus not counting its line as part of the commit description.

This patch is not relevant for the Linux kernel development process
as gerrit is not involved and the Change-Id tag is rejected. But
other projects, like OpenOCD, base the development on gerrit and
reuse kernel's checkpatch with flag '--ignore GERRIT_CHANGE_ID'.

This patch has been refused [1] in Linux upstream because it has
not been considered relevant for that project.
Let's take it as another add-on in OpenOCD checkpatch.

Change-Id: I3b55b8fffa07ce67177c108e7c9554ca46674246
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Link: [1] https://lore.kernel.org/lkml/20230410100255.16755-1-borneo.antonio@gmail.com/
Reviewed-on: https://review.openocd.org/c/openocd/+/8539
Tested-by: jenkins
2024-11-16 14:25:35 +00:00
R. Diez 6d60ac5c08 Make bootstrap more robust
Change-Id: I67cc22752b34dd49c277e247f0b648047927a02b
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8532
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-16 14:20:48 +00:00
R. Diez 564b24e7f8 Makefile.am: generate ChangeLog with git log instead of git2cl
git log is faster than git2cl and the result has a better format.

Change-Id: I465ca62e3e30fed230fe9661e82a987980c05459
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8531
Tested-by: jenkins
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-16 14:20:06 +00:00
Jan Matyas d4a64e3f38 autoconf: Add support for code coverage
Add support for code coverage collection. This helps
developers to check if their test scenarios really exercised
all the OpenOCD functionality that they intended to test.

- Option --enable-gcov has been added to configure.ac
  which enables the coverage collection using Gcov. (Disabled
  by default.)

- The steps to collect and inspect the coverage have been
  described in HACKING file.

Change-Id: I259e401937a255e7ad7f155359a0b7787e4d0752
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8521
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-16 14:18:57 +00:00
Evgeniy Naydanov a2f5da3289
Merge pull request #1161 from en-sc/en-sc/deassert-reset
target/riscv: avoid updating `target` if `ackhavereset` fails
2024-11-14 13:23:42 +03:00
Parshintsev Anatoly faffae0493 target/riscv: detailed error messages for cases when resume operation fails
This change aims to provide more context in case if resume operation
fails. Before the change messages were quite confusing.
2024-11-14 12:23:47 +03:00
Evgeniy Naydanov f7ea8245e6
Merge pull request #1160 from zqb-all/reduce-log
[NFC] target/riscv: remove LOG_ERROR when COMMAND check ARGC fail
2024-11-12 17:45:57 +03:00
Evgeniy Naydanov cabb6000df Merge up to fd62626dff from upstream
Conflicts are related to `unsigned`->`unisgned int` cleanup:
* `src/jtag/drivers/ftdi.c` -- between
  6749c70a3a and
  a64dc23bf1.
* `src/rtos/hwthread.c` -- between
  ef3e61bebc and
  436e6f1770.
* `src/target/target.c` and `.h` -- between
  53ec10b61d and
  e72733d590.
* `src/target/riscv/*` -- due to
  957eb741a0 and
  fec3b22421.
  Resolved by:
    * Changing the return type of `riscv_batch_get_dmi_read_op()` to
      `uint32_t`.
    * Using RISC-V OpenOCD's version in other cases.

Change-Id: Ia6e2129c6fddb1dec26adcd936506af2539412ef
2024-11-12 17:25:33 +03:00
Evgeniy Naydanov fd62626dff target/breakpoints: fix types in `watchpoint_add_internal()`
There was a conflict:
1. commit 2cd8ebf44d ("breakpoints: use 64-bit type for watchpoint mask
   and value")
2. commit 0bf3373e80 ("target/breakpoints: Use 'unsigned int' for
   length")

The second commit was created erlier, but merged later so the types of
`mask` and `value` became `uint32_t` in `watchpoint_add_internal()`.

This created a bug:
`WATCHPOINT_IGNORE_DATA_VALUE_MASK` is defined as `(~(uint64_t)0)`.
Truncation to uint32_t makes it so the comparisons with the constant
don't work.

Change-Id: I19c414c351f52aff72a60330d83c29db7bbca375
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8500
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
Reviewed-by: Karl Palsson <karlp@tweak.au>
2024-11-11 17:33:56 +00:00
zhusonghe 215ecdaedf target/riscv:Perform single step before resume if necessary
Two cases where single step is needed before resume:
1. ebreak used in software breakpoint;
2. a trigger that is taken just before the instruction
   that triggered it is retired.

Signed-off-by: Songhe Zhu <zhusonghe@eswincomputing.com> Co-developed-by: Fei Gao <gaofei@eswincomputing.com> Co-developed-by: xiatianyi <xiatianyi@eswincomputing.com>
2024-11-11 15:31:49 +08:00
Marek Kraus b68d23da3c tcl/target/bl702: implement full software reset
In previous implementation, it was known that it does not perform
full reset, and that some peripherals, such as GLB core,
which handles among other stuff GPIOs, was not reset.

It was presumed, that full reset by software is not possible,
although, by accident, even when comment says that
CTRL_PWRON_RESET is set to 1, it is not
(value written into 0x40000018 supposed to be 0x7, not 0x6).

CTRL_PWRON_RESET indeed triggers full "power-on like" reset,
so this method is implemented in this commit.
There are some workarounds to make reset seamless, without any
error messages, which are described in comments of TCL script.

Only down-side of this reset is, that chip is halted after reset
bit later in BootROM than previous implementation,
but it's still good.

Change-Id: Ife2cdcc6a2d96a2e24039bfec149705baf046318
Signed-off-by: Marek Kraus <gamelaster@outlook.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8529
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-09 21:06:05 +00:00
Mark Zhuang bcebc84882 contrib: convert 'unsigned' to 'unsigned int'
Conversion done with
        checkpatch --fix-inplace -types UNSPECIFIED_INT

Change-Id: I0e31f87d437fcf3503736474f10a63f9c6be242b
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8368
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-09 21:05:18 +00:00
Evgeniy Naydanov 784687d781 target/riscv: avoid updating `target` if `ackhavereset` fails
`target`'s `state` and `debug_reason` should not be updated in
`deassert_reset` if sending reset acknowledgment fails.

Change-Id: I86136fe829e7a7c6b69f718f0cf32322e40341b0
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-11-08 16:36:25 +03:00
Mark Zhuang e024f112e3 [NFC] target/riscv: remove LOG_ERROR when COMMAND check ARGC fail
Per current OpenOCD conventions, LOG_ERROR should not be printed
when ERROR_COMMAND_SYNTAX_ERROR is returned. OpenOCD will print
the command syntax to the user on its own.
2024-11-06 19:32:20 +08:00
Mark Zhuang 340e38a9ed target/riscv: support disable auto fence
Support disable automatic fence, it's useful for
debug some cache related issue.
2024-11-06 17:15:57 +08:00
MicBiso 40d58ce529 tcl/target/renesas_rz_g2: Rename to renesas_rz and add RZ/V2L-G3S
Rename file to get it more generic and add more targets belonging
to the same family.
Add support for two new devices: RZ/V2L and RZ/G3S

Change-Id: Idb7f4d81d2f95ad15ef686e940f43ed29f49f343
Signed-off-by: MicBiso <michele.bisogno.ct@renesas.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8211
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-02 21:06:37 +00:00
Marc Schink 3b261fb155 adapter/parport: Coding style changes
Apply some coding style changes according to the C style guide. The
patch is tested for regression with the 'wiggler' parallel port cable.

Change-Id: I43774f596831d8c46f90f18893418178041a930b
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8516
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-02 21:06:05 +00:00
Marc Schink 337db329c9 adapter/bitbang: Use 'bool' data type for blink()
Change-Id: I187f8944ad5fd92f28cbd32e447f9ec1a97e16d6
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8515
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-02 21:05:37 +00:00
Marc Schink f4d81cd4d4 tcl/interface: Restructure parport config files
Provide cable specific configuration files like for the FTDI interface.
Depcrecate the old configuration files but keep them until the next
release for compatibility reasons.

Change-Id: I436bd60779a107120c9e1b1f0b8a69a39a240ad4
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8514
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-11-02 21:04:44 +00:00
Mark Zhuang 99f60d5e59 jtag: convert 'unsigned' to 'unsigned int'
Conversion done with
        checkpatch --fix-inplace -types UNSPECIFIED_INT

Change-Id: I2c2d56aa98e89bcc6088a1bd51d70066d67d6dad
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8367
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-02 21:03:37 +00:00
Mark Zhuang b95633b30c flash: convert 'unsigned' to 'unsigned int'
Change-Id: I8e8da78385eed714524891b580e19a79cfb459d3
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8370
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-02 21:03:19 +00:00
Mark Zhuang 114ad468ca server: convert 'unsigned' to 'unsigned int'
Conversion done with
        checkpatch --fix-inplace -types UNSPECIFIED_INT

Ignore the cast as they could be better addressed.

Change-Id: Ib0cbd9388d61659f8d47c8f57c09baa6df123487
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8369
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-02 21:03:04 +00:00
Mark Zhuang 134e56338d target: riscv: convert 'unsigned' to 'unsigned int'
Change-Id: I10b9abf9e42389eb91b210b8c2f01219ca9068cd
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8366
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-02 21:02:42 +00:00
Antonio Borneo 34ec5536c0 stlink: deprecate HLA support
The STLink API that supports dap-direct is available from STLink
firmware v2j24, published in early 2015.
We can reasonably expect that any old STLink still in use today
has got at least one firmware update during the last 10 years.

Most of the board files in upstream OpenOCD still use the STLink
in HLA mode. This limits the test coverage of the dap-direct code,
which was introduced in OpenOCD v0.11.0.

- Rename interface/stlink.cfg as interface/stlink-hla.cfg to still
  provide support for HLA, adding a deprecated message.

- Rename interface/stlink-dap.cfg as interface/stlink.cfg to make
  dap-direct the default trasport.

- Add a redirect file interface/stlink-dap.cfg for users that have
  out-of-tree custom board files.

- Update all the board files to the new setup.

- Remove STLink HLA mentions from the documentation, while adding
  a reference to interface/stlink-hla.cfg

Checkpatch-ignore: LONG_LINE
Change-Id: I99366bb03cd3b83f8f408514e657f30e59813063
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8523
Tested-by: jenkins
Reviewed-by: Andrzej Sierżęga <asier70@gmail.com>
2024-11-02 21:01:07 +00:00
Antonio Borneo 3ce0962f2c target: cortex_m: fix polling for target kept under reset
In multi-target SoC not all the targets are running simultaneously
and some target could be powered off or kept under reset.
Commit 4892e32294 ("target/cortex_m: allow poll quickly get out
of TARGET_RESET state") does not considers the case of a target
that is kept in reset and expects the target to change state from
TARGET_RESET immediately.
This causes OpenOCD to log continuously:
	Info : [stm32mp15x.cm4] external reset detected
	Info : [stm32mp15x.cm4] external reset detected
	Info : [stm32mp15x.cm4] external reset detected

Read again dhcsr to detect the 'stable' reset status and quit,
waiting for next poll to re-check the target's status.

Change-Id: Ic66029b988404a1599bb99bc66d4a8845b8b02c6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 4892e32294 ("target/cortex_m: allow poll quickly get out of TARGET_RESET state")
Reviewed-on: https://review.openocd.org/c/openocd/+/8399
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-11-02 20:59:48 +00:00
R. Diez 7214c8be46 configure: show adapter Xilinx XVC/PCIe in the configuration summary
Adapter Xilinx XVC/PCIe was not appearing in the configuration summary
because of the wrong variable name: build_xlnx_pcie_xvc
instead of enable_xlnx_pcie_xvc.

Also build this adapter automatically on Linux.

Change-Id: I69ea92f550052b9ce55ce32597ac446a15a87388
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8312
Tested-by: jenkins
Reviewed-by: R. Diez <rdiez-2006@rd10.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-11-02 20:59:15 +00:00
Evgeniy Naydanov f9a1292716
Merge pull request #1154 from en-sc/en-sc/dcsr-ebreak-halt-on-reset
target/riscv: avoid unnecessary `dcsr.ebreak*` update on reset
2024-10-30 17:52:56 +03:00
Evgeniy Naydanov e3a47cae3e
Merge pull request #1156 from zqb-all/max-macro
[NFC] target/riscv: simplify code with MAX macros
2024-10-30 17:51:35 +03:00
Mark Zhuang b7708c84e6 [NFC] target/riscv: simplify code with MAX macros
slightly improves readability
2024-10-28 22:57:07 +08:00
Evgeniy Naydanov 9ff272e34b
Merge pull request #1149 from zqb-all/read-write-cross-page
riscv: fix read/write virtual memory across page boundaries
2024-10-28 14:40:13 +03:00
Evgeniy Naydanov 3fe20e7aa4 target/riscv: avoid unnecessary `dcsr.ebreak*` update on reset
There is no need to change if `dcsr.ebreak*` fields after a reset if a
user requested a configuration that will result `dcsr.ebreak*` field
values equal to reset values.

Change-Id: I2844d30aef8f735c7b37394ee422e9b3f04a2e3b
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-10-25 17:27:19 +03:00
Mark Zhuang 92d7a5798d [NFC] target/riscv: refactor riscv_read_memory,riscv_write_memory
Reduce duplicate code
2024-10-24 23:47:58 +08:00
Mark Zhuang 4a1bd80842 target/riscv: fix cross-page misaligned access when mmu not enabled
When mmu is disabled, simply call the physical read/write function
2024-10-24 23:47:48 +08:00
Mark Zhuang 593b377073 target/riscv: fix read/write virtual memory across page boundaries
When read/write virtual addresses cross page boundaries,
the physical addresses are not necessarily contiguous and
need to call virt2phys again.
2024-10-24 23:39:10 +08:00
Evgeniy Naydanov 7b4ad6f173
Merge pull request #1152 from fk-sc/translation-drivers
target/riscv: added translation drivers
2024-10-24 15:06:27 +03:00
Farid Khaydari 6a27d9fbc0 target/riscv: added translation drivers
Existing flags: 'enable_virtual' and 'enable_virt2phys' were
replaced with explicit translation drivers. Motivation:

(1) Having 'enable_virtual' and 'enable_virt2phys' flags set simultaneously
may cause double address translation which is unacceptable

(2) Flags were global for all targets which is wrong too

Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2024-10-23 12:36:29 +03:00
Jan Matyas d09ff47644 gdb_server: Improve const correctness
On several packet-handling functions, add "const" to arguments
that represent read-only packet buffers.

For instance on GCC 13.2.0, this code:

const char *some_packet = "...";
gdb_put_packet(conn, some_packet, strlen(some_packet));

would prior to the fix produce warning:

passing argument 2 of ‘gdb_put_packet’ discards ‘const’
qualifier from pointer target type [-Wdiscarded-qualifiers]

Change-Id: Idb62f57d37ed323c39de38982e57afdd3882e280
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8517
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-10-20 09:25:25 +00:00
Jan Matyas 114ca19f64 gitignore: Start ignoring ".vscode"
To help the developers who use Visual Studio Code IDE,
ignore the ".vscode" folder in Git. This folder contains
local configuration of the VSCode workspace.

Change-Id: I1d54d8ce2bd0680f2fa1fb773bb33c786bdcc608
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8518
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-10-20 09:24:43 +00:00
Florian Fainelli 21a211d547 arm_adi_v5: Added Cortex-A55 debug unit identifier
Add identifier of the Cortex-A55 debug unit.

Change-Id: I67336094a5153a3187cccc32c0e38d78ae4af542
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8430
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-10-20 09:24:15 +00:00
Antonio Borneo fec3b22421 target: riscv: remove non-trivial 'unsigned' cast
Change the prototype of riscv_batch_get_dmi_read_op().
Now that 'target->smp' is unsigned, drop the cast.

Change-Id: I2a54268ed1e4bf0ea884b62cceb73f5c7451da78
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8484
Tested-by: jenkins
2024-10-20 09:23:09 +00:00
Antonio Borneo 957eb741a0 target: riscv: convert 'unsigned' to 'unsigned int'
Conversion done with
	checkpatch --fix-inplace -types UNSPECIFIED_INT

Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).

Change-Id: I11f10eddadc21e051c96eb3d4d4c0554a2cddd15
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8483
Tested-by: jenkins
2024-10-20 09:22:52 +00:00
Antonio Borneo bcf63ac562 checkpatch: check SPDX in Makefile
The firmware in contrib folder use Makefile for the build.
Force checkpatch to check these Makefile for the SPDX.

Change-Id: I815bf6df636c96a15f82c3d8a9de0c4f219303d2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8520
Tested-by: jenkins
2024-10-20 09:21:11 +00:00
Evgeniy Naydanov bc68bd71a3
Merge pull request #1146 from en-sc/en-sc/select-dmi-bypass
target/riscv: check other TAPs in `select_dmi()`
2024-10-18 12:37:31 +03:00
Evgeniy Naydanov 417ff401f8
Merge pull request #1150 from borneoa/riscv
target: riscv: convert 'unsigned' to 'unsigned int'
2024-10-17 11:10:42 +03:00
Evgeniy Naydanov f3ed0ab608 target/riscv: check other TAPs in `select_dmi()`
If some other TAP is not in BYPASS, an IR scan is needed to select
BYPASS on that TAP.

Change-Id: Iae425a415109b1a853db3718762661877eea56e8
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-10-16 13:42:48 +03:00
Antonio Borneo 89fb9211ec target: riscv: convert 'unsigned' to 'unsigned int'
Conversion done with
	checkpatch --fix-inplace -types UNSPECIFIED_INT

Change-Id: I62fad88dd33716c24154d44c5a23ae2c0f7c4a4c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-10-12 17:01:36 +02:00
Evgeniy Naydanov a4020f1a02
Merge pull request #1142 from en-sc/en-sc/from_upstream
Merge up to 1173473f66 from upstream
2024-10-08 14:17:57 +03:00
Jan Matyas edf2c82cf6 helper/align.h: Fix macro IS_PWR_OF_2
Zero is not a power of two.

All functions that use IS_PWR_OF_2 were checked and the edge case
of IS_PWR_OF_2(0) does not occur anywhere at the moment. Therefore
the fix is safe.

Change-Id: I84d9f9c64c9a7df452ca6e99c2ee4169ccb2b0be
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Fixes: 9544cd653d ("helper: add align.h")
Reviewed-on: https://review.openocd.org/c/openocd/+/8511
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-10-05 15:53:43 +00:00
Antonio Borneo 30c3d077f2 jimtcl: update to version 0.83
New version tagged on 2024-08-28.

Change-Id: Id0cf82a692469ccf794c9680c5d5ac09ea26e6da
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8513
Tested-by: jenkins
2024-10-05 15:53:02 +00:00
Antonio Borneo 73390332d2 openocd: fix build with jimtcl 0.83
In jimtcl 0.82, the include file jim.h included in turn stdio.h
This made redundant to include the former in openocd source files.
Since jimtcl 0.83, jim.h drops the include of stdio.h, causing
openocd build to fail.

Include stdio.h in the files that need it.

Change-Id: Ic81c9b273d7520f4d2d8c32bc3e0a6bcfffb67ed
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8512
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Tested-by: jenkins
2024-10-05 15:52:26 +00:00
Antonio Borneo 116e9553d1 openocd: build: allow more socket connections on Windows
Cross compiling OpenOCD for Windows forces the maximum number of
open files (including sockets) to 64. See in include file
psdk_inc/_fd_types.h:
	#ifndef FD_SETSIZE
	#define FD_SETSIZE 64
	#endif

This limit is far lower than the default value 1024 used by Linux.

In pull request #644 [1] in risc-v fork it's reported that:
- each socket server of OpenOCD (GDB, telnet, ...) uses one FD;
- each active connection to a socket server uses another FD;
- multi-core devices with 32 or more cores, each having a GDB
  connection, already saturates the 64 available FD at the 26th
  GDB connection.

The patch [2] proposed and merged in risc-v fork adds the compile
flag
	-DFD_SETSIZE=128
to all the host types. While this looks fine for Windows, it
reduces the default value for Linux and other OS.

Add the compile flag FD_SETSIZE only to cross compile for Windows.

Link: [1] https://github.com/riscv-collab/riscv-openocd/pull/644
Link: [2] https://github.com/riscv-collab/riscv-openocd/pull/644/commits/1bab4cfbc4f4
Change-Id: Ie43a792ac11a5e63e0407b68e3f270efea0c87be
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8503
Tested-by: jenkins
2024-10-05 15:51:58 +00:00
Antonio Borneo 595bb965b7 jtag: bcm2835gpio: fix macro definition
The macros trigger few errors with checkpatch:

	ERROR:MACRO_ARG_REUSE: Macro argument reuse 'g' - possible
	side-effects?

	ERROR:TRAILING_STATEMENTS: trailing statements should be
	on next line

	ERROR:SPACING: spaces preferred around (several cases)

	ERROR:SINGLE_STATEMENT_DO_WHILE_MACRO: Single statement
	macros should not use a do {} while (0) loop

plus an empty line triggers

	ERROR:BRACES: Blank lines aren't necessary before a close
	brace '}'

Fix them!

Change-Id: I0690b68b511ed7f45a7e0909a0addd2822ba9fe8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8499
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-10-05 15:50:23 +00:00
Antonio Borneo 8c23e6c175 target: arm: drop casts commented-out
The function dpm->finish() returns a value that is almost always
ignored.
Drop the commented-out cast
	/* (void) */

Change-Id: I7ff210a2693dd1877b7c7591705cdcd96a2c6125
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8498
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-10-05 15:49:49 +00:00
Antonio Borneo 3ccf68cd0a OpenOCD: drop comparison with true/false
Fix checkpatch errors:

	ERROR:BOOL_COMPARISON: Using comparison to true/false is
	error prone

While there,
- drop useless parenthesis,
- drop unnecessary else after a return.

Change-Id: I1234737b3e65bd10df5e938d1c36f9abaf02d348
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8496
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-10-05 15:49:04 +00:00
Antonio Borneo 66006d83b9 target: drop comparison to NULL
Fix checkpatch error:

	ERROR:COMPARISON_TO_NULL: Comparison to NULL could be
	written "cmd_ctx"

Change-Id: I3615fc427f8b160d44b6edbf7a066a086cab99bb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8495
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-10-05 15:48:48 +00:00
Antonio Borneo 39197cdb4e jtag: stlink_usb: drop comparison to NULL
Fix checkpatch error:

	ERROR:COMPARISON_TO_NULL: Comparison to NULL could be
	written "handle"

Change-Id: I0ac12ccfc5fce4dd41266f83eb4b973a4e6a314d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8494
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-10-05 15:48:35 +00:00
Antonio Borneo 4214fca447 OpenOCD: fix code alignment
Fix checkpatch errors:

	ERROR:TABSTOP: Statements should start on a tabstop

Change-Id: Ia771e7b7fa2cc4ef0be7f52b670525175555c8e4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8493
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-10-05 15:48:23 +00:00
Antonio Borneo 537793bb24 target: mem_ap: drop return from void function
Checkpatch triggers the error

	ERROR:RETURN_VOID: void function return statements are not
	generally useful

Fix it!

Change-Id: I72d9fb8242d6a91c0aa481d5d023f0359c76a5ec
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8492
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-10-05 15:48:11 +00:00
Antonio Borneo 39f024900e flash: stm32l4x: fix open brace style
Checkpatch triggers the error

	ERROR:OPEN_BRACE: open brace '{' following function
	definitions go on the next line

Fix it!

Change-Id: I0ce4585a6507eca094b82cdabdecf6fdbe7923b1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8491
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-10-05 15:47:52 +00:00
Antonio Borneo 436e6f1770 openocd: convert 'unsigned' to 'unsigned int'
Conversion done with
	checkpatch --fix-inplace -types UNSPECIFIED_INT

Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).

Change-Id: I4f936ffc4cedb153afa331cd293b08f4c913dc93
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8482
Tested-by: jenkins
2024-10-05 15:46:25 +00:00
Antonio Borneo a64dc23bf1 jtag: convert 'unsigned' to 'unsigned int'
Conversion done with
	checkpatch --fix-inplace -types UNSPECIFIED_INT

Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).

Change-Id: I2c1ef03bbc828112cc5bea89463cff9fc0c1e94f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8481
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-10-05 15:45:57 +00:00
Antonio Borneo e72733d590 target: convert 'unsigned' to 'unsigned int'
Conversion done with
	checkpatch --fix-inplace -types UNSPECIFIED_INT

Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).

Use Checkpatch-ignore below for the function pointers in the file
'armv7a_cache_l2x.h' that do not assign the identifier names to
the function arguments.
Most of these struct are unused and should be fixed or dropped.

Checkpatch-ignore: FUNCTION_ARGUMENTS

Change-Id: I8f27e68eb3502e431c1ba801b362358105f9f2dc
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8480
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-10-05 15:45:34 +00:00
Antonio Borneo 2ad48b78d4 flash: convert 'unsigned' to 'unsigned int'
Conversion done with
	checkpatch --fix-inplace -types UNSPECIFIED_INT

Ignore the cast as they could be better addressed.
Fix only minor additional checkpatch issue (spacing and line
length).

Change-Id: Id808747855a02052f3738e2d232bff4dd99b27f1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8479
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-10-05 15:45:19 +00:00
Antonio Borneo 50586c9a06 target: use 'unsigned int' for smp group
Change the type to 'struct target::smp' and to the initialization
variable 'smp_group'.

Change-Id: I5f5a30a796aaf4e0014a38e81abdf4fb4afbdf48
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8478
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-10-05 15:45:00 +00:00
Antonio Borneo bf1cf4afbb openocd: fix conversion string for stdint values
Detected while converting 'unsigned' to 'unsigned int'.

Use the correct conversion string for stdint values.

Change-Id: I99f3dff4c64dfd7acf2bddb130b56e9ebe1e6c60
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8477
Tested-by: jenkins
2024-10-05 15:44:46 +00:00
Antonio Borneo 8750beeb44 tcl: update to new syntax of telnet command
Commit ad21613618 ("server/telnet: Restructure commands")
modifies the syntax.

	sed -i 's/telnet_port/telnet port/'

Change-Id: If1ad34a1ec54824dbc124acd36a894862276a34f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8502
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-10-05 15:43:26 +00:00
Walter Ji 00ee9b09d9 target/mips32: add dsp access support for gdb
Change order of dsp register name array and removed hi0 and lo0
to comply with gdb definition of dsp in mips-dsp.xml, the regs
name array is now mapping corresponding dsp accumulator names
onto `mips32_regs` and `core_regs` instead of mapping to instr
arrays in dsp functions.
feature now requires a place to store cached dsp registers.
Add dsp registers to reg_list for gdb to access them.
Add dsp module enable detection to avoid DSP Disabled exception
while reading dsp accumulators.
Add dsp register reading procedure in `mips32_pracc_read_regs`
and writing procedure in `mips32_pracc_write_regs`.

Change-Id: Iacc335da030ab85989922c81aac7925b3dc17459
Signed-off-by: Walter Ji <walter.ji@oss.cipunited.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8476
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-10-05 15:43:03 +00:00
Antonio Borneo ab31562131 jep106: update to revision JEP106BK Sep 2024
Change-Id: Ica84e22b8d2da152cec39fc569c8333677c19490
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8501
Tested-by: jenkins
2024-10-05 15:42:32 +00:00
Parshintsev Anatoly bd93b83f1b jtag: update constant names to follow code style guidelines
Change-Id: Ib081433c67f3be0e5be0b39469680bcce079e0cc
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8485
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-10-05 15:42:07 +00:00
Antonio Borneo 017e61feb4 HACKING: add info on ignoring check-patch checks
Due to checkpatch internal state machine, the field 'Checkpatch-ignore:'
must be in the commit message before the 'Signed-off-by:' line.
Report it in the documentation and add that multiple 'Checkpatch-ignore:'
lines are allowed.

Change-Id: I770cdc4cb5b33bcf63c860c154ab3cbd4785ad20
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7572
Tested-by: jenkins
2024-10-05 15:41:30 +00:00
Antonio Borneo 8edfdb02ed rtos: chibios: fix version display
The field 'struct chibios_chdebug::ch_version' is 16 bits wide, so
using le_to_h_u32() and be_to_h_u32() overflows in the following
fields of the struct.

Restrict the endianness conversion to 16 bits and use the target
endianness dependent target_buffer_get_u16().
Convert the 'struct chibios_chdebug::ch_version' to an array of
uint8_t.

Change-Id: Iaa80e9cb1a65c27512919398b8ffbf14e5c240cd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8473
Tested-by: jenkins
2024-10-05 15:38:23 +00:00
Evgeniy Naydanov 0a2c146440
Merge pull request #1140 from TommyMurphyTM1234/riscv
Fix `riscv013_invalidate_cached_progbuf()`
2024-10-04 16:39:32 +03:00
Evgeniy Naydanov e4f5489723
Merge pull request #1127 from sunnyzhu-learning/Songhe-develop
target/riscv: Mismatch napot when mcontrol.maskmax is not expected
2024-10-04 11:12:02 +03:00
Evgeniy Naydanov ec00140a10 Merge up to 1173473f66 from upstream
1ae6b07b45 replaced `buf_cmp()` with
`buf_eq()`, so a96a0a4e39 needs to be
adjusted.

Change-Id: I97f6a3518db9421dab2ae4dd2312f443e928b114
2024-10-03 21:48:18 +03:00
Tommy Murphy 16fa57da41 Fix riscv013_invalidate_cached_progbuf() off by one error
See https://github.com/riscv-collab/riscv-openocd/issues/1139
riscv013_invalidate_cached_progbuf() was failing to zeroize the final
buffer array element. Use memset() instead of a manual loop to zeroize
it in order to address this and simplify the code.
2024-10-03 09:37:28 +01:00
Matt Trescott 1173473f66 flash/nor/atsame5: add PIC32CX-SG device IDs
These devices are essentially the same as the E54 series with the
exception of immutable boot (SG41, SG61) and HSM (SG60, SG61), and some
bug fixes found only in E54 revision F. When the security features are
not enabled, they behave identically except for the different DIDs.

Signed-off-by: Matt Trescott <mtc@melexis.com>
Change-Id: Ic93313f3e20af0ed4a5768880d17b335a7b7bb04
Reviewed-on: https://review.openocd.org/c/openocd/+/8355
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-10-01 04:00:05 +00:00
Evgeniy Naydanov 841b61adf3
Merge pull request #1134 from fk-sc/early-exit-support
target/riscv: early exit support for memory access operations
2024-09-30 10:49:35 +03:00
Evgeniy Naydanov 27220e4c85
Merge pull request #1136 from en-sc/en-sc/batch-logging
target/riscv: DMI logging improvements
2024-09-27 17:50:55 +03:00
Farid Khaydari 173086a651 target/riscv: early exit support for memory access operations
(1) Error code and 'skip_reason' string were replaced with memory access
    status. It allows to specify whether OpenOCD should exit the access
    early.
(2) Slightly refactored 'read_memory' and 'write_memory' functions.

Checkpatch-ignore: MACRO_ARG_PRECEDENCE, MULTISTATEMENT_MACRO_USE_DO_WHILE
Checkpatch-ignore: TRAILING_SEMICOLON
Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2024-09-27 12:27:11 +03:00
Evgeniy Naydanov f3302653a7
Merge pull request #1135 from borneoa/riscv
Move FD_SETSIZE to configure.ac
2024-09-26 12:30:19 +03:00
Evgeniy Naydanov 250aa20135 target/riscv: DMI logging improvements
Fixes #1043

There were multiple issuese with DMI logging:
1. Address was assumed to be the same (#1043).
2. Reported IDLE count was not affected by a reset of the delays.
3. VLA were used.

These issues are addressed in the commit.

Change-Id: I82f45505e8a62dfdd7dcb418784975fe10180109
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-09-26 12:25:28 +03:00
zhusonghe 85c836bfb0 target/riscv: Mismatch napot when mcontrol.maskmax is not expected
1.Remove trigger_request_info::tdata1_ignore_mask
2.Adding ignore napot matching condition

Signed-off-by: Songhe Zhu <zhusonghe@eswincomputing.com>
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2024-09-25 17:34:07 +08:00
Evgeniy Naydanov 7f8c43a77d target/riscv: move `riscv_log_dmi_scan`
Change-Id: Iade30374331e9bde31a411b82056d47207cc39a8
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-09-23 18:28:51 +03:00
Antonio Borneo 54037d7b98 Move FD_SETSIZE to configure.ac
The commit from the pull request #644 sets the macro FD_SETSIZE to
128 for every host OS, while it is needed on Windows only.
Note that this macro has a much higher value on other OS and after
this commit it get reduced to 128 only.

Since in configure.ac is already present a hook to change the
compile defines for Windows, move there also FD_SETSIZE.

Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-09-23 12:01:59 +02:00
Marc Schink ad21613618 server/telnet: Restructure commands
Use a command group 'telnet' with subcommands instead of individual
commands with 'telnet_' prefix. Even though there is only one subcommand
at the moment, make this change to ensure consistency with other commands.

The old command is still available to ensure backwards compatibility,
but are marked as deprecated.

Change-Id: I5e88632fa0d0ce5a8129e9fcf5ae743fc5b093cb
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8378
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-09-21 09:05:36 +00:00
Evgeniy Naydanov e6ade35305 server/gdb_server: improve error handling for `Z/z` packet
* Report errors for `z` packet.
* Report not supported types as required by GDB Remote Protocol's
  documentation:
  > Implementation notes: A remote target shall return an empty string
    for an unrecognized breakpoint or watchpoint packet type.

  Link: https://sourceware.org/gdb/current/onlinedocs/gdb.html/Packets.html#insert-breakpoint-or-watchpoint-packet

Change-Id: I9130400aca5dbc54fefb413ed74f27d75fe50640
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8488
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-09-21 09:05:02 +00:00
Jessica Clarke 1ae6b07b45 binarybuffer: Invert buf_cmp* return value and rename to buf_eq*
The current semantics are a bit confusing, as the return value looks
like memcmp (0/false being equal) but the bool return type means one
likely expects true to mean equal. Make this clearer by switching them
out for buf_eq* functions that do that instead.

Checkpatch-ignore: UNSPECIFIED_INT
Change-Id: Iee0c5af794316aab5327cb9c168051fabd3bc1cb
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8490
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-09-21 09:04:06 +00:00
daniellizewski 5159c59915 src/rtos/rtos_nuttx_stackings.c: Fix stack alignment for cortex-m targets
Backtraces performed by GDB on any thread other than the current
thread would fail if hardware 8 byte ISR stack alignment
was enabled on cortex_m targets. Stack reads now adjust
the stored SP to account for a potential offset introduced by hardware.
Fixed incorrect register offsets for cortex_m Nuttx frames by reading
the TCB info symbols to determine correct offsets.
Fixed offsets can no longer be used since the offsets have changed
multiple times for different Nuttx versions.
Tested on nuttx-12.1.0.
Tested using custom stm32h7 board and custom s32k148 board variants.
Built with CONFIG_ARCH_FPU enabled and disabled to
test FPU and non FPU frame logic.

Change-Id: Ifcbeefb0ddcfbcb528daa9d1d95732ca9584c9ef
Signed-off-by: daniellizewski <daniellizewski@geotab.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8180
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-09-21 09:02:59 +00:00
Peter Collingbourne b14f63e004 aarch64: Invalidate caches on reset
When a target is reset we must invalidate register caches in order
to avoid showing stale register values or writing them back to
registers. Use EDPRSR.SR to detect a previous reset, and EDPRSR.R to
detect a current reset state.

Change-Id: Ia1e97d7154cf7789d392274eee475733086a835b
Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8425
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-09-21 09:01:16 +00:00
Evgeniy Naydanov 3bed4c8015
Merge pull request #1132 from en-sc/en-sc/from_upstream
Merge up to fd7b66c5eb from upstream
2024-09-19 17:46:25 +03:00
Evgeniy Naydanov 90162b3250
Merge pull request #1130 from en-sc/en-sc/fix-reg-hide-warning
Revert "target/riscv: re-apply patch do stop avoid warnings when a no… …n-existent CSR is hidden"
2024-09-17 12:21:38 +03:00
Evgeniy Naydanov 4c45762d76 target/breakpoints: fix types in `watchpoint_add_internal()`
There was a conflict:
1. commit 2cd8ebf44d ("breakpoints: use 64-bit type for watchpoint mask
   and value")
2. commit 0bf3373e80 ("target/breakpoints: Use 'unsigned int' for
   length")

The second commit was created erlier, but merged later so the types of
`mask` and `value` became `uint32_t` in `watchpoint_add_internal()`.

This created a bug:
`WATCHPOINT_IGNORE_DATA_VALUE_MASK` is defined as `(~(uint64_t)0)`.
Truncation to uint32_t makes it so the comparisons with the constant
don't work.

Change-Id: I19c414c351f52aff72a60330d83c29db7bbca375
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-09-16 18:41:08 +03:00
Evgeniy Naydanov 269c57e376 Merge up to fd7b66c5eb from upstream
Backports the fix for #1131.

Commit 0bf3373 ("target/breakpoints: Use 'unsigned int' for length")
introduces a bug.
Link: https://review.openocd.org/c/openocd/+/7056/comment/3c4d9185_83614e2a/

Change-Id: I9f5f67050698a83c27f84965f6de031e2cad492d
2024-09-16 18:38:05 +03:00
Jessica Clarke fd7b66c5eb binarybuffer: Fix inverted return value in buf_cmp
This is the fast path for when there is a mismatch in the leading whole
bytes, which means we should return true to indicate not equal like all
the other cases here and in the surrounding functions. Otherwise we'll
incorrectly report _buf1 == _buf2 if and only if there are mismatches in
the leading whole bytes.

This was introduced during the refactor and optimisation referenced
below.

The only in-tree caller of this is jtag_check_value_inner, which will
just fail to catch some errors. However, downstream in riscv-openocd it
gets used in the riscv target to determine whether an IR scan is needed
to select the debug module, and with an IRLEN >= 8 this breaks resetting
if the encoding for the DMI isn't all-ones in its leading whole bytes
(to match BYPASS), since it will believe they are the same and not do an
IR scan, failing (with "At least one TAP shouldn't be in BYPASS mode")
in the subsequent DR scan due to the TAP still being recorded as having
bypass set (and really having an instruction of either BYPASS or
IDCODE).

Fixes: e4ee891759 ("improve buf_cmp and buf_cmp_mask helpers")
Change-Id: Ic4f7ed094429abc4c06a775eb847a8b3ddf2e2d6
Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8489
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-09-15 09:22:44 +00:00
Marc Schink 63ca967032 README: Use proper Markdown syntax
The README file contains a mixture of Markdown and non-Markdown syntax.
Refurbish the document and use only Markdown syntax according to the
specification in [1].

[1] https://www.markdownguide.org/

Change-Id: If58f4e2971dc798a03a78841226804ab1f2d33c8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8387
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-09-15 09:20:31 +00:00
Ian Thompson a9ba96f94a doc/xtensa: update supported architecture list
- Xtensa LX8 is fully supported in addition to prior LX and NX cores.

Change-Id: I2f3f0a21ce1518b3ced6d241f0ab84c65af64423
Signed-off-by: Ian Thompson <ianst@cadence.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8362
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-09-15 09:19:23 +00:00
liangzhen 84d196673e tcl/target: Add SpacemiT Key Stone K1 config
Add basic connection details with Key Stone K1

Change-Id: I3e51d4194cfd3b7fe8ae395e0aca0fa4799dfb73
Signed-off-by: liangzhen <zhen.liang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8361
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-09-15 09:18:35 +00:00
Antonio Borneo 0261cd9958 checkpatch: check for SPDX in linker scripts
Current script does not enforces the check for the SPDX tag in the
linker scripts.
Add the extension '.ld' in the OpenOCD specific part.

Change-Id: I1cb6bc52e9dd86d99a26393085c7e2c9e8bac11f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8475
Tested-by: jenkins
2024-09-15 09:17:34 +00:00
Jiafei Pan 96924dda01 target: add imx8mp and evk board support
Have verified with JLink:
openocd -f interface/jlink.cfg -f board/nxp_imx8mp-evk.cfg
-c "gdb_breakpoint_override hard"

Change-Id: I74f8766b8c5334ca5758c2672c283ff2405de4c3
Signed-off-by: Jiafei Pan <Jiafei.Pan@nxp.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8352
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-09-15 09:15:48 +00:00
Tomas Vanek ea28f96aa9 flash/nor/sfdp, stmqspi: use native type for buffer size
Two different sizes uint8_t and uint32_t was used for this value
without a good reason.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I4bb60cc5397ffd0d37e7034e3930e62793140c8d
Reviewed-on: https://review.openocd.org/c/openocd/+/8439
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
Tested-by: jenkins
2024-09-15 09:15:06 +00:00
Tomas Vanek 1dc3d7e8fe flash/nor/sfdp: expose SFDP_MAGIC in sfdp.h
Could be handy for dummy transfer size detection.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ibb485218f6c2ff9066910bb58be0fc614b77add3
Reviewed-on: https://review.openocd.org/c/openocd/+/8438
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
2024-09-15 09:13:48 +00:00
Richard Allen 930ec2f439 target/espressif: add profiling function for ESP32-S3
Use the TRAX interface DEBUGPC if available.
Otherwise use default stop-and-go profiling.

ESP32-S3, before this patch:
	Internal: 8 samples/second
	FT2232H: 12 samples/second

After this patch:
	Internal: 18ksamples/second
	FT2232H: 100ksamples/second

Change-Id: I681f0bccf4263c1e24f38be511e3b3aec8bf4d60
Signed-off-by: Richard Allen <rsaxvc@rsaxvc.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/8431
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Yurii Shutkin <yurii.shutkin@gmail.com>
2024-09-15 09:13:05 +00:00
Antonio Borneo e5276bb945 rtos: use target_buffer_get_u32()
Simplify the code using the target endianness independent API.

Change-Id: I39f720d0db9cf24eb41d7f359e4321bbc2045658
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8474
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-09-15 09:11:57 +00:00
Parshintsev Anatoly e5a2001a33 binarybuffer: add asserts for the number of requested bits for get/set functions
Change-Id: Ieca5b4e690c9713ad60dc9d8c223c2d64822e2f5
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8427
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-09-15 09:10:13 +00:00
Alexandre Bailon 760dd1f3a8 tcl/boards: Add support of LP-CC1352P7 board
This adds support of TI LP-CC1352P7 evaluation kit.

For further details, see https://www.ti.com/tool/LP-CC1352P7.

Change-Id: I4aba160dbf4920febb7897458d06450e7d134147
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8194
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Vaishnav M A <vaishnav@beagleboard.org>
2024-09-15 09:09:27 +00:00
Alexandre Bailon 13f1bcbe90 tcl/target: Add support of CC1352P7
This adds support for TI CC13X2X7 / CC26X2X7 family.

For further details, see https://www.ti.com/lit/ug/swcu192/swcu192.pdf.

Change-Id: Ifd9b505716ddf0abbdd00f617e50a93a3d4fbe6a
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8193
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Vaishnav M A <vaishnav@beagleboard.org>
2024-09-15 09:09:13 +00:00
Alexandre Bailon 1aa759dbb9 flash/nor: Update cc26xx flash driver to support cc13x2x7
This updates the flash driver to support more than one bank.
This is required to support the cc1352p7 which has two banks.

This only have been tested on a cc1352p7.
The loader has been built using a gcc-arm-none-eabi-4_8-2014q3
toolchain.

Change-Id: Ia813421ececd96d6e2fd4dae910ad60fcc3d3c88
Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8192
Tested-by: jenkins
Reviewed-by: Vaishnav M A <vaishnav@beagleboard.org>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-09-15 09:08:58 +00:00
daniellizewski d35399b00e src/flash/nor/kinetis.c: Fixed flash bank write gap
Flash banks created in kinetis_create_missing_banks did not populate
bank->minimal_write_gap. The default value of 0 was interpreted as
FLASH_WRITE_CONTINUOUS. This created unnecessary large padding if your
binary had a gap in the populated flash. It also caused flash errors
when loading with GDB because the erroneously padded pages were not
erased first. Tested using an S32k148 using s32k.cfg.

Change-Id: I9b7af698e29ac2c4f5fc8ecd82fa7f4b1a0d43f1
Signed-off-by: daniellizewski <daniellizewski@geotab.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8463
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-09-15 09:07:12 +00:00
Jun Yan 6f9b1ee521 tcl/interface/ftdi: add support for Sipeed USB-JTAG/TTL Debugger
Sipeed USB-JTAG/TTL Debugger is a compact FT2232D-based JTAG adapter.

Change-Id: Ibc9075723f47cd9b49ba4bb39e3d292e7d80bed7
Signed-off-by: Jun Yan <jerrysteve1101@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8472
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-09-15 09:06:26 +00:00
Marcus Nilsson 0efedd7bd7 drivers/jlink: Print serial numbers when multiple devices are connected
When multiple jlink programmers are connected and no specific serial
or USB location is specified, print out the detected serial numbers.

Signed-off-by: Marcus Nilsson <brainbomb@gmail.com>
Change-Id: I280da2b85363f7054c5f466637120427cadcf7d1
Reviewed-on: https://review.openocd.org/c/openocd/+/8356
Reviewed-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-09-15 09:06:02 +00:00
Parshintsev Anatoly f0bad430df rtos/hwthread: fix threadid generation
Looks like 7f2d3e2925 introduced a regression by incorrectly assigning
threads. The title of the commit message says that the intention was to
"derive threadid from SMP index", this is not what happens, however.
Instead threadid is assigned based on an index of all examined targets
in an SMP group.

This introduces two logical errors.

*Error 1*

Here is the code that assigns threads to harts:

```
foreach_smp_target(head, target->smp_targets) {
  struct target *curr = head->target;

  if (!target_was_examined(curr))
    continue;

  threadid_t tid = threads_found + 1;
  hwthread_fill_thread(rtos, curr, threads_found, tid);
```

Now, imagine a situation when we have two targets: `target.A` and
`target.B`.  Let's assume that `target.A` is NOT examined (it could be
under reset, for example).  Then, according to the algorithm when
assigning thread identifiers `target.B` will be assigned tid of 1. The
respected inferior on GDB side will be called `Thread 1`.

Now, imagine that `target.A` activates and succefully examined - OpenOCD
will re-assign thread identifiers. And now on GDB side `Thread 1` will
represent the state of `target.A`. Which is incorrect.

*Error 2*

The reverse mapping between `threadid` and targets does not take the
state of targets into account.

```
static struct target *
hwthread_find_thread(struct target *target, threadid_t thread_id)
...
  threadid_t tid = 1;
  foreach_smp_target(head, target->smp_targets) {
    if (thread_id == tid)
      head->target;
    ++tid;
  }
```

So the constructed mapping is incorrect. Since in example above
`Thread 1` will get mapped to `target.A`.

*Solution:*

It seems that threadids should be assigned based on position of the
thread in an smp group disregarding the target state.

Change-Id: Ib93b7ed3bb03696afdf56a105b333e22b9ec69b5
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8471
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Mark Zhuang <mark.zhuang@spacemit.com>
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-09-15 09:05:04 +00:00
Parshintsev Anatoly 7a70a28e6b target/riscv: do not emit warnings when a non-existent CSR is hidden
hide_csrs should not emit warnings on an attempt to hide non-exitents CSR.
hide_csrs funcitonality is intended to be used for scenarios when we don`t
want certain groups of registers to be available in GDB. Typically this is
needed to simplify integration with various IDE. In such scenarious it may
be impractical/unfeseable to figure out which register is present on a
target. So reporting a situation when a user wants to hide a non-existent
register creates way too much noise. This commit reduces severity of
relevant debug message to LOG_TARGET_DEBUG

Change-Id: Icbb982c4bcce7586fe35b6b004d0874d6014d5a7
2024-09-10 12:59:53 +03:00
Evgeniy Naydanov 826923fa60 Revert "target/riscv: re-apply patch do stop avoid warnings when a non-existent CSR is hidden"
This reverts commit e56dc61697.

The reverted commit claims to be the same as
b201a5db23, but it's not -- it changes the
warning in `riscv_reg_impl_expose_csrs()` instead of the one in
`riscv_reg_impl_hide_csrs()`.
2024-09-10 12:55:04 +03:00
Evgeniy Naydanov c85d4e1858
Merge pull request #1129 from rtwfroody/calloc
target/riscv: Fix calloc calls.
2024-09-10 12:02:06 +03:00
Evgeniy Naydanov c455b60ff7
Merge pull request #1091 from en-sc/en-sc/no-extra-ir
target/riscv: avoid unnecessary IR scans
2024-09-10 12:01:40 +03:00
Marek Vasut cbed09ee9b tcl/target: Make sure R-Car Gen3 _targets variable is global
The _targets has to be global as it is accessed at the end of this file.
This is already the case for setup_a5x {}, assure it is the same way for
setup_crx{} . Without this change, the _targets at the end of this file
is empty in case the Cortex-R is the boot core, fix this.

Change-Id: I4979e3125ec7d93bbd56eee0096ae1d9c5f6a565
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8470
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-09-07 11:42:25 +00:00
Adam Novak 75b418faa7 tcl/board: Support for Digilent Anvyl board
Support Digilent Anvyl board JTAG chain

Change-Id: I6fb52284429af6c98c19411fc8bc3ab983dfa9b8
Signed-off-by: Adam Novak <interfect@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8467
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-09-07 11:41:22 +00:00
Parshintsev Anatoly f9b2a1a2bd jtag_vpi: fix signed/unsigned comparison jtag_vpi_stableclocks
Change-Id: Id2b00fbc8ba627f4465c109fbde6e010faaff9d2
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8462
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-09-07 11:40:45 +00:00
Adam Novak 324469da57 cpld: update warning to suggest virtex2 refresh
virtex2 refresh replaced virtex2 program, but the even older programming
commands like xc6s_program still suggest the old, now-removed program
command. This changes the warnings to suggest the command that is still
there, and also adds some indication that you will need to use the .pld
name instead of the .tap name.

Change-Id: I292da62a95a9b414c69cdb1bba8a28dfd16a7336
Signed-off-by: Adam Novak <interfect@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8468
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Daniel Anselmi <danselmi@gmx.ch>
2024-09-07 11:39:22 +00:00
Ondřej Hošek 7e271c9151 flash/stm32l4x: option_write usage: mask is optional
If no mask is given, the value in the option register is replaced
completely. If a mask is set, only those bits that are set in the mask
are transferred into the option register; the others remain unchanged.

Change-Id: If488a10f92d7dcc0e0f192aef5e67c255fd529c3
Signed-off-by: Ondřej Hošek <ondra.hosek@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8466
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-09-07 11:38:52 +00:00
Ondřej Hošek ca72d23c3b doc: fix stm32l4x option_write usage
stm32l4x option_write works like stm32h7x option_write, i.e. expects the
value to write after reg_offset and optionally reg_mask after the value.

Change-Id: I57fb4fb1dbf7f43fe063b48f4db2dd5f2ef0ade0
Signed-off-by: Ondřej Hošek <ondra.hosek@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8464
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-09-07 11:38:30 +00:00
Marcus Nilsson e01e180f62 drivers/cmsis_dap: Fix buffer overflow in cmsis_dap_hid_open()
Use mbstowcs() to get required length of wide character string and
include space for terminating null wide character.

Change-Id: I668de6f0acc9b3ec5aca033d870dd9ef354f9077
Signed-off-by: Marcus Nilsson <brainbomb@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8232
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-09-07 11:37:46 +00:00
Antonio Borneo 4680d6ebdf binarybuffer: str_to_buf(): align prefix to TCL syntax
Integer values are interpreted by TCL as decimal, binary, octal
or hexadecimal if prepended with '0d', '0b', '0o' or '0x'
respectively.
The case of '0' prefix has been interpreted as octal till TCL 8.6
but is interpreted as part of a decimal number by JimTCL and from
TCL 9.

Align str_to_buf() to latest TCL syntax by:
- addding support for '0d', '0b' and '0o' prefix;
- dropping support for '0' prefix.

Change-Id: I708ef72146d75b7bf429df329a0269cf48700a44
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8465
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2024-09-07 11:37:15 +00:00
Tim Newsome 77bffed1c4 target/riscv: Fix calloc calls.
This was pointed out by gcc. Presumably it's a newer warning. I doubt it
has any effect on anything.
2024-09-06 08:34:58 -07:00
Evgeniy Naydanov a96a0a4e39 target/riscv: avoid unnecessary IR scans
Change-Id: I03feb5c7d72d5aa38f2cc13c4ed30175cffde84a
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-09-06 16:12:39 +03:00
Evgeniy Naydanov 3cd99c08c7
Merge pull request #1112 from en-sc/en-sc/misa-xlen
target/riscv: check `misa` value before reporting
2024-09-06 15:58:39 +03:00
Evgeniy Naydanov d58c656f72
Merge pull request #1111 from en-sc/en-sc/ref-reg-manual-hwbp
target/riscv: manage triggers available to OpenOCD for internal use
2024-09-06 15:57:38 +03:00
Evgeniy Naydanov d7a7c9822e
Merge pull request #1125 from fk-sc/fk-sc/field-duplication
target/riscv: remove duplicate of progbufsize field
2024-09-06 12:23:37 +03:00
Evgeniy Naydanov 5a8697b3cf target/riscv: manage triggers available to OpenOCD for internal use
Before the change, if the user wrote to any `tdata*` register, OpenOCD
would sometimes start to disable all the triggers (by writing zeroes to
`tdata1`) and re-enable them again (by witing all trigger registers to the
values read before for each `tselect` value), e.g. on `step`
(see `disable/enable_triggers()`).

There are a couple of issues with such approach:
1. RISC-V Debug Specification does not require custom register types
   to support re-enabling by such sequence of writes (e.g. some custom
   trigger type may require writing a custom CSR to enable it).
2. OpenOCD may still overwrite these triggers when a user asks to set a
   new WP.

This commit introduces `riscv reserve_trigger ...` command to explicitly
mark the triggers OpenOCD should not touch.

Such approach allows to separate management of custom triggers and
offload it onto the user (e.g. disable/enable such triggers by setting up
an event handler on `step`-related events).

Change-Id: I3339000445185ab221368442a070f412bf44bfab
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-09-05 12:59:35 +03:00
Evgeniy Naydanov 6c021da8cc target/riscv: check `misa` value before reporting
Currently, during register file examination:
1. A read of an XPR is attempted via 64-bit abstract access.
2. If such a read fails (e.g. connection unstable) XLEN is assumed to be
   32.
3. Then `misa` is read. Since `misa` is a CSR and it may be only
   readable via program buffer, `s0` should be readable beforehand (at
   least some assumption about `xlen` should be made).
4. Before the commit, the `misa.mxl` field was not checked against
   `xlen`, therefore erroneous info may have been reported to the user.
   Moreover, the `examine()` would pass indicating no error at all.
5. After the commit, `misa.mxl` is checked against `xlen` value.

Change-Id: I3fe5bd6742e564e6de782aad9ed10e65c0728923
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-09-05 11:56:59 +03:00
Evgeniy Naydanov 909bbb899b
Merge pull request #1115 from en-sc/en-sc/fixup-bscan
target/riscv: restrict BSCAN-related commands to before-`init`
2024-09-04 19:40:41 +03:00
Farid Khaydari a61e7271ef target/riscv: remove duplicate progbufsize field
* removed `progbuf_size`  field from `riscv_info`; added getter
* moved `impebreak` field from `riscv_info` to `riscv013_info`
  as implementation dependent field; added getter

Signed-off-by: Farid Khaydari <f.khaydari@syntacore.com>
2024-09-04 17:55:14 +03:00
Anatoly Parshintsev 22bbdd2a5e
Merge pull request #1109 from aap-sc/aap-sc/sbus_fixup
target/riscv: sys bus v1 fix for sizes greater than 4
2024-09-03 11:07:31 +03:00
Anatoly Parshintsev 8ea44aa381
Merge pull request #1118 from aap-sc/aap-sc/fixup_hidecsr_warnings
target/riscv: re-apply patch do stop avoid warnings when a non-existent CSR is hidden
2024-08-30 01:15:36 +03:00
Anatoly Parshintsev 38bd4b4852
Merge pull request #1116 from aap-sc/aap-sc/aug_upstream_sync
Merge up to ac63cd00d7 from upstream
2024-08-29 23:35:56 +03:00
Tomas Vanek e09bb72da5 target/cortex_m: add DSCSR_CDSKEY bit definition
Needed e.g. for flash drivers handling secure mode.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: If6cb49609140d06a73bcf2e446b6a634d6326e80
Reviewed-on: https://review.openocd.org/c/openocd/+/8435
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-25 12:44:16 +00:00
Karl Palsson e7a060090e rtt: default the ID to "SEGGER RTT"
Instead of making people type this in all the time, just default to
"SEGGER RTT" so more things work out of the box.

Change-Id: I147142cf0a755e635d3f66e047be2eb5049cf511
Signed-off-by: Karl Palsson <karl.palsson@marel.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8354
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-25 12:43:22 +00:00
Richard Allen 5cb184a732 target: fix profiler output on Windows
Open output file in binary mode to disable EOL
conversion on Windows (and sometimes cygwin depending
on installation settings and path).

Change-Id: I38276dd1af011ce5781b0264b7cbb08c32a1a2ad
Signed-off-by: Richard Allen <rsaxvc@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8278
Reviewed-by: Karl Palsson <karlp@tweak.au>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-25 12:42:44 +00:00
Parshintsev Anatoly ff22f78d46 doc: document that breakpoints are disabled on step/resume
OpenOCD disables breakpoints on step/resume if they
match the current code position. This is a non-obvious
behavior that should be documented

Change-Id: Id762066569ec6452869a58dfcd9df88c8a14d6ab
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8388
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-25 12:42:14 +00:00
Marc Schink 0bf3373e80 target/breakpoints: Use 'unsigned int' for length
Change-Id: I233efb5b18de5f043fdc976807437db0a94236d1
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7056
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-08-25 12:41:05 +00:00
Peter Collingbourne 941fa8538f arm_cti: Add CTIDEVCTL to register list
This is useful for setting a reset catch on a CPU that is being
brought out of reset.

Change-Id: Id8fe9bc3f75fd170f207f470a9f3b0faba7f24c1
Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8422
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-25 12:40:24 +00:00
Peter Collingbourne fc1e73b9cf arm_cti: Clean up the list of CTI registers
Reduce the amount of boilerplate by moving cti_regs into its only
user, making it a local variable and removing the now-redundant
p_val pointer.

Change-Id: I778cc1e960532fae1ac1a952c6ff19c54e578a5f
Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8421
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-08-25 12:40:00 +00:00
Peter Collingbourne 7eb9a48f2d arm_adi_v5: Also clear sticky overrun bit on init
Some targets start up with the sticky overrun bit set. On such targets
we need to clear it in order to avoid subsequent incorrect reads.

Change-Id: I3e939a9e092de6fcea9494d3179a3386aa1701d2
Signed-off-by: Peter Collingbourne <pcc@google.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8420
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-08-25 12:39:25 +00:00
Antonio Borneo d3f50ea914 target: arm_adi_v5: add more CoreSight P/N
Add part numbers for:
- Cortex-A65AE,
- Cortex-M52,
- Cortex-M55,
- Cortex-R52+,
- STAR-MC1.

Change-Id: I6282768896dd727e803a071139816494470744f1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8319
Tested-by: jenkins
2024-08-25 12:38:28 +00:00
Marc Schink 16429f6252 target/arm_cti: Use suitable data types
While at it, fix some small coding style issues.

Change-Id: Ifb8e78b55d29a06d69a3ce71d12d0040777aef13
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8423
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-25 12:37:20 +00:00
Antonio Borneo ceae51ad74 checkpatch: only report error on hit
The Linux checkpatch script used by OpenOCD reports hits either as
error, warning and check.
Such classification is meaningful for Linux maintainers, but for
OpenOCD Jenkins they are all considered as errors.

Having such classification in the checkpatch report by Jenkins is
misleading for developers that expect 'warnings' to be probably
ignored by maintainers, while having no idea what 'checks' means.

This patch flattens all the checkpatch reports to 'error' only.

Checkpatch can trigger false positives. OpenOCD uses the tag
	Checkpatch-ignore:
in the commit message to prevent Jenkins to report the error, as
described in HACKING.

Change-Id: I1d3164ba1f725c0763dfe362192ffa669b3856e6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8424
Reviewed-by: Karl Palsson <karlp@tweak.au>
Tested-by: jenkins
2024-08-25 12:36:57 +00:00
Antonio Borneo bfd3110e59 binarybuffer: str_to_buf(): simplify it and fix scan-build error
The function str_to_buf() can be simplified by writing directly
the intermediate results in the output buffer.
Such simplification improves the readability and also makes
scan-build happy, as it does not trigger anymore the warning:
	src/helper/binarybuffer.c:328:8: warning: Use of memory
	allocated with size zero [unix.Malloc]
		if ((b256_buf[(buf_len / 8)] & mask) != 0x0) {

Change-Id: I1cef9a1ec5ff0e5841ba582610f273e89e7a81da
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8396
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Tested-by: jenkins
2024-08-25 12:36:29 +00:00
Antonio Borneo bee5999a44 binarybuffer: str_to_buf(): rename buf_len as buf_bitsize
The name 'buf_len' is misleading, as it usually refers to the byte
length of a buffer. Here we use it for the length in bits.

Rename it as 'buf_bitsize'.
While there, fix checkpatch error by changing the index type to
'unsigned int'.

Change-Id: I78855ed79a346d996d9c0100d94d14c64a36b228
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8395
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2024-08-25 12:36:13 +00:00
Antonio Borneo 8a3efbf21f binarybuffer: simplify the prototype of str_to_buf()
With 'radix' always zero and '_detected_radix' always NULL, drop
the two parameters and simplify str_to_buf().

While there:
- drop some redundant assert(),
- drop the re-check for the base prefix,
- simplify str_strip_number_prefix_if_present() and rename it, as
  the prefix MUST be present,
- fix a minor typo,
- update the doxygen description of str_to_buf().

Change-Id: I1abdc8ec0587b23881953d3094101c04d5bb1c58
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8394
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2024-08-25 12:36:00 +00:00
Antonio Borneo ea859e1cd0 helper: command: drop radix parameter from command_parse_str_to_buf()
Commit 53b94fad58 ("binarybuffer: Fix str_to_buf() parsing
function") introduces the helper command_parse_str_to_buf() to
parse as number a string on TCL command-line.
The parameter 'radix' can specify the base (decimal, octal,
hexadecimal, or auto-detected).

TCL is supposed to use decimal numbers by default, while octal and
hexadecimal numbers must be prefixed respectively with '0' and
'0x' (or '0X').
This would require the helper to always run auto-detection of the
base, thus always set the 'radix' parameter to zero. This makes
the parameter useless.

Keeping the 'radix' parameter can open the door to future abuse of
TCL syntax, E.g. a command can require an octal value without the
mandatory TCL '0' prefix; the octal value cannot be the result of
TCL expression.

To prevent any future abuse of the 'radix' parameter, drop it.

Change-Id: I88855bd83b4e08e8fdcf86a2fa5ef3269dd4ad57
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8393
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
2024-08-25 12:35:47 +00:00
Antonio Borneo a414ffaf65 doc: document command 'ms'
Add documentation for the commands 'ms'.

Change-Id: I247adce1c586c4f4cd36d044d48298c370635e67
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8432
Tested-by: jenkins
2024-08-25 12:35:27 +00:00
Parshintsev Anatoly e56dc61697 target/riscv: re-apply patch do stop avoid warnings when a non-existent CSR is hidden
the original fix was introduced in b201a5db23 but was lost in 3883b03a
2024-08-21 19:18:10 +03:00
Parshintsev Anatoly 0fb31af501 fixed compilation failure due to signed/unsigned comparison warning
the warning is caused by b3d4c97b in upstream OpenOCD
2024-08-20 15:52:56 +03:00
Parshintsev Anatoly 9740a4ddd6 Merge up to ac63cd00d7 from upstream
- src/jtag/drivers/ftdi.c:

```
++<<<<<<< HEAD
 +      int i;
 +      static const uint8_t zero;
++=======
+       uint8_t zero = 0;
++>>>>>>> ocd_upstream
```

Decided to choose the latter.

- src/target/riscv/riscv-013.c:

```
++<<<<<<< HEAD
 +      int abs_chain_position;
 +      /* The base address to access this DM on DMI */
 +      uint32_t base;
++=======
+       unsigned int abs_chain_position;
+
++>>>>>>> ocd_upstream
```

Decided to choose the latter (abs_chain_position is unsigned now)

- src/target/riscv/batch.c:

```
++<<<<<<< HEAD
++=======
+ void dump_field(int idle, const struct scan_field *field)
+ {
  ...
+ }
++>>>>>>> ocd_upstream
```

dump_field function is not needed anymore

Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
2024-08-20 15:44:15 +03:00
Evgeniy Naydanov e07d70e52c
Merge pull request #1114 from en-sc/en-sc/dup-dtmcontrol
target/riscv: remove duplicate `dtmcontrol_scan()`
2024-08-16 17:06:10 +03:00
Evgeniy Naydanov e4d6885eb5
Merge pull request #1101 from en-sc/en-sc/ref-reg-examine
target/riscv: reg cache entry is initialized before access
2024-08-16 17:04:24 +03:00
Tomas Vanek ac63cd00d7 tcl/interface/raspberrypi5-gpiod: fix string match pattern escaping
Use correct TCL syntax and save string map operation.

Change-Id: Ic2a522bd57cf6610b7df1d9cddd0fbdc2076ed62
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8426
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-16 04:45:11 +00:00
Parshintsev Anatoly ebb8c057a6 target/riscv: sys bus v1 fix for sizes greater than 4
read_memory_bus_v1 incorrectly copied data to output buffer

Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
2024-08-15 21:17:51 +03:00
Evgeniy Naydanov 342f294031 target/riscv: restrict BSCAN-related commands to before-`init`
Logically, BSCAN tunneling is used to establish a connection, therefore
it should be set up before the communication starts (i.e. before
`init`).

Moreover, current implementation does not support changing
`bscan_tunnel_ir_width` after `init`. This is evident by RISC-V handler
of the `init` itself.
Link: 9a23c9e679/src/target/riscv/riscv.c (L467-L481)

Change-Id: I817c6a996f7f7171b2286e181daf1092bd358f69
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-08-14 20:50:32 +03:00
Evgeniy Naydanov 4379e84380 target/riscv: remove duplicate `dtmcontrol_scan()`
Also avoid receiving data if the value is discarded on the call-site.

Change-Id: Ied87b551536a00d9fad469b9843cccae1976e6b6
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-08-14 20:13:36 +03:00
Evgeniy Naydanov 5f45b5bd73 target/riscv: reg cache entry is initialized before access
* Register file examination is separated.
* Allow to access registers through cache as early as possible to re-use
  general register access interface and propely track state of the
  register.
* Reduces the number of operations: S0 and S1 are saved/restored only
  when needed (targets without abstract CSR access).

Change-Id: I2e205ae4e88733a5c792f8a35cf30325c68d96b2
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-08-14 19:24:11 +03:00
Evgeniy Naydanov 9a23c9e679
Merge pull request #1104 from TommyMurphyTM1234/fix-include-guards
Align include guards with OpenOCD coding guidelines
2024-08-08 15:25:15 +03:00
Marc Schink efe9022197 server/telnet: Always allow 'exit' command
The telnet 'exit' command is only available in the execution phase of
OpenOCD. Thus, a telnet session cannot be closed via 'exit' if OpenOCD
is started with 'noinit'. Make the 'exit' command always available.

Change-Id: I14447ecde63e579f1c523d606f048ad29cc84a35
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8379
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-08-06 14:31:29 +00:00
Marc Schink b9224c0c0f transport: Remove echo in transport selection
Do not echo the selected transport to avoid stray and confusing
messages in the output of OpenOCD. For example, the "swd" line here:

  Open On-Chip Debugger 0.12.0+dev-00559-ge02f6c1b9-dirty
  Licensed under GNU GPL v2
  For bug reports, read
  	http://openocd.org/doc/doxygen/bugs.html
  swd
  Info : Listening on port 6666 for tcl connections
  Info : Listening on port 4444 for telnet connections

While at it, fix some small documentation style issues.

Change-Id: Ie85426c441289bbaa35615dbb7b53f0b5c46cfc0
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8217
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-08-02 16:08:32 +00:00
Marc Schink d5adab697f target/breakpoints: Fix 'orig_instr' output
The 'orig_instr' information of software breakpoints is incorrect
because buf_to_hex_str() expects the length of the buffer to be
converted in bits and not bytes.

Change-Id: I9a9ed383a8c25200d461b899749d5259ee4c6e3d
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8218
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-08-02 16:07:33 +00:00
Marc Schink 5b3d503e2e doc: Add 'jlink targetpower' command
Change-Id: I7e6c9e75f3c70675a3ea55fd5f0d7de1a35f2c4b
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8418
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-08-02 16:06:26 +00:00
Marc Schink 4cab20b599 adapter/jlink: Allow to determine the target power state
Change-Id: I0b4f543e0ba0e48c43f78e32e4fa41d7dec9d7b8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8417
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-08-02 16:06:04 +00:00
Marc Schink fc0ec6cf0b adapter/jlink: Use COMMAND_PARSE_* instead of sscanf()
While at it, apply some coding style fixes.

Change-Id: I77a6917a045af733ebe9211ca338952dbd49c89b
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8416
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-08-02 16:05:33 +00:00
Marc Schink 2b6d63a44d jtag: Use 'unsigned int' data type
This patch modifies as little code as possible in order to simplify the
review. Data types that are affected by these changes will be addresses
in following patches.

While at it, apply coding style fixes if these are not too extensive.

Change-Id: I364467b88f193f8387623a19e6994ef77899d117
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8414
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-02 16:05:07 +00:00
Marc Schink 7d56407ba7 jtag: Use 'unsigned int' for 'scan_field.num_bits'
This patch modifies as little code as possible in order to simplify the
review. Data types that are affected by these changes will be addresses
in following patches.

While at it, apply coding style fixes if these are not too extensive.

Change-Id: Idcbbbbbea2705512201eb326c3e6cef110dbc674
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8413
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-02 16:04:49 +00:00
Marc Schink 9ef59daef0 target/avrt: Remove unused parameter 'rti'
Change-Id: Ib6957b89190188f5c15fadc3d4036709f19a6cea
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8412
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-02 16:04:24 +00:00
Marc Schink 0847a4d7fb jtag/commands: Use 'unsigned int' data type
This patch modifies as little code as possible in order to simplify the
review. Data types that are affected by these changes will be addresses
in following patches.

While at it, apply coding style fixes if these are not too extensive.

Change-Id: Ie048b3d472f546fecb6733f17f9d0f17fda40187
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8404
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-02 16:03:28 +00:00
Marc Schink 42450345dd jtag: Use 'unsigned int' for 'ir_length'
This patch modifies as little code as possible in order to simplify the
review. Data types that are affected by these changes will be modified
in following patches.

Change-Id: I83921d70e017095d63547e0bc9fe61779191d9d0
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8403
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-02 16:02:25 +00:00
Marc Schink 4fac13827f jtag: Use 'unsigned int' for 'abs_chain_position'
Change-Id: I1ac0a6a86f820b051619aa132754a69b8f8e0ab9
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8402
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-02 16:01:59 +00:00
Marc Schink 632df9e5cb jtag: Use bool data type for 'jtag_verify'
Change-Id: Iae46e45c7523252eee44224e6b9b3b1484aaeb35
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8401
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-02 16:01:31 +00:00
Antonio Borneo 882749dd2f uncrustify.cfg: add SPDX license
Add the SPDX tag line.

Change-Id: I701580948a0cacdb7fe31d91ed730e848da9b0ba
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8411
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-08-02 16:01:12 +00:00
Antonio Borneo 5543bb4a90 doc: Makefile.am: add SPDX license
Add the SPDX tag line.

Change-Id: Iffe73faaf20614f9e5237b7afba3c580dfa03a9e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8410
Tested-by: jenkins
2024-08-02 16:00:50 +00:00
Antonio Borneo 4c77f942e1 tcl: fix minor typos and repeated words
Detected with checkpatch.

Change-Id: Id306928496cf70bbe7ff065bf726bc7dceadce26
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8409
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-08-02 16:00:22 +00:00
Antonio Borneo 13f9f29fa8 checkpatch: extend checks to TCL, Makefile.am and configure.ac files
The script, originally written for Linux code, skips several tests
on files whose name's extension is not in Perl list
'(h|c|s|S|sh|dtsi|dts)$'.
This causes such tests to not be executed on OpenOCD TCL files and
on Makefile.am and configure.ac.

Modify the script to include the OpenOCD files in the list.

Change-Id: I17c96bf32ee40d9390e60996e176e4e927c00197
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8408
Reviewed-by: Marek Kraus <gamelaster@outlook.com>
Tested-by: jenkins
2024-08-02 16:00:09 +00:00
Marek Kraus 1b5c137e43 tcl/target: add initial Bouffalo Lab BL702 chip series support
Adds initial support for the BL702 series of chips, BL702, BL704 and BL706.
No flash bank support yet.

File name bl702.tcl was chosen over bl70x.tcl, because Bouffalo Lab
uses bl702 to mark the whole series in many of their tools.

The ndmreset bit in the RISC-V Debug Module isn't implemented correctly,
so it doesn't trigger a system reset as it should.
To solve this problem, the software reset is implemented
in the reset-assert-pre hook, which uses best reset method I could find.
What is not reset is the GLB core, which handles GPIOs, pinmux, etc.
The reset mechanism has been extensively tested, and works correctly
for both "reset run" and "reset halt", which the latter
halts very early in the BootROM.

Change-Id: I5ced6eb3902d1b9d9c1bba56f817ec5dc3493cb0
Signed-off-by: Marek Kraus <gamelaster@outlook.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8407
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-08-02 15:59:42 +00:00
Marc Schink a8a0b4c507 configure: Use pkg-config for jimtcl
The jimtcl project supports pkg-config, use it for a simpler
configuration of compiler and linker flags and to enforce the minimum
required package version.

Since the jimtcl pkg-config file is not available on all systems, use
AC_CHECK_HEADER() as fallback.

Change-Id: I6fdcc818a8fdd205a126b0a46356434dbe890226
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8383
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-08-02 15:59:07 +00:00
Grant Ramsay 16c114c058 flash/startup.tcl: Tidy flash program preverify documentation
Remove the hyphen from "pre-verify" in usage text.
Add preverify to the help text and procedure comment

Change-Id: I6d96e78ca84d99929300d461e435f5b4ce07b5db
Signed-off-by: Grant Ramsay <grant.ramsay@hotmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8376
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-07-28 13:36:58 +00:00
Antonio Borneo 2cbfd141e8 jep106: update to revision JEP106BJ.01 July 2024
Change-Id: Iebab3f6a3b1f6d82f955997fd4e691c55d01c767
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8406
Tested-by: jenkins
2024-07-28 13:34:26 +00:00
Antonio Borneo 4c6646f10a doc: fix makeinfo warning
Build returns a makeinfo warning:
	openocd.texi:5201: warning: `.' or `,' must follow @xref, not f

Add a dummy ',' after '@xref{..}' to silent the warning.

Fixes: 44cfdef0a4 ("server/gdb: Restructure commands")
Change-Id: Ic0bff8fc9b54942ebb72762816686ea7c7881345
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8392
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-07-28 13:27:57 +00:00
Antonio Borneo 5b7b77349c cortex_m: fix scan-build false positive
Scan-build is unable to detect that 'target->dbg_msg_enabled' does
not change across the function cortex_m_fast_read_all_regs().
It incorrectly assumes that it can be false at the first check (so
'dcrdr' get not assigned) and it is true later on (when 'dcrdr'
get used).
This triggers a false positive:
	src/target/cortex_m.c:338:12: warning:
		3rd function call argument is an uninitialized value
		[core.CallAndMessage]
	retval = mem_ap_write_atomic_u32(armv7m->debug_ap, DCB_DCRDR, dcrdr);

Use a local variable for 'target->dbg_msg_enabled' so scan-build
can track it as not modified.
While there, change the type of 'target->dbg_msg_enabled' to
boolean as there is no reason to use uint32_t.

Change-Id: Icaf1a1b2dea8bc55108182ea440708ab76396cd7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8391
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-07-28 13:26:05 +00:00
Tarek BOCHKATI 052a4a69b5 flash/stm32l4x: support STM32U53/U54x devices
STM32U53/U54x devices are similar to U57/U58x devices
with 2 flash banks up to 256 KB each

Change-Id: I774ef0df4dddac5f06bbfc2e6c3fc2e628d2249e
Signed-off-by: FBOSTM <fedi.bouzazi@st.com>
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7515
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-07-25 04:07:35 +00:00
Evgeniy Naydanov 5afed58fcd
Merge pull request #1100 from en-sc/en-sc/single-as-batch
target/riscv: single DMI accesses via batch
2024-07-18 15:49:21 +03:00
Tarek BOCHKATI 6554d176e9 flash/stm32l4x: support STM32U59/U5Ax devices
STM32U59/U5Ax devices are similar to U57/U58x devices
with 2 flash banks up to 2 MB each

while at there update STM32U57x/U58x revisions

Change-Id: I7e5c1700acf8c9fda34f660c9274bfd8bcb1381b
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6875
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-07-18 08:18:28 +00:00
Evgeniy Naydanov 9a489be795 target/riscv: single DMI accesses via batch
* Eliminates the use of VLA, which is prohibited by `doc/manual
/style.txt`:
Link: c6bb902629/doc/manual/style.txt (L164-L166)

* Unifies DMI access interface.

* Reduces code duplication.

Change-Id: I2d7b0595f171e21062049ff61f76fb5a3c992d11
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-07-16 16:43:46 +03:00
Evgeniy Naydanov 7f2d3e2925 rtos/hwthread: derive threadid from SMP index
As defined in `target/target.h`, `coreid` is the index of the target on
the TAP, so, if an SMP group includes targets from multiple TAPs, it can
not be used as the base for `threadid`.

Change-Id: Ied7cfa42197aaf4908ef6628c6436f28d4856ebe
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7957
Tested-by: jenkins
Reviewed-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 22:31:16 +00:00
Nishanth Menon 812fad02fe tcl/board: Add am62p/am62a7/j722s native swd configuration
Direct memory driver swd native configuration for am62a7, am62p and
J722S SoCs. All three share common memory map for the debug address
map, so there is a strong reuse. However, introduce board file
specific to the board to allow users to directly get started.

Change-Id: I5609925a2e9918fd4c91d9fd40fbee98de27fdbc
Signed-off-by: Nishanth Menon <nm@ti.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8283
Tested-by: jenkins
Reviewed-by: Vaishnav M A <vaishnav@beagleboard.org>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-07-13 22:30:01 +00:00
Marc Schink 40a6af6eda tcl: Replace 'tcl_' prefix with 'tcl' command group
Change-Id: Iee1e84a87d07172aa6b0adfb7b85fb465cefb979
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8345
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 22:29:34 +00:00
Marc Schink 73b15194ea server/tcl: Restructure commands
Use a command group 'tcl' with subcommands instead of individual
commands with 'tcl_' prefix.

The old commands are still available to ensure backwards compatibility,
but are marked as deprecated.

Change-Id: I1efd8a0e2c1403833f8cb656510a54d5ab0b2740
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8344
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-07-13 22:29:04 +00:00
Marc Schink b764fc2a4d tcl: Replace 'gdb_' prefix with 'gdb' command group
Change-Id: I0490b4c112c1a922bf77a4b37df2a630a8f6cea1
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8337
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-07-13 22:28:33 +00:00
Marc Schink 44cfdef0a4 server/gdb: Restructure commands
Use a command group 'gdb' with subcommands instead of individual
commands with 'gdb_' prefix.

The old commands are still available to ensure backwards compatibility,
but are marked as deprecated.

Change-Id: I037dc58554e589d5710cf46924e0a00f863aa300
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8336
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 22:28:12 +00:00
Jonathan Forrest 2992ec9095 jtag/drivers/mpsse: Added FT4232HA
Added FT4232HA varianet of FTDI's FT4232H which has a different bcd.
Also added default PID/VID for the FT4243HA to contrib/60-openocd.rules.
And added default PID/VIDs for FTDI's HP ICs to contrib/60-openocd.rules
as this wasn't done previously.

BugLink: https://sourceforge.net/p/openocd/tickets/410/

Change-Id: Ia84b566aa004332d3f7815a3d22ac37eee4f522a
Signed-off-by: Jonathan Forrest <jonyscathe@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8225
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 22:23:46 +00:00
Jan Matyas 53b94fad58 binarybuffer: Fix str_to_buf() parsing function
The function str_to_buf() was too benevolent and did
not perform sufficient error checking on the input
string being parsed. Especially:

- Invalid numbers were silently ignored.
- Out-of-range numbers were silently truncated.

The following commands that use str_to_buf()
were affected:

- reg (when writing a register value)
- set_reg
- jtag drscan

This pull request fixes that by:

- Rewriting str_to_buf() to add the missing checks.
- Adding function command_parse_str_to_buf() which can
  be used in command handlers. It parses the input
  numbers and provides user-readable error messages
  in case of parsing errors.

Examples:

jtag drscan 10 huh10

- Old behavior: The string "huh10" is silently
  converted to 10 and the command is then executed.
  No warning error or warning is shown to the user.
- New behavior: Error message is shown:
  "'huh10' is not a valid number"

reg pc 0x123456789

Assuming the "pc" is 32 bits wide:

- Old behavior: The register value is silently
  truncated to 0x23456789 and the command is performed.
- New behavior: Error message is shown to the user:
  "Number 0x123456789 exceeds 32 bits"

Change-Id: I079e19cd153aec853a3c2eb66953024b8542d0f4
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8315
Tested-by: jenkins
Reviewed-by: Marek Vrbka <marek.vrbka@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 22:23:15 +00:00
Tomas Vanek c97a8ff10d flash/nor/nrf5: remove asserts on dereferenced pointers
The driver code works reliably, no need to use assert() everywhere.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Idb1942bfd31d370a74610b8a8836bc2e64370557
Reviewed-on: https://review.openocd.org/c/openocd/+/8324
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 22:22:17 +00:00
Tomas Vanek f09ccc817b flash/nor/nrf5: split chip and bank probes
nrf5_auto_probe() always re-probed chip hardware to
get flash geometry.

Introduce nrf5_probe_chip() and move chip related probing to it.
Save all flash parameters needed for bank setup to struct nrf5_info.

Introduce nrf5_setup_bank() and move bank setup code to it.

Call both chip probe and bank setup unconditionally from nrf5_probe():
in case of manual issuing 'flash probe' command, we should refresh actual
values from the device.

Call chip probe and bank setup only if not done before from
nrf5_auto_probe().

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ib090a97fd7a41579b3d4f6e6634a5fdf93836c83
Reviewed-on: https://review.openocd.org/c/openocd/+/8322
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 22:22:00 +00:00
Ian Thompson c322060fbd target/xtensa: flag additional write-only registers
intsetN, intclearN (for LX8)
mesrclr (for NX)

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I0bb59728fcec761a71c4789189f733a10bad6375
Reviewed-on: https://review.openocd.org/c/openocd/+/8235
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-07-13 22:20:39 +00:00
Antonio Borneo 6da4025167 target: cortex_m: replace 'implementor' with 'implementer'
ARM documentation for Cortex-M reports the field 'implementer' in
the register CPUID.
OpenOCD used the miss-spelled 'implementor'. Fix it!

Change-Id: I854d223971ae7a49346e1f7491c2c0415f5e2c1d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8318
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-07-13 22:19:55 +00:00
Antonio Borneo fbb16b05da target: cortex_m: add detection for Cortex-M52
Add Cortex-M52 to the list of known Cortex-M implementations to
allow detection of the core.
Values checked against the ARM document "Arm China Cortex®-M52
Processor Technical Reference Manual" 102776_0002_06_en.

Reported-by: Joseph Yiu <Joseph.Yiu@arm.com>
Change-Id: Id0bde8a0476f76799b7274835db9690f975e2dd6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8317
Tested-by: jenkins
2024-07-13 22:19:33 +00:00
Antonio Borneo df7a31f536 target: cortex_m: fix detection of STAR-MC1 device
The detection of Cortex-M STAR-MC1 was introduced with [1], at a
time when OpenOCD was only checking the field PartNo of the CPUID
register.
Later-on [2], OpenOCD extended the check to the field implementer
of CPUID register. The value for ARM (0x41) implementer was used
to all the Cortex-M, but no feedback for STAR-MC1 was available. A
comment reporting the possible mismatch was added.

As reported on OpenOCD mailing-list, the technical reference manual
for STAR-MC1 is now available [3] and it reports the implementer
as ARM China (0x63) [3].

Fix the STAR-MC1 implementer accordingly.

Reported-by: Joseph Yiu <Joseph.Yiu@arm.com>
Change-Id: I8ed1064a847b73065528ee7032be967b5c58b431
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Link: [1] 7dc4be3157 ("target/arm: Add support with identify STAR-MC1")
Fixes: [2] 05ee889155 ("target/cortex_m: check core implementor field")
Link: [3] https://www.armchina.com/download/Documents/Application-Notes/Technical-Reference-Manual?infoId=160
Reviewed-on: https://review.openocd.org/c/openocd/+/8316
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-07-13 22:19:04 +00:00
Marc Schink ed80a182ce tcl: Replace 'hla_' prefix with 'hla' command group
Change-Id: I99ec2dc7f300352d091cf9eb807a690901c33307
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8338
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-07-13 22:18:17 +00:00
Marc Schink 4d99e77419 jtag/hla: Restructure commands
Use a command group 'hla' with subcommands instead of individual
commands with 'hla_' prefix.

The old commands are still available to ensure backwards compatibility,
but are marked as deprecated.

Change-Id: I612e3cc080d308735932aea0f11001428eadc570
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8335
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 16:48:53 +00:00
Mark Zhuang 7957208cf6 openocd: fix some coding style
Add space around math operators.

Change-Id: I50fce3da283a78ba02bf70b6a752f7bf778d79f5
Signed-off-by: Mark Zhuang <mark.zhuang@spacemit.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7585
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 16:47:44 +00:00
Antonio Borneo 990869f7ec openocd: build: prevent old clone to fail on git submodules
Working on an old local git repository, the git sub-modules could
have been set before last changes in .gitmodules.
The script 'bootstrap' does not update the url of the repositories
and this can cause the script to fail.

Add 'git submodule sync' to the script to update the url of the
repositories.
While there, fuse 'git submodule init' and git submodule update'
in a single command.

Reported-by: Karl Hammar <karl@aspodata.se>
Change-Id: I61412f804dbbb7a843aa009139ddb4b8e71beefb
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8375
Tested-by: jenkins
2024-07-13 16:47:12 +00:00
Marc Schink 6ed058933c doc: Refurbish manual page
Remove the outdated option '--pipe' and bring the description of OpenOCD
up to date without focus on JTAG only.

Change-Id: If52e936a366dde21c1dd514bd3960d100b540e77
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8347
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 16:46:36 +00:00
Marc Schink 636f003eee AUTHORS: Refer to source code and Git history
The list of authors and contributors is not maintained and outdated for
years now. Refer to the source code and Git history instead of keeping a
separate list.

Change-Id: I9a92e8e0d5073b56030bc36086b76e28de96389f
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8346
Reviewed-by: Jonathan McDowell <noodles-openocd@earth.li>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 16:46:06 +00:00
Marc Schink 31e0fc4a7a doc: Remove outdated '-pipe' option
Change-Id: Ie3a7a3aaf69485f16b2447bd1dfa7622b584c7c0
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8348
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-07-13 16:45:34 +00:00
Antonio Borneo 2fe392ef50 flash: psoc6: drop use of 'coreid' to identify the CPU
The flag '-coreid' is used by the command 'target create' to
specify the debug controller of the target, either in case of a
single debug controller for multiple CPU (e.g. RISC-V harts) or
in case of multiple CPU on a DAP access port (e.g. Cortex-A SMP
cluster).
It is also currently used to specify the CPU ID in a SMP cluster,
but this is going to be reworked.

This flag has no effects on Cortex-M; ARM specifies that only one
CPU Cortex-M can occupy the DAP access port by using hardcoded
addresses.

The flash driver 'psoc6' uses the flag '-coreid' to detect if the
current target is the Cortex-M0 on AP#1 or the Cortex-M4 on AP#2
in the SoC.
There are other ways to run such detection, without using such
unrelated '-coreid' flag, e.g. using the AP number or the arch
type of the target.

Use the arch type to detect Cortex-M0 (ARM_ARCH_V6M) vs Cortex-M4
(ARM_ARCH_V7M).
Drop the flags '-coreid' from the psoc6 configuration file.

Change-Id: I0b9601c160dd4f2421a03ce6e3e7c55c6212f714
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8128
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-07-13 16:44:53 +00:00
Antonio Borneo c9f22c79df doc: document 'target create' flags '-dbgbase' and '-coreid'
Add to the command 'target create' the description for the flags
'-dbgbase' and '-coreid'.
Report that '-coreid' is currently used for purposes other than
CPU detection/examination, and that such uses are going to be
re-considered.

Change-Id: I25c839e3653101234c5862ce9da77019a5bb3249
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8129
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-07-13 16:44:26 +00:00
Evgeniy Naydanov 87c581a80d
Merge pull request #1099 from en-sc/en-sc/sb-addr-batch
target/riscv: write SB address using batch
2024-07-12 14:18:34 +03:00
Evgeniy Naydanov 6d4ad0033e target/riscv: write SB address using batch
Reduces the number of JTAG queue flushes.

Change-Id: Id103f5da1a3ea3177447046711e0e62a22c98c75
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-07-10 13:08:20 +03:00
Evgeniy Naydanov 2f29b804be
Merge pull request #1096 from en-sc/en-sc/run-batch-busy
target/riscv: reset `dmi.busy` after batches
2024-07-09 14:29:04 +03:00
Evgeniy Naydanov 59ce92aaeb
Merge pull request #1083 from en-sc/en-sc/deprecate-reset-timeout
target/riscv: deprecate `riscv set_reset_timeout_sec`
2024-07-09 14:28:42 +03:00
Evgeniy Naydanov f34e531bd7
Merge pull request #1081 from en-sc/en-sc/sb_read_v1
target/riscv: use batch interface in `read_memory_bus_v1()`
2024-07-09 14:28:15 +03:00
Evgeniy Naydanov 57d2553cec
Merge pull request #1093 from en-sc/en-sc/v-ext-csrs
target/riscv: vector CSRs are optional
2024-07-09 14:27:53 +03:00
Tommy Murphy 205e4c8b97 Align include guards with OpenOCD coding guidelines
Fixes: https://github.com/riscv-collab/riscv-openocd/issues/1097
2024-07-09 11:03:33 +01:00
Evgeniy Naydanov f3abfe49fd target/riscv: deprecate `riscv set_reset_timeout_sec`
Change-Id: I46bf3e4dab2a99c97b7ab133a85c13332365f9b7
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-07-04 12:20:38 +03:00
Evgeniy Naydanov f5f5f6dd2a
Merge pull request #1082 from en-sc/en-sc/sbcs-read
target/riscv: simplify `sbcs` read in `write_memory_bus_v1()`
2024-07-04 12:17:08 +03:00
Evgeniy Naydanov c05a10d318 target/riscv: reset `dmi.busy` after batches
Additionally, avoid calling `riscv_batch_finished_scans()` /
decrementing reset counter if the batch run failed.

Change-Id: I3eb7b23e4dc029090e92e3e543719824add623e1
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-07-03 11:32:39 +03:00
Evgeniy Naydanov 6ea577d3f5 target/riscv: vector CSRs are optional
This is a fix to a mistake made in
ea7e17491d.

The newly introduced `gdb_regno_exist()` function was missing a part
regarding vector CSRs.
Link: ea7e17491d (diff-b4aa16f9e42cb8f0934baa7c8e0ec9c70a369bef98b99b26ae2e896c8aa95d6aL6163-L6171)

Change-Id: I0361ea4dce8df5be748e2c6e7e6838029d3a7120
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-07-03 11:27:31 +03:00
Evgeniy Naydanov aa4fcee9d1 target/riscv: use batch interface in `read_memory_bus_v1()`
Fixes #1080

Change-Id: Ifc1a48fcd0b28f7cdb1e5ad3cbd20d53ea3560a5
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-07-03 11:17:55 +03:00
Evgeniy Naydanov 4b5668bdaa
Merge pull request #1087 from en-sc/en-sc/delay-types
target/riscv: replace `info->*_delay` with `riscv_scan_delays`
2024-07-03 10:54:28 +03:00
Evgeniy Naydanov e9eca80c31
Merge pull request #1084 from en-sc/en-sc/ref-reg-files
target/riscv: separate register cache stuff into files
2024-07-03 10:52:05 +03:00
Evgeniy Naydanov 4455f7f3c8 target/riscv: simplify `sbcs` read in `write_memory_bus_v1()`
Change-Id: Ifc94614eaaa191925d44d8963cd6d1e5e8427cba
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-07-02 20:14:11 +03:00
Evgeniy Naydanov 3883b03aaa target/riscv: separate register cache stuff into files
This commit creates file structure for register cache related
functions.
Specifically:

* `riscv_reg.h` -- general interface to registers. Safe to use after
  register cache initialization is successful.
* `riscv_reg_impl.h` -- helper functions to use while implementing
  register cache initialization.
* `riscv_reg.c` -- definitions of functions from `riscv_reg.h` and
  `riscv_reg_impl.h`.
* `riscv-011_reg.h` -- register cache interface specific to 0.11
  targets.
* `riscv-013_reg.h` -- register cache interface specific to 0.13+
  targets.
* `riscv-011/0.13.h` -- version-specific methods used to access
  registers. Will be extended as needed once other functionality (not
  related to register access) is separated (e.g. DM/DTM specific stuff).

Change-Id: I7918f78d0d79b97188c5703efd0296660e529f2a
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-07-02 10:15:20 +03:00
Evgeniy Naydanov aa9a3fa348 target/riscv: replace `info->*_delay` with `riscv_scan_delays`
* Improves error handling.
* Handles possible overflow.

Change-Id: Iae0df9356af06cc21dc71c86ba7c923d1515bdc5
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-07-01 15:42:42 +03:00
Evgeniy Naydanov c6bb902629
Merge pull request #1085 from en-sc/en-sc/checkpatch-check-git
.github/workflows: check git revisions instead of a diff
2024-07-01 10:00:15 +03:00
Evgeniy Naydanov ad871cb11b
Merge pull request #1094 from en-sc/en-sc/from_upstream
Merge up to ad87fbd1cf from upstream
2024-07-01 09:59:07 +03:00
Tomas Vanek 23c33e1d3a target/cortex_m: workaround Cortex-M7 erratum 3092511
When an asynchronous exception occurs at the same time
as a breakpoint event (either hardware breakpoint or software breakpoint),
it is possible for the processor to halt at the beginning of the
exception handler instead of the instruction address pointed
by the breakpoint.

During debug entry in exception handler state and with BKPT bit set
as the only break reason in DFSR, check if there is a breakpoint, which
have triggered the debug halt. If there is no such breakpoint,
resume execution. The processor services the interrupt and
halts again at the correct breakpoint address.

The workaround is not needed during target algo run (debug_execution)
because interrupts are disabled in PRIMASK register.

Also after single step the workaround resume never takes place:
the situation is treated as error.

Link: https://developer.arm.com/documentation/SDEN1068427/latest/
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I8b23f39cedd7dccabe7e7066d616fb972b69f769
Reviewed-on: https://review.openocd.org/c/openocd/+/8332
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Liviu Ionescu
2024-07-01 03:32:22 +00:00
Evgeniy Naydanov 2eedd74197 Merge up to ad87fbd1cf from upstream
Conflicts:

* `doc/openocd.texi`: due to d382c95d57,
resolved by selecting the upstream version.

* `src/server/gdb_server.c`: between
944fe66f10 and
92e8823ebd. Resolved by adopting the use
of `LOG_TARGET_*`.
* `src/target/target.c`: between
639e68a621 and
c5358c84ad, selected the version from
`riscv-openocd`.

Change-Id: Ic1327f25e147945e0ec82947a82452501e8ee5de
2024-06-25 14:51:18 +03:00
Tomas Vanek ad87fbd1cf tcl/interface: support for Raspberry Pi 5
Make sure raspberrypi-native.cfg cannot be used on RPi5.

Add raspberrypi5-gpiod.cfg which uses linuxgpiod adapter driver.
Issue a warning if PCIe is in power save mode.

While on it, re-format warnings issued from Tcl to look similar
to LOG_WARNING() output.

Change-Id: If19b0350bd5fff83d9a0c65999e33b161fb6957a
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8333
Tested-by: jenkins
Reviewed-by: Jonathan Bell <jonathan@raspberrypi.com>
2024-06-25 07:23:18 +00:00
Antonio Borneo 67be8188bb Remove other '_s' suffix from structs
Most of the work is already done by [1].
Remove few more '_s' suffix and also fix some comment referring to
the old name of the struct.

Link: https://review.openocd.org/c/openocd/+/8340
Change-Id: Ifddc401c3b05e62ece3aa7926af1e78f0c4a671e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8341
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-06-23 09:33:47 +00:00
Marc Schink 6b984a54c9 Remove '_s' suffix from structs
Change-Id: I956acce316e60252b317daa41274403d87f704b8
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8340
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-23 09:33:33 +00:00
Marc Schink 92e8823ebd server/gdb: Use LOG_TARGET_xxx() to show target name
The output "gdb port disabled" is confusing without reference to the
target. Use LOG_TARGET_INFO() to output the target name.

While at it, use LOG_TARGET_xxx() for all log statements where the
target name is already used.

Change-Id: I70b134145837db623e008a4a6c0be0008d9a0d87
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8313
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-06-23 09:33:13 +00:00
Timur Golubovich 23ba602ca5 remote_bitbang: fix assertion failure for the cases when connection is abruptly terminated
Changes affect the function remote_bitbang_fill_buf.
When read_socket returns 0, socket reached EOF and there is
no data to read. But if request was blocking, the caller
expected some data. Such situations should be treated as ERROR.

Change-Id: I02ed484e61fb776c1625f6e36ab14c85891939b2
Signed-off-by: Timur Golubovich <timur.golubovich@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8325
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-23 09:32:08 +00:00
Antonio Borneo dde096e03f itm: fix default initialization
Commit f9509c92db ("itm: rework itm commands before 'init'")
ignores the default enable of ITM channel 0, that is applied when
no 'itm port[s]' is issued.

Call armv7m_trace_itm_config() unconditionally to handle it.

Change-Id: I3e85d0b063ed38c1552f6af9ea9eea2e76aa9025
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Paul Fertser <fercerpav@gmail.com>
Fixes: f9509c92db ("itm: rework itm commands before 'init'")
Reviewed-on: https://review.openocd.org/c/openocd/+/7900
Reviewed-by: <post@frankplowman.com>
Tested-by: jenkins
2024-06-23 09:30:43 +00:00
Antonio Borneo 198fecf5e4 target: aarch64: access reg SPSR_EL1 only in EL1, EL2 and EL3
The register SPSR_EL1 is accessible and it's content is relevant
only when the target is in EL1 or EL2 or EL3.
Plus, the register is 64 bits wide.

Without this patch, an error:
	Error: Opcode 0xd5384000, DSCR.ERR=1, DSCR.EL=1
is triggered by GDB register window or through GDB command
        x/p $SPSR_EL1
or through OpenOCD command
        reg SPSR_EL1

Detect the EL and return error if the register cannot be accessed.
Handle the register as 64 bits.

Change-Id: Ia0f984d52920cc32b8ee31157d62c13dea616a3a
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8276
Tested-by: jenkins
2024-06-23 09:29:43 +00:00
Antonio Borneo b5dfef7577 target: aarch64: access reg ESR_EL1 only in EL1, EL2 and EL3
The register ESR_EL1 is accessible and it's content is relevant
only when the target is in EL1 or EL2 or EL3.
Plus, the register is 64 bits wide.

Without this patch, an error:
	Error: Opcode 0xd5385200, DSCR.ERR=1, DSCR.EL=1
is triggered by GDB register window or through GDB command
        x/p $ESR_EL1
or through OpenOCD command
        reg ESR_EL1

Detect the EL and return error if the register cannot be accessed.
Handle the register as 64 bits.

Change-Id: Icd65470c279e5cfd03091db6435cdaa1c447644c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8275
Tested-by: jenkins
2024-06-23 09:29:37 +00:00
Antonio Borneo f39f136e01 target: aarch64: access reg ELR_EL1 only in EL1, EL2 and EL3
The register ELR_EL1 is accessible and it's content is relevant
only when the target is in EL1 or EL2 or EL3.

Without this patch, an error:
	Error: Opcode 0xd5384020, DSCR.ERR=1, DSCR.EL=1
is triggered by GDB register window or through GDB command
	x/p $ELR_EL1
or through OpenOCD command
	reg ELR_EL1

Detect the EL and return error if the register cannot be accessed.

Change-Id: I402dda4cd9dae502b05572fc6c1a8f0edf349bb1
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8274
Tested-by: jenkins
2024-06-23 09:29:29 +00:00
Antonio Borneo 2a63fabd09 target: aarch64: access reg SPSR_EL2 only in EL2 and EL3
The register SPSR_EL2 is accessible and it's content is relevant
only when the target is in EL2 or EL3.
Virtualization SW in EL1 can also access it, but this either
triggers a trap to EL2 or returns SPSR_EL1. Debugger should not
mix the real SPSR_EL2 with the virtual register.
Plus, the register is 64 bits wide.

Without this patch, an error:
	Error: Opcode 0xd53c4000, DSCR.ERR=1, DSCR.EL=1
is triggered by GDB register window or through GDB command
        x/p $SPSR_EL2
or through OpenOCD command
        reg SPSR_EL2

Detect the EL and return error if the register cannot be accessed.
Handle the register as 64 bits.

Change-Id: If3792296b36282c08d597dd46cfe044d6b8288ea
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8273
Tested-by: jenkins
2024-06-23 09:29:22 +00:00
Antonio Borneo 766a84b798 target: aarch64: access reg ESR_EL2 only in EL2 and EL3
The register ESR_EL2 is accessible and it's content is relevant
only when the target is in EL2 or EL3.
Virtualization SW in EL1 can also access it, but this either
triggers a trap to EL2 or returns ESR_EL1. Debugger should not mix
the real ESR_EL2 with the virtual register.
Plus, the register is 64 bits wide.

Without this patch, an error:
	Error: Opcode 0xd53c5200, DSCR.ERR=1, DSCR.EL=1
is triggered by GDB register window or through GDB command
        x/p $ESR_EL2
or through OpenOCD command
        reg ESR_EL2

Detect the EL and return error if the register cannot be accessed.
Handle the register as 64 bits.

Change-Id: Icb32b44886d50907f29b068ce61e4be8bed10208
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8272
Tested-by: jenkins
2024-06-23 09:29:16 +00:00
Antonio Borneo 190176a6bc target: aarch64: access reg ELR_EL2 only in EL2 and EL3
The register ELR_EL2 is accessible and it's content is relevant
only when the target is in EL2 or EL3.
Virtualization SW in EL1 can also access it, but this either
triggers a trap to EL2 or returns ELR_EL1. Debugger should not mix
the real ELR_EL2 with the virtual register.

Without this patch, an error:
	Error: Opcode 0xd53c4020, DSCR.ERR=1, DSCR.EL=1
is triggered by GDB register window or through GDB command
	x/p $ELR_EL2
or through OpenOCD command
	reg ELR_EL2

Detect the EL and return error if the register cannot be accessed.

Change-Id: Idf02b42a7339df83260c1e44ceabbb05fbf392b9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8271
Tested-by: jenkins
2024-06-23 09:29:04 +00:00
Antonio Borneo 405e78771b target: aarch64: access reg SPSR_EL3 only in EL3
The register SPSR_EL3 is accessible and it's content is relevant
only when the target is in EL3.
Plus, the register is 64 bits wide.

Without this patch, an error:
	Error: Opcode 0xd53e4000, DSCR.ERR=1, DSCR.EL=1
is triggered by GDB register window or through GDB command
        x/p $SPSR_EL3
or through OpenOCD command
        reg SPSR_EL3

Detect the EL and return error if the register cannot be accessed.
Handle the register as 64 bits.

Change-Id: I00849d99feeb96589c426fcafda98127dbd19a67
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8270
Tested-by: jenkins
2024-06-23 09:28:48 +00:00
Antonio Borneo 2306809160 target: aarch64: access reg ESR_EL3 only in EL3
The register ESR_EL3 is accessible and it's content is relevant
only when the target is in EL3.
Plus, the register is 64 bits wide.

Without this patch, an error:
	Error: Opcode 0xd53e5200, DSCR.ERR=1, DSCR.EL=1
is triggered by GDB register window or through GDB command
        x/p $ESR_EL3
or through OpenOCD command
        reg ESR_EL3

Detect the EL and return error if the register cannot be accessed.
Handle the register as 64 bits.
Drop the FIXME comment on Aarch32 case, as the register exists in
Aarch64 only.

Change-Id: Ie8c69dc7b50ae81a52506cf151c8e64e15752d0d
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8269
Tested-by: jenkins
2024-06-23 09:28:40 +00:00
Antonio Borneo 8c75e47603 target: aarch64: access reg ELR_EL3 only in EL3
The register ELR_EL3 is accessible and it's content is relevant
only when the target is in EL3.

Without this patch, an error:
	Error: Opcode 0xd53e4020, DSCR.ERR=1, DSCR.EL=1
is triggered by GDB register window or through GDB command
	x/p $ELR_EL3
or through OpenOCD command
	reg ELR_EL3

Detect the EL and return error if the register cannot be accessed.

Change-Id: I545abb196e5c34e462c7e5d5d3ec952e588642da
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8268
Tested-by: jenkins
2024-06-23 09:28:32 +00:00
Antonio Borneo bcd6a10223 target: armv8_dpm: silence error on register R/W
The command 'gdb_report_register_access_error' is used to silence
errors while reading registers and not reporting them to GDB.
Nevertheless, the error is printed by a LOG_ERROR() in armv8_dpm.

Change the message to LOG_DEBUG().
It will still cause the error to be propagated and eventually
printed by the caller (e.g. by the command 'reg').

Change-Id: Ic0db74fa28235d686ddd21a5960c52ae003e0931
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8267
Tested-by: jenkins
2024-06-23 09:28:21 +00:00
Antonio Borneo 91043cecee target: aarch64: align armv8_read_reg() and armv8_read_reg32()
These functions are today always called with non-NULL parameter
regval, so the actual check is not needed.
Anyway, for any future code change, check the parameter at the
entry of the functions and return error if it is not valid.
Simplify the check to assign the result value and align the code
of the two functions.

Change-Id: Ie4d98063006d70d9e2bcfc00bc930133caf33515
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8266
Tested-by: jenkins
2024-06-23 09:28:08 +00:00
Anatoly Parshintsev fdd07f1279
Merge pull request #1089 from en-sc/en-sc/batch-select-dmi
target/riscv: select DMI IR on batch access
2024-06-17 18:37:16 +03:00
Marc Schink c5358c84ad target: Do not use LOG_USER() for error messages
Use LOG_TARGET_ERROR() to print the error messages and additionally add
a reference to the related target.

Change-Id: I06722f3911ef4034fdd05dc9b0e2571b01b657a4
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8314
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-06-17 14:05:25 +00:00
Tomas Vanek 4892e32294 target/cortex_m: allow poll quickly get out of TARGET_RESET state
cortex_m_poll_one() detects reset testing S_RESET_ST sticky bit.
If the signal comes unexpectedly, poll must return TARGET_RESET state.

On the contrary in case of polling inside of an OpenOCD reset command,
TARGET_RESET has been has already been set and we need to get out of
it as quickly as possible.

The original code needs 2 polls: the first clears S_RESET_ST
and keeps TARGET_RESET state, the current TARGET_RUNNING or TARGET_HALTED
is reflected as late as the second poll is done.

Change the logic to keep in TARGET_RESET only when necessary.

See also [1]

Link: [1] 8284: tcl/target: ti_cc3220sf: Use halt for CC3320SF targets | https://review.openocd.org/c/openocd/+/8284
Fixes: https://sourceforge.net/p/openocd/tickets/360/
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I759461e5f89ca48a6e16e4b4101570260421dba1
Reviewed-on: https://review.openocd.org/c/openocd/+/8285
Tested-by: jenkins
Reviewed-by: Dhruva Gole <d-gole@ti.com>
2024-06-17 14:04:49 +00:00
Daniel Anselmi bf4be566a7 pld: small documentation fixes.
Change-Id: I969f51c38fc0c34c6bdba98b0e618d7f28ea4052
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/8084
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-06-15 14:25:17 +00:00
Daniel Anselmi 9bc7a381b2 pld/intel: remove idcodes from intel.c
Remove list of id codes for all families.
Maintain a list with id, bscan-length and check position
in the tcl config files for each family.

The Intel FPGA Driver option 'family' is not otional anymore.

Change-Id: I9a40a041069e84f6b4728f2cd715756a36759c89
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/8083
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-06-15 14:25:05 +00:00
Daniel Anselmi 7e4c9609ca pld/intel: remove duplicated code
Change-Id: I043d16c77ce97d3e888774747ed6bfc4c7e63c04
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/8082
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-15 14:24:32 +00:00
George Voicu b1600bb342 tcl/board: Support for Digilent Nexys 2 board
Support Digilent Nexys 2 board JTAG chain

Signed-off-by: George Voicu <razvanvg@hotmail.com>
Change-Id: I350f80b49303c4b0402d93ebc120a591ef727551
Reviewed-on: https://review.openocd.org/c/openocd/+/7336
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-15 14:14:11 +00:00
George Voicu a420f00d10 tcl/fpga: Support for Xilinx Spartan3 series devices
Tap definition for Xilinx Spartan 3/3E/3A/3AN/3A-DSP devices.

Signed-off-by: George Voicu <razvanvg@hotmail.com>
Change-Id: Ieda2b61fc270840f9192976697fcac259c45e3b8
Reviewed-on: https://review.openocd.org/c/openocd/+/7335
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-06-15 14:13:58 +00:00
George Voicu ed30c9a572 tcl/fpga/xilinx-dna: Support for reading Spartan3 DNA code
Add Xilinx Spartan3 ISC_DNA instruction

Signed-off-by: George Voicu <razvanvg@hotmail.com>
Change-Id: Iaddb079c9fdd1b91c65def36878fe81783098696
Reviewed-on: https://review.openocd.org/c/openocd/+/7331
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-15 14:13:28 +00:00
Antonio Borneo b49e03f77e target/arm_tpiu_swo: Fix memory leak on error
In case of fail to allocate 'obj->name', the memory allocated for
'obj->out_filename' is not freed, thus leaking.

Since 'obj' is allocated with calloc(), thus zeroed, switch to use
the common error exit path for both allocations of 'obj->name' and
'obj->out_filename'.

Fixes: 2506ccb509 ("target/arm_tpiu_swo: Fix division by zero")
Change-Id: I412f66ddd7bf7d260cee495324058482b26ff0c5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8300
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-06-15 14:12:06 +00:00
Evgeniy Naydanov 400cf213c0 fix GCC's `-Wcalloc-transposed-args` warning
GCC 14.1.0 warns about calls to `calloc()` with element size as the
first argument.
Link: https://gcc.gnu.org/onlinedocs/gcc-14.1.0/gcc/Warning-Options.html#index-Wcalloc-transposed-args

Change-Id: I7d44a74a003ee6ec49d165f91727972478214587
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8301
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-06-15 14:11:16 +00:00
Evgeniy Naydanov 07940e68b0 target/riscv: select DMI IR on batch access.
Without the selection the TAP can be left in bypass.

Change-Id: I79c6bf74802dc9c9475947d1787a3d0b797f3952
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-06-14 13:32:46 +03:00
Evgeniy Naydanov 38ec813ad8
Merge pull request #1073 from en-sc/en-sc/abs-reg-batch
target/riscv: write registers using batch
2024-06-10 12:01:18 +03:00
Tomas Vanek e4c0904731 flash/nor/nrf5: handle ERROR_WAIT during nRF91 flash erase
Erase is initiated by write to a flash address. Due to the
silicon errata of nRF91 the write stalls the bus until the page erase
is finished (takes up to 87ms).
If the adapter does not handle SWD WAIT properly, the following read
in nrf5_wait_for_nvmc() returns ERROR_WAIT.

Wait for fixed time before accessing AP. Not nice, but the only
working solution until all adapters handle SWD WAIT.

If the fixed wait does not suffice, continue the wait loop after a delay.
It makes some unnecessary noise however erase works.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I63faf38dad79440a0117ed79930442bd2843c6db
Reviewed-on: https://review.openocd.org/c/openocd/+/8115
Reviewed-by: Tomáš Beneš <tomas@dronetag.cz>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 09:20:14 +00:00
Tomas Vanek 70b362d4f4 flash/nor/nrf5: show proper SoC type on newer nRF91 devices
Since nRF9160 Product Specification v2.1 the new UICR SIPINFO
fields should be preferred over UICR INFO.
Tested on nRF9161.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ib8005b3b6292aa20fa83c1dcebd2de27df58b661
Reviewed-on: https://review.openocd.org/c/openocd/+/8114
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 09:19:14 +00:00
Tomas Vanek 17be341d38 tcl/target: add nRF53 and nRF91 config files
Both devices can be configured with or without SWD multidrop.

nRF53 network core is examined on demand to avoid problems
when the core is forced off.

Change-Id: I08f88ff48ff7ac592e9214b89ca8e5e9428573a5
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8113
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-06-08 09:12:14 +00:00
Tomas Vanek d94daf776c flash/nor/nrf5: add basic nRF53 and nRF91 support
Probes all flash and UICR areas.
Flash erase and write tested.

On nRF53 mass erase works on the application core flash bank only.
The Tcl script nrf53_recover can serve as the workaround on the
network core.
TODO: mass erase of the nRF53 network core flash.

Some ideas taken from [1] and [2].

Change-Id: I8e27a780f4d82bcabf029f79b87ac46cf6a531c7
Link: [1] 7404: flash: nor: add support for Nordic nRF9160 | https://review.openocd.org/c/openocd/+/7404
Link: [2] 8062: flash: nor: add support for Nordic nRF9160 | https://review.openocd.org/c/openocd/+/8062
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8112
Reviewed-by: Tomáš Beneš <tomas@dronetag.cz>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 09:04:34 +00:00
Tomas Vanek fc7a428fc2 flash/nor/nrf5: make flash erase little faster
Enable and disable erase mode only once
instead of toggling it for each sector.

Refactor to decrease the number of call levels.

Change-Id: Ie546a4fc24da0eea2753a2bebaa63d941ef7aa1d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8111
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 09:03:53 +00:00
Tomas Vanek 37f9485cef flash/nor/nrf5: introduce address maps
Preparatory change before extending support to nRF53 and 91.

While on it, rename nRF51 and 52 specific routines and constants.

Change-Id: I46bc496cef5cbde46d6755a4b908c875351f6612
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8110
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 08:59:53 +00:00
Paul Fertser ed9203f4aa gdb_server: do not start multiple instances on "pipe"
For configurations which include multiple targets and the "pipe" mode is
requested only the first gdb_server instance should be enabled,
otherwise GDB gets confusing replies, goes out of sync and the session
fails in weird ways.

Compile-tested only.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Change-Id: If8f13aa7b58e9b0dc6d5ae88cf75538b34cc1218
Reviewed-on: https://review.openocd.org/c/openocd/+/8222
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 08:51:20 +00:00
Marc Schink 1fba55a9b6 flash/nor/tcl: Fix memory leak of flash bank name
Change-Id: I54cd1ee479a0570ae849a71be47c82eebd1ae454
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8303
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-06-08 08:50:55 +00:00
Marc Schink 0a3217b8ff tcl/board: Add config for NXP FRDM-KV31F
Change-Id: I4d7cd1bcadd8159e4830107c2788708aef02add0
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8299
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 08:46:36 +00:00
Marc Schink 84126893ff tcl/board: Add config for NXP FRDM-KV11Z
Change-Id: I9cd497a085f8f9c7854ae3b96e60a73b3b050d0e
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8298
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-06-08 08:46:24 +00:00
Parshintsev Anatoly d382c95d57 target/riscv: support for smp group manipulation
this functionality allows to query if a target belongs to some smp group
and to dynamically turn on/off smp-specific behavior

Change-Id: I67bafb1817c621a38ae4a2f55e12e4143e992c4e
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Signed-off-by: Bernhard Rosenkränzer <bero@baylibre.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8296
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 08:45:44 +00:00
Tim Newsome 2f8bb252ff doc: Minimally describe the BSCAN tunnel interface.
Add minimal documentation for the BSCAN tunnel interface.
This is based on Tim Newsome <tim@sifive.com>'s work on
the RISC-V fork.

Change-Id: I5e0cd6972cb90649670249765e9bb30c2847eea6
Signed-off-by: Tim Newsome <tim@sifive.com>
Signed-off-by: Bernhard Rosenkränzer <bero@baylibre.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8297
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 08:45:21 +00:00
Mark Featherston 9623069e80 jtag/drivers/ftdi: Use command_print instead of LOG_USER for get_signal
LOG_USER only outputs to user interfaces, but leaves no way to get the
FTDI inputs over the RPC interface. Switch to command_print so this
string goes to both logs and the RPC interface.

Change-Id: I99024194b6687b88d354ef278aa25f372c862c22
Signed-off-by: Mark Featherston <mark@embeddedts.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8294
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: zapb <dev@zapb.de>
2024-06-08 08:45:04 +00:00
Antonio Borneo 72b39088ee target: reset examine after assert_reset
For some target, the API assert_reset() checks if the target has
been examined, with target_was_examined(), to perform conditional
operations like:
- assert adapter's srst;
- write some register to catch the reset vector;
- invalidate the register cache.

Targets created with -defer-examine gets the examine flag reset
right before entering in their assert_reset(), disrupting the
actions above.

For targets created with -defer-examine, move the reset examine
after the assert_reset().

Change-Id: If96e7876dcace8905165115292deb93a3e45cb36
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8293
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-06-08 08:44:36 +00:00
Noah Moroze b5e7118048 src/helper/startup: fix syntax errors
The missing closing brackets were caught by tclint v0.2.5
(https://github.com/nmoroze/tclint):

```
tclint src/helper/startup.tcl | grep "syntax error"
```

The improperly escaped backslash was caught by manual inspection during
code review.

Change-Id: I8cd44e58040d4627f6b2fc8b88ca8a930cda0ba6
Signed-off-by: Noah Moroze <noahmoroze@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8282
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 08:44:18 +00:00
Noah Moroze 7050cade9d tcl/chip/st/spear: fix syntax errors
While the current jimtcl does not consider this an error, the Tcl
dodekalogue states that strings terminate at the second double quote
character (see https://www.tcl.tk/man/tcl/TclCmd/Tcl.htm#M8).

These syntax errors were caught by tclint v0.2.5
(https://github.com/nmoroze/tclint):

```
tclint tcl/chip/st/spear/spear3xx_ddr.tcl | grep "syntax error"
```

Change-Id: I2763d93095e3db7590644652f16b7b24939d6cae
Signed-off-by: Noah Moroze <noahmoroze@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8281
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 08:44:04 +00:00
Noah Moroze 223e3d8fe7 tcl/target/c100helper: fix syntax errors
Fixes: 64d89d5ee1 ("tcl: [3/3] prepare for jimtcl 0.81 'expr' syntax change")

These syntax errors were caught by tclint v0.2.5
(https://github.com/nmoroze/tclint):

```
tclint tcl/target/c100helper.tcl | grep "syntax error"
```

Change-Id: I511c54353c4853560adca6b4852d48df2aade283
Signed-off-by: Noah Moroze <noahmoroze@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8280
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-06-08 08:43:30 +00:00
Noah Moroze eecba412cd tcl/memory: fix syntax errors
Using a command in an expression requires a bracketed command
substitution.

These syntax errors were caught by tclint v0.2.5
(https://github.com/nmoroze/tclint):

```
tclint tcl/memory.tcl | grep "syntax error"
```

Change-Id: I510d46222f4fb02d6ef73121b231d5b2df77e5c0
Signed-off-by: Noah Moroze <noahmoroze@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8279
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-06-08 08:42:34 +00:00
Marc Schink c7c4d4d48c contrib: Drop 'coresight-trace.txt'
This document is outdated and has broken text formatting. It also
provides no useful information to users nor developers, at worst it
causes confusion. For that reason, drop this file.

Change-Id: Id5ee1f6e74d1a641c60d897f114bb97f5fd48e5b
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8292
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-06-08 08:42:04 +00:00
Antonio Borneo 71013521d7 server: gdb: respect command gdb_report_register_access_error
Commit 236c54c94a ("server/gdb_server.c: support unavailable
registers") correctly returns a string of 'x' when the register is
not available in the current target.

While implementing this, it incorrectly drops the pre-existing
feature of optionally ignoring errors while reading a register.
This feature has a real use case documented in the OpenOCD manual
in chapter 'Using GDB as a non-intrusive memory inspector', where
GDB attaches to a target without halting it. For targets that need
to be halted to read its registers, we need to hack the values of
the registers returned to GDB; either returning 'xxxx' or an error
causes GDB to drop the connection.

Re-add the check on 'gdb_report_register_access_error' to keep the
pre-existing behavior when a register error has to be ignored:
- return a string of '0';
- drop a debug message.

Change-Id: Ie65c92f259f92502e688914f334655b635874179
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 236c54c94a ("server/gdb_server.c: support unavailable registers")
Reviewed-on: https://review.openocd.org/c/openocd/+/8228
Tested-by: jenkins
2024-06-08 08:38:26 +00:00
Evgeniy Naydanov 568baf8c0b
Merge pull request #1044 from en-sc/en-sc/riscv-011-sep-reg-acc
target/riscv: stop using register_get/set for 0.11 targets
2024-06-07 17:01:42 +03:00
Evgeniy Naydanov 9555b741b1 target/riscv: write registers using batch
This allows to eliminate up to two DMI NOPs.

Change-Id: I09a18bd896fce2392d1b65d4efb38b53e334a358
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-06-06 18:39:11 +03:00
Evgeniy Naydanov ff9736cc3c .github/workflows: check git revisions instead of a diff
When running on diff, Checkpatch ignores `Checkpatch-ignore` directives
in the commit message.

Change-Id: Ib296d5e972408973fb381fafc51f59569a01d1f0
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-06-05 22:34:07 +03:00
Evgeniy Naydanov 40cda81e8b
Merge pull request #1075 from en-sc/en-sc/from_upstream
Merge up to 437dde701c from upstream
2024-06-05 19:26:06 +03:00
Evgeniy Naydanov cb87885c00 target/riscv: stop using register_get/set for 0.11 targets
Caching is somewhat handled in `riscv-011.c`. Handling it additionaly in
`riscv.c` may cause problems. Sice there is no simulator that supports
RISC-V Debug Specification v0.11, so it is not feaseable to automate
testing.
This commit separates 0.11 register accesses and unlocks further
development in this area.

Change-Id: I73ff17ef85106c4ababa38319f446f6c384a1750
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-06-04 19:22:11 +03:00
Evgeniy Naydanov c470cd21ae Revert "Initialize all registers in examine"
This reverts commit 9d4df3420c.

I believe the reasoning behind this workaround is no longer valid.

Change-Id: Ie8705f75eb8ad7b72fc8ffcf39125be764cb43be
2024-06-04 19:22:11 +03:00
Anatoly Parshintsev b548653f66
Merge pull request #1056 from aap-sc/aap-sc/no_hit_bit_status
target/riscv: fix halt reason for targets that do not support hit bit on triggers
2024-06-04 18:49:42 +03:00
Evgeniy Naydanov 8568f9b9af
Merge pull request #1077 from riscv-collab/remove-slot_t-from-riscv-013
riscv-013: Remove unused typedef slot_t
2024-06-04 12:06:37 +03:00
Jan Matyas 4ac35e4f39 riscv-013: Remove unused typedef slot_t
Code cleanup: "slot_t" is unused in riscv013 - remove it.

Change-Id: I9d5a0cf8446a180b1d13a9ce2c86d904b946cf28
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2024-05-31 07:58:20 +02:00
Evgeniy Naydanov 9c4a5d64ca Merge up to 437dde701c from upstream
Conflict in src/rtos/FreeRTOS.c due to
fbea7d5d38 -- resolved by replacing
`target->type->name` with a call to `target_type_name()`.

Change-Id: I56702c6133894458903de7a4d764903004aa8b86
2024-05-30 19:46:03 +03:00
Evgeniy Naydanov 347981ca55
Merge pull request #1072 from aap-sc/aap-sc/fix_warnings_on_hide_csrs
target/riscv: do not emit warnings when a non-existent CSR is hidden
2024-05-30 19:37:35 +03:00
Parshintsev Anatoly b201a5db23 target/riscv: do not emit warnings when a non-existent CSR is hidden
hide_csrs should not emit warnings on an attempt to hide non-exitents CSR.
hide_csrs funcitonality is intended to be used for scenarios when we don`t
want certain groups of registers to be available in GDB. Typically this is
needed to simplify integration with various IDE. In such scenarious it may
be impractical/unfeseable to figure out which register is present on a
target. So reporting a situation when a user wants to hide a non-existent
register creates way too much noise. This commit reduces severity of
relevant debug message to LOG_TARGET_DEBUG
2024-05-28 22:45:37 +03:00
Parshintsev Anatoly 2c00a087da target/riscv: fix halt reason for targets that do not support hit bit on triggers
Before this patch the following behavior is observed on targets that do
not support hit bit:

```
bp 0x80000004 4 hw
resume 0x80000000
riscv.cpu halted due to watchpoint
```

This happens because the current implementation relies on the presence
of hit bit way too much. While working on this patch few defects in
hit bit-based trigger detection were discovered, added appropriate
TODOs.
2024-05-28 21:46:19 +03:00
Evgeniy Naydanov 38ef9cc99b
Merge pull request #1033 from en-sc/en-sc/err-read-abs-arg
target/riscv: read abstract args using batch
2024-05-28 10:35:56 +03:00
R. Diez 437dde701c Documentation: fix warning "unbalanced square brackets"
Change-Id: I17b716533f5c9371600f0d932bf9b81c95c349e7
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8261
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-05-26 10:01:03 +00:00
R. Diez 7c4ddfb546 Documentation: Fix 2 warnings "Underfull \hbox (badness 10000)"
The link to product GW16042 was broken, so it has been reduced to
the manufacturer's website, which fixes the warning as a side effect.

The link to Raisonance RLink was broken, and the new one is shorter,
which fixes the warning as a side effect.

Change-Id: I4df9acf2d994d51cd8f375bdac6c803270029506
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8264
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-05-26 10:00:42 +00:00
R. Diez cf48bf6d3d ChangeLog: fix warning "Wide character in print" from git2cl
Change-Id: Iaefd989413753fb59642c3887807abd6ddac4b53
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8262
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-05-26 10:00:00 +00:00
R. Diez 1fba7d53bb configure.ac: show the dummy adapter in the configuration summary
The dummy adapter now uses the same config logic as most adapters.
Its name has changed from "dummy port driver" to "Dummy Adapter".

Change-Id: Ic9ee617aab1f54215835d4d8db03f6637b797082
Signed-off-by: R. Diez <rdiezmail-openocd@yahoo.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/7340
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-26 09:58:47 +00:00
Antonio Borneo fbea7d5d38 openocd: drop include of target_type.h
Few files include target_type.h even if it is not needed.
Drop the include.

Other files access directly to target type's name instead of using
the proper API target_type_name().
Use the API and drop the include.

Change-Id: I86c0e0bbad51db93500c0efa27b7d6f1a67a02c2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8260
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-05-26 09:57:51 +00:00
Bernhard Rosenkränzer ccc5c1642b Fix build with clang even if it sets __GNUC__ to >= 4.4
clang doesn't support the gnu_printf attribute that OpenOCD uses if
__GNUC__ and __GNUC_MINOR__ indicates gcc >= 4.4.

Most clang builds set __GNUC__/__GNUC_MINOR__ to 4.2 for historical
reasons, so they don't trigger this condition; however, some builds set
it to something much higher to work around code using __GNUC__ to
determine if a feature that does exist in clang (but not gcc 4.2) is
available, causing OpenOCD to use attribute gnu_printf.

The problem can be reproduced without a special clang build by adding
-fgnuc-version=14.1 to CFLAGS.

Change-Id: I3c0832d4201578b116c5214203f95b6153dad30e
Signed-off-by: Bernhard Rosenkränzer <bero@baylibre.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8258
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-26 09:56:50 +00:00
Marc Schink bd89b91c69 target/semihosting: Fix double free()
Do not free the service in 'connection_closed_handler' because it is
free'd by the server infrastructure.

Checkpatch-ignore: COMMIT_LOG_LONG_LINE

This error was detected with valgrind:

==272468== Invalid free() / delete / delete[] / realloc()
==272468==    at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==272468==    by 0x1F34C7: remove_service (server.c:374)
==272468==    by 0x2ED3D5: semihosting_tcp_close_cnx (semihosting_common.c:1819)
==272468==    by 0x2ED3D5: handle_common_semihosting_redirect_command (semihosting_common.c:1926)
==272468==    by 0x1FC703: exec_command (command.c:520)
==272468==    by 0x1FC703: jim_command_dispatch (command.c:931)
==272468==    by 0x36980F: JimInvokeCommand (in /home/marc/openocd/build/src/openocd)
==272468==    by 0x1FFFFFFFFF: ???
==272468==    by 0x53ED09F: ???
==272468==    by 0x300000001: ???
==272468==    by 0x1FFEFFF7FF: ???
==272468==    by 0x3D3984: ??? (in /home/marc/openocd/build/src/openocd)
==272468==    by 0x2: ???
==272468==  Address 0x5fff650 is 0 bytes inside a block of size 24 free'd
==272468==    at 0x484B27F: free (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==272468==    by 0x2ECA42: semihosting_service_connection_closed_handler (semihosting_common.c:1807)
==272468==    by 0x1F2E39: remove_connection.isra.0 (server.c:164)
==272468==    by 0x1F349E: remove_connections (server.c:350)
==272468==    by 0x1F349E: remove_service (server.c:364)
==272468==    by 0x2ED3D5: semihosting_tcp_close_cnx (semihosting_common.c:1819)
==272468==    by 0x2ED3D5: handle_common_semihosting_redirect_command (semihosting_common.c:1926)
==272468==    by 0x1FC703: exec_command (command.c:520)
==272468==    by 0x1FC703: jim_command_dispatch (command.c:931)
==272468==    by 0x36980F: JimInvokeCommand (in /home/marc/openocd/build/src/openocd)
==272468==    by 0x1FFFFFFFFF: ???
==272468==    by 0x53ED09F: ???
==272468==    by 0x300000001: ???
==272468==    by 0x1FFEFFF7FF: ???
==272468==    by 0x3D3984: ??? (in /home/marc/openocd/build/src/openocd)
==272468==  Block was alloc'd at
==272468==    at 0x484DA83: calloc (in /usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so)
==272468==    by 0x2ED326: handle_common_semihosting_redirect_command (semihosting_common.c:1931)
==272468==    by 0x1FC703: exec_command (command.c:520)
==272468==    by 0x1FC703: jim_command_dispatch (command.c:931)
==272468==    by 0x36980F: JimInvokeCommand (in /home/marc/openocd/build/src/openocd)
==272468==    by 0x1FFFFFFFFF: ???
==272468==    by 0x53ED09F: ???
==272468==    by 0x400000002: ???
==272468==    by 0x1FFEFFF7FF: ???
==272468==    by 0x3D3984: ??? (in /home/marc/openocd/build/src/openocd)
==272468==    by 0x2: ???
==272468==

Change-Id: I3e5323f145a98d1ff9ea7d03f87ed96140f49a18
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8257
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-26 09:55:45 +00:00
Marc Schink edb14a02e9 tcl/target/nrf52: Configure trace port speed
Configure the TRACECONFIG.TRACEPORTSPEED register depending on the
trace clock speed. Also catch invalid trace clock speeds.

Change-Id: I1ece1cc59da539732d2d71f296fd55799c195387
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8256
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-05-26 09:55:31 +00:00
Marc Schink 1a00c67e10 tcl/target/nrf52: Use 'error' instead of 'echo'
Use 'error' instead of 'echo' for error messages. Otherwise, capturing
is always started, for example with an unsupported device.

While at it, make the error messages more consistent and clear.

Change-Id: I83c9abfb4514e6b638c4be14651e67f768af8bad
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8255
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: <post@frankplowman.com>
2024-05-26 09:54:17 +00:00
Marc Schink be1aebd818 target/arm_tpiu_swo: Handle errors in pre/post-enable events
Currently, errors in pre/post-enable events are ignored and capturing is
always started, even if necessary device configuration fails. This
behaviour is confusing to users. Also, the TPIU must be disabled before
re-configuration is possible.

Start capturing and enable TPIU only if no errors in pre/post-enable
events occurred.

Change-Id: I422033e36ca006e38aa4504d491b7947def1237a
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8254
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-05-26 09:54:01 +00:00
Marc Schink c831758ea4 server/gdb: Use 'bool' data type where appropriate
Change-Id: Ic23c5469334337963185b69fcabeedf70c2c7ae9
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8253
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-05-26 09:53:40 +00:00
Marc Schink 2506ccb509 target/arm_tpiu_swo: Fix division by zero
When external capturing is configured (default), the SWO pin frequency
is required. Enforce this to avoid a division by zero error.

While at it, ensure that the 'out_filename' variable always contains a
valid string. This saves a few checks and makes the code more clean and
readable.

Change-Id: If8c1dae9549dd10e2f21d5b896414d47edac9fc2
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8224
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-26 09:53:03 +00:00
Evgeniy Naydanov 1db7ca1929 target/riscv: read abstract args using batch
This would elliminate the need for an extra nop in-between the two reads
in case of a 64-bit register.

Change-Id: I2cddc14f7f78181bbda5f931c4e2289cfb7a6674
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-05-23 14:17:13 +03:00
Evgeniy Naydanov ac120651c8
Merge pull request #1061 from en-sc/en-sc/dm-reset
target/riscv: only `dmactive` can be written if `dmactive` is low
2024-05-18 17:25:06 +03:00
Evgeniy Naydanov 4924f63926
Merge pull request #1029 from MrAlexei/add_decode_wp_rvc
Add functions to decode RVC load and store instructions for watchpoints
2024-05-17 16:39:12 +03:00
Evgeniy Naydanov 418fcf1cea target/riscv: only `dmactive` can be written if `dmactive` is low
There was an error introduced by
8319eee9e1.

According to RISC-V Debug Spec 1.0.0-rc1 [3.14.2. Debug Module Contro]:
> 0 (inactive): The module’s state, including authentication mechanism,
takes its reset values (the dmactive bit is the only bit which can be
written to something other than its reset value).

`dmactive` was written together with `hartsel` and `hasel` in
8319eee9e1.

Change-Id: I11fba35cb87f8261c0a4a45e28b2813a5a086078
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-05-15 18:58:47 +03:00
Ian Thompson 2c8376b79d target/xtensa: avoid IHI for writes to non-executable memory
For MPU configs, determine memory access rights
by probing protection TLB.  Issuing IHI without execute
permissions can trigger an exception.

No new clang static analyzer warnings.

Change-Id: Iea8eab5c2113df3f954285c3b9a79e96d41aa941
Signed-off-by: Ian Thompson <ianst@cadence.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8080
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-11 11:55:55 +00:00
Parshintsev Anatoly 22ddf62d75 gdb_server: enable keep-alive packets for qCRC packet
Change-Id: Ia384179bb83ad6b70bf385cc9d575e9ec58f76c7
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8227
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-11 11:55:17 +00:00
Antonio Borneo 126d8a0972 cortex_a: drop cortex_a_dap_write_memap_register_u32()
Historically, the function cortex_a_dap_write_memap_register_u32()
was used to discriminate the register write in APB-AP CPU debug
against the complex memory access in AHB-AP memory bus.

It has no sense to keep the function and its comment.
Plus, by forcing atomic write it impacts the debug performance.

Drop it!
A further rework to enqueue sequence of atomic writes is needed.

Change-Id: I2f5e9015f0e27fa5a6d8337a1ae25e753e2e1d26
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8231
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Tested-by: jenkins
2024-05-11 11:54:51 +00:00
Antonio Borneo caabdd4a66 cortex_a: drop the command 'cache auto'
The command 'cache auto' was introduced with commit cd440bd32a
("add armv7a_cache handlers") in 2015 to allow disabling the cache
handling done automatically by OpenOCD.
This was probably a way to test the cache handling when there were
still the two independent accesses for APB-AP CPU debug and for
AHB-AP memory bus.

The handling of cache for cortex_a is robust and there is no more
reason to disable it.
The command 'cache auto' is not used in any upstream script.
On target aarch64 this command has never been introduced as the
cache is always handled automatically by OpenOCD.

Drop the command 'cache auto' and add it in the deprecated list.
Drop the flag 'auto_cache_enabled' by considering it as true.
Rename the function 'armv7a_cache_auto_flush_all_data()' as
'armv7a_cache_flush_all_data()' and, while there, fix the error
propagation in SMP case.

Change-Id: I0399f1081b08c4929e0795b76f4a686630f41d56
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8230
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-11 11:54:40 +00:00
Antonio Borneo dbef02789f cortex_a: drop useless cache invalidate on mem write
The initial OpenOCD code for Cortex-A (ARMv7a) [1] was merged in
2009 but, due to lack of public documentation for ARMv7a, it was
almost a simple copy/paste from the existing code for Cortex-M
(ARMv7m).

On Cortex-M the same AP provides access to both CPU debug and CPU
memory. This feature is not present on ARMv7a.
To still keep some communality with ARMv7m code, the change [2]
splits the CPU debug access from the CPU memory access by using
two independent AP; this is copied from the system architecture of
TI OMAP3530 which provides to DAP a direct AHB-AP memory bus on
AP#0, separated from AP#1 for the APB-AP CPU debug.
But the direct memory access through the system bus breaks the
coherency between memory and CPU caches, so change [3] added some
cache invalidation to avoid issues.

The code to allow ARMv7a CPU to really read/write in CPU memory
was added by change [4] in 2011. Such still not optimized
implementation was very slow, so it did not replace the access
through the system bus. A selection through DAP's 'apsel" command
was used to select between the two modes.

Only in 2015, with change [5], the speed of CPU read/write was
improved using the DCC_FAST_MODE. But the direct access to the
memory through the system bus remained.

Finally, with change [6] in 2018 the system bus access was dropped
for good, as the new virtual target "mem_ap" could implement such
access in a more clean way.
Only memory access through CPU remained for ARMv7a.
Nevertheless, a useless cache invalidation remained in the code,
decreasing the speed of the write access.

Drop the useless cache invalidate on CPU memory write and the
associated comment, not anymore valid.
Drop the now unused function armv7a_cache_auto_flush_on_write().

This provides a speedup of between 4 and 8, depending on adapter
and JTAG/SWD speed.

Link: [1] 7a93100c2d ("Add minimalist Cortex A8 file")
Link: [2] 1d0b276c9f ("The rest of the Cortex-A8 support from Magnus: ...")
Link: [3] d4e4d65d28 ("Cache invalidation when writing to memory")
Link: [4] 05ab8bdb81 ("cortex_a9: implement read/write memory through APB-AP")
Link: [5] 0228f8e827 ("Cortex A: fix extra memory read and non-word sizes")
Link: [6] fac9be64d9 ("target/cortex_a: remove buggy memory AP accesses")

Change-Id: Ifa3c7ddf2698b2c87037fb48f783844034a7140e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8229
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-11 11:54:11 +00:00
Evgeniy Naydanov ae7ffa424e
Merge pull request #1064 from en-sc/en-sc/from_upstream
Merge up to 04154af5d6 from upstream
2024-05-07 10:54:01 +03:00
Daniel Anselmi bc9ca5f4a8 ipdbg: fix double free of virtual-ir data
Fix possible double free and possible
memory leak while creating an ipdbg hub.

Change-Id: I6254663c27c4f38d46008c4dbff11aa27b84f399
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/8085
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-04 08:36:50 +00:00
Sean Anderson a84d1b5f5e tcl/target: Add helpers for booting Xilinx ZynqMP from JTAG
Add some helpers for booting ZynqMPs over JTAG. Normally, the CSU ROM
will load boot.bin from the boot medium. However, when booting from JTAG
we have to do this ourselves. There are generally two parts to this.
First, we need to load the PMU firmware. Xilinx's tools do this by
attaching to the PMU (a Microblaze CPU) over JTAG. However, the TAP is
undocumented and we don't have any microblaze support in-tree. So
instead we do it the same way FSBL does it:

- We ask the PMU to halt
- We load the firmware into the PMU RAM
- We ask the PMU to resume

The second thing we need to do is start one of the APU cores. When an
APU is released from reset, it starts executing at the value of its
RVBARADDR. While we could load the APU firmware over the AXI target,
it is faster to load it over the APU target. To do this, we put the APU
into an infinite loop before halting it. As an aside, I chose to use the
"APU" terminology as opposed to "core" to make it clear that these
commands operate on the A53 cores and not the R5F cores.

Typical usage of these commands could look something like

	targets uscale.axi
	boot_pmu /path/to/pmu-firmware.bin
	boot_apu /path/to/u-boot-spl.bin

But of course there is always the option to call lower-level commands
individually if your boot process is more unusual.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Change-Id: I816940c2022ccca0fabb489aa75d682edd0f6138
Reviewed-on: https://review.openocd.org/c/openocd/+/8133
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-05-04 08:36:23 +00:00
Antonio Borneo 3eba7b53bf smp: fix SIGSEGV for "smp off" during target examine
The gdb subsystem is initialized after the first target examine,
so the field struct target::gdb_service is NULL during examine.

A command "smp off" in the examine event handler causes a SIGSEGV
during OpenOCD startup.

Check for pointer not NULL before dereferencing it.

Change-Id: Id115e28be23a957fef1b97ab66d7273f0ea0dce4
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8216
Tested-by: jenkins
2024-05-04 08:35:27 +00:00
Antonio Borneo c72afedce7 target: cortex_a: fix regs invalidation when -defer-examine
The code for cortex_a allocates the register cache during the very
first examine of the target.
To prevent a segmentation fault in assert_reset(), the call to
register_cache_invalidate() is guarded by target_was_examined().

But for targets with -defer-examine, the target is set as not
examined in handle_target_reset() just before entering in
assert_reset().

This causes registers to not be invalidated while reset a target
examined but with -defer-examine.

Change the condition and invalidate the register cache if it has
been already allocated.

Change-Id: I81ae782ddce07431d5f2c1bea3e2f19dfcd6d1ce
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8215
Tested-by: jenkins
2024-05-04 08:35:00 +00:00
Antonio Borneo 42e31d75b4 target: aarch64: fix regs invalidation when -defer-examine
The code for aarch64 allocates the register cache during the very
first examine of the target.
To prevent a segmentation fault in assert_reset(), the call to
register_cache_invalidate() is guarded by target_was_examined().

But for targets with -defer-examine, the target is set as not
examined in handle_target_reset() just before entering in
assert_reset().

This causes registers to not be invalidated while reset a target
examined but with -defer-examine.

Change the condition and invalidate the register cache if it has
been already allocated.

Change-Id: Ie13abb0ae2cc28fc3295d678c4ad1691024eb7b8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8214
Tested-by: jenkins
2024-05-04 08:34:37 +00:00
Antonio Borneo 89d881c19a cortex_m: don't try to halt not-examined targets
Prevent a segmentation fault by preventing to try to halt a target
that has not been examined yet.

Change-Id: I5d344e7fbdb5422f7c5e2c39bdd48cbc6c2a3e58
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8213
Tested-by: jenkins
2024-05-04 08:33:54 +00:00
Marc Schink 8667a72653 target/target: Add 'debug_reason' to current target
Change-Id: Ie35b13b3e06411b4866ffeada47b3262493dbf2e
Signed-off-by: Marc Schink <dev@zapb.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8021
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-05-04 08:31:14 +00:00
Antonio Borneo ac6b00c3ca target: cortex_m: fix display of DWT registers
Commit 16b4b8cf54 ("Cortex-M3: expose most DWT registers") added
the DWT registers to the list of CPU registers.
The commit message from 2009 reports the reason behind this odd
mixing of CPU and DWT registers.
This feature got broken in 2017 with the introduction of the field
struct reg::exist and its further use in the code. As result, the
command 'reg' on a target Cortex-M reports only the core registers
and then the header line
	===== Cortex-M DWT registers
not anymore followed by the DWT registers.

Fix it by tagging each DWT registers as existing.

Change-Id: Iab026e7da8d6b8ba052514c3fd3b5cdfe301f330
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: b5964191f0 ("register: support non-existent registers")
Reviewed-on: https://review.openocd.org/c/openocd/+/8198
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-05-04 08:24:27 +00:00
Antonio Borneo a9e8ca55a6 jtag: linuxgpiod: minor alignment to coding style
Avoid double TAB in 'then' block by increasing indentation of the
multi-line condition.

Change-Id: I7f5a4437fe4f74228f1b0d98e5c5921af4fd36b8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8200
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-04 08:22:11 +00:00
Antonio Borneo 495311d206 doc: style: report indentation of multi-line condition
To help readability and discriminate the 'then' block from the
multi-line condition, suggest to increase the indentation of the
condition.

Change-Id: I02e3834be3001e7ecf24349ad3cefe94b27b79c8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8199
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-04 08:21:33 +00:00
Evgeniy Naydanov 6a72b323da
Merge pull request #1028 from en-sc/en-sc/busy-reset-batch
target/riscv: reset delays during batch scans
2024-05-02 10:55:16 +03:00
Aleksey Lotosh 69cf9babfb Add functions to decode RVC load and store instructions
For GDB to fully support hardware watchpoints, OpenOCD needs to tell GDB
which data address has been hit. OpenOCD relies on a target-specific
hit_watchpoint function to do this. If GDB is not given the address, it
will not print the hit variable name or its old and new value.

There does not seem to be a way for the hardware to tell us which
trigger
was hit (0.13 introduced the 'hit bit' but this is optional).
Alternatively,
we can decode the instruction at dpc and find out which memory address
it accesses.

This commit adds support for RVC (compressed) load and store
instructions.

Related to:
https://github.com/riscv-collab/riscv-openocd/issues/688
https://github.com/riscv-collab/riscv-openocd/pull/291
2024-04-30 10:50:51 +03:00
Evgeniy Naydanov 687f00c060
Merge pull request #1031 from aap-sc/aap-sc/hart_status_info_fixup
fix confusing status messages during resume
2024-04-27 16:44:09 +03:00
Evgeniy Naydanov 9563cd67e6
Merge pull request #1055 from aap-sc/aap-sc/bp_unitialized
target/riscv: use breakpoint_hw_set/watchpoint_set to properly initialize bp/wp descriptor
2024-04-27 16:42:29 +03:00
Evgeniy Naydanov c0791b1c9e Merge up to 04154af5d6 from upstream
Change-Id: I84c1566472e5416bc2a71afa5adaf63c6c7a4a75
2024-04-27 15:16:16 +03:00
Evgeniy Naydanov 68fcd1c5b7 target/riscv: reset delays during batch scans
This commit is related to testing how OpenOCD responds to `dmi.busy`.

Consider testing on Spike (e.g. `riscv-tests/debug` testsuite). Spike
returns `dmi.busy` if there were less then a given number of RTI cycles
(`required_rti_cycles`) between DR_UPDATE and DR_CAPTURE:
https://github.com/riscv-software-src/riscv-isa-sim/blob/master/riscv/jtag_dtm.cc#L145
https://github.com/riscv-software-src/riscv-isa-sim/blob/master/riscv/jtag_dtm.cc#L202
`required_rti_cycles` gets it's value from `--dmi-rti` CLI argument and
is constant throughout the run.

OpenOCD learns this required number of RTI cycles by starting with zero
and increasing it if `dmi.busy` is encountered. So the required number
of RTI cycles is learned during the first DMI access in the `examine()`.

To induce `dmi.busy` on demand `riscv reset_delays <x>` command is
provided. This command initializes `riscv_info::reset_delays_wait`
counter to the provided `<x>` value. The counter is decreased before a
DMI access and when it reaches zero the learned value of RTI cycles
required is reset, so the DMI access results in `dmi.busy`.

Now consider running a batch of accesses.  Before the change all the
accesses in the batch had the same number of RIT cycles in between them.
So either:
* Number of accesses in the batch was greater then the value of
  `riscv_info::reset_delays_wait` counter and there was no `dmi.busy`
throughout the batch.
* Number of accesses in the batch was less or equal then the value of
  `riscv_info::reset_delays_wait` counter and the first access of the
batch resulted in `dmi.busy`.

Therefore it was impossible to encounter `dmi.busy` on any scan of the
batch except the first one.

Change-Id: Ib0714ecaf7d2e11878140d16d9aa6152ff20f1e9
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-26 21:24:54 +03:00
Evgeniy Naydanov e51f8695ed
Merge pull request #1025 from en-sc/en-sc/dump-field
target/riscv: decode DMI scans in batch access
2024-04-26 20:49:35 +03:00
Evgeniy Naydanov de03da8c2c
Merge pull request #1046 from en-sc/en-sc/reg-rv011-segfault-propper
target/riscv/riscv-011.c: fix access to non-existent register
2024-04-26 20:49:11 +03:00
Evgeniy Naydanov 5aac841f4a
Merge pull request #1054 from en-sc/en-sc/rv011-pc-dpc
target/riscv/riscv-011: pc and dpc should be cached at the same location
2024-04-26 20:48:47 +03:00
Evgeniy Naydanov 16db1b77ff
Merge pull request #1050 from TommyMurphyTM1234/update-github-actions
Bump GitHub actions to latest versions
2024-04-25 08:56:11 +03:00
Parshintsev Anatoly 665fbf605b fix confusing status messages during resume
Recently, (after b503fdef02) OpenOCD started to notify user about hart
state updates. This causes confusion in some cases since some internal
updates to the hart state should not be visible to the user as these are
implementation details. For example situation like this:

```
> reset halt
JTAG tap: riscv.tap tap/device found: 0xdeadbeef ...
> resume
[riscv.cpu0] Found 4 triggers
riscv.cpu0 halted due to single-step.
[riscv.cpu1] Found 4 triggers
riscv.cpu1 halted due to single-step.
[riscv.cpu2] Found 4 triggers
riscv.cpu2 halted due to single-step.
[riscv.cpu3] Found 4 triggers
riscv.cpu3 halted due to single-step.
```
likely confuse people.

There is no issue with the resume functionality. It`s just that
resume internally causes single-step that causes hart state
to change.

This commit disable calling of user-specified (and default)
callbacks during the "hidden" step operation disabling these
confusing messages

Change-Id: I3412a089e2abdcd315d86cec7ee732fdd18c1601
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
2024-04-24 02:34:48 +03:00
Parshintsev Anatoly 88f7650a6d target/riscv: use breakpoint_hw_set/watchpoint_set to properly initialize bp/wp descriptor
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
2024-04-24 02:07:16 +03:00
Evgeniy Naydanov 98ece6bac9 target/riscv/riscv-011: pc and dpc should be cached at the same location
Prior to the commit, pc was cached at `info->dpc`, but dpc at register
cache.

Change-Id: I369788441dbe21bcf8fc360d2e97e98096b25e3a
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-23 16:42:55 +03:00
Tommy Murphy 5c80ac8c57 Bump GitHub actions to latest versions - https://github.com/riscv-collab/riscv-openocd/issues/1048 2024-04-22 09:21:05 +01:00
Evgeniy Naydanov 967510cb1d target/riscv/riscv-011.c: fix access to non-existent register
`reg` is a number in register cache, as evident by the following call to
`reg_cache_set()`. `CSR_DCSR` is `GDB_REGNO_DCSR - 65`. This results in
setting cache value for another register, which does not exist, and
causes a segfault if all non-existent registers are not allocated a
value (`reg->value == NULL`).

Change-Id: Iab68a4bb55ce6d4730804e9709e40ab2af8a07c6
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-20 00:11:51 +03:00
Evgeniy Naydanov e1e6cdfec6 target/riscv: decode DMI scans in batch access
This allows to merge the implementation in `batch.c` with the one in
`riscv-013.c`.

Change-Id: Ic3821a9ce2d75a7c6e618074679595ddefb14cfc
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-19 13:21:19 +03:00
Evgeniy Naydanov 3991492cc1
Merge pull request #1040 from rivos-eblot/dev/ebl/read_mem_dmibase
target/riscv: Add missing DM base offset to read_memory_bus_v1()
2024-04-14 17:00:24 +03:00
Evgeniy Naydanov 740cdc78f3
Merge pull request #1023 from en-sc/en-sc/check-ac-busy
target/riscv: check `abstractcs.busy`
2024-04-14 16:59:04 +03:00
Evgeniy Naydanov 93f6260621
Merge pull request #1039 from en-sc/en-sc/running-cache
target/riscv: read registers are not valid on a running target
2024-04-14 16:58:10 +03:00
Evgeniy Naydanov 27fbc2767a
Merge pull request #1036 from en-sc/en-sc/from_upstream
Merge up to a35e254c53 from upstream
2024-04-14 16:57:29 +03:00
Evgeniy Naydanov 34d6fe3676 target/riscv: check `abstractcs.busy`
According to the RISC-V Debug Spec (1.0.0-rc1)[3.7 Abstract Commands]:
> While an abstract command is executing (busy in abstractcs is high), a
debugger must not change hartsel, and must not write 1 to haltreq,
resumereq, ackhavereset, setresethaltreq, or clrresethaltreq.

The patch ensures the rule is followed.

Change-Id: Id7d363d9fdeb365181b7058e0ceb0be0df39654f
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-11 12:30:15 +03:00
Evgeniy Naydanov 8319eee9e1 target/riscv: introduce `examine_dm()` function
This allows to examine each DM ones (e.g. enumerating harts assigned to
the DM). Additionaly, it is guaranteed that the DM is reset before the
examination.

Change-Id: I2333d06ff1152bf51c647d59baa55cb402054cb9
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-11 12:30:09 +03:00
Evgeniy Naydanov 67b2a5a955 target/riscv: cache `abstractcs.busy` in `dm013_info_t`
According to the RISC-V Debug Spec (1.0.0-rc1)[3.7 Abstract Commands]:
> While an abstract command is executing (busy in abstractcs is high), a
debugger must not change hartsel, and must not write 1 to haltreq,
resumereq, ackhavereset, setresethaltreq, or clrresethaltreq.

Tracking `abstractcs.busy` allows to enforce this rule.

Change-Id: If5975b48cf9fd379033268145c79103c36fb8134
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-10 13:10:19 +03:00
Antonio Borneo 04154af5d6 jtag: linuxgpiod: drop extra parenthesis
Checkpatch complains for extra parenthesis not required.

Drop them.

Change-Id: I311409f5732acf10a4910de5dcf0fb05f43e21b5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8187
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-04-07 20:09:42 +00:00
Walter Ji 47d983a77a target/mips32: fix clang sbuild check fail
Initialized `value` variables that could only be set in a branch.

Change-Id: Iec7413ade9d053c93352a58ff954ad49a6545923
Signed-off-by: Walter Ji <walter.ji@oss.cipunited.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8179
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-04-07 19:36:49 +00:00
J. Neuschäfer 79b51fedab remote_bitbang: Change sleep commands to Zz to avoid conflict with SWD
It was noticed that the remote_bitbang protocol has a design issue:
SWD and sleep commands cannot be implemented at the same time, because
they overlap:

 - SWD uses d,e,f,g for setting pin state
 - sleep uses d,D for microsecond and millisecond sleep, respectively

This has previously been reported by Marek Vrbka, but it wasn't fixed.

This commit does the following to resolve the issue:

 - Change the sleep commands to 'Z' for 1 ms, 'z' for 1 µs
 - Document 'D' and 'd' as deprecated aliases
 - Switch the remote_bitbang driver in OpenOCD to 'Z' and 'z'

Unfortunately that's a breaking change, because existing adapter-side
implementations of the protocol will have to implement the new commands
to keep working with future versions of OpenOCD. Fortunately, the
remote sleep commands haven't been part of an OpenOCD release yet,
which should limit the breakage somewhat.

Reported-by: Marek Vrbka <marek.vrbka@codasip.com>
Link: https://sourceforge.net/p/openocd/mailman/openocd-devel/thread/670d28d2-75a1-45ec-afe5-541415701d7a%40codasip.com/
Fixes: e8e09b1b5 ("remote_bitbang: add use_remote_sleep option to send delays to remote")
Change-Id: I04d2790a33bff9d47eb7f69b3275fd9a271625ae
Signed-off-by: J. Neuschäfer <j.neuschaefer@gmx.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/8191
Reviewed-by: David Ryskalczyk <david.rysk@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Reviewed-by: Jeremy Herbert <jeremy.006@gmail.com>
2024-04-07 19:36:29 +00:00
Antonio Borneo e035756b22 jtag: linuxgpiod: fix detection for line request bias
Commit 290eac04b9 ("drivers/linuxgpiod: Migrate to adapter gpio
commands") introduced an incorrect check to determine if the
library libgpiod declares the line request flags:
	GPIOD_LINE_REQUEST_FLAG_BIAS_DISABLE
	GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_UP
	GPIOD_LINE_REQUEST_FLAG_BIAS_PULL_DOWN
The names above are declared by the library inside an enum, thus
cannot be used by the C preprocessor in a #ifdef.

Determine in configure if the version of libgpiod provides the
line request flags for "bias" and define a C macro.
Use the new macro in the driver code.

Change-Id: Iaa452230f4753fce4c6e9daa254299cedb7cab7f
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 290eac04b9 ("drivers/linuxgpiod: Migrate to adapter gpio commands")
Reviewed-on: https://review.openocd.org/c/openocd/+/8186
Tested-by: jenkins
Reviewed-by: Michael Heimpold <michaheimpold@gmail.com>
2024-04-07 19:35:41 +00:00
Antonio Borneo 74e7fcb2dd configure: prevent build of linuxgpiod with libgpiod v2
The API in libgpiod v2 have changed, and current driver code for
linuxgpiod does not build anymore.

Prevent building the current driver linuxgpiod with the new
library.

Change-Id: Ie673db786dc50ae18a263d2c0a2b46b106866450
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8185
Reviewed-by: Michael Heimpold <michaheimpold@gmail.com>
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-04-07 19:35:02 +00:00
Dominik Wernberger 329e983ee9 zynq_7000.cfg: Fix issue 'Error: can't read "zynq_pl": no such variable'
Change-Id: Ic79ce114b60d0707a6e082a81743b378b164b4e2
Signed-off-by: Dominik Wernberger <dominik.wernberger@gmx.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8190
Reviewed-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-04-07 13:46:13 +00:00
Evgeniy Naydanov 9c45c9f4be target/riscv: read registers are not valid on a running target
Change-Id: I2c5335bb6055b767d3c3ffb3f6910b71b9c2bb35
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-04-05 14:19:33 +03:00
Emmanuel Blot fbd9b3d5f4 target/riscv: Add missing DM base offset to read_memory_bus_v1()
dmi_scan expects the full DMI address.

Signed-off-by: Emmanuel Blot <eblot@rivosinc.com>
2024-04-04 19:41:48 +02:00
Steven Chang dd17582722 flash/nor/eneispif: support ENE KB1200 ispi flash
Change-Id: I03bccceb1956ee121e6a3728b7d647ef1262fa23
Signed-off-by: Steven Chang <steven@ene.com.tw>
Reviewed-on: https://review.openocd.org/c/openocd/+/8136
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-04-01 05:51:33 +00:00
Evgeniy Naydanov 46e7507e48 Merge up to a35e254c53 from upstream
Checkpatch-ignore: MACRO_ARG_REUSE, MACRO_ARG_PRECEDENCE
Change-Id: Icd10f44d162054f8f32019a579ccbdda2cee7a91
2024-03-28 12:40:33 +03:00
Evgeniy Naydanov 722cef1ae0
Merge pull request #1022 from en-sc/en-sc/upstream-refactor-reg-acc
[NFC] target/riscv: refactor `init_registers()`
2024-03-27 20:10:10 +03:00
Tomas Vanek a35e254c53 target/adi_v5_swd: move setting of do_reconnect one level up
Move setting of do_reconnect flag from swd_run_inner()
to swd_run(). Reconnect is not used at the inner level
and the flag had to be cleared after swd_run_inner()
to prevent recursion.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ib1de80bbdf10d1cbfb1dd351c6a5658e50d12af2
Reviewed-on: https://review.openocd.org/c/openocd/+/8155
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-24 13:42:24 +00:00
Antonio Borneo c02cf9404d helper/list: include the correct header file
The file 'list.h', copied from FreeBSD, does not depend from any
OpenOCD specific include file, but only needs 'stddef.h' for the
type 'size_t'.

Let 'list.h' to include the correct header file, then fix the now
broken dependencies in the other files that were incorrectly
relying on 'list.h' to include 'helper/types.h'

Change-Id: Idd31b5bf607e226cac44ef41b2aa335ae4dbf519
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8173
Tested-by: jenkins
2024-03-24 13:41:17 +00:00
Antonio Borneo a213afad09 helper/list: Replace Linux code with FreeBSD one
The file list.h was originally taken from the Linux kernel code,
thus under license GPL-2.0-only. This locks OpenOCD to follow the
same license, even if the majority of OpenOCD files are licensed
as GPL-2.0-or-later.

A similar file is also present in FreeBSD code base under the more
permissive license BSD-2-Clause.

Drop the code from Linux kernel and replace it with the code from
FreeBSD 13.3.0.
Adapt the code to OpenOCD coding style by fixing the majority of
issues identified by checkpatch.
Add the OpenOCD specific macros and comments.

Unfortunately this causes the lost of all the doxygen comments.

Checkpatch-ignore: MACRO_ARG_REUSE, MACRO_ARG_PRECEDENCE
Change-Id: I6d86752c50158f3174c4e8c4add81e9998d01e0e
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8172
Tested-by: jenkins
2024-03-24 13:41:03 +00:00
Antonio Borneo 35e4c4616f gdb_server: drop useless check in gdb_keep_client_alive()
OpenOCD can send it's log to gdb, and gdb replies with 'OK'.
Calls to LOG_XXX() are also present in the code that communicates
with gdb. This can cause infinite nested calls.

OpenOCD uses the flag 'gdb_con->busy' to protect the communication
with gdb and prevent nested calls.

There is no reason to check for 'gdb_con->busy' in the code for
keep-alive, as keep_alive() is never called in this gdb server;
the flag would eventually be set if the current keep_alive() will
send something to gdb.

Drop the flag 'gdb_con->busy' in gdb_keep_client_alive().
While there, document the use of 'gdb_con->busy'.

Change-Id: I1ea20bf96abb5d2f1fcdba1e3861df257c396bb6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8166
Tested-by: jenkins
2024-03-24 13:40:27 +00:00
Antonio Borneo 0c0243228c gdb_server: add async-notif keep-alive during memory read/write
To avoid gdb to timeout, OpenOCD implements a keep-alive mechanism
that consists in sending periodically to gdb empty strings embedded
in the "O" remote reply packet.

The main purpose of "O" packets is to forward in the gdb console
the output of the remote execution; the gdb-remote puts in the "O"
packet the string that gdb will print. It's use is restricted to
few "running/execution" contexts listed in
http://sourceware.org/gdb/onlinedocs/gdb/Stop-Reply-Packets.html
and this currently limits the keep-alive capabilities of OpenOCD.

Long data transfer (memory R/W) can also cause gdb to timeout if
the interface is too slow. In this case the usual keep-alive based
on "O" packet cannot be used and, if used, would trigger a protocol
error that causes the transfer to be dropped.
The slow transfer rate can be simulated by adding some delay in the
main loop of mem_ap_write() and mem_ap_read(), then using the gdb
commands "dump" and "restore".

In the wait loop during a memory R/W, gdb drops any extra character
received from the gdb-remote that is not recognized as a valid
reply to the memory command. Every dropped character re-initializes
the timeout counter and could be used as keep-alive.

From gdb 7.0 (released 2009-10-06), an asynchronous notification
can also be received from gdb-remote during a memory R/W and has
the effect to reset the timeout counter, thus can be used as
keep-alive.
The notification would be treated as "junk" extra characters by any
gdb older than 7.0, being still valid as keep-alive.
Check putpkt_binary() and getpkt_sane() in gdb commit
74531fed1f2d662debc2c209b8b3faddceb55960

Currently, only one notification packet ("Stop") is recognized by
gdb, and gdb documentation reports that notification packets that
are not recognized should be silently dropped.
Use 'set debug remote 1' in gdb to dump the received notifications
and the junk extra characters.

Add a new level in enum gdb_output_flag for using the asynchronous
notifications.
Activate this new level during memory transfers.
Send a custom "oocd_keepalive" notification packet as keep_alive.
While there, drop a useless return in the switch/case, already
managed in case of break.

After this commit, the proper calls to keep_alive() have to be
added in the loops that code the memory transfers. Of course, the
keep_alive() should be placed during the wait for JTAG flush, not
while locally queuing the JTAG elementary transfers.

Change-Id: I9ca8e78630611597d15984bd0e8634c8fc3c32b9
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8165
Tested-by: jenkins
2024-03-24 13:40:11 +00:00
Evgeniy Naydanov ea7e17491d [NFC] target/riscv: refactor `init_registers()`
The logic in `init_registers()` was quite convoluted.
Initialization of each `struct reg` field is separated into function
`gdb_regno_<field_name>()`.
IMHO, this makes it much easier to reason about the code.

Change-Id: Id7faa1464ce026cc5025585d0a6a95a01fb39cee
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-03-21 18:45:14 +03:00
Evgeniy Naydanov cb2b394514
Merge pull request #1027 from en-sc/en-sc/from_upstream
Merge up to 07141132a7 from upstream
2024-03-19 17:53:05 +03:00
Walter Ji 01a797af14 target/mips32: add fpu access support
Add access to fpr and cp1 registers.
GDB can now check the FPRs with `info reg f` and change them.
Checkpatch-ignore: MACRO_ARG_REUSE

Change-Id: I63896ab6f6737054d8108db105a13a58e1446fbc
Signed-off-by: Walter Ji <walter.ji@oss.cipunited.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7866
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-16 14:47:16 +00:00
Daniel Anselmi a88db9b121 ipdbg: configurable queue size used between JTAG-Host and JTAG-Hub
Change-Id: I7941de02a968ccab730bfebd3483b8c3b84d7e53
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7980
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-16 14:44:31 +00:00
Daniel Anselmi 7a77355a3e ipdbg: split ipdbg command into multiple commands
To simplify the ipdbg start/stop command and be able to
add additional commands in the future, we introduce the
concept of a hub which has to be created before a
ipdbg server can be started.
The hub was created on the fly in previous versions.

Change-Id: I55f317542d01a7324990b2cacd496a41fa5ff875
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7979
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-16 14:43:33 +00:00
Antonio Borneo 1d076d6ce1 openocd: dump full command line in the debug log
When receiving an OpenOCD debug log to investigate about errors or
issues, the first question is often about providing the complete
command line to better understand the use context.
Plus, when OpenOCD is lunched by an IDE, its command line is kept
hidden inside the IDE, adding troubles to the user to recover it.

Add the full command line directly inside the debug log.

It could have been useful to also search and add in the log the
full path of the OpenOCD executable, but this is not an immediate
task due to portability among OS's. See, for example:
	https://stackoverflow.com/questions/933850
This part could be handled in a future change, if really needed.

Change-Id: Ia6c5b838b9b7208bf1ecac7f95b5efc319aeabf5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8170
Tested-by: jenkins
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2024-03-16 14:42:20 +00:00
Antonio Borneo e9df8a5102 target: aarch64: add support for 32 bit MON mode
Extend the existing code to support Monitor mode in AArch32.

Change-Id: Ia43df98d1497baac48aea67b92d81344c24f0635
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8169
Tested-by: jenkins
2024-03-16 14:41:53 +00:00
Tomas Vanek 4c0a2cf42e target/adi_v5_swd: fix DP registers banking
ADIv6 brought more complicated rules for DP reg 0 banking.
Neither the original implementation [1] nor the later
modification [2] respected that the DP reg 0 is banked
for read only, not for write. Enforcing of an useless
SELECT write before a write to ABORT register may trigger
FAULT (CTRL/STAT bits ORUNDETECT and STICKYORUN are set)
or WAIT (DP is stalled by an outstanding previous operation)
and therefore make ABORT register virtually unusable
on some adapters (bitbang, CMSIS-DAP).

There are DP ABORT specific functions swd_queue_ap_abort()
and swd_clear_sticky_errors() which worked around the problem
using the lowest level swd->write_reg(). Using a specific
write procedure for a single DP register was error prone
(there are other DP_ABORT writes using swd_queue_dp_write_inner())
and also the Tcl command 'xx.dap dpreg 0 value' suffered
from unwanted SELECT write.

Other smaller discords in DP banking probably do not
influence normal DP operation however they may complicate
debugging in corner cases.

Adhere strictly to the DP banking rules for both ADI versions.

Fixes: [1] commit 72fb88613f ("adiv6: add low level swd transport")
Fixes: [2] commit ee3fb5a0ea ("target/arm_adi_v5: fix DP SELECT logic")
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I3328748c1c3e0661c5ecd6eb070ac519b190ace2
Reviewed-on: https://review.openocd.org/c/openocd/+/8154
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-16 14:38:21 +00:00
Tomas Vanek 31af18e9d1 jtag/drivers/bitbang: limit SWD WAIT retries by timeout
The bitbang driver kept retrying a SWD command as long as
the debugged device had been responding by SWD WAIT.
If the DP stalled in WAIT permanently, OpenOCD hanged.

Check 0.5 sec timeout in WAIT retry loop.

While on it insert a short alive_sleep() if the command
is retried 20 or more times.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I744e56e21a5a2dc2c4494cc0d7bbcb4be14ddb23
Reviewed-on: https://review.openocd.org/c/openocd/+/8153
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-16 14:37:26 +00:00
Tomas Vanek f7f4fa84f1 jtag/drivers/bitbang: use LOG_CUSTOM_LEVEL() macro for SWD
Log SWD commands with not OK response but WAIT retries at debug level.
For commands responded OK and WAIT retries use debug io level
not to flood the log.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Idf658e82ed970061c155945df55d06908ed25e09
Reviewed-on: https://review.openocd.org/c/openocd/+/8152
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-16 14:37:03 +00:00
Tomas Vanek b63e065f23 helper/log: add LOG_CUSTOM_LEVEL() macro
Allow logging at a changeable level.

Add an example of usage in ftdi driver.
Log SWD commands with not OK response at debug level (3).
For commands which responded OK use debug io level (4)
not to flood the log.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I67a472b293f7ed9ee84cadb7c081803e9eeb1ad0
Reviewed-on: https://review.openocd.org/c/openocd/+/8151
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-16 14:36:48 +00:00
Tomas Vanek 263dbc1472 target/arm_adi_v5: introduce adiv5_jim_configure_ext()
Allow direct pointer to struct adiv5_private_config
for targets with adiv5_private_config inside of a bigger
private config container. Use it instead of the private_config
pointer toggling hack in aarch64.c

Allow optional use of -dap parameter and use it instead
of the static variable hack in xtensa_chip.c

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I7260c79332940adfa49d57b45cae39325cdaf432
Reviewed-on: https://review.openocd.org/c/openocd/+/8138
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-16 14:35:24 +00:00
Tomas Vanek 348b79aafe drivers/cmsis_dap, kitprog: use helper to derive err code from ack
Unify the error codes returned by adapter drivers in the case
of the received SWD ACK field differs from OK.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I29e478390b4b30408054a090ac6a7fac3415ae71
Reviewed-on: https://review.openocd.org/c/openocd/+/8137
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-16 14:34:28 +00:00
Tomas Vanek 12ff36bd19 flash/nor/nrf5: drop useless for cycle condition
Commit [1] added a break on error to the nrf5_erase() sector loop
and the checking of the res value became useless in the for loop condition.

Removing nrf5_get_probed_chip_if_halted() later in [2]
dropped res initialization and clang static analyser complains
  "The left operand of '==' is a garbage value"

Drop the useless test!

Fixes: [1] commit 491636c8b8 ("flash/nor/nrf5: check protection before flash erase/write on nRF51")
Fixes: [2] commit 2db325f539 ("flash/nor/nrf5: drop nrf5_get_probed_chip_if_halted()")
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ife6071c509719f8d7dc312fe9a780bdcf2575f69
Reviewed-on: https://review.openocd.org/c/openocd/+/8174
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-10 17:54:52 +00:00
Walter Ji 561ea48d83 target/mips32: add dsp access support
Add access to dsp registers and a command for dsp related operations.
Checkpatch-ignore: MACRO_ARG_REUSE

Change-Id: I30aec0b9e4984896965edb1663f74216ad41101e
Signed-off-by: Walter Ji <walter.ji@oss.cipunited.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7867
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09 11:08:21 +00:00
Antonio Borneo fcda9f1561 gdb_server: fix segfault with GDB command 'flash-erase'
Running the GDB command 'flash-erase' triggers sending the remote
GDB commands 'vFlashErase' (one per flash bank) followed by one
single 'vFlashDone', with no 'vFlashWrite' commands in between.
This causes the field 'gdb_connection->vflash_image' to be NULL
during the execution of 'vFlashDone', triggering a segmentation
fault in OpenOCD.

While parsing 'vFlashDone', check if any image to flash has been
received.

Change-Id: I443021c7a531255b60f2c44c2685e52e3c34b5c8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8164
Tested-by: jenkins
2024-03-09 11:04:29 +00:00
Antonio Borneo 5c395fdef4 mem_ap: fix GDB connections
After commit d9b2607ca0 ("gdb_server: support sparse register
maps"), GDB crashes while requesting the value of 'cpsr' because
the fake register is tagged as not existing.

Change the logic and set all register as existing, while still
limiting the list for the initial GDB request at connect.

Change-Id: I1c4e274c06147683db2a59a8920ae5ccd863e15c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8163
Tested-by: jenkins
2024-03-09 11:03:49 +00:00
Tomas Vanek 61e19349b2 flash/nor/nrf5: use BIT() instead of << operator
for features flags.

Change-Id: I8bff0f5fac41c50180c847f36c6d2a075eca32ca
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8109
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-09 11:02:43 +00:00
Tomas Vanek cdc569ce3a flash/nor/nrf5: drop nrf5 info command
The command substantially complicates support of nRF53/91
series. It was not even properly ported to nRF52.
The informative value is disputable. Who wants to see
e.g. override trim values for radio or unique device ID?

Drop it and simplify the driver.

Change-Id: Ia7fb20ce2ebf16065705c5d18deaf934e58db426
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8108
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09 11:02:17 +00:00
Tomas Vanek 2db325f539 flash/nor/nrf5: drop nrf5_get_probed_chip_if_halted()
nrf5_get_probed_chip_if_halted() was somewhat bizarre
combination of functions:
- test if the target is halted is appropriate for flash
  erase/write only, certainly not for getting chip info
- getting chip pointer takes place more frequently
  and using one temporary variable for dereference
  makes no harm
- probing chip is useless at all as the flash
  infrastructure always calls auto_probe() before
  entering a flash operation

Replace the function by ordinary and readable code.

Change-Id: Ic31f4e33d8b7b36687be3f40bfd0fe913d17b75f
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8107
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09 11:02:02 +00:00
Tomas Vanek 42e4f26a3d flash/nor/nrf5: add missing device types
from nRF52 family.

Change-Id: I6d2b4586700bb4014c0b77dbf4ea26d1b5dc9715
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8106
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-09 11:01:20 +00:00
Tomas Vanek 85bc328969 flash/nor/nrf5: add missing package codes
from Product Specification of nRF52805, 810, 811
820, 833 and 840.

While on it, rename the table to make sure the codes
are valid for nRF52 series only.

Change-Id: Id8f78fd214c5d345d1769378ae546a6be5a183ba
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8105
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09 11:01:04 +00:00
Tomas Vanek 19ef6634f0 target/nrf51: use PAN #16 workaround in reset-init only
After 'reset run' or 'reset halt' the loaded application
is expected to manipulate RAMON register to workaround
the known silicon errata.

Moreover, writing to RAMON register from 'reset-end' event
after 'reset run' may collide with application intentions.

Use the workaround in 'reset-init' event only to ensure
correct function of target algorithms.

Change-Id: I7d2d92e6805a05a83676edb46b3163ef39b9a7e4
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8104
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-09 11:00:50 +00:00
Tomas Vanek 1354ff7adf flash/nor/nrf5, target/nrf51: deprecate nrf51 flash driver
Use the newer driver name 'nrf5' instead.

While on it set the unused parameters of flash bank
creation to zero.

While on it remove 2 empty comments.

Change-Id: I9cf0eadc5b696e6c8b7e6aec0ea3345967523e87
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8103
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-09 11:00:30 +00:00
Tomas Vanek 46ae39c623 flash/nor/nrf5: drop unused part of HWIDs table
While on it update table comment and drop
not working URLs.

Change-Id: I9e21c72aa75a908c644460e43c148d3240c49b2d
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8102
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-03-09 10:59:58 +00:00
Evgeniy Naydanov 19acf51c39 Merge up to 07141132a7 from upstream
Change-Id: Ibca0c8093e2983e1ee199f79ed777f5136794195
2024-03-07 12:38:57 +03:00
Antonio Borneo 07141132a7 gdb_server: don't send unrequested ACK at connection
On 2008-03-05, before git's age, commit 6d95014674 adds sending
an ACK ('+' char) at GDB connection, before receiving any GDB
remote command that requires to be ACK'ed.

Neither the text added in the commit message ("added ACK upon
connection (send +)") nor in the associated comment ("send ACK to
GDB for debug request") provide an exhaustive explanation for
sending this unsolicited ACK.

This code has never been touched since its introduction.

Analysis of GDB code doesn't show it's required, including old GDB
code.
Running gdbserver (from GDB package) and attaching it with "nc"
shows that gdbserver does not send any ACK to a new connection.
Same for lldb-server.

Drop it!

Change-Id: Id68c352ce44dd85a1ea3d67446e17e2a241ef058
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6768
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-by: Anatoly P <anatoly.parshintsev@syntacore.com>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-03-02 11:05:47 +00:00
Erhan Kurubas 271c4e5253 target/esp_xtensa_smp: don't use coreid as an SMP index
For the sake of https://review.openocd.org/c/openocd/+/7957

Instead of "coreid", 'target smp' command call order used as
an index

Signed-off-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Change-Id: Iab86b81868d37c0bf8663707ee11367c41f6b96d
Reviewed-on: https://review.openocd.org/c/openocd/+/8162
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-02 11:04:14 +00:00
Luca Rufer 56a7925a1d src/jtag/drivers/mpsse: Add support for new FTDI chip types.
The new FTDI ICs with USB-C Support have different bcdDevice
identifiers. The added bcdDevice identifiers are taken from
the chips datasheet, respectively. The patch was tested with
a FT4232HP IC.
The used bcdDevice IDs can be found in Section 8.1 of the respective
Datasheets:
https://ftdichip.com/wp-content/uploads/2023/09/DS_FT233HP-v1.4.pdf
https://ftdichip.com/wp-content/uploads/2023/09/DS_FT2233HP-v1.4.pdf
https://ftdichip.com/wp-content/uploads/2023/09/DS_FT4233HP-v1.5.pdf

Change-Id: I701083cb72030e398ce1c74310676e13895a77ff
Signed-off-by: Luca Rufer <lucarufer333@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8134
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-03-02 11:03:10 +00:00
Evgeniy Naydanov ca7d882526
Merge pull request #977 from kr-sc/kr-sc/improve-riscv-controls
target/riscv: Improve riscv controls that manage the set of available triggers for watchpoints
2024-02-27 14:04:49 +03:00
SydMontague 179169268c jtag/commands: fixed buffer overflow
When performing a command queue allocation larger than the default page
size of 1MiB any subsequent allocations will run into an integer under-
flow when checking for the remaining memory left in the current page.
Causing the function returning a pointer past the end of the buffer and
thus creating a buffer overflow.

This has been observed to cause some transfers to Efinix FPGAs to fail,
because another buffer can get corrupted in the process, causing its
respective free() to fail.

Change-Id: Ic5a0e1774e2dbd58f1a05127f14816c8251a7d9c
Signed-off-by: SydMontague <sydmontague@phoenix-staffel.de>
Reviewed-on: https://review.openocd.org/c/openocd/+/8126
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-02-24 13:41:06 +00:00
Sevan Janiyan 33573cda4a src/target/riscv: Help older compilers
find members of a union, nested in struct.
Allows file to be compiled with GCC 4.0

Signed-off-by: Sevan Janiyan <venture37@geeklan.co.uk>
Change-Id: Ied68668d3b5f811573a20e11e83aceff268963eb
Reviewed-on: https://review.openocd.org/c/openocd/+/8120
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-24 13:37:49 +00:00
Evgeniy Naydanov 3c88a95d44
Merge pull request #1018 from en-sc/en-sc/from_upstream
Merge up to efdd5e0 from upstream
2024-02-24 15:55:18 +03:00
Evgeniy Naydanov 9f4c0ba1cc
Merge pull request #1014 from riscv-collab/riscv-batch-cleanup
Fixes and cleanup in riscv batch and related functions
2024-02-21 14:40:48 +03:00
Kirill Radkin b6ee137206 driver: Add additional check for count of BYPASS devices
At least one TAP shouldn't be in BYPASS mode

Change-Id: Ic882acbfc9b6a9f4b0c3bb4741a49f3981503c8c
Signed-off-by: Kirill Radkin <kirill.radkin@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7741
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-18 18:41:41 +00:00
wangyanwen 9d5117a23e server/gdb-server: fix type error.
Fix flash operation error when addr-width > 32bit
on any 32-bit OS and some 64-bit OS (windows).

Change-Id: I199f1cc5128c45bd0bb155e37acb2fb6325dff88
Signed-off-by: wangyanwen <wangyanwen@nucleisys.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8095
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
2024-02-17 19:44:23 +00:00
Evgeniy Naydanov a5464a54d3
Merge pull request #1016 from tom-van/free-dm-target_list
Free dm and target_list structures
2024-02-16 11:05:22 +03:00
Jan Matyas 9bcbae13e0 Fixes of review findings
Change-Id: Ie9889d995d7b2a6e458ad5f66cc3d990888f54ec
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2024-02-15 12:22:42 +01:00
Sevan Janiyan 7145b984a9 portability fix: Switch binary literals to hex
Allows build with legacy toolchains which do not support
C23 nor GCC extension for binary literals.

Change-Id: I742d3a8a86bf16f81421d11c59d3cb155ee17aed
Signed-off-by: Sevan Janiyan <venture37@geeklan.co.uk>
Reviewed-on: https://review.openocd.org/c/openocd/+/8123
Tested-by: jenkins
Reviewed-by: Jörg Wunsch <openocd@uriah.heep.sax.de>
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-02-15 09:00:50 +00:00
Evgeniy Naydanov bfedb42adf Merge up to efdd5e09b1 from upstream
There is an ongoing discussion on
https://review.openocd.org/c/openocd/+/8124 regarding
0d3d4c981a, but AFAIU it seems that the
patch does not break anything.

Change-Id: I48037504300e517b14e41a00f3bf978a16172d14
2024-02-15 11:17:13 +03:00
Kirill Radkin 5003b3642c target/riscv: Improve riscv controls that manage the set of available triggers for watchpoints
Add more debug messages connected with triggers.
Update names for internal flags to make them more clarified.

Change-Id: I5642346ce4a1e9bf79b22cdbf36bd757a7beffa8
Signed-off-by: Kirill Radkin <kirill.radkin@syntacore.com>
2024-02-13 16:27:12 +03:00
Jan Matyas 5d4fa0001e
Merge pull request #1011 from en-sc/en-sc/wa-halt-groups
target/riscv: set `state` and `debug_reason` in `riscv_halt_go_all_harts()`
2024-02-12 07:51:22 +01:00
Antonio Borneo efdd5e09b1 jep106: update to revision JEP106BI January 2024
The original documents from Jedec since JEP106BG, do not report
the entry for "21  NXP (Philips)", replaced by "c".
It's clearly a typo.

Keep the line from JEP106BF.01 for "NXP (Philips)".

Change-Id: I293173c4527c2eabebdc33a94cd23d3a557a4618
Signed-off-by: Antonio Borneo <antonio.borneo@st.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8132
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:13:33 +00:00
Evan Hunter 847f1209d6 jtag interfaces: Reduce usage of global for jtag queue
Makes driver interface slightly more flexible.

Change-Id: I2c7f5cb6d014e94a0e6122cbe2f4002c77fbabb9
Signed-off-by: Evan Hunter <ehunter@broadcom.com>
Signed-off-by: David Ryskalczyk <david.rysk@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/945
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-02-11 23:12:03 +00:00
N S c6e7e48b05 jtag/drivers: fix reset logic handling in OpenJTAG
The OpenJTAG driver behaviour always forces a system reset on jtag_init.
The driver was incorrectly assuming that when execute_reset is called
with trst set to 1 - perform a software TAP reset, otherwise perform a
system reset when trst is 0.

The set_state call assumes the that OpenJTAG hardware will perform a
software TLR reset if the target state is TAP_RESET. This is not the
case: the published VHDL will simply find the shortest path to TLR and
not perform a fixed 5 cycle operation with TMS held high.

Fix the code to only perform system resets when srst is 1 in
execute_reset and to force a software TAP reset operation in set_state
when the target state is TAP_RESET.

Change-Id: I7e0f76f8491efefff1ccaeb4b1ae16e722d76df4
Signed-off-by: N S <nlshipp@yahoo.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8121
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-02-11 23:11:00 +00:00
N S 7295ddc15c jtag/drivers: OpenJTAG standard variant perf improvement
Calculate exact size of response expected from OpenJTAG device so that
openjtag_buf_read_standard doesn't spend 5 retry cycles waiting for
data that isn't coming.

Change-Id: Icd010d1fa4453d6592a1f9aed93fb1f01e0a19da
Signed-off-by: N S <nlshipp@yahoo.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8101
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-02-11 23:10:30 +00:00
Antonio Borneo 81a50d3e90 jtag: fix jtag configure command containing events
Commit ea2e26f7d5 ("jtag: rewrite jim_jtag_configure() as
COMMAND_HANDLER") breaks the option -event if it is the last of
the command line.
This can be tested, even without any device connected, through:
	#> openocd -f board/ti_cc26x0_launchpad.cfg
	wrong # args: should be "-event <event-name> <event-body>"

Fix the check on available arguments after -event.

Change-Id: Iec1522238f906d61a888a09a7685acd9ac6442a7
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reported-by: Lorenz Brun <lorenz@brun.one>
Fixes: ea2e26f7d5 ("jtag: rewrite jim_jtag_configure() as COMMAND_HANDLER")
Reviewed-on: https://review.openocd.org/c/openocd/+/8125
Tested-by: jenkins
Reviewed-by: Lorenz Brun <lorenz@brun.one>
2024-02-11 23:07:46 +00:00
Evgeniy Naydanov d0548940f2 helper/log: report the file in `log_output` command
Prior to the change when calling `log_output` without any arguments it
was unclear where the log was redirected.

Change-Id: Iaa3ecea8166f9c7ec8aad7adf5bd412799f719a1
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8071
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:07:09 +00:00
Parshintsev Anatoly 50be4bd267 jtag/mpsse: mpsse_flush should not treat LIBUSB_ERROR_INTERRUPTED as an error
LIBUSB_ERROR_INTERRUPTED can happen when (among other things) OpenOCD
process receives a signal like SIGHUP or SIGINT during a call to libusb.
Such situations are expected and should not be treated as an error - the
affected request should just be restarted.

Without this patch applied if a signal arrives during FTDI initialization
procedure we can easily end up (if JTAG speed is low) in situations like
https://review.openocd.org/c/openocd/+/4767. This happens because
fpsse_flush fails due to LIBUSB_ERROR_INTERRUPTED .

It should be noted that the current usage of mpsse_flush should be
revised since it seems that we don't always process error codes returned
by the function.

Change-Id: Ifa063ce828068f8d0371e1c2a864bb6174649848
Signed-off-by: Parshintsev Anatoly <anatoly.parshintsev@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7769
Reviewed-by: Tim Newsome <tim@sifive.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-02-11 23:04:48 +00:00
N S 3b5ef1726a jtag/drivers: Add vid_pid command to OpenJTAG
Enable support for USB vid and pid combinations other than 0x0403/0x6001
on OpenJTAG adapters.

Change-Id: Ibb5fb14a6f33abbc011dbf3179df20d79ed74a7a
Signed-off-by: N S <nlshipp@yahoo.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8100
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:04:13 +00:00
Tomas Vanek 79f519bb63 target/cortex_m: fix couple of comments
Fix obsoleted references to Cortex-M3 from the time
when M3 was the only supported Cortex.

Fix typo.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I6f93265f1b9328fec063fecd819210deb28aaf2c
Reviewed-on: https://review.openocd.org/c/openocd/+/8099
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:02:56 +00:00
Tomas Vanek 226085065b target/cortex_m: drop useless target_halt() call
In 2008 the commit 1829361253 ("define resetting
the target into the halted or running state as an atomic operation.")
introduced the target_halt() call to the end of cortex_m3_assert_reset(),

Checkpatch-ignore: GIT_COMMIT_ID

A year later the commit ed36a8d15d
("... Updated halt handling for cortex_m3")
prevented cortex_m3_halt() take any action in case of TARGET_RESET state.
This narrowed the target_halt() called from cortex_m3_assert_reset()
to setting target->halt_issued and storing a time stamp.

Introducing ocd_process_reset(_inner) made the setting of halt_issued
and halt_issued_time useless. The Tcl function waits for halt
of all targets if applicable.

cortex_m_halt() and also target_halt() does not work as expected
if the cached target state is TARGET_RESET (although the core could
be out of reset and ready to be halted, just have not been polled).
Explicit Tcl arp_poll must be issued in many scenarios.

Remove the useless hack.

Also remove the explicit error return from cortex_m_halt_one()
in case of RESET_SRST_PULLS_TRST and asserted srst. If the communication
with the target is gated by any reset, cortex_m_write_debug_halt_mask()
fails. Propagate the error return of this call instead.

Change-Id: I0da05b87f43c3d0facb78e54d8f00c1728fe7c46
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8098
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:02:29 +00:00
Tomas Vanek 3861699074 target/cortex_m: prevent asserting reset if examine is deferred
In a corner case when debug_ap is not available,
cortex_m_assert_reset() asserts reset to restore
communication with the target.

Prevent to do so on targets with defer_examine,
as such targets need some special handling to enable them
after reset anyway.

The change makes possible to handle a multicore Cortex-M SoC with
an auxiliary Cortex-M core(s) switched of by default
even with 'reset_config srst_gates_jtag'

Change-Id: I8cec7a816423e588d5e2e4f7904c81c776eddc42
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: https://review.openocd.org/c/openocd/+/8097
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-02-11 23:02:09 +00:00
Tomas Vanek c83bd69b39 target/riscv: free dm and target_list structures
Fix memory leak on exit.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I6a89ac0c93b11da35b90eec3abcc5b6fd5d1be68
2024-02-11 19:58:21 +01:00
Jan Matyas b7e7a030c1
Merge pull request #1013 from riscv/dm-calls-cleanup
Cosmetic cleanup of dm_*() calls in riscv-013.c
2024-02-09 07:40:14 +01:00
Jan Matyas 4f17df0d1d
Merge pull request #1008 from en-sc/en-sc/from_upstream
Merge up to 9659a9b5e2 from upstream
2024-02-09 07:02:29 +01:00
Jan Matyas 2fc7360190
Merge pull request #1012 from riscv/remove-dead-code-riscv-program-exec
riscv/program: Remove dead code for save/restore of registers
2024-02-09 06:56:39 +01:00
Vincent Fazio 0d3d4c981a jtag/adapter: retype adapter_gpio_config.{gpio,chip}_num
Previously, the gpio_num and chip_num members of adapter_gpio_config
were typed as 'int' and a sentinel value of -1 was used to denote
unconfigured values.

Now, these members are typed as 'unsigned int' to better reflect their
expected value range.

The sentinel value now maps to UINT_MAX as all adapters either define an
upper bound for these members or, in the case of bcm2835gpio, only
operate on a specific chip, in which case the value doesn't matter.

Format specifiers have been left as %d since, when configured, valid
values are within the positive range of 'int'. This allows unconfigured
values to display as a more readable value of -1 instead of UINT_MAX.

Change-Id: Ieb20e5327b2e2e443a8e43d8689cb29538a5c9c1
Signed-off-by: Vincent Fazio <vfazio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8124
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2024-02-08 21:16:30 +00:00
Jan Matyas d0615e4a12 riscv/program: Removed dead code for restoring register values
Function riscv_program_exec() contains code for restoring
of register values after progbuf execution. This code is
not used anymore by current OpenOCD, and hence removed.

Related discussion can be found under:
https://github.com/riscv/riscv-openocd/issues/982

Change-Id: I4c79bec081522b6fc0d16367cef51ed19a131962
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2024-02-06 14:34:22 +01:00
Jan Matyas 67a3d4fe7f Fixes and cleanup in riscv batch and related functions
Fixes:

- Data types of address & data parameters in riscv_batch_add_*()
  and riscv*_fill_dm*() changed to uint64_t and uint32_t.

- Corrected the comparison in riscv_batch_full().

- Corrected assertions in riscv_batch_get_dmi_read_op()
  and riscv_batch_get_dmi_read_data().

Cleanup:

- Simplified calloc() fail handling in riscv_batch_alloc().

- Added explicit NULL assignments in riscv_batch_alloc()
  for clarity and readability. Don't rely on calloc().

- Removed suffix `_u64` from riscv_*_fill_dm*() since it
  does not have any meaning.

- Renamed *dmi_write_u64_bits() to *get_dmi_scan_length()
  which better describes its purpose.

Change-Id: Id70e5968528d64b2ee5476f1c00e08459a1e291d
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2024-02-06 14:24:02 +01:00
Jan Matyas 0e03f9bf0a Cosmetic cleanup of dm_*() calls in riscv-013.c
Cleanup, non-functional changes:
- Replaced one call of low-level function dm_op()
  by high-level dm_read().
- Made sure that truncation of values passed to dm_*
  is explicit. (Added explicit casts.)

Change-Id: I1d1b2f29a822b6841373f3313de2b1e96f514116
Signed-off-by: Jan Matyas <jan.matyas@codasip.com>
2024-02-05 13:08:38 +01:00
Tomas Vanek 4593c75f0b jtag/drivers/jlink: make jlink quiet polling target in -d 3
Jlink driver floods the debug log by a message per one poll interval.

Avoid annoying messages, change their logging level to LOG_DEBUG_IO

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I84ea6aa9cdfd44b5985c5393519d1efb7de9530a
Reviewed-on: https://review.openocd.org/c/openocd/+/8116
Reviewed-by: zapb <dev@zapb.de>
Tested-by: jenkins
2024-02-04 02:56:09 +00:00
Evgeniy Naydanov 24d71d7a72 target/riscv: set `state` and `debug_reason` in `riscv_halt_go_all_harts()`
If targets are in a halt group, and a target in the group reaches a
breakpoint, the target's state was able to remain `TARGET_RUNNING`.

Addresses issue #1010

Change-Id: I734bc6da71d289c4d05b417c8bf67a7d1a56574f
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-02-02 18:42:26 +03:00
Evgeniy Naydanov 16e7adbd9c Merge up to 9659a9b5e2 from upstream
Change-Id: I2fda9689d3465b3d8c8f3459b1ed954cb1d70fdc
2024-01-29 14:28:24 +03:00
Antonio Borneo 9659a9b5e2 target/esirisc: free memory at OpenOCD exit
The target esirisc does not free the allocated memory resources,
causing memory leaks at OpenOCD exit.

Add esirisc_free_reg_cache() and esirisc_deinit_target() and use
them to free all the allocated resources.

Change-Id: I17b8ebff54906fa25a37f2d96c01d010a98cffbd
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8094
Tested-by: jenkins
Reviewed-by: Steven Stallion <sstallion@gmail.com>
2024-01-28 14:19:46 +00:00
Evgeniy Naydanov 1b0ffa97ea target: get_gdb_arch() accepts target via const pointer
The function in question does not need to change target state. It is a
target-type-dependant function, however, IMHO, it is safe to assume that
any target type would not need to change type-independant state of a
target to figure out the arch.

Change-Id: I607cb3aee6529cd5a97bc1200a0226cf6ef43caf
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8093
Tested-by: jenkins
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-28 14:18:54 +00:00
Evgeniy Naydanov 67675323e1 target: pass target to observers via const pointer
There are quite a lot of "getters" in target interface.
They do not change target structure, nevertheless the structure is
passed to these functions via a plain pointer.

The intention is to clarify the purpouse of these functions by passing
the `target` structure as a pointer to constant data.

Change-Id: Ida4a798da94938753b86a293a308d93b091d1bf3
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8092
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-28 14:18:26 +00:00
Ian Thompson 3d3f823920 target/xtensa: add dual-core support
- Example for configuring multiple non-SMP
  Xtensa cores e.g. for heterogeneous debug
- JTAG only at this time; DAP out of scope
- Dual-Xtensa Palladium example via VDebug
- Update Xtensa core config examples

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I6d2b3d13fa8075416dcd383cf256a3e8582ee1c1
Reviewed-on: https://review.openocd.org/c/openocd/+/8078
Tested-by: jenkins
Reviewed-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-28 14:17:28 +00:00
Jacek Wuwer 151b743714 jtag/vdebug: add support for DAP6
This change implements the support for the ARM Debug Interface v6.
The DAP-level interface properly selects the DP Banks and AP address.
Sample ARM configuration DAP and JTAG scripts have been updated.

Change-Id: I7df87ef764bca587697c778810443649a7f46c2b
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8067
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-21 21:31:37 +00:00
Jacek Wuwer 80b970bd29 jtag/vdebug: fix socket options on CYGWIN
the socket option RCVLOWAT is not supported on CYGWIN.
implemented ifdef __CYGWIN not to set this option.

Change-Id: I9f6e81fa98ecf5261ea286deb4675658aae59b8e
Signed-off-by: Jacek Wuwer <jacekmw8@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8066
Tested-by: jenkins
Reviewed-by: Ian Thompson <ianst@cadence.com>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-21 21:30:57 +00:00
Ian Thompson 987a274a85 target/xtensa: update COMMAND_HELPER output to use command_print() API
- Change LOG_ERROR() and LOG_INFO() output, but
keep DEBUG and WARNING levels for verbosity
- Update command error code return values and
remove unnecessary output.

Signed-off-by: Ian Thompson <ianst@cadence.com>
Change-Id: I4ef0753b3a56be02716f2db43a7d4370a1917237
Reviewed-on: https://review.openocd.org/c/openocd/+/8076
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-21 21:30:17 +00:00
Antonio Borneo d7ee0e422e contrib/rtos-helpers/uCOS-III-openocd: change license to Apache-2.0
This file is intended to be included in any user's project that
plans to use OpenOCD awareness for uCOS-III.
It is supposed to be distributed under a license compatible with
the uCOS-III code, that is Apache-2.0 license.

Distribute it under Apache License 2.0.

Change-Id: I51ecd469c8ccdd23a069d21e89b7d90886691395
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7996
Tested-by: jenkins
2024-01-21 21:27:11 +00:00
Antonio Borneo 3fb729980c LICENSES: Add the Apache-2.0 license for standalone files
Add the full text of the Apache-2.0 license to the OpenOCD tree.
It has the same content from:

  https://spdx.org/licenses/Apache-2.0.html#licenseText

but reformatted as in the Linux kernel document and added the
required tags for reference and tooling.
While this commit is specific for standalone files, it already
reports the information for dual licensing.

Change-Id: I1fd427256c310ab733fb5d50f344ac52c64a56f5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8005
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
2024-01-21 21:26:53 +00:00
Ahmed BOUDJELIDA d8499687f8 jtag/drivers: Correct ANGIE driver and GPIO Extender configuration
Correct GPIO Extender configuration, after reconsideration,
we need to configure the IO extender 0x23 pins as all inputs.

Add more LOG_ERRORs to the code to better track bugs.

Re-organize angie_init function

Change-Id: I1fcf4919ba9ea95576803dd35cce7dafa26853b4
Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8079
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-21 21:26:28 +00:00
Tomas Vanek 43e1d60e77 jtag/drivers/cmsis_dap_usb_bulk: fix clang warning
Clang static analyzer warnings
"1st function call argument is an uninitialized value"
on the first libusb_free_transfer() parameter (lines 423, 424)
could turn into a real problem in a corner case:
If allocation of a libusb transfer struct fails, the pointers of not yet
allocated transfers remain uninitialized.

Use calloc() to zero whole struct cmsis_dap_backend_data.

Fixes: fd75e9e542 (jtag/drivers/cmsis_dap_bulk: use asynchronous libusb transfer)
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I0e489757d82d10ed7416c5e8c215e1facc7f8093
Reviewed-on: https://review.openocd.org/c/openocd/+/8045
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-21 21:26:03 +00:00
Antonio Borneo ea2e26f7d5 jtag: rewrite jim_jtag_configure() as COMMAND_HANDLER
The function is used for commands:
- jtag configure
- jtag cget

While there, add the missing .usage field.

Change-Id: I97ddc4898259ddb7fd2d057a997f33a6f4b0e2a8
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8058
Tested-by: jenkins
2024-01-13 14:51:22 +00:00
Ahmed BOUDJELIDA b9f5262d42 contrib/firmware: Change USB interruption handling for JTAG/I2C communications
Before this change, when we send an I2C Bulk data at the same
time while Jtag bitbanging functions execute, the microcontroller
puts JTAG bitbanging on wait and executes all I2C bitbanging
function, which causes problems like loss of Ack in DAP responses
and other errors.

With this commit, When I2C interruption occurs, it sets a variable
to true and continues JTAG bitbanging, when it finish it executes
the I2C bitbang.

Change-Id: Ia80bac21f8a259f4a1176b5346bf74ed0aa6e38b
Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8074
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-13 14:48:56 +00:00
Ahmed BOUDJELIDA b50a8dbe41 jtag/drivers: Add GPIO extender configuration function to ANGIE driver
Add GPIO extender initial configuration that is needed to configure
some important GPIOs and ensure that the dev board is ready to work.

Add i2c_write function that make a write transfer to any slave device.

Give a new Product ID to ANGIE to make it different than the non
programmed ANGIE.

Change-Id: I0a8dacb7fe218145b7d3ed1cb75f106ed6256714
Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8072
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-13 14:48:29 +00:00
Ahmed BOUDJELIDA 868700e720 jtag/drivers: give ANGIE a new PID after renumeration
Give ANGIE a new PID after renumeration to be able to distinguish
the two cases (programmed and not programmed)

Change-Id: I30a91d8ed2e8e261221488b98d40a027ca41da52
Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7991
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-13 14:48:08 +00:00
Ahmed BOUDJELIDA 74807daeb3 jtag/drivers: correct the angie_reset function
remove angie_clear_queue function from executing before the
angie_execute_queued_commands function and making it at the
end of the reset function.

Change-Id: Id8a0664fbd5b8f9730545ce0f8f272ae0b0e7e78
Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7990
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-13 14:47:45 +00:00
Ahmed BOUDJELIDA c7073853eb contrib/firmware: Add direction control for 'SCL' i2c signal
We want to keep the tri-state buffers located between the FPGA
and the board, in 'Z' state until we launch an i2c connection.

We launch an i2c start condition, make the SCL
direction 'OUT' to start the i2c protocol and at the end
of the i2c connection at the stop condition, we re-make
the tri-state buffers at 'Z' state.

Change-Id: Ic597a70d0427832547f6b539864c24ce20a18c64
Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7989
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-13 14:47:31 +00:00
Ahmed BOUDJELIDA 995a7af21d jtag/drivers: send bitstream size to firmware via libusb
Send bitstream size to firmware to initialize the GPIF count registers,
since we're going to send this size via GPIF, we need to give the exact
number of bytes to be sent, then the GPIF counter will decrement with
every clock cycle (every byte sent) until reaching zero and stops.

Change-Id: Ib4e8e0f95a6a4a95ef4888ba8a04a0ea45567f5a
Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7988
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-13 14:47:10 +00:00
Ahmed BOUDJELIDA fce7aa754f contrib/firmware: update gpif FSM configuration file
Change the GPIF state machine, configuring only one of the 4 waveforms
to generate the clock signal (CCLK) used to program the FPGA, and send
one byte every cycle using an 8-bit bus.

Change-Id: I43cf5480b9d5c40cc2f6a62a52ecfe078b76458e
Signed-off-by: Ahmed BOUDJELIDA <aboudjelida@nanoxplore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7976
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-01-13 14:46:42 +00:00
Antonio Borneo c47d77780c target/mips32: fix false positive from clang
clang build triggers an error for an uninitialized value of the
variable 'instr'.
This is a false positive, as the macro
 #define MIPS32_CONFIG3_ISA_MASK (3 << MIPS32_CONFIG3_ISA_SHIFT)
guarantees the switch/case already covers all the possible values
with cases 0, 1, 2 and 3.

Silent clang by adding a useless default case to the switch.
While there, fix the indentation of the switch/case accordingly to
OpenOCD coding style.

Change-Id: I0ae316754ce7d091dd8366bf314b8e6ee780e313
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 7de4b1202d ("target/mips32: add cpu info detection")
Reviewed-on: https://review.openocd.org/c/openocd/+/8065
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-01-13 14:45:56 +00:00
ianst 53811fc584 target/xtensa: enable xtensa algo support
- Add extra error checking
- Cache PS; lower PS.INTLEVEL to allow  breakpoint trigger (LX)
- Xtensa algo support functional on LX per functional flash driver
- Test on NX via manual algo validation

Change-Id: Ie7cff4933979a0551308b382fa33c33c66376f25
Signed-off-by: ianst <ianst@cadence.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8075
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
Tested-by: jenkins
2024-01-13 14:45:33 +00:00
Antonio Borneo e680841fd2 helper/command: pass command arguments also as Jim_Obj
Some OpenOCD command gets fragment of TCL scripts as command-line
argument, fragments that will be kept and executed later on.
E.g. the command 'configure' gets the body of an OpenOCD event:
	$TARGET configure -event halted {TCL code}

These commands store the argument as a Jim_Obj and pass it to the
jimtcl interpreter when the TCL fragment has to be executed.
Using Jim_Obj as storage is relevant to let the jimtcl interpreter
to recover extra info of the TCL fragment, like the file-name and
the line-number that contain the fragment, that will be printed
out in case of run-time errors.

While converting the commands to COMMAND_HANDLER, we should avoid
storing the argument as C strings otherwise we will loose precious
info in case of run-time errors making challenging the debugging
of such TCL fragments.

Extend the struct command_invocation to contain the array that
points to the Jim_Obj of the command arguments.
This will be used while converting commands to COMMAND_HANDLER.

Change-Id: If37c5f20e9a71349f77ba1571baf1e6778e28aa5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8057
Tested-by: jenkins
2024-01-13 14:44:32 +00:00
Antonio Borneo f857db98bd helper/command: inline run_command() in exec_command()
Simplify the command execution by inlining run_command() inside
exec_command().

Change-Id: Id932b006846720cfd867d22d142cd35831dbd1a2
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8056
Tested-by: jenkins
2024-01-13 14:44:08 +00:00
Antonio Borneo f9ea9ce24c helper/command: simplify exec_command()
The jimtcl interpreter guarantees that the Jim objects in argv[]
are not deallocated during the command execution. Thus, there is
no need to copy the string content of argv[].

Simplify exec_command() by inlining its two sub-functions and
dropping the strdup().

While there, add a LOG_ERROR() for out of memory.

Change-Id: I3e21ed7da50ca0bd072edbd49fca9740c81f95b0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8055
Tested-by: jenkins
2024-01-13 14:43:29 +00:00
Antonio Borneo 712c1244e8 helper/command: simplify script_command_args_alloc()
The output parameter nwords is always equal to the input parameter
argc, when the function succeeds.

Drop the parameter nwords and let the caller use directly the
value in argc.

While there, convert some 'unsigned' to 'unsigned int'.

Change-Id: Ie3d8ce1351792f3c07fe39cdcbcd180fd24dc928
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8054
Tested-by: jenkins
2024-01-13 14:43:10 +00:00
Antonio Borneo 5e1468da18 helper/command: drop unused variables
In both functions script_debug() and script_command_args_alloc()
the variable len is never used, and Jim_GetString() does not
mandate it.

Drop the variable and pass NULL to Jim_GetString().

Change-Id: I754b27a59c6087cde729496be42609d2a7145b0c
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8053
Tested-by: jenkins
2024-01-13 14:42:39 +00:00
Antonio Borneo 6e6d486de2 target: drop deprecated code for mem2array and array2mem
Commit e370e06b72 ("target: Deprecate 'array2mem' and
'mem2array''") has already replaced the deprecated root versions
of commands mem2array and array2mem with TCL proc's that use
'read_memory' and 'write_memory'. It has left the deprecated code
of the target's version of the commands because the effort to code
the TCL replacement was not considered valuable.

To drop the last jim_handler commands, I consider much easier and
less error-prone to code them in TCL instead of converting the
deprecated code to COMMAND_HANDLER.

Drop the code in target.c and extend the TCL proc's.
While there, add the TCL procs to _telnet_autocomplete_skip.

Change-Id: I97d2370d8af479434ddf5af68541f90913982bc0
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8052
Tested-by: jenkins
2024-01-13 14:42:16 +00:00
Antonio Borneo 305f293201 LICENSES: drop SPDX tag 'GPL-2.0' and use 'GPL-2.0-only'
The SPDX tag 'GPL-2.0' has been deprecated in
https://spdx.org/licenses/GPL-2.0.html
and the preferred tag is now 'GPL-2.0-only'
https://spdx.org/licenses/GPL-2.0-only.html

Update the LICENSES documents and the SPDX of the only file that
reports the deprecated tag.

Change-Id: I3c3215438bc4378ff470bb9fa8fa962505a9ae50
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8064
Tested-by: jenkins
2024-01-13 14:41:21 +00:00
Evgeniy Didin 0de852f561 target/arc: skip over breakpoints in arc_resume()
When requested by the core code (handle_breakpoints = true),
arc_resume() should be able to advance over a potential breakpoint set
at the resume address instead of getting stuck in one place. This is
achieved by removing the breakpoint, executing one instruction,
resetting the breakpoint, then proceeding forward as normal.

With this patch applied, openocd is now able to resume from a
breakpoint halt when debugging ARCv2 targets via telnet.

This has previously been committed to the Zephyr project's openocd repo
(see https://github.com/zephyrproject-rtos/openocd/pull/31).

Change-Id: I17dba0dcea311d394b303c587bc2dfaa99d67859
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Signed-off-by: Artemiy Volkov <artemiy@synopsys.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7817
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-01-13 14:40:27 +00:00
Evgeniy Didin 2c10e3e257 target/arc: restore breakpoints in arc_resume()
Presently, we rely on gdb to restore break/watchpoints upon resuming
execution in arc_resume(). To match this behavior in absence of gdb
(more specifically, when handle_breakpoints is true), this patch
explicitly re-enables all breakpoints and watchpoints in arc_resume().

This has previously been committed to the Zephyr project's openocd repo
(see https://github.com/zephyrproject-rtos/openocd/pull/31).

Change-Id: I59e9c91270ef0b5fd19cfc570663dc67a6022dbd
Signed-off-by: Evgeniy Didin <didin@synopsys.com>
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
Signed-off-by: Artemiy Volkov <artemiy@synopsys.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/7816
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2024-01-13 14:40:02 +00:00
ianst 04eda37263 target/xtensa: extra debug info for "xtensa exe" failures
- Read and display EXCCAUSE on exe error
- Clean up error messages
- Clarify "xtensa exe" documentation

Signed-off-by: ianst <ianst@cadence.com>
Change-Id: I90ed39f6afb6543c0c873301501435384b4dccbe
Reviewed-on: https://review.openocd.org/c/openocd/+/7982
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-13 14:38:51 +00:00
Tarek BOCHKATI 22ebb693b6 cortex_m: add detection of MVE feature for Armv8.1-M cores
For Armv8.1-M based cores, detect if the core implements the optional
M-profile vector extension (MVE), using MVFR1 register.

While at there rework armv7m->fp_feature detection based on MVFR0
and MVFR1 registers.

Change-Id: I92d5b1759aea9f7561d285f46acdec51d6efb7b4
Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6950
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-01-13 14:37:50 +00:00
Daniel Anselmi d2b2ac28d9 ipdbg: improve ipdbg-host speed
By queuing multiple jtag transfers the connection speed between
JTAG-Host and JTAG-Hub is improved. This is due to much less
calls to OS functions. An improvement of about x30 has been
measured with ftdi-based jtag adapters

For this to work the JTAG-Host server needs to know if flow control
is enabled on the JTAG-Hub ports. This is possible with newer
JTAG-Hub/JtagCDC. For old JTAG-Hubs the queuing is not enabled so
this change is backwards compatible.

Change-Id: I8a5108adbe2a2c1e3d3620b5c9ff77a546bfc14e
Signed-off-by: Daniel Anselmi <danselmi@gmx.ch>
Reviewed-on: https://review.openocd.org/c/openocd/+/7978
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-13 14:37:09 +00:00
Tomas Vanek 44e02e1f49 jtag/drivers/cmsis_dap: use oocd_libusb_dev_mem_alloc() helper
On some systems (at least Windows/CYGWIN and macOS) libusb_dev_mem_alloc()
simply returns NULL. The helper can fall-back to malloc() to allocate
CMSIS-DAP pending command/response buffers.

Fixes: fd75e9e542 (jtag/drivers/cmsis_dap_bulk: use asynchronous libusb transfer)
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: I89660f6747ad9d494b8192711cbbee5764e058fa
Reviewed-on: https://review.openocd.org/c/openocd/+/8044
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
2024-01-12 07:13:04 +00:00
Tomas Vanek 15f74c2595 drivers/libusb_helper: introduce oocd_libusb_dev_mem_alloc() helper
On some systems (at least Windows/CYGWIN and macOS) libusb_dev_mem_alloc()
simply returns NULL.

Use the result of the very first libusb_dev_mem_alloc() call to decide
if the underlining system supports dev mem allocation or we should
fall-back to plain heap malloc().

From the decision time on, keep using the selected type of memory allocator
and deallocator.

Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Change-Id: Ia1f0965cea44b4bb6d936b02ec43f5a16a46f080
Reviewed-on: https://review.openocd.org/c/openocd/+/8059
Tested-by: jenkins
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-01-12 07:12:32 +00:00
510 changed files with 21112 additions and 11185 deletions

View File

@ -17,7 +17,6 @@
--ignore LINE_SPACING --ignore LINE_SPACING
--ignore LOGICAL_CONTINUATIONS --ignore LOGICAL_CONTINUATIONS
--ignore MACRO_WITH_FLOW_CONTROL --ignore MACRO_WITH_FLOW_CONTROL
--ignore NEW_TYPEDEFS
--ignore PARENTHESIS_ALIGNMENT --ignore PARENTHESIS_ALIGNMENT
--ignore PREFER_DEFINED_ATTRIBUTE_MACRO --ignore PREFER_DEFINED_ATTRIBUTE_MACRO
--ignore PREFER_FALLTHROUGH --ignore PREFER_FALLTHROUGH

View File

@ -10,7 +10,7 @@ jobs:
BUILD_DIR: ../build BUILD_DIR: ../build
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Checkout Base - name: Checkout Base
@ -23,10 +23,4 @@ jobs:
sudo apt-get install patchutils python3-ply python3-git sudo apt-get install patchutils python3-ply python3-git
- name: Run checkpatch - name: Run checkpatch
run: | run: |
git diff --patch FETCH_HEAD \ ./tools/scripts/checkpatch.pl --no-signoff --git FETCH_HEAD..HEAD
| filterdiff \
-x "a/src/jtag/drivers/libjaylink/*" \
-x "a/tools/git2cl/*" \
-x "a/.github/*" \
-x "a/HACKING" \
| ./tools/scripts/checkpatch.pl --no-signoff -

View File

@ -9,13 +9,34 @@ jobs:
env: env:
CFLAGS: -m32 CFLAGS: -m32
CC: clang CC: clang
PKG_CONFIG_PATH: /opt/libjim32/lib/pkgconfig
steps: steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Install required packages (apt-get) - name: Install required packages (apt-get)
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install clang gcc-multilib sudo apt-get install clang gcc-multilib
- name: Get 32-bit JIM TCL from cache
id: cache-libjim32
uses: actions/cache@v4
with:
path: /opt/libjim32
key: libjim32
- if: ${{ steps.cache-libjim32.outputs.cache-hit != 'true' }}
name: Checkout JIM TCL
uses: actions/checkout@v4
with:
repository: msteveb/jimtcl
ref: 0.83
path: jimtcl
- if: ${{ steps.cache-libjim32.outputs.cache-hit != 'true' }}
name: Build 32-bit JIM TCL from source
run: |
cd jimtcl
./configure --prefix=/opt/libjim32 --with-ext=json --minimal --disable-ssl
make -j`nproc`
make install
- name: Checkout Code
uses: actions/checkout@v4
- run: ./bootstrap - run: ./bootstrap
- run: ./configure --enable-remote-bitbang --enable-jtag_vpi --disable-target64 - run: ./configure --enable-remote-bitbang --enable-jtag_vpi --disable-target64
- run: make -j`nproc` - run: make -j`nproc`
@ -30,7 +51,7 @@ jobs:
CC: gcc CC: gcc
steps: steps:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Configure environment - name: Configure environment
run: | run: |
TAG=$(git rev-parse --short HEAD) TAG=$(git rev-parse --short HEAD)
@ -39,7 +60,7 @@ jobs:
- name: Install required packages (apt-get) - name: Install required packages (apt-get)
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev sudo apt-get install libusb-1.0-0 libusb-1.0-0-dev libjim-dev
- run: ./bootstrap - run: ./bootstrap
- run: ./configure --enable-remote-bitbang --enable-jtag_vpi --enable-ftdi-cjtag --prefix /tmp/${{ env.NAME }} - run: ./configure --enable-remote-bitbang --enable-jtag_vpi --enable-ftdi-cjtag --prefix /tmp/${{ env.NAME }}
- run: make -j`nproc` - run: make -j`nproc`
@ -55,7 +76,7 @@ jobs:
make install make install
tar zcvf ${{ env.NAME }}.tgz -C /tmp ${{ env.NAME }} tar zcvf ${{ env.NAME }}.tgz -C /tmp ${{ env.NAME }}
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: ${{ env.NAME }} name: ${{ env.NAME }}
path: ${{ env.NAME }}.tgz path: ${{ env.NAME }}.tgz

View File

@ -18,7 +18,7 @@ jobs:
sudo apt-get update sudo apt-get update
sudo apt-get install autotools-dev autoconf automake libtool pkg-config cmake texinfo texlive g++-mingw-w64-i686 sudo apt-get install autotools-dev autoconf automake libtool pkg-config cmake texinfo texlive g++-mingw-w64-i686
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v1 uses: actions/checkout@v4
- run: ./bootstrap - run: ./bootstrap
- name: Prepare libusb1 - name: Prepare libusb1
env: env:
@ -66,6 +66,14 @@ jobs:
cd libjaylink-${LIBJAYLINK_VER} cd libjaylink-${LIBJAYLINK_VER}
./autogen.sh ./autogen.sh
echo "LIBJAYLINK_SRC=$PWD" >> $GITHUB_ENV echo "LIBJAYLINK_SRC=$PWD" >> $GITHUB_ENV
- name: Prepare jimtcl
env:
JIMTCL_VER: 0.83
run: |
mkdir -p $DL_DIR && cd $DL_DIR
wget https://github.com/msteveb/jimtcl/archive/refs/tags/${JIMTCL_VER}.tar.gz
tar -xzf ${JIMTCL_VER}.tar.gz
echo "JIMTCL_SRC=$PWD/jimtcl-${JIMTCL_VER}" >> $GITHUB_ENV
- name: Package OpenOCD for windows - name: Package OpenOCD for windows
env: env:
MAKE_JOBS: 2 MAKE_JOBS: 2
@ -75,6 +83,7 @@ jobs:
LIBFTDI_CONFIG: -DSTATICLIBS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF LIBFTDI_CONFIG: -DSTATICLIBS=OFF -DEXAMPLES=OFF -DFTDI_EEPROM=OFF
CAPSTONE_CONFIG: "CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no" CAPSTONE_CONFIG: "CAPSTONE_BUILD_CORE_ONLY=yes CAPSTONE_STATIC=yes CAPSTONE_SHARED=no"
LIBJAYLINK_CONFIG: --enable-shared --disable-static LIBJAYLINK_CONFIG: --enable-shared --disable-static
JIMTCL_CONFIG: --with-ext=json --minimal --disable-ssl
run: | run: |
# check if there is tag pointing at HEAD, otherwise take the HEAD SHA-1 as OPENOCD_TAG # check if there is tag pointing at HEAD, otherwise take the HEAD SHA-1 as OPENOCD_TAG
OPENOCD_TAG="`git tag --points-at HEAD`" OPENOCD_TAG="`git tag --points-at HEAD`"
@ -102,11 +111,11 @@ jobs:
echo "IS_PRE_RELEASE=$IS_PRE_RELEASE" >> $GITHUB_ENV echo "IS_PRE_RELEASE=$IS_PRE_RELEASE" >> $GITHUB_ENV
echo "ARTIFACT_PATH=$PWD/$ARTIFACT" >> $GITHUB_ENV echo "ARTIFACT_PATH=$PWD/$ARTIFACT" >> $GITHUB_ENV
- name: Publish OpenOCD packaged for windows - name: Publish OpenOCD packaged for windows
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
path: ${{ env.ARTIFACT_PATH }} path: ${{ env.ARTIFACT_PATH }}
- name: Delete 'latest' Release - name: Delete 'latest' Release
uses: dev-drprasad/delete-tag-and-release@v0.2.1 uses: dev-drprasad/delete-tag-and-release@v1.1
with: with:
delete_release: true delete_release: true
tag_name: ${{ env.RELEASE_NAME }} tag_name: ${{ env.RELEASE_NAME }}

View File

@ -28,12 +28,12 @@ jobs:
name: Test debug (Ubuntu) name: Test debug (Ubuntu)
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Install packages - name: Install packages
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y device-tree-compiler build-essential sudo apt-get install -y device-tree-compiler build-essential libjim-dev
- name: Get revisions of dependencies - name: Get revisions of dependencies
run: | run: |
@ -47,14 +47,14 @@ jobs:
- name: Get the toolchain from cache (if available) - name: Get the toolchain from cache (if available)
id: cache-toolchain id: cache-toolchain
uses: actions/cache@v3 uses: actions/cache@v4
with: with:
path: /opt/riscv/toolchain path: /opt/riscv/toolchain
key: "toolchain-${{env.TOOLCHAIN_URL}}" key: "toolchain-${{env.TOOLCHAIN_URL}}"
- name: Get spike from cache (if available) - name: Get spike from cache (if available)
id: cache-spike id: cache-spike
uses: actions/cache@v3 uses: actions/cache@v4
with: with:
path: /opt/riscv/spike path: /opt/riscv/spike
key: "spike-${{env.SPIKE_COMMIT}}" key: "spike-${{env.SPIKE_COMMIT}}"
@ -130,7 +130,7 @@ jobs:
- name: Archive test logs - name: Archive test logs
# Proceed even if there was a failed test # Proceed even if there was a failed test
if: ${{ success() || failure() }} if: ${{ success() || failure() }}
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: test-logs name: test-logs
path: riscv-tests/debug/logs path: riscv-tests/debug/logs

9
.gitignore vendored
View File

@ -11,9 +11,9 @@
*.la *.la
*.in *.in
# generated source files # coverage files (gcov)
src/jtag/minidriver_imp.h *.gcda
src/jtag/jtag_minidriver.h *.gcno
# OpenULINK driver files generated by SDCC # OpenULINK driver files generated by SDCC
src/jtag/drivers/OpenULINK/*.rel src/jtag/drivers/OpenULINK/*.rel
@ -84,6 +84,9 @@ patches
.cproject .cproject
.settings .settings
# VSCode stuff
.vscode
# Emacs temp files # Emacs temp files
*~ *~

3
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "tools/git2cl"]
path = tools/git2cl
url = https://git.savannah.nongnu.org/git/git2cl.git
[submodule "jimtcl"] [submodule "jimtcl"]
path = jimtcl path = jimtcl
url = https://github.com/msteveb/jimtcl.git url = https://github.com/msteveb/jimtcl.git

14
AUTHORS
View File

@ -1,12 +1,2 @@
Dominic Rath <Dominic.Rath@gmx.de> Please check the source code files and/or Git history for a list of all authors
Magnus Lundin <lundin@mlu.mine.nu> and contributors.
Michael Fischer <fischermi@t-online.de>
Spencer Oliver <spen@spen-soft.co.uk>
Carsten Schlote <schlote@vahanus.net>
Øyvind Harboe <oyvind.harboe@zylin.com>
Duane Ellis <openocd@duaneellis.com>
Michael Schwingen <michael@schwingen.org>
Rick Altherr <kc8apf@users.berlios.de>
David Brownell <dbrownell@users.sourceforge.net>
Vincint Palatin <vpalatin@users.berlios.de>
Zachary T Welch <zw@superlucidity.net>

23
HACKING
View File

@ -118,6 +118,22 @@ patch:
make make
@endcode @endcode
- Code coverage analysis
By inspecting the code coverage, you can identify potential gaps in your testing
and use that information to improve your test scenarios.
Example usage:
@code
mkdir build-gcov; cd build-gcov
../configure --enable-gcov [...]
make
# ... Now execute your test scenarios to collect OpenOCD code coverage ...
lcov --capture --directory ./src --output-file openocd-coverage.info
genhtml openocd-coverage.info --output-directory coverage_report
# ... Open coverage_report/index.html in a web browser ...
@endcode
Please consider performing these additional checks where appropriate Please consider performing these additional checks where appropriate
(especially Clang Static Analyzer for big portions of new code) and (especially Clang Static Analyzer for big portions of new code) and
mention the results (e.g. "Valgrind-clean, no new Clang analyzer mention the results (e.g. "Valgrind-clean, no new Clang analyzer
@ -313,6 +329,13 @@ Only for <em>exceptional cases</em>, it is allowed to submit patches
to Gerrit with the special field 'Checkpatch-ignore:' in the commit to Gerrit with the special field 'Checkpatch-ignore:' in the commit
message. This field will cause checkpatch to ignore the error types message. This field will cause checkpatch to ignore the error types
listed in the field, only for the patch itself. listed in the field, only for the patch itself.
For errors in the commit message, the special field has to be put in
the commit message before the line that produces the error.
The special field must be added <em>before</em> the 'Signed-off-by:'
line, otherwise it is ignored.
To ignore multiple errors, either add multiple lines with the special
field or add multiple error types, separated by space or commas, in a
single line.
The error type is printed by checkpatch on failure. The error type is printed by checkpatch on failure.
For example the names of Windows APIs mix lower and upper case chars, For example the names of Windows APIs mix lower and upper case chars,
in violation of OpenOCD coding style, triggering a 'CAMELCASE' error: in violation of OpenOCD coding style, triggering a 'CAMELCASE' error:

View File

@ -0,0 +1,189 @@
Valid-License-Identifier: Apache-2.0
SPDX-URL: https://spdx.org/licenses/Apache-2.0.html
Usage-Guide:
Do NOT use on OpenOCD code. The Apache-2.0 is not GPL2 compatible. It may only
be used for dual-licensed files where the other license is GPL2 compatible.
If you end up using this it MUST be used together with a GPL2 compatible
license using "OR".
It may also be used for stand-alone code NOT linked within the OpenOCD binary
but distributed with OpenOCD.
To use the Apache License version 2.0 put the following SPDX tag/value
pair into a comment according to the placement guidelines in the
licensing rules documentation:
SPDX-License-Identifier: Apache-2.0
License-Text:
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and
distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the
copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other
entities that control, are controlled by, or are under common control with
that entity. For the purposes of this definition, "control" means (i) the
power, direct or indirect, to cause the direction or management of such
entity, whether by contract or otherwise, or (ii) ownership of fifty
percent (50%) or more of the outstanding shares, or (iii) beneficial
ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising
permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation source,
and configuration files.
"Object" form shall mean any form resulting from mechanical transformation
or translation of a Source form, including but not limited to compiled
object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form,
made available under the License, as indicated by a copyright notice that
is included in or attached to the work (an example is provided in the
Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form,
that is based on (or derived from) the Work and for which the editorial
revisions, annotations, elaborations, or other modifications represent, as
a whole, an original work of authorship. For the purposes of this License,
Derivative Works shall not include works that remain separable from, or
merely link (or bind by name) to the interfaces of, the Work and Derivative
Works thereof.
"Contribution" shall mean any work of authorship, including the original
version of the Work and any modifications or additions to that Work or
Derivative Works thereof, that is intentionally submitted to Licensor for
inclusion in the Work by the copyright owner or by an individual or Legal
Entity authorized to submit on behalf of the copyright owner. For the
purposes of this definition, "submitted" means any form of electronic,
verbal, or written communication sent to the Licensor or its
representatives, including but not limited to communication on electronic
mailing lists, source code control systems, and issue tracking systems that
are managed by, or on behalf of, the Licensor for the purpose of discussing
and improving the Work, but excluding communication that is conspicuously
marked or otherwise designated in writing by the copyright owner as "Not a
Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on
behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this
License, each Contributor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable copyright license to
reproduce, prepare Derivative Works of, publicly display, publicly
perform, sublicense, and distribute the Work and such Derivative Works
in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this
License, each Contributor hereby grants to You a perpetual, worldwide,
non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
this section) patent license to make, have made, use, offer to sell,
sell, import, and otherwise transfer the Work, where such license
applies only to those patent claims licensable by such Contributor that
are necessarily infringed by their Contribution(s) alone or by
combination of their Contribution(s) with the Work to which such
Contribution(s) was submitted. If You institute patent litigation
against any entity (including a cross-claim or counterclaim in a
lawsuit) alleging that the Work or a Contribution incorporated within
the Work constitutes direct or contributory patent infringement, then
any patent licenses granted to You under this License for that Work
shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or
Derivative Works thereof in any medium, with or without modifications,
and in Source or Object form, provided that You meet the following
conditions:
a. You must give any other recipients of the Work or Derivative Works a
copy of this License; and
b. You must cause any modified files to carry prominent notices stating
that You changed the files; and
c. You must retain, in the Source form of any Derivative Works that You
distribute, all copyright, patent, trademark, and attribution notices
from the Source form of the Work, excluding those notices that do not
pertain to any part of the Derivative Works; and
d. If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained within
such NOTICE file, excluding those notices that do not pertain to any
part of the Derivative Works, in at least one of the following
places: within a NOTICE text file distributed as part of the
Derivative Works; within the Source form or documentation, if
provided along with the Derivative Works; or, within a display
generated by the Derivative Works, if and wherever such third-party
notices normally appear. The contents of the NOTICE file are for
informational purposes only and do not modify the License. You may
add Your own attribution notices within Derivative Works that You
distribute, alongside or as an addendum to the NOTICE text from the
Work, provided that such additional attribution notices cannot be
construed as modifying the License.
You may add Your own copyright statement to Your modifications and may
provide additional or different license terms and conditions for use,
reproduction, or distribution of Your modifications, or for any such
Derivative Works as a whole, provided Your use, reproduction, and
distribution of the Work otherwise complies with the conditions stated
in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any
Contribution intentionally submitted for inclusion in the Work by You to
the Licensor shall be under the terms and conditions of this License,
without any additional terms or conditions. Notwithstanding the above,
nothing herein shall supersede or modify the terms of any separate
license agreement you may have executed with Licensor regarding such
Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to
in writing, Licensor provides the Work (and each Contributor provides
its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
OF ANY KIND, either express or implied, including, without limitation,
any warranties or conditions of TITLE, NON-INFRINGEMENT,
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely
responsible for determining the appropriateness of using or
redistributing the Work and assume any risks associated with Your
exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether
in tort (including negligence), contract, or otherwise, unless required
by applicable law (such as deliberate and grossly negligent acts) or
agreed to in writing, shall any Contributor be liable to You for
damages, including any direct, indirect, special, incidental, or
consequential damages of any character arising as a result of this
License or out of the use or inability to use the Work (including but
not limited to damages for loss of goodwill, work stoppage, computer
failure or malfunction, or any and all other commercial damages or
losses), even if such Contributor has been advised of the possibility of
such damages.
9. Accepting Warranty or Additional Liability. While redistributing the
Work or Derivative Works thereof, You may choose to offer, and charge a
fee for, acceptance of support, warranty, indemnity, or other liability
obligations and/or rights consistent with this License. However, in
accepting such obligations, You may act only on Your own behalf and on
Your sole responsibility, not on behalf of any other Contributor, and
only if You agree to indemnify, defend, and hold each Contributor
harmless for any liability incurred by, or claims asserted against, such
Contributor by reason of your accepting any such warranty or additional
liability.
END OF TERMS AND CONDITIONS

View File

@ -7,7 +7,7 @@ AUTOMAKE_OPTIONS = gnu 1.6
.DELETE_ON_ERROR: .DELETE_ON_ERROR:
# make sure we pass the correct jimtcl flags to distcheck # make sure we pass the correct jimtcl flags to distcheck
DISTCHECK_CONFIGURE_FLAGS = --disable-install-jim AM_DISTCHECK_CONFIGURE_FLAGS = --disable-install-jim
# do not run Jim Tcl tests (esp. during distcheck) # do not run Jim Tcl tests (esp. during distcheck)
check-recursive: SUBDIRS := check-recursive: SUBDIRS :=
@ -37,20 +37,27 @@ DISTCLEANFILES += jimtcl/jsmn/jsmn.o
endif endif
# common flags used in openocd build # common flags used in openocd build
AM_CFLAGS = $(GCC_WARNINGS)\ AM_CFLAGS = $(GCC_WARNINGS)
-DFD_SETSIZE=128 AM_LDFLAGS =
AM_CPPFLAGS = $(HOST_CPPFLAGS)\ AM_CPPFLAGS = $(HOST_CPPFLAGS)\
-I$(top_srcdir)/src \ -I$(top_srcdir)/src \
-I$(top_builddir)/src \ -I$(top_builddir)/src \
-DPKGDATADIR=\"$(pkgdatadir)\" \ -DPKGDATADIR=\"$(pkgdatadir)\" \
-DBINDIR=\"$(bindir)\"\ -DBINDIR=\"$(bindir)\"
-DFD_SETSIZE=128
if INTERNAL_JIMTCL if INTERNAL_JIMTCL
AM_CPPFLAGS += -I$(top_srcdir)/jimtcl \ AM_CPPFLAGS += -I$(top_srcdir)/jimtcl \
-I$(top_builddir)/jimtcl -I$(top_builddir)/jimtcl
else
AM_CPPFLAGS += $(JIMTCL_CFLAGS)
endif endif
if USE_GCOV
AM_CFLAGS += --coverage
AM_LDFLAGS += --coverage
endif
EXTRA_DIST += \ EXTRA_DIST += \
BUGS \ BUGS \
HACKING \ HACKING \
@ -72,6 +79,7 @@ EXTRA_DIST += \
LICENSES/preferred/GPL-2.0 \ LICENSES/preferred/GPL-2.0 \
LICENSES/preferred/LGPL-2.1 \ LICENSES/preferred/LGPL-2.1 \
LICENSES/preferred/MIT \ LICENSES/preferred/MIT \
LICENSES/stand-alone/Apache-2.0 \
LICENSES/stand-alone/GPL-3.0 \ LICENSES/stand-alone/GPL-3.0 \
tools/logger.pl \ tools/logger.pl \
tools/rlink_make_speed_table \ tools/rlink_make_speed_table \
@ -115,9 +123,13 @@ TCL_PATH = tcl
TCL_FILES = find $(srcdir)/$(TCL_PATH) -name '*.cfg' -o -name '*.tcl' -o -name '*.txt' | \ TCL_FILES = find $(srcdir)/$(TCL_PATH) -name '*.cfg' -o -name '*.tcl' -o -name '*.txt' | \
sed -e 's,^$(srcdir)/$(TCL_PATH),,' sed -e 's,^$(srcdir)/$(TCL_PATH),,'
# The git log command below generates many empty text lines with only some space characters
# for indentation purposes, so use sed to trim all trailing whitespace.
dist-hook: dist-hook:
if test -d $(srcdir)/.git -a \( ! -e $(distdir)/ChangeLog -o -w $(distdir)/ChangeLog \) ; then \ if test -d $(srcdir)/.git -a \( ! -e $(distdir)/ChangeLog -o -w $(distdir)/ChangeLog \) ; then \
git --git-dir $(srcdir)/.git log | $(srcdir)/tools/git2cl/git2cl > $(distdir)/ChangeLog ; \ git --git-dir $(srcdir)/.git log --date=short --pretty="format:%ad %aN <%aE>%n%n%w(0,4,6)* %B" \
| sed 's/[[:space:]]*$$//' > $(distdir)/ChangeLog.tmp && \
mv $(distdir)/ChangeLog.tmp $(distdir)/ChangeLog; \
fi fi
for i in $$($(TCL_FILES)); do \ for i in $$($(TCL_FILES)); do \
j="$(distdir)/$(TCL_PATH)/$$i" && \ j="$(distdir)/$(TCL_PATH)/$$i" && \

104
README
View File

@ -1,5 +1,4 @@
Welcome to OpenOCD! # Welcome to OpenOCD!
===================
OpenOCD provides on-chip programming and debugging support with a OpenOCD provides on-chip programming and debugging support with a
layered architecture of JTAG interface and TAP support including: layered architecture of JTAG interface and TAP support including:
@ -26,9 +25,7 @@ This README file contains an overview of the following topics:
- packaging tips. - packaging tips.
============================ # Quickstart for the impatient
Quickstart for the impatient
============================
If you have a popular board then just start OpenOCD with its config, If you have a popular board then just start OpenOCD with its config,
e.g.: e.g.:
@ -39,20 +36,22 @@ If you are connecting a particular adapter with some specific target,
you need to source both the jtag interface and the target configs, you need to source both the jtag interface and the target configs,
e.g.: e.g.:
```
openocd -f interface/ftdi/jtagkey2.cfg -c "transport select jtag" \ openocd -f interface/ftdi/jtagkey2.cfg -c "transport select jtag" \
-f target/ti_calypso.cfg -f target/ti_calypso.cfg
```
```
openocd -f interface/stlink.cfg -c "transport select hla_swd" \ openocd -f interface/stlink.cfg -c "transport select hla_swd" \
-f target/stm32l0.cfg -f target/stm32l0.cfg
```
After OpenOCD startup, connect GDB with After OpenOCD startup, connect GDB with
(gdb) target extended-remote localhost:3333 (gdb) target extended-remote localhost:3333
===================== # OpenOCD Documentation
OpenOCD Documentation
=====================
In addition to the in-tree documentation, the latest manuals may be In addition to the in-tree documentation, the latest manuals may be
viewed online at the following URLs: viewed online at the following URLs:
@ -71,35 +70,34 @@ by subscribing to the OpenOCD developer mailing list:
openocd-devel@lists.sourceforge.net openocd-devel@lists.sourceforge.net
Building the OpenOCD Documentation ## Building the OpenOCD Documentation
----------------------------------
By default the OpenOCD build process prepares documentation in the By default the OpenOCD build process prepares documentation in the
"Info format" and installs it the standard way, so that "info openocd" "Info format" and installs it the standard way, so that `info openocd`
can access it. can access it.
Additionally, the OpenOCD User's Guide can be produced in the Additionally, the OpenOCD User's Guide can be produced in the
following different formats: following different formats:
# If PDFVIEWER is set, this creates and views the PDF User Guide. If `PDFVIEWER` is set, this creates and views the PDF User Guide.
make pdf && ${PDFVIEWER} doc/openocd.pdf make pdf && ${PDFVIEWER} doc/openocd.pdf
# If HTMLVIEWER is set, this creates and views the HTML User Guide. If `HTMLVIEWER` is set, this creates and views the HTML User Guide.
make html && ${HTMLVIEWER} doc/openocd.html/index.html make html && ${HTMLVIEWER} doc/openocd.html/index.html
The OpenOCD Developer Manual contains information about the internal The OpenOCD Developer Manual contains information about the internal
architecture and other details about the code: architecture and other details about the code:
# NB! make sure doxygen is installed, type doxygen --version Note: make sure doxygen is installed, type doxygen --version
make doxygen && ${HTMLVIEWER} doxygen/index.html make doxygen && ${HTMLVIEWER} doxygen/index.html
================== # Supported hardware
Supported hardware
==================
JTAG adapters ## JTAG adapters
-------------
AM335x, ARM-JTAG-EW, ARM-USB-OCD, ARM-USB-TINY, AT91RM9200, axm0432, BCM2835, AM335x, ARM-JTAG-EW, ARM-USB-OCD, ARM-USB-TINY, AT91RM9200, axm0432, BCM2835,
Bus Blaster, Buspirate, Cadence DPI, Cadence vdebug, Chameleon, CMSIS-DAP, Bus Blaster, Buspirate, Cadence DPI, Cadence vdebug, Chameleon, CMSIS-DAP,
@ -116,8 +114,7 @@ sysfsgpio, Tigard, TI XDS110, TUMPA, Turtelizer, ULINK, USB-A9260, USB-Blaster,
USB-JTAG, USBprog, VPACLink, VSLLink, Wiggler, XDS100v2, Xilinx XVC/PCIe, USB-JTAG, USBprog, VPACLink, VSLLink, Wiggler, XDS100v2, Xilinx XVC/PCIe,
Xverve. Xverve.
Debug targets ## Debug targets
-------------
ARM: AArch64, ARM11, ARM7, ARM9, Cortex-A/R (v7-A/R), Cortex-M (ARMv{6/7/8}-M), ARM: AArch64, ARM11, ARM7, ARM9, Cortex-A/R (v7-A/R), Cortex-M (ARMv{6/7/8}-M),
FA526, Feroceon/Dragonite, XScale. FA526, Feroceon/Dragonite, XScale.
@ -125,8 +122,7 @@ ARCv2, AVR32, DSP563xx, DSP5680xx, EnSilica eSi-RISC, EJTAG (MIPS32, MIPS64),
ESP32, ESP32-S2, ESP32-S3, Intel Quark, LS102x-SAP, RISC-V, ST STM8, ESP32, ESP32-S2, ESP32-S3, Intel Quark, LS102x-SAP, RISC-V, ST STM8,
Xtensa. Xtensa.
Flash drivers ## Flash drivers
-------------
ADUC702x, AT91SAM, AT91SAM9 (NAND), ATH79, ATmega128RFA1, Atmel SAM, AVR, CFI, ADUC702x, AT91SAM, AT91SAM9 (NAND), ATH79, ATmega128RFA1, Atmel SAM, AVR, CFI,
DSP5680xx, EFM32, EM357, eSi-RISC, eSi-TSMC, EZR32HG, FM3, FM4, Freedom E SPI, DSP5680xx, EFM32, EM357, eSi-RISC, eSi-TSMC, EZR32HG, FM3, FM4, Freedom E SPI,
@ -140,12 +136,9 @@ TI CC13xx, TI CC26xx, TI CC32xx, TI MSP432, Winner Micro w600, Xilinx XCF,
XMC1xxx, XMC4xxx. XMC1xxx, XMC4xxx.
================== # Installing OpenOCD
Installing OpenOCD
==================
A Note to OpenOCD Users ## A Note to OpenOCD Users
-----------------------
If you would rather be working "with" OpenOCD rather than "on" it, your If you would rather be working "with" OpenOCD rather than "on" it, your
operating system or JTAG interface supplier may provide binaries for operating system or JTAG interface supplier may provide binaries for
@ -164,8 +157,7 @@ Users of these binary versions of OpenOCD must contact their Packager to
ask for support or newer versions of the binaries; the OpenOCD ask for support or newer versions of the binaries; the OpenOCD
developers do not support packages directly. developers do not support packages directly.
A Note to OpenOCD Packagers ## A Note to OpenOCD Packagers
---------------------------
You are a PACKAGER of OpenOCD if you: You are a PACKAGER of OpenOCD if you:
@ -192,11 +184,9 @@ suggestions:
- Use "ftdi" interface adapter driver for the FTDI-based devices. - Use "ftdi" interface adapter driver for the FTDI-based devices.
================ # Building OpenOCD
Building OpenOCD
================
The INSTALL file contains generic instructions for running 'configure' The INSTALL file contains generic instructions for running `configure`
and compiling the OpenOCD source code. That file is provided by and compiling the OpenOCD source code. That file is provided by
default for all GNU autotools packages. If you are not familiar with default for all GNU autotools packages. If you are not familiar with
the GNU autotools, then you should read those instructions first. the GNU autotools, then you should read those instructions first.
@ -204,8 +194,7 @@ the GNU autotools, then you should read those instructions first.
The remainder of this document tries to provide some instructions for The remainder of this document tries to provide some instructions for
those looking for a quick-install. those looking for a quick-install.
OpenOCD Dependencies ## OpenOCD Dependencies
--------------------
GCC or Clang is currently required to build OpenOCD. The developers GCC or Clang is currently required to build OpenOCD. The developers
have begun to enforce strict code warnings (-Wall, -Werror, -Wextra, have begun to enforce strict code warnings (-Wall, -Werror, -Wextra,
@ -220,9 +209,7 @@ You'll also need:
- make - make
- libtool - libtool
- pkg-config >= 0.23 or pkgconf - pkg-config >= 0.23 or pkgconf
- libjim >= 0.79
OpenOCD uses jimtcl library; build from git can retrieve jimtcl as git
submodule.
Additionally, for building from git: Additionally, for building from git:
@ -250,8 +237,7 @@ Optional development script checkpatch needs:
- python - python
- python-ply - python-ply
Permissions delegation ## Permissions delegation
----------------------
Running OpenOCD with root/administrative permissions is strongly Running OpenOCD with root/administrative permissions is strongly
discouraged for security reasons. discouraged for security reasons.
@ -268,27 +254,24 @@ For parport adapters on Windows you need to run install_giveio.bat
(it's also possible to use "ioperm" with Cygwin instead) to give (it's also possible to use "ioperm" with Cygwin instead) to give
ordinary users permissions for accessing the "LPT" registers directly. ordinary users permissions for accessing the "LPT" registers directly.
Compiling OpenOCD ## Compiling OpenOCD
-----------------
To build OpenOCD, use the following sequence of commands: To build OpenOCD, use the following sequence of commands:
./bootstrap (when building from the git repository) ./bootstrap
./configure [options] ./configure [options]
make make
sudo make install sudo make install
The 'configure' step generates the Makefiles required to build The `bootstrap` command is only necessary when building from the Git repository. The `configure` step generates the Makefiles required to build
OpenOCD, usually with one or more options provided to it. The first OpenOCD, usually with one or more options provided to it. The first
'make' step will build OpenOCD and place the final executable in 'make' step will build OpenOCD and place the final executable in
'./src/'. The final (optional) step, ``make install'', places all of './src/'. The final (optional) step, `make install`, places all of
the files in the required location. the files in the required location.
To see the list of all the supported options, run To see the list of all the supported options, run `./configure --help`
./configure --help
Cross-compiling Options ## Cross-compiling Options
-----------------------
Cross-compiling is supported the standard autotools way, you just need Cross-compiling is supported the standard autotools way, you just need
to specify the cross-compiling target triplet in the --host option, to specify the cross-compiling target triplet in the --host option,
@ -303,29 +286,26 @@ additional wrapper script as described at
This is needed to tell pkg-config where to look for the target This is needed to tell pkg-config where to look for the target
libraries that OpenOCD depends on. Alternatively, you can specify libraries that OpenOCD depends on. Alternatively, you can specify
*_CFLAGS and *_LIBS environment variables directly, see "./configure `*_CFLAGS` and `*_LIBS` environment variables directly, see `./configure
--help" for the details. --help` for the details.
For a more or less complete script that does all this for you, see For a more or less complete script that does all this for you, see
contrib/cross-build.sh contrib/cross-build.sh
Parallel Port Dongles ## Parallel Port Dongles
---------------------
If you want to access the parallel port using the PPDEV interface you If you want to access the parallel port using the PPDEV interface you
have to specify both --enable-parport AND --enable-parport-ppdev, since have to specify both `--enable-parport` and `--enable-parport-ppdev`, since
the later option is an option to the parport driver. the later option is an option to the parport driver.
The same is true for the --enable-parport-giveio option, you have to The same is true for the `--enable-parport-giveio` option, you have to
use both the --enable-parport AND the --enable-parport-giveio option use both the `--enable-parport` and the `--enable-parport-giveio` option
if you want to use giveio instead of ioperm parallel port access if you want to use giveio instead of ioperm parallel port access
method. method.
========================== # Obtaining OpenOCD From GIT
Obtaining OpenOCD From GIT
==========================
You can download the current GIT version with a GIT client of your You can download the current GIT version with a GIT client of your
choice from the main repository: choice from the main repository:
@ -343,9 +323,7 @@ directory called "openocd" in the current directory):
git clone git://git.code.sf.net/p/openocd/code openocd git clone git://git.code.sf.net/p/openocd/code openocd
Then you can update that at your convenience using Then you can update that at your convenience using `git pull`.
git pull
There is also a gitweb interface, which you can use either to browse There is also a gitweb interface, which you can use either to browse
the repository or to download arbitrary snapshots using HTTP: the repository or to download arbitrary snapshots using HTTP:

View File

@ -3,8 +3,8 @@
# Run the autotools bootstrap sequence to create the configure script # Run the autotools bootstrap sequence to create the configure script
# Abort execution on error set -e # Abort execution on error.
set -e set -u # Abort if you reference an undefined variable.
if which libtoolize > /dev/null; then if which libtoolize > /dev/null; then
libtoolize="libtoolize" libtoolize="libtoolize"
@ -15,13 +15,23 @@ else
exit 1 exit 1
fi fi
if [ "$1" = "nosubmodule" ]; then WITH_SUBMODULES=0
SKIP_SUBMODULE=1
case "$#" in
0) ;;
1) if [ "$1" = "with-submodules" ]; then
WITH_SUBMODULES=1
elif [ "$1" = "nosubmodule" ]; then
WITH_SUBMODULES=0
elif [ -n "$1" ]; then elif [ -n "$1" ]; then
echo "$0: Illegal argument $1" echo "$0: Illegal argument $1" >&2
echo "USAGE: $0 [nosubmodule]" echo "USAGE: $0 [with-submodules]" >&2
exit 1 exit 1
fi fi;;
*) echo "$0: Wrong number of command-line arguments." >&2
echo "USAGE: $0 [with-submodules]" >&2
exit 1;;
esac
# bootstrap the autotools # bootstrap the autotools
( (
@ -34,12 +44,12 @@ autoheader --warnings=all
automake --warnings=all --gnu --add-missing --copy automake --warnings=all --gnu --add-missing --copy
) )
if [ -n "$SKIP_SUBMODULE" ]; then if [ "$WITH_SUBMODULES" -ne 0 ]; then
echo "Skipping submodule setup"
else
echo "Setting up submodules" echo "Setting up submodules"
git submodule init git submodule sync
git submodule update git submodule update --init
else
echo "Skipping submodule setup"
fi fi
if [ -x src/jtag/drivers/libjaylink/autogen.sh ]; then if [ -x src/jtag/drivers/libjaylink/autogen.sh ]; then

View File

@ -7,6 +7,6 @@ AC_DEFUN([AX_CONFIG_SUBDIR_OPTION],
AC_CONFIG_SUBDIRS([$1]) AC_CONFIG_SUBDIRS([$1])
m4_ifblank([$2], [rm -f $srcdir/$1/configure.gnu], m4_ifblank([$2], [rm -f $srcdir/$1/configure.gnu],
[echo -e '#!/bin/sh\nexec "`dirname "'\$'0"`/configure" '"$2"' "'\$'@"' > "$srcdir/$1/configure.gnu" [printf '#!/bin/sh\nexec "`dirname "'\$'0"`/configure" '"$2"' "'\$'@"\n' > "$srcdir/$1/configure.gnu"
]) ])
]) ])

View File

@ -52,9 +52,16 @@ AC_SEARCH_LIBS([openpty], [util])
AC_CHECK_HEADERS([sys/socket.h]) AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([elf.h]) AC_CHECK_HEADERS([elf.h])
AC_EGREP_HEADER(Elf64_Ehdr, [elf.h], [
AC_DEFINE([HAVE_ELF64], [1], [Define to 1 if the system has the type `Elf64_Ehdr'.]) AC_CHECK_TYPE([Elf64_Ehdr],
]) AC_DEFINE([HAVE_ELF64], [1], [Define to 1 if the system has the type 'Elf64_Ehdr'.]),
[], [[#include <elf.h>]])
AC_MSG_CHECKING([for glibc])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <features.h>]], [[int v = __GLIBC__;return 0;]])],
[have_glibc=yes], [have_glibc=no])
AC_MSG_RESULT($have_glibc)
AC_CHECK_HEADERS([fcntl.h]) AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([malloc.h]) AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([netdb.h]) AC_CHECK_HEADERS([netdb.h])
@ -104,12 +111,18 @@ AS_IF([test -x "$srcdir/guess-rev.sh"], [
AC_MSG_RESULT([$build_release]) AC_MSG_RESULT([$build_release])
# Adapter drivers # Adapter drivers
# 1st column -- configure option # 1st column -- Basename for the configure option generated with AC_ARG_ENABLE.
# 2nd column -- description # For example, "buspirate" generates options "--enable-buspirate[=yes/no]"
# 3rd column -- symbol used for both config.h and automake # and "--disable-buspirate".
# 2nd column -- Description for the configure option. For example, "Bus Pirate"
# generates "Enable building support for the Bus Pirate (default is auto)".
# 3rd column -- Basename for the config.h and Automake symbols.
# For example, basename "BUS_PIRATE" generates "BUILD_BUS_PIRATE" with AC_DEFINE
# for config.h and "BUS_PIRATE" with AM_CONDITIONAL for Automake.
m4_define([ADAPTER_ARG], [m4_argn([1], $1)]) m4_define([ADAPTER_ARG], [m4_argn([1], $1)])
m4_define([ADAPTER_DESC], [m4_argn([2], $1)]) m4_define([ADAPTER_DESC], [m4_argn([2], $1)])
m4_define([ADAPTER_SYM], [m4_argn([3], $1)]) m4_define([ADAPTER_SYM], [m4_argn([3], $1)])
# AC_ARG_ENABLE uses prefix "enable_" to name the corresponding option variable.
m4_define([ADAPTER_VAR], [enable_[]ADAPTER_ARG($1)]) m4_define([ADAPTER_VAR], [enable_[]ADAPTER_ARG($1)])
m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])]) m4_define([ADAPTER_OPT], [m4_translit(ADAPTER_ARG($1), [_], [-])])
@ -158,9 +171,22 @@ m4_define([PCIE_ADAPTERS],
m4_define([SERIAL_PORT_ADAPTERS], m4_define([SERIAL_PORT_ADAPTERS],
[[[buspirate], [Bus Pirate], [BUS_PIRATE]]]) [[[buspirate], [Bus Pirate], [BUS_PIRATE]]])
m4_define([LINUXSPIDEV_ADAPTER],
[[[linuxspidev], [Linux spidev driver], [LINUXSPIDEV]]])
m4_define([VDEBUG_ADAPTER],
[[[vdebug], [Cadence Virtual Debug Interface], [VDEBUG]]])
# The word 'Adapter' in "Dummy Adapter" below must begin with a capital letter
# because there is an M4 macro called 'adapter'.
m4_define([DUMMY_ADAPTER],
[[[dummy], [Dummy Adapter], [DUMMY]]])
m4_define([OPTIONAL_LIBRARIES], m4_define([OPTIONAL_LIBRARIES],
[[[capstone], [Use Capstone disassembly framework], []]]) [[[capstone], [Use Capstone disassembly framework], []]])
m4_define([COVERAGE],
[[[gcov], [Collect coverage using gcov], []]])
AC_ARG_ENABLE([doxygen-html], AC_ARG_ENABLE([doxygen-html],
AS_HELP_STRING([--disable-doxygen-html], AS_HELP_STRING([--disable-doxygen-html],
[Disable building Doxygen manual as HTML.]), [Disable building Doxygen manual as HTML.]),
@ -189,6 +215,19 @@ AC_ARG_ENABLE([werror],
AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]), AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
[gcc_werror=$enableval], [gcc_werror=$gcc_warnings]) [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])
AC_ARG_ENABLE([gcov],
AS_HELP_STRING([--enable-gcov], [Enable runtime coverage collection via gcov]),
[enable_gcov=$enableval], [enable_gcov=no])
AS_IF([test "x$enable_gcov" = "xyes"], [
AC_DEFINE([USE_GCOV], [1], [1 to enable coverage collection using gcov.])
dnl When collecting coverage, disable optimizations.
dnl This overrides the "-O2" that autoconf uses by default:
CFLAGS+=" -O0"
], [
AC_DEFINE([USE_GCOV], [0], [0 to leave coverage collection disabled.])
])
# set default verbose options, overridden by following options # set default verbose options, overridden by following options
debug_usb_io=no debug_usb_io=no
debug_usb_comms=no debug_usb_comms=no
@ -231,14 +270,10 @@ AC_ARG_ENABLE([malloc_logging],
AC_MSG_CHECKING([whether to enable malloc free space logging]); AC_MSG_CHECKING([whether to enable malloc free space logging]);
AC_MSG_RESULT([$debug_malloc]) AC_MSG_RESULT([$debug_malloc])
AS_IF([test "x$debug_malloc" = "xyes"], [ AS_IF([test "x$debug_malloc" = "xyes" -a "x$have_glibc" = "xyes"], [
AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging]) AC_DEFINE([_DEBUG_FREE_SPACE_],[1], [Include malloc free space in logging])
]) ])
AC_ARG_ENABLE([dummy],
AS_HELP_STRING([--enable-dummy], [Enable building the dummy port driver]),
[build_dummy=$enableval], [build_dummy=no])
AC_ARG_ENABLE([rshim], AC_ARG_ENABLE([rshim],
AS_HELP_STRING([--enable-rshim], [Enable building the rshim driver]), AS_HELP_STRING([--enable-rshim], [Enable building the rshim driver]),
[build_rshim=$enableval], [build_rshim=no]) [build_rshim=$enableval], [build_rshim=no])
@ -250,9 +285,13 @@ AC_ARG_ENABLE([dmem],
m4_define([AC_ARG_ADAPTERS], [ m4_define([AC_ARG_ADAPTERS], [
m4_foreach([adapter], [$1], m4_foreach([adapter], [$1],
[AC_ARG_ENABLE(ADAPTER_OPT([adapter]), [AC_ARG_ENABLE(ADAPTER_OPT([adapter]),
AS_HELP_STRING([--enable-ADAPTER_OPT([adapter])], AS_HELP_STRING([--enable-ADAPTER_OPT([adapter])[[[=yes/no/auto]]]],
[Enable building support for the ]ADAPTER_DESC([adapter])[ (default is $2)]), [Enable building support for the ]ADAPTER_DESC([adapter])[ (default is $2)]),
[], [ADAPTER_VAR([adapter])=$2]) [case "${enableval}" in
yes|no|auto) ;;
*) AC_MSG_ERROR([Option --enable-ADAPTER_OPT([adapter]) has invalid value "${enableval}".]) ;;
esac],
[ADAPTER_VAR([adapter])=$2])
]) ])
]) ])
@ -261,9 +300,13 @@ AC_ARG_ADAPTERS([
HIDAPI_ADAPTERS, HIDAPI_ADAPTERS,
HIDAPI_USB1_ADAPTERS, HIDAPI_USB1_ADAPTERS,
LIBFTDI_ADAPTERS, LIBFTDI_ADAPTERS,
LIBFTDI_USB1_ADAPTERS LIBFTDI_USB1_ADAPTERS,
LIBGPIOD_ADAPTERS, LIBGPIOD_ADAPTERS,
LINUXSPIDEV_ADAPTER,
SERIAL_PORT_ADAPTERS, SERIAL_PORT_ADAPTERS,
DUMMY_ADAPTER,
VDEBUG_ADAPTER,
PCIE_ADAPTERS,
LIBJAYLINK_ADAPTERS LIBJAYLINK_ADAPTERS
],[auto]) ],[auto])
@ -285,10 +328,6 @@ AC_ARG_ENABLE([jtag_vpi],
AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]), AS_HELP_STRING([--enable-jtag_vpi], [Enable building support for JTAG VPI]),
[build_jtag_vpi=$enableval], [build_jtag_vpi=no]) [build_jtag_vpi=$enableval], [build_jtag_vpi=no])
AC_ARG_ENABLE([vdebug],
AS_HELP_STRING([--enable-vdebug], [Enable building support for Cadence Virtual Debug Interface]),
[build_vdebug=$enableval], [build_vdebug=no])
AC_ARG_ENABLE([jtag_dpi], AC_ARG_ENABLE([jtag_dpi],
AS_HELP_STRING([--enable-jtag_dpi], [Enable building support for JTAG DPI]), AS_HELP_STRING([--enable-jtag_dpi], [Enable building support for JTAG DPI]),
[build_jtag_dpi=$enableval], [build_jtag_dpi=no]) [build_jtag_dpi=$enableval], [build_jtag_dpi=no])
@ -338,25 +377,15 @@ AC_ARG_ENABLE([sysfsgpio],
AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]), AS_HELP_STRING([--enable-sysfsgpio], [Enable building support for programming driven via sysfs gpios.]),
[build_sysfsgpio=$enableval], [build_sysfsgpio=no]) [build_sysfsgpio=$enableval], [build_sysfsgpio=no])
AC_ARG_ENABLE([xlnx_pcie_xvc],
AS_HELP_STRING([--enable-xlnx-pcie-xvc], [Enable building support for Xilinx XVC/PCIe.]),
[build_xlnx_pcie_xvc=$enableval], [build_xlnx_pcie_xvc=no])
AS_CASE([$host_os], AS_CASE([$host_os],
[linux*], [], [linux*], [
is_linux=yes
],
[ [
AS_IF([test "x$build_sysfsgpio" = "xyes"], [ AS_IF([test "x$build_sysfsgpio" = "xyes"], [
AC_MSG_ERROR([sysfsgpio is only available on linux]) AC_MSG_ERROR([sysfsgpio is only available on linux])
]) ])
AS_IF([test "x$enable_linuxgpiod" = "xyes"], [
AC_MSG_ERROR([linuxgpiod is only available on linux])
])
AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
AC_MSG_ERROR([xlnx_pcie_xvc is only available on linux])
])
AS_CASE([$host_os], [freebsd*], [], AS_CASE([$host_os], [freebsd*], [],
[ [
AS_IF([test "x$build_rshim" = "xyes"], [ AS_IF([test "x$build_rshim" = "xyes"], [
@ -370,8 +399,8 @@ AS_CASE([$host_os],
]) ])
AC_ARG_ENABLE([internal-jimtcl], AC_ARG_ENABLE([internal-jimtcl],
AS_HELP_STRING([--disable-internal-jimtcl], [Disable building internal jimtcl]), AS_HELP_STRING([--enable-internal-jimtcl], [Enable building internal jimtcl (deprecated)]),
[use_internal_jimtcl=$enableval], [use_internal_jimtcl=yes]) [use_internal_jimtcl=$enableval], [use_internal_jimtcl=no])
AC_ARG_ENABLE([jimtcl-maintainer], AC_ARG_ENABLE([jimtcl-maintainer],
AS_HELP_STRING([--enable-jimtcl-maintainer], [Enable maintainer mode when building internal jimtcl]), AS_HELP_STRING([--enable-jimtcl-maintainer], [Enable maintainer mode when building internal jimtcl]),
@ -395,8 +424,10 @@ AS_CASE(["${host_cpu}"],
parport_use_ppdev=yes parport_use_ppdev=yes
]) ])
AS_CASE([$host], can_build_buspirate=yes
[*-cygwin*], [
AS_CASE([$host_os],
[cygwin*], [
is_win32=yes is_win32=yes
parport_use_ppdev=no parport_use_ppdev=no
@ -416,7 +447,7 @@ AS_CASE([$host],
]) ])
]) ])
], ],
[*-mingw* | *-msys*], [ [mingw* | msys*], [
is_mingw=yes is_mingw=yes
is_win32=yes is_win32=yes
parport_use_ppdev=no parport_use_ppdev=no
@ -426,16 +457,16 @@ AS_CASE([$host],
]) ])
parport_use_giveio=yes parport_use_giveio=yes
AS_IF([test "x$enable_buspirate" = "xyes"], [ AS_IF([test "x$ADAPTER_VAR([buspirate])" = "xyes"], [
AC_MSG_ERROR([buspirate currently not supported by MinGW32 hosts]) AC_MSG_ERROR([The Bus Pirate adapter is currently not supported by MinGW32 hosts.])
]) ])
# In case enable_buspirate=auto, make sure it will not be built. # In case enable_buspirate=auto, make sure it will not be built.
enable_buspirate=no can_build_buspirate=no
AC_SUBST([HOST_CPPFLAGS], [-D__USE_MINGW_ANSI_STDIO]) AC_SUBST([HOST_CPPFLAGS], ["-D__USE_MINGW_ANSI_STDIO -DFD_SETSIZE=128"])
], ],
[*darwin*], [ [darwin*], [
is_darwin=yes is_darwin=yes
AS_IF([test "x$parport_use_giveio" = "xyes"], [ AS_IF([test "x$parport_use_giveio" = "xyes"], [
@ -493,11 +524,8 @@ AS_IF([test "x$build_dmem" = "xyes"], [
AC_DEFINE([BUILD_DMEM], [0], [0 if you don't want to debug via Direct Mem.]) AC_DEFINE([BUILD_DMEM], [0], [0 if you don't want to debug via Direct Mem.])
]) ])
AS_IF([test "x$build_dummy" = "xyes"], [ AS_IF([test "x$ADAPTER_VAR([dummy])" != "xno"], [
build_bitbang=yes build_bitbang=yes
AC_DEFINE([BUILD_DUMMY], [1], [1 if you want dummy driver.])
], [
AC_DEFINE([BUILD_DUMMY], [0], [0 if you don't want dummy driver.])
]) ])
AS_IF([test "x$build_ep93xx" = "xyes"], [ AS_IF([test "x$build_ep93xx" = "xyes"], [
@ -553,12 +581,6 @@ AS_IF([test "x$build_jtag_vpi" = "xyes"], [
AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.]) AC_DEFINE([BUILD_JTAG_VPI], [0], [0 if you don't want JTAG VPI.])
]) ])
AS_IF([test "x$build_vdebug" = "xyes"], [
AC_DEFINE([BUILD_VDEBUG], [1], [1 if you want Cadence vdebug interface.])
], [
AC_DEFINE([BUILD_VDEBUG], [0], [0 if you don't want Cadence vdebug interface.])
])
AS_IF([test "x$build_jtag_dpi" = "xyes"], [ AS_IF([test "x$build_jtag_dpi" = "xyes"], [
AC_DEFINE([BUILD_JTAG_DPI], [1], [1 if you want JTAG DPI.]) AC_DEFINE([BUILD_JTAG_DPI], [1], [1 if you want JTAG DPI.])
], [ ], [
@ -578,12 +600,6 @@ AS_IF([test "x$build_gw16012" = "xyes"], [
AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.]) AC_DEFINE([BUILD_GW16012], [0], [0 if you don't want the Gateworks GW16012 driver.])
]) ])
AS_IF([test "x$enable_buspirate" != "xno"], [
AC_DEFINE([BUILD_BUSPIRATE], [1], [1 if you want the Buspirate JTAG driver.])
], [
AC_DEFINE([BUILD_BUSPIRATE], [0], [0 if you don't want the Buspirate JTAG driver.])
])
AS_IF([test "x$use_internal_jimtcl" = "xyes"], [ AS_IF([test "x$use_internal_jimtcl" = "xyes"], [
AS_IF([test -f "$srcdir/jimtcl/configure"], [ AS_IF([test -f "$srcdir/jimtcl/configure"], [
AS_IF([test "x$use_internal_jimtcl_maintainer" = "xyes"], [ AS_IF([test "x$use_internal_jimtcl_maintainer" = "xyes"], [
@ -595,6 +611,15 @@ AS_IF([test "x$use_internal_jimtcl" = "xyes"], [
], [ ], [
AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.]) AC_MSG_ERROR([jimtcl not found, run git submodule init and git submodule update.])
]) ])
], [
PKG_CHECK_MODULES([JIMTCL], [jimtcl >= 0.79], [
have_jimtcl_pkg_config=yes
], [
have_jimtcl_pkg_config=no
AC_CHECK_HEADER([jim.h], [], [
AC_MSG_ERROR([jimtcl is required but not found via pkg-config and system includes])
])
])
]) ])
AS_IF([test "x$build_remote_bitbang" = "xyes"], [ AS_IF([test "x$build_remote_bitbang" = "xyes"], [
@ -611,13 +636,6 @@ AS_IF([test "x$build_sysfsgpio" = "xyes"], [
AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.]) AC_DEFINE([BUILD_SYSFSGPIO], [0], [0 if you don't want SysfsGPIO driver.])
]) ])
AS_IF([test "x$build_xlnx_pcie_xvc" = "xyes"], [
build_xlnx_pcie_xvc=yes
AC_DEFINE([BUILD_XLNX_PCIE_XVC], [1], [1 if you want the Xilinx XVC/PCIe driver.])
], [
AC_DEFINE([BUILD_XLNX_PCIE_XVC], [0], [0 if you don't want Xilinx XVC/PCIe driver.])
])
PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [ PKG_CHECK_MODULES([LIBUSB1], [libusb-1.0], [
use_libusb1=yes use_libusb1=yes
AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x]) AC_DEFINE([HAVE_LIBUSB1], [1], [Define if you have libusb-1.x])
@ -670,11 +688,20 @@ PKG_CHECK_MODULES([LIBFTDI], [libftdi1], [
PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no]) PKG_CHECK_MODULES([LIBFTDI], [libftdi], [use_libftdi=yes], [use_libftdi=no])
]) ])
PKG_CHECK_MODULES([LIBGPIOD], [libgpiod], [use_libgpiod=yes], [use_libgpiod=no]) PKG_CHECK_MODULES([LIBGPIOD], [libgpiod < 2.0], [
use_libgpiod=yes
PKG_CHECK_EXISTS([libgpiod >= 1.5],
[AC_DEFINE([HAVE_LIBGPIOD1_FLAGS_BIAS], [1], [define if libgpiod v1 has line request flags bias])])
], [use_libgpiod=no])
PKG_CHECK_MODULES([LIBJAYLINK], [libjaylink >= 0.2], PKG_CHECK_MODULES([LIBJAYLINK], [libjaylink >= 0.2],
[use_libjaylink=yes], [use_libjaylink=no]) [use_libjaylink=yes], [use_libjaylink=no])
# Arg $1: An array of adapter triplets, used to derive option and variable names for each adapter.
# Arg $2: Whether the adapters can be enabled, for example, because
# their prerequisites are installed in the system.
# Arg $3: What prerequisites are missing, to be shown in an error message
# if an adapter was requested but cannot be enabled.
m4_define([PROCESS_ADAPTERS], [ m4_define([PROCESS_ADAPTERS], [
m4_foreach([adapter], [$1], [ m4_foreach([adapter], [$1], [
AS_IF([test $2], [ AS_IF([test $2], [
@ -685,7 +712,7 @@ m4_define([PROCESS_ADAPTERS], [
]) ])
], [ ], [
AS_IF([test "x$ADAPTER_VAR([adapter])" = "xyes"], [ AS_IF([test "x$ADAPTER_VAR([adapter])" = "xyes"], [
AC_MSG_ERROR([$3 is required for the ADAPTER_DESC([adapter])]) AC_MSG_ERROR([$3 is required for [adapter] "ADAPTER_DESC([adapter])".])
]) ])
ADAPTER_VAR([adapter])=no ADAPTER_VAR([adapter])=no
AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).) AC_DEFINE([BUILD_]ADAPTER_SYM([adapter]), [0], [0 if you do not want the ]ADAPTER_DESC([adapter]).)
@ -699,8 +726,14 @@ PROCESS_ADAPTERS([HIDAPI_ADAPTERS], ["x$use_hidapi" = "xyes"], [hidapi])
PROCESS_ADAPTERS([HIDAPI_USB1_ADAPTERS], ["x$use_hidapi" = "xyes" -a "x$use_libusb1" = "xyes"], [hidapi and libusb-1.x]) PROCESS_ADAPTERS([HIDAPI_USB1_ADAPTERS], ["x$use_hidapi" = "xyes" -a "x$use_libusb1" = "xyes"], [hidapi and libusb-1.x])
PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi]) PROCESS_ADAPTERS([LIBFTDI_ADAPTERS], ["x$use_libftdi" = "xyes"], [libftdi])
PROCESS_ADAPTERS([LIBFTDI_USB1_ADAPTERS], ["x$use_libftdi" = "xyes" -a "x$use_libusb1" = "xyes"], [libftdi and libusb-1.x]) PROCESS_ADAPTERS([LIBFTDI_USB1_ADAPTERS], ["x$use_libftdi" = "xyes" -a "x$use_libusb1" = "xyes"], [libftdi and libusb-1.x])
PROCESS_ADAPTERS([LIBGPIOD_ADAPTERS], ["x$use_libgpiod" = "xyes"], [libgpiod]) PROCESS_ADAPTERS([LIBGPIOD_ADAPTERS], ["x$use_libgpiod" = "xyes"], [Linux libgpiod])
PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.2]) PROCESS_ADAPTERS([LIBJAYLINK_ADAPTERS], ["x$use_internal_libjaylink" = "xyes" -o "x$use_libjaylink" = "xyes"], [libjaylink-0.2])
PROCESS_ADAPTERS([PCIE_ADAPTERS], ["x$is_linux" = "xyes"], [Linux build])
PROCESS_ADAPTERS([SERIAL_PORT_ADAPTERS], ["x$can_build_buspirate" = "xyes"],
[internal error: validation should happen beforehand])
PROCESS_ADAPTERS([LINUXSPIDEV_ADAPTER], ["x$is_linux" = "xyes"], [Linux spidev])
PROCESS_ADAPTERS([VDEBUG_ADAPTER], [true], [unused])
PROCESS_ADAPTERS([DUMMY_ADAPTER], [true], [unused])
AS_IF([test "x$enable_linuxgpiod" != "xno"], [ AS_IF([test "x$enable_linuxgpiod" != "xno"], [
build_bitbang=yes build_bitbang=yes
@ -740,7 +773,6 @@ AS_IF([test "x$enable_esp_usb_jtag" != "xno"], [
AM_CONDITIONAL([RELEASE], [test "x$build_release" = "xyes"]) AM_CONDITIONAL([RELEASE], [test "x$build_release" = "xyes"])
AM_CONDITIONAL([PARPORT], [test "x$build_parport" = "xyes"]) AM_CONDITIONAL([PARPORT], [test "x$build_parport" = "xyes"])
AM_CONDITIONAL([DUMMY], [test "x$build_dummy" = "xyes"])
AM_CONDITIONAL([GIVEIO], [test "x$parport_use_giveio" = "xyes"]) AM_CONDITIONAL([GIVEIO], [test "x$parport_use_giveio" = "xyes"])
AM_CONDITIONAL([EP93XX], [test "x$build_ep93xx" = "xyes"]) AM_CONDITIONAL([EP93XX], [test "x$build_ep93xx" = "xyes"])
AM_CONDITIONAL([AT91RM9200], [test "x$build_at91rm9200" = "xyes"]) AM_CONDITIONAL([AT91RM9200], [test "x$build_at91rm9200" = "xyes"])
@ -749,15 +781,12 @@ AM_CONDITIONAL([IMX_GPIO], [test "x$build_imx_gpio" = "xyes"])
AM_CONDITIONAL([AM335XGPIO], [test "x$build_am335xgpio" = "xyes"]) AM_CONDITIONAL([AM335XGPIO], [test "x$build_am335xgpio" = "xyes"])
AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"]) AM_CONDITIONAL([BITBANG], [test "x$build_bitbang" = "xyes"])
AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes"]) AM_CONDITIONAL([JTAG_VPI], [test "x$build_jtag_vpi" = "xyes"])
AM_CONDITIONAL([VDEBUG], [test "x$build_vdebug" = "xyes"])
AM_CONDITIONAL([JTAG_DPI], [test "x$build_jtag_dpi" = "xyes"]) AM_CONDITIONAL([JTAG_DPI], [test "x$build_jtag_dpi" = "xyes"])
AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"]) AM_CONDITIONAL([USB_BLASTER_DRIVER], [test "x$enable_usb_blaster" != "xno" -o "x$enable_usb_blaster_2" != "xno"])
AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"]) AM_CONDITIONAL([AMTJTAGACCEL], [test "x$build_amtjtagaccel" = "xyes"])
AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"]) AM_CONDITIONAL([GW16012], [test "x$build_gw16012" = "xyes"])
AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"]) AM_CONDITIONAL([REMOTE_BITBANG], [test "x$build_remote_bitbang" = "xyes"])
AM_CONDITIONAL([BUSPIRATE], [test "x$enable_buspirate" != "xno"])
AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"]) AM_CONDITIONAL([SYSFSGPIO], [test "x$build_sysfsgpio" = "xyes"])
AM_CONDITIONAL([XLNX_PCIE_XVC], [test "x$build_xlnx_pcie_xvc" = "xyes"])
AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"]) AM_CONDITIONAL([USE_LIBUSB1], [test "x$use_libusb1" = "xyes"])
AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"]) AM_CONDITIONAL([IS_CYGWIN], [test "x$is_cygwin" = "xyes"])
AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"]) AM_CONDITIONAL([IS_MINGW], [test "x$is_mingw" = "xyes"])
@ -773,8 +802,11 @@ AM_CONDITIONAL([DMEM], [test "x$build_dmem" = "xyes"])
AM_CONDITIONAL([HAVE_CAPSTONE], [test "x$enable_capstone" != "xno"]) AM_CONDITIONAL([HAVE_CAPSTONE], [test "x$enable_capstone" != "xno"])
AM_CONDITIONAL([INTERNAL_JIMTCL], [test "x$use_internal_jimtcl" = "xyes"]) AM_CONDITIONAL([INTERNAL_JIMTCL], [test "x$use_internal_jimtcl" = "xyes"])
AM_CONDITIONAL([HAVE_JIMTCL_PKG_CONFIG], [test "x$have_jimtcl_pkg_config" = "xyes"])
AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = "xyes"]) AM_CONDITIONAL([INTERNAL_LIBJAYLINK], [test "x$use_internal_libjaylink" = "xyes"])
AM_CONDITIONAL([USE_GCOV], [test "x$enable_gcov" = "xyes"])
# Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h? # Look for environ alternatives. Possibility #1: is environ in unistd.h or stdlib.h?
AC_MSG_CHECKING([for environ in unistd.h and stdlib.h]) AC_MSG_CHECKING([for environ in unistd.h and stdlib.h])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
@ -840,6 +872,10 @@ AS_IF([test "x$enable_jlink" != "xno"], [
]]) ]])
) )
AS_IF([test "x$use_internal_jimtcl" = "xyes"], [
AC_MSG_WARN([Using the internal jimtcl is deprecated and will not be possible in the future.])
])
echo echo
echo echo
echo OpenOCD configuration summary echo OpenOCD configuration summary
@ -849,7 +885,11 @@ m4_foreach([adapter], [USB1_ADAPTERS,
LIBFTDI_USB1_ADAPTERS, LIBFTDI_USB1_ADAPTERS,
LIBGPIOD_ADAPTERS, LIBGPIOD_ADAPTERS,
LIBJAYLINK_ADAPTERS, PCIE_ADAPTERS, SERIAL_PORT_ADAPTERS, LIBJAYLINK_ADAPTERS, PCIE_ADAPTERS, SERIAL_PORT_ADAPTERS,
OPTIONAL_LIBRARIES], LINUXSPIDEV_ADAPTER,
VDEBUG_ADAPTER,
DUMMY_ADAPTER,
OPTIONAL_LIBRARIES,
COVERAGE],
[s=m4_format(["%-40s"], ADAPTER_DESC([adapter])) [s=m4_format(["%-40s"], ADAPTER_DESC([adapter]))
AS_CASE([$ADAPTER_VAR([adapter])], AS_CASE([$ADAPTER_VAR([adapter])],
[auto], [ [auto], [
@ -860,6 +900,11 @@ m4_foreach([adapter], [USB1_ADAPTERS,
], ],
[no], [ [no], [
echo "$s"no echo "$s"no
],
[
AC_MSG_ERROR(m4_normalize([
Error in [adapter] "ADAPTER_ARG([adapter])": Variable "ADAPTER_VAR([adapter])"
has invalid value "$ADAPTER_VAR([adapter])".]))
]) ])
]) ])
echo echo

View File

@ -29,6 +29,27 @@ ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6014", MODE="660", GROUP="plugdev",
# Original FT231XQ VID:PID # Original FT231XQ VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE="660", GROUP="plugdev", TAG+="uaccess" ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6015", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Original FT2233HP VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6040", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Original FT4233HP VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6041", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Original FT2232HP VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6042", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Original FT4232HP VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6043", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Original FT233HP VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6044", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Original FT232HP VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6045", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Original FT4232HA VID:PID
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6048", MODE="660", GROUP="plugdev", TAG+="uaccess"
# DISTORTEC JTAG-lock-pick Tiny 2 # DISTORTEC JTAG-lock-pick Tiny 2
ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8220", MODE="660", GROUP="plugdev", TAG+="uaccess" ATTRS{idVendor}=="0403", ATTRS{idProduct}=="8220", MODE="660", GROUP="plugdev", TAG+="uaccess"

View File

@ -1,68 +0,0 @@
+OpenOCD and CoreSight Tracing
+
Many recent ARM chips (Using e..g. Cortex-M3 and
Cortex-M4 cores) support CoreSight debug/trace.
This note sketches an approach currently planned for those cores
with OpenOCD.
This tracing data can help debug and tune ARM software, but not
all cores support tracing. Some support more extensive tracing
other cores with trace support +should be able to use the same
approach and maybe some of the same analysis code.
+the Cortex-M3 is assumed here to be the
+core in use, for simplicity and to reflect current OpenOCD users.
This note summarizes a software model to generate, collect, and
analyze such trace data . That is not fully implemented as of early
January 2011, +and thus is not *yet* usable.
+
+
+Some microcontroller cores support a low pin-count Single-wire trace,
with a mode where +trace data is emitted (usually to a UART. To use
this mode, +SWD must be in use.
+At this writing, OpenOCD SWD support is not yet complete either.
(There are also multi-wire trace ports requiring more complex debug
adapters than OpenOCD currently supports, and offering richer data.
+
+
+* ENABLING involves activating SWD and (single wire) trace.
+
+current expectations are that OpenOCD itself will handle enabling;
activating single wire trace involves a debug adapter interaction, and
collecting that trace data requires particular (re)wiring.
+
+* CONFIGURATION involves setting up ITM and/or ETM modules to emit the
+desired data from the Cortex core. (This might include dumping
+event counters printf-style messages; code profiling; and more. Not all
+cores offer the same trace capabilities.
+
+current expectations are that Tcl scripts will be used to configure these
+modules for the desired tracing, by direct writes to registers. In some
+cases (as with RTOS event tracking and similar messaging, this might
+be augmented or replaced by user code running on the ARM core.
+
+COLLECTION involves reading that trace data, probably through UART, and
+saving it in a useful format to analyse For now, deferred analysis modes
are assumed, not than real-time or interactive ones.
+
+
+current expectations are to to dump data in text using contrib/itmdump.c
+or derived tools, and to post-process it into reports. Such reports might
+include program messaging (such as application data streams via ITM, maybe
+using printf type messaging; code coverage analysis or so forth. Recent
+versions of CMSIS software reserve some ITM codespace for RTOS event
tracing and include ITM messaging support.
Clearly some of that data would be valuable for interactive debugging.
+
+Should someone get ambitious, GUI reports should be possible. GNU tools
+for simpler reports like gprof may be simpler to support at first.
+In any case, OpenOCD is not currently GUI-oriented. Accordingly, we now
+expect any such graphics to come from postprocessing.
measurements for RTOS event timings should also be easy to collect.
+Examples include context and message switch times, as well as times
for application interactions.
+

View File

@ -42,6 +42,7 @@ WORK_DIR=$PWD
: ${LIBFTDI_SRC:=/path/to/libftdi} : ${LIBFTDI_SRC:=/path/to/libftdi}
: ${CAPSTONE_SRC:=/path/to/capstone} : ${CAPSTONE_SRC:=/path/to/capstone}
: ${LIBJAYLINK_SRC:=/path/to/libjaylink} : ${LIBJAYLINK_SRC:=/path/to/libjaylink}
: ${JIMTCL_SRC:=/path/to/jimtcl}
OPENOCD_SRC=`readlink -m $OPENOCD_SRC` OPENOCD_SRC=`readlink -m $OPENOCD_SRC`
LIBUSB1_SRC=`readlink -m $LIBUSB1_SRC` LIBUSB1_SRC=`readlink -m $LIBUSB1_SRC`
@ -49,6 +50,7 @@ HIDAPI_SRC=`readlink -m $HIDAPI_SRC`
LIBFTDI_SRC=`readlink -m $LIBFTDI_SRC` LIBFTDI_SRC=`readlink -m $LIBFTDI_SRC`
CAPSTONE_SRC=`readlink -m $CAPSTONE_SRC` CAPSTONE_SRC=`readlink -m $CAPSTONE_SRC`
LIBJAYLINK_SRC=`readlink -m $LIBJAYLINK_SRC` LIBJAYLINK_SRC=`readlink -m $LIBJAYLINK_SRC`
JIMTCL_SRC=`readlink -m $JIMTCL_SRC`
HOST_TRIPLET=$1 HOST_TRIPLET=$1
BUILD_DIR=$WORK_DIR/$HOST_TRIPLET-build BUILD_DIR=$WORK_DIR/$HOST_TRIPLET-build
@ -57,6 +59,7 @@ HIDAPI_BUILD_DIR=$BUILD_DIR/hidapi
LIBFTDI_BUILD_DIR=$BUILD_DIR/libftdi LIBFTDI_BUILD_DIR=$BUILD_DIR/libftdi
CAPSTONE_BUILD_DIR=$BUILD_DIR/capstone CAPSTONE_BUILD_DIR=$BUILD_DIR/capstone
LIBJAYLINK_BUILD_DIR=$BUILD_DIR/libjaylink LIBJAYLINK_BUILD_DIR=$BUILD_DIR/libjaylink
JIMTCL_BUILD_DIR=$BUILD_DIR/jimtcl
OPENOCD_BUILD_DIR=$BUILD_DIR/openocd OPENOCD_BUILD_DIR=$BUILD_DIR/openocd
## Root of host file tree ## Root of host file tree
@ -172,6 +175,18 @@ if [ -d $LIBJAYLINK_SRC ] ; then
make install DESTDIR=$SYSROOT make install DESTDIR=$SYSROOT
fi fi
# jimtcl build & install into sysroot
if [ -d $JIMTCL_SRC ] ; then
mkdir -p $JIMTCL_BUILD_DIR
cd $JIMTCL_BUILD_DIR
$JIMTCL_SRC/configure --host=$HOST_TRIPLET --prefix=$PREFIX \
$JIMTCL_CONFIG
make -j $MAKE_JOBS
# Running "make" does not create this file for static builds on Windows but "make install" still expects it
touch $JIMTCL_BUILD_DIR/build-jim-ext
make install DESTDIR=$SYSROOT
fi
# OpenOCD build & install into sysroot # OpenOCD build & install into sysroot
mkdir -p $OPENOCD_BUILD_DIR mkdir -p $OPENOCD_BUILD_DIR
cd $OPENOCD_BUILD_DIR cd $OPENOCD_BUILD_DIR

View File

@ -43,9 +43,9 @@ unsigned int dump_swit;
* NOTE that this specific encoding could be space-optimized; and that * NOTE that this specific encoding could be space-optimized; and that
* trace data streams could also be history-sensitive. * trace data streams could also be history-sensitive.
*/ */
static void show_task(int port, unsigned data) static void show_task(int port, unsigned int data)
{ {
unsigned code = data >> 16; unsigned int code = data >> 16;
char buf[16]; char buf[16];
if (dump_swit) if (dump_swit)
@ -77,7 +77,7 @@ static void show_task(int port, unsigned data)
static void show_reserved(FILE *f, char *label, int c) static void show_reserved(FILE *f, char *label, int c)
{ {
unsigned i; unsigned int i;
if (dump_swit) if (dump_swit)
return; return;
@ -96,9 +96,9 @@ static void show_reserved(FILE *f, char *label, int c)
printf("\n"); printf("\n");
} }
static bool read_varlen(FILE *f, int c, unsigned *value) static bool read_varlen(FILE *f, int c, unsigned int *value)
{ {
unsigned size; unsigned int size;
unsigned char buf[4]; unsigned char buf[4];
*value = 0; *value = 0;
@ -135,8 +135,8 @@ err:
static void show_hard(FILE *f, int c) static void show_hard(FILE *f, int c)
{ {
unsigned type = c >> 3; unsigned int type = c >> 3;
unsigned value; unsigned int value;
char *label; char *label;
if (dump_swit) if (dump_swit)
@ -230,16 +230,16 @@ static void show_hard(FILE *f, int c)
*/ */
struct { struct {
int port; int port;
void (*show)(int port, unsigned data); void (*show)(int port, unsigned int data);
} format[] = { } format[] = {
{ .port = 31, .show = show_task, }, { .port = 31, .show = show_task, },
}; };
static void show_swit(FILE *f, int c) static void show_swit(FILE *f, int c)
{ {
unsigned port = c >> 3; unsigned int port = c >> 3;
unsigned value = 0; unsigned int value = 0;
unsigned i; unsigned int i;
if (port + 1 == dump_swit) { if (port + 1 == dump_swit) {
if (!read_varlen(f, c, &value)) if (!read_varlen(f, c, &value))
@ -272,7 +272,7 @@ static void show_swit(FILE *f, int c)
static void show_timestamp(FILE *f, int c) static void show_timestamp(FILE *f, int c)
{ {
unsigned counter = 0; unsigned int counter = 0;
char *label = ""; char *label = "";
bool delayed = false; bool delayed = false;

View File

@ -12,7 +12,7 @@
#include <assert.h> #include <assert.h>
#include <helper/list.h> #include <helper/list.h>
static LIST_HEAD(threads); static OOCD_LIST_HEAD(threads);
struct thread { struct thread {
int id; int id;

View File

@ -1,249 +1,248 @@
/* Autogenerated with ../../../../src/helper/bin2char.sh */ /* Autogenerated with ../../../../src/helper/bin2char.sh */
0x08,0xb5,0x00,0xbf,0x00,0xbf,0x00,0xbf,0x00,0xbf,0xdf,0xf8,0x1c,0xd0,0x07,0x48, 0x08,0xb5,0x00,0xbf,0x00,0xbf,0x00,0xbf,0x00,0xbf,0xdf,0xf8,0x1c,0xd0,0x07,0x48,
0x07,0x49,0x4f,0xf0,0x00,0x02,0x88,0x42,0xb8,0xbf,0x40,0xf8,0x04,0x2b,0xfa,0xdb, 0x07,0x49,0x4f,0xf0,0x00,0x02,0x88,0x42,0xb8,0xbf,0x40,0xf8,0x04,0x2b,0xff,0xf6,
0x00,0xf0,0xa8,0xf9,0xfe,0xe7,0x00,0x00,0xf0,0x0e,0x00,0x20,0x54,0x13,0x00,0x20, 0xfa,0xaf,0x00,0xf0,0x71,0xf9,0xfe,0xe7,0xe0,0x0e,0x00,0x20,0x44,0x13,0x00,0x20,
0x98,0x13,0x00,0x20,0x08,0xb5,0x07,0x4b,0x07,0x48,0x03,0x33,0x1b,0x1a,0x06,0x2b, 0x88,0x13,0x00,0x20,0x10,0xb5,0x07,0x4c,0x23,0x78,0x00,0x2b,0x07,0xd1,0x06,0x4b,
0x04,0xd9,0x06,0x4b,0x00,0x2b,0x01,0xd0,0x00,0xf0,0x5c,0xf8,0x08,0xbc,0x01,0xbc,
0x00,0x47,0xc0,0x46,0x50,0x13,0x00,0x20,0x50,0x13,0x00,0x20,0x00,0x00,0x00,0x00,
0x08,0x48,0x09,0x49,0x09,0x1a,0x89,0x10,0x08,0xb5,0xcb,0x0f,0x59,0x18,0x49,0x10,
0x04,0xd0,0x06,0x4b,0x00,0x2b,0x01,0xd0,0x00,0xf0,0x44,0xf8,0x08,0xbc,0x01,0xbc,
0x00,0x47,0xc0,0x46,0x50,0x13,0x00,0x20,0x50,0x13,0x00,0x20,0x00,0x00,0x00,0x00,
0x10,0xb5,0x08,0x4c,0x23,0x78,0x00,0x2b,0x09,0xd1,0xff,0xf7,0xcb,0xff,0x06,0x4b,
0x00,0x2b,0x02,0xd0,0x05,0x48,0xaf,0xf3,0x00,0x80,0x01,0x23,0x23,0x70,0x10,0xbc, 0x00,0x2b,0x02,0xd0,0x05,0x48,0xaf,0xf3,0x00,0x80,0x01,0x23,0x23,0x70,0x10,0xbc,
0x01,0xbc,0x00,0x47,0x54,0x13,0x00,0x20,0x00,0x00,0x00,0x00,0xe0,0x0e,0x00,0x20, 0x01,0xbc,0x00,0x47,0x44,0x13,0x00,0x20,0x00,0x00,0x00,0x00,0xd4,0x0e,0x00,0x20,
0x08,0xb5,0x0b,0x4b,0x00,0x2b,0x03,0xd0,0x0a,0x48,0x0b,0x49,0xaf,0xf3,0x00,0x80, 0x08,0xb5,0x09,0x4b,0x00,0x2b,0x03,0xd0,0x08,0x48,0x09,0x49,0xaf,0xf3,0x00,0x80,
0x0a,0x48,0x03,0x68,0x00,0x2b,0x04,0xd1,0xff,0xf7,0xc2,0xff,0x08,0xbc,0x01,0xbc, 0x08,0x48,0x03,0x68,0x00,0x2b,0x04,0xd0,0x07,0x4b,0x00,0x2b,0x01,0xd0,0x00,0xf0,
0x00,0x47,0x07,0x4b,0x00,0x2b,0xf7,0xd0,0x00,0xf0,0x0c,0xf8,0xf4,0xe7,0xc0,0x46, 0x0d,0xf8,0x08,0xbc,0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,0xd4,0x0e,0x00,0x20,
0x00,0x00,0x00,0x00,0xe0,0x0e,0x00,0x20,0x58,0x13,0x00,0x20,0x4c,0x13,0x00,0x20, 0x48,0x13,0x00,0x20,0x3c,0x13,0x00,0x20,0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,
0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,0xd4,0x30,0x9f,0xe5,0x00,0x00,0x53,0xe3, 0xd8,0x30,0x9f,0xe5,0x00,0x00,0x53,0xe3,0xcc,0x30,0x9f,0x05,0x03,0xd0,0xa0,0xe1,
0xc8,0x30,0x9f,0x05,0x03,0xd0,0xa0,0xe1,0x00,0x20,0x0f,0xe1,0x0f,0x00,0x12,0xe3, 0x00,0x20,0x0f,0xe1,0x0f,0x00,0x12,0xe3,0x15,0x00,0x00,0x0a,0xd1,0xf0,0x21,0xe3,
0x15,0x00,0x00,0x0a,0xd1,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,0x01,0xaa,0x4d,0xe2, 0x03,0xd0,0xa0,0xe1,0x01,0xaa,0x4d,0xe2,0x0a,0x30,0xa0,0xe1,0xd7,0xf0,0x21,0xe3,
0x0a,0x30,0xa0,0xe1,0xd7,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,0x01,0x3a,0x43,0xe2, 0x03,0xd0,0xa0,0xe1,0x01,0x3a,0x43,0xe2,0xdb,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,
0xdb,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,0x01,0x3a,0x43,0xe2,0xd2,0xf0,0x21,0xe3, 0x01,0x3a,0x43,0xe2,0xd2,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,0x02,0x3a,0x43,0xe2,
0x03,0xd0,0xa0,0xe1,0x02,0x3a,0x43,0xe2,0xd3,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1, 0xd3,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,0x02,0x39,0x43,0xe2,0xff,0x30,0xc3,0xe3,
0x02,0x39,0x43,0xe2,0xff,0x30,0xc3,0xe3,0xff,0x3c,0xc3,0xe3,0x04,0x30,0x03,0xe5, 0xff,0x3c,0xc3,0xe3,0x04,0x30,0x03,0xe5,0x00,0x20,0x53,0xe9,0xc0,0x20,0x82,0xe3,
0x00,0x20,0x53,0xe9,0xc0,0x20,0x82,0xe3,0x02,0xf0,0x21,0xe1,0x01,0xa8,0x43,0xe2, 0x02,0xf0,0x21,0xe1,0x01,0xa8,0x43,0xe2,0x00,0x10,0xb0,0xe3,0x01,0xb0,0xa0,0xe1,
0x00,0x10,0xb0,0xe3,0x01,0xb0,0xa0,0xe1,0x01,0x70,0xa0,0xe1,0x5c,0x00,0x9f,0xe5, 0x01,0x70,0xa0,0xe1,0x60,0x00,0x9f,0xe5,0x60,0x20,0x9f,0xe5,0x00,0x20,0x52,0xe0,
0x5c,0x20,0x9f,0xe5,0x00,0x20,0x52,0xe0,0x01,0x30,0x8f,0xe2,0x13,0xff,0x2f,0xe1, 0x01,0x30,0x8f,0xe2,0x13,0xff,0x2f,0xe1,0x00,0xf0,0x44,0xfd,0x11,0x4b,0x00,0x2b,
0x00,0xf0,0x42,0xfd,0x10,0x4b,0x00,0x2b,0x01,0xd0,0xfe,0x46,0x9f,0x46,0x0f,0x4b, 0x01,0xd0,0xfe,0x46,0x9f,0x46,0x10,0x4b,0x00,0x2b,0x01,0xd0,0xfe,0x46,0x9f,0x46,
0x00,0x2b,0x01,0xd0,0xfe,0x46,0x9f,0x46,0x00,0x20,0x00,0x21,0x04,0x00,0x0d,0x00, 0x00,0x20,0x00,0x21,0x04,0x00,0x0d,0x00,0x0e,0x48,0x00,0x28,0x02,0xd0,0x0e,0x48,
0x0d,0x48,0x00,0xf0,0x89,0xfc,0x00,0xf0,0xc3,0xfc,0x20,0x00,0x29,0x00,0x00,0xf0, 0x00,0xf0,0x24,0xfe,0x00,0xf0,0xbe,0xfc,0x20,0x00,0x29,0x00,0x00,0xf0,0xcc,0xf8,
0xd1,0xf8,0x00,0xf0,0x8b,0xfc,0x7b,0x46,0x18,0x47,0x00,0x00,0x11,0x00,0x00,0xef, 0x00,0xf0,0xa4,0xfc,0x7b,0x46,0x18,0x47,0x11,0x00,0x00,0xef,0x00,0x00,0x08,0x00,
0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x13,0x00,0x20,
0x54,0x13,0x00,0x20,0x98,0x13,0x00,0x20,0x15,0x0b,0x00,0x20,0x70,0xb5,0x04,0x46, 0x88,0x13,0x00,0x20,0xad,0x0d,0x00,0x20,0xc1,0x0d,0x00,0x20,0x70,0xb5,0x04,0x46,
0x0e,0x46,0x15,0x46,0x00,0x21,0x28,0x22,0x00,0xf0,0x0e,0xfd,0x26,0x61,0x65,0x62, 0x0e,0x46,0x15,0x46,0x00,0x21,0x28,0x22,0x00,0xf0,0x0c,0xfd,0x26,0x61,0x65,0x62,
0x00,0x21,0x20,0x22,0x02,0x48,0x00,0xf0,0x07,0xfd,0x00,0x20,0x70,0xbd,0x00,0xbf, 0x00,0x21,0x20,0x22,0x02,0x48,0x00,0xf0,0x05,0xfd,0x00,0x20,0x70,0xbd,0x00,0xbf,
0x70,0x13,0x00,0x20,0x10,0xb5,0x01,0x20,0x00,0xf0,0xac,0xf9,0x04,0x46,0x28,0xb9, 0x60,0x13,0x00,0x20,0x10,0xb5,0x01,0x20,0x00,0xf0,0xba,0xf9,0x04,0x46,0x28,0xb9,
0x01,0x21,0x20,0x22,0x03,0x48,0x00,0xf0,0xf7,0xfc,0x01,0xe0,0x40,0xf2,0x01,0x14, 0x01,0x21,0x20,0x22,0x03,0x48,0x00,0xf0,0xf5,0xfc,0x01,0xe0,0x40,0xf2,0x01,0x14,
0x20,0x46,0x10,0xbd,0x70,0x13,0x00,0x20,0x01,0x39,0xf8,0xb5,0x04,0x0b,0x08,0x44, 0x20,0x46,0x10,0xbd,0x60,0x13,0x00,0x20,0x01,0x39,0xf8,0xb5,0x04,0x0b,0x08,0x44,
0x05,0x0b,0x26,0x03,0xac,0x42,0x14,0xd8,0x0b,0x4f,0xe3,0x5d,0x6b,0xb9,0x30,0x46, 0x07,0x0b,0x25,0x03,0xbc,0x42,0x14,0xd8,0x0b,0x4e,0xa3,0x5d,0x6b,0xb9,0x28,0x46,
0x00,0xf0,0xfc,0xf8,0x38,0xb1,0x00,0x04,0x00,0xf4,0x7f,0x00,0x40,0xea,0x04,0x60, 0x00,0xf0,0xf8,0xf8,0x38,0xb1,0x00,0x04,0x00,0xf4,0x7f,0x00,0x40,0xea,0x04,0x60,
0x40,0xf4,0x81,0x70,0xf8,0xbd,0x01,0x23,0xe3,0x55,0x01,0x34,0x06,0xf5,0x80,0x56, 0x40,0xf4,0x81,0x70,0xf8,0xbd,0x01,0x23,0xa3,0x55,0x01,0x34,0x05,0xf5,0x80,0x55,
0xe8,0xe7,0x00,0x20,0xf8,0xbd,0x00,0xbf,0x70,0x13,0x00,0x20,0x2d,0xe9,0xf0,0x4f, 0xe8,0xe7,0x00,0x20,0xf8,0xbd,0x00,0xbf,0x60,0x13,0x00,0x20,0xb2,0xf5,0x80,0x5f,
0x0d,0x46,0x53,0x1e,0x85,0xb0,0x0b,0x44,0x02,0x90,0x4f,0xea,0x11,0x38,0x1b,0x0b, 0xf8,0xb5,0x07,0x46,0x0e,0x46,0x15,0x46,0x0b,0xd8,0x08,0x46,0x11,0x46,0xff,0xf7,
0x16,0x46,0x23,0x48,0x00,0x21,0x20,0x22,0x01,0x93,0x4f,0xea,0x08,0x37,0x00,0xf0, 0xd3,0xff,0x04,0x46,0x40,0xb9,0x38,0x46,0x31,0x46,0x2a,0x46,0x00,0xf0,0xe0,0xf8,
0xbb,0xfc,0x4f,0xf0,0x00,0x09,0xc5,0xf3,0x0b,0x0c,0x01,0x9b,0x98,0x45,0x33,0xd8, 0x02,0xe0,0x4f,0xf4,0x82,0x70,0xf8,0xbd,0x20,0x46,0xf8,0xbd,0x2d,0xe9,0xf0,0x4f,
0x74,0x19,0x07,0xf5,0x80,0x5a,0x54,0x45,0x98,0xbf,0x34,0x46,0xdf,0xf8,0x64,0xb0, 0x53,0x1e,0x0b,0x44,0x1b,0x0b,0x85,0xb0,0x0c,0x46,0x0f,0x0b,0x83,0x46,0x15,0x46,
0x88,0xbf,0xc4,0xf3,0x0b,0x04,0x39,0x46,0x4f,0xf4,0x80,0x52,0x58,0x46,0x88,0xbf, 0x20,0x48,0x00,0x21,0x20,0x22,0x03,0x93,0x4f,0xea,0x07,0x38,0x00,0xf0,0xa2,0xfc,
0x34,0x1b,0xcd,0xf8,0x0c,0xc0,0x00,0xf0,0x5f,0xfc,0xdd,0xf8,0x0c,0xc0,0x02,0x9b, 0x4f,0xf0,0x00,0x0a,0xc4,0xf3,0x0b,0x03,0x03,0x9a,0x97,0x42,0x2e,0xd8,0x08,0xf5,
0x0b,0xeb,0x0c,0x00,0x03,0xeb,0x09,0x01,0x22,0x46,0x00,0xf0,0x55,0xfc,0x38,0x46, 0x80,0x5c,0x2e,0x19,0xdf,0xf8,0x60,0x90,0x66,0x45,0x88,0xbf,0xc6,0xf3,0x0b,0x06,
0x4f,0xf4,0x80,0x51,0x08,0xf1,0x01,0x08,0xff,0xf7,0x9e,0xff,0x68,0xb9,0x39,0x46, 0x41,0x46,0x4f,0xf4,0x80,0x52,0x48,0x46,0x8c,0xbf,0xc6,0xeb,0x05,0x06,0x2e,0x46,
0x58,0x46,0x4f,0xf4,0x80,0x52,0x25,0x44,0x00,0xf0,0xae,0xf8,0x36,0x1b,0xc5,0xf3, 0xcd,0xf8,0x04,0xc0,0x02,0x93,0x00,0xf0,0x41,0xfc,0x02,0x9b,0x0b,0xeb,0x0a,0x01,
0x0b,0x0c,0xa1,0x44,0x57,0x46,0xc8,0xe7,0x00,0x20,0x05,0xb0,0xbd,0xe8,0xf0,0x8f, 0x09,0xeb,0x03,0x00,0x32,0x46,0x00,0xf0,0x39,0xfc,0x48,0x46,0x41,0x46,0x4f,0xf4,
0x70,0x13,0x00,0x20,0x00,0x3c,0x00,0x20,0xb2,0xf5,0x80,0x5f,0xf8,0xb5,0x07,0x46, 0x80,0x52,0xff,0xf7,0xab,0xff,0x01,0x37,0xdd,0xf8,0x04,0xc0,0x38,0xb9,0x34,0x44,
0x0e,0x46,0x15,0x46,0x0b,0xd8,0x08,0x46,0x11,0x46,0xff,0xf7,0x7d,0xff,0x04,0x46, 0xc4,0xf3,0x0b,0x03,0xad,0x1b,0xb2,0x44,0xe0,0x46,0xcd,0xe7,0x00,0x20,0x05,0xb0,
0x40,0xb9,0x38,0x46,0x31,0x46,0x2a,0x46,0x00,0xf0,0x8e,0xf8,0x02,0xe0,0x4f,0xf4, 0xbd,0xe8,0xf0,0x8f,0x60,0x13,0x00,0x20,0x00,0x3c,0x00,0x20,0x08,0xb5,0x00,0xf0,
0x82,0x70,0xf8,0xbd,0x20,0x46,0xf8,0xbd,0x08,0xb5,0x00,0xf0,0x85,0xf8,0x00,0x20, 0x87,0xf8,0x00,0x20,0x08,0xbd,0x00,0x00,0xf8,0xb5,0x32,0x48,0x32,0x49,0x33,0x4a,
0x08,0xbd,0x00,0x00,0xf8,0xb5,0x31,0x48,0x31,0x49,0x32,0x4a,0x32,0x4c,0xff,0xf7, 0x33,0x4d,0xff,0xf7,0x43,0xff,0x00,0x23,0x2b,0x60,0x2a,0x68,0x2d,0x4c,0x14,0x23,
0x3d,0xff,0x00,0x23,0x23,0x60,0x22,0x68,0x2c,0x4f,0x14,0x23,0x03,0xfb,0x02,0x73, 0x03,0xfb,0x02,0x43,0x08,0x33,0x5b,0x68,0x00,0x2b,0xf7,0xd0,0x2d,0x4b,0x1a,0x68,
0x08,0x33,0x5b,0x68,0x00,0x2b,0xf7,0xd0,0x2c,0x4b,0x1a,0x68,0x11,0x07,0xfb,0xd4, 0x19,0x46,0x12,0xf0,0x08,0x0f,0xf9,0xd1,0x2b,0x4e,0x2c,0x4f,0x33,0x68,0x3b,0x60,
0x2b,0x4d,0x2c,0x4e,0x2a,0x68,0x32,0x60,0x42,0xf0,0x33,0x02,0x2a,0x60,0x1a,0x68, 0x43,0xf0,0x33,0x03,0x33,0x60,0x0a,0x68,0x12,0x07,0xfc,0xd4,0x2b,0x68,0x14,0x22,
0x12,0x07,0xfc,0xd4,0x21,0x68,0x14,0x22,0x02,0xfb,0x01,0x73,0x98,0x68,0x13,0x46, 0x02,0xfb,0x03,0x41,0x89,0x68,0x01,0x39,0x04,0x29,0x26,0xd8,0xdf,0xe8,0x01,0xf0,
0x01,0x38,0x04,0x28,0x26,0xd8,0xdf,0xe8,0x00,0xf0,0x03,0x06,0x0e,0x16,0x1e,0x00, 0x03,0x06,0x0e,0x16,0x1e,0x00,0xff,0xf7,0x2d,0xff,0x20,0xe0,0x53,0x43,0xe2,0x18,
0xff,0xf7,0x28,0xff,0x20,0xe0,0x4b,0x43,0xfa,0x18,0x10,0x69,0xf9,0x58,0x52,0x68, 0x10,0x69,0xe1,0x58,0x52,0x68,0xff,0xf7,0xc1,0xff,0x18,0xe0,0x53,0x43,0xe2,0x18,
0xff,0xf7,0xc2,0xff,0x18,0xe0,0x4b,0x43,0xfa,0x18,0x10,0x69,0xf9,0x58,0x52,0x68, 0x10,0x69,0xe1,0x58,0x52,0x68,0xff,0xf7,0x51,0xff,0x10,0xe0,0x53,0x43,0xe2,0x18,
0xff,0xf7,0xa2,0xff,0x10,0xe0,0x4b,0x43,0xfa,0x18,0x10,0x69,0xf9,0x58,0x52,0x68, 0x10,0x69,0xe1,0x58,0x52,0x68,0xff,0xf7,0x61,0xff,0x08,0xe0,0x53,0x43,0xe2,0x18,
0xff,0xf7,0x44,0xff,0x08,0xe0,0x4b,0x43,0xfa,0x18,0xf8,0x58,0x51,0x68,0xff,0xf7, 0xe0,0x58,0x51,0x68,0xff,0xf7,0x20,0xff,0x01,0xe0,0x40,0xf2,0x05,0x10,0x3b,0x68,
0x1b,0xff,0x01,0xe0,0x40,0xf2,0x05,0x10,0x33,0x68,0x2b,0x60,0x0b,0x4b,0x1b,0x68, 0x33,0x60,0x0c,0x4b,0x1b,0x68,0x1b,0x07,0xfb,0xd4,0x2b,0x68,0x14,0x22,0x02,0xfb,
0x1b,0x07,0xfb,0xd4,0x22,0x68,0x14,0x23,0x03,0xfb,0x02,0x77,0xfb,0x68,0xf8,0x60, 0x03,0x44,0x10,0xb1,0xe3,0x68,0xe0,0x60,0xfe,0xe7,0xe2,0x68,0x83,0xf0,0x01,0x03,
0x00,0xb1,0xfe,0xe7,0x82,0xf0,0x01,0x02,0x22,0x60,0xa4,0xe7,0xd8,0x1b,0x00,0x20, 0xe0,0x60,0xa1,0xe7,0xd8,0x1b,0x00,0x20,0x00,0x1c,0x00,0x20,0x00,0x2c,0x00,0x20,
0x00,0x1c,0x00,0x20,0x00,0x2c,0x00,0x20,0x90,0x13,0x00,0x20,0x00,0x40,0x03,0x40, 0x80,0x13,0x00,0x20,0x00,0x40,0x03,0x40,0x04,0x40,0x03,0x40,0x84,0x13,0x00,0x20,
0x04,0x40,0x03,0x40,0x94,0x13,0x00,0x20,0xfe,0xe7,0x00,0x00,0x08,0xb5,0x04,0x4b, 0xfe,0xe7,0x00,0x00,0x08,0xb5,0x04,0x4b,0x1b,0x68,0x5b,0x69,0x98,0x47,0x03,0x4b,
0x1b,0x68,0x5b,0x69,0x98,0x47,0x03,0x4b,0x00,0x22,0x1a,0x60,0x08,0xbd,0x00,0xbf, 0x00,0x22,0x1a,0x60,0x08,0xbd,0x00,0xbf,0xa8,0x01,0x00,0x10,0x84,0x04,0x60,0x42,
0xa8,0x01,0x00,0x10,0x84,0x04,0x60,0x42,0x08,0xb5,0x04,0x4b,0x1b,0x68,0x9b,0x69, 0x08,0xb5,0x04,0x4b,0x1b,0x68,0x9b,0x69,0x98,0x47,0x03,0x4b,0x00,0x22,0x1a,0x60,
0x98,0x47,0x03,0x4b,0x00,0x22,0x1a,0x60,0x08,0xbd,0x00,0xbf,0xa8,0x01,0x00,0x10, 0x08,0xbd,0x00,0xbf,0xa8,0x01,0x00,0x10,0x84,0x04,0x60,0x42,0x10,0xb5,0x3a,0x4b,
0x84,0x04,0x60,0x42,0x10,0xb5,0x33,0x4b,0x33,0x48,0x1b,0x68,0x33,0x4a,0x13,0xf0, 0x3a,0x4a,0x1b,0x68,0x13,0xf0,0x02,0x0f,0x39,0x4b,0x19,0x68,0x41,0xf0,0x02,0x01,
0x02,0x0f,0x03,0x68,0x43,0xf0,0x02,0x03,0x03,0x60,0x13,0x68,0x01,0x68,0x19,0xd0, 0x19,0x60,0x12,0x68,0x1a,0xd0,0x19,0x68,0xc2,0xf3,0xc1,0x04,0x21,0xf4,0xe1,0x71,
0x21,0xf4,0xe1,0x72,0xc3,0xf3,0xc1,0x04,0x22,0xf0,0x01,0x02,0x22,0x43,0xc3,0xf3, 0x21,0xf0,0x01,0x01,0xc2,0xf3,0xc0,0x10,0x21,0x43,0x41,0xea,0x00,0x21,0xc2,0xf3,
0xc0,0x11,0x42,0xea,0x01,0x22,0xc3,0xf3,0x41,0x11,0x42,0xea,0x81,0x12,0x02,0x60, 0x41,0x10,0x41,0xea,0x80,0x11,0x19,0x60,0x1b,0x68,0xdc,0x07,0x03,0xd5,0x2d,0x4b,
0x02,0x68,0xd4,0x07,0x03,0xd5,0x26,0x4a,0x12,0x68,0x50,0x07,0xfb,0xd5,0x03,0xf0, 0x1b,0x68,0x58,0x07,0xfb,0xd5,0x02,0xf0,0x07,0x03,0x19,0xe0,0x19,0x68,0xc2,0xf3,
0x07,0x03,0x18,0xe0,0x21,0xf4,0xe1,0x72,0xc3,0xf3,0xc1,0x24,0x22,0xf0,0x01,0x02, 0xc1,0x24,0x21,0xf4,0xe1,0x71,0x21,0xf0,0x01,0x01,0xc2,0xf3,0xc0,0x30,0x21,0x43,
0xc3,0xf3,0xc0,0x31,0x22,0x43,0x42,0xea,0x01,0x22,0xc3,0xf3,0x41,0x31,0x42,0xea, 0x41,0xea,0x00,0x21,0xc2,0xf3,0x41,0x30,0x41,0xea,0x80,0x11,0x19,0x60,0x1b,0x68,
0x81,0x12,0x02,0x60,0x02,0x68,0xd1,0x07,0x03,0xd5,0x19,0x4a,0x12,0x68,0x52,0x07, 0xd9,0x07,0x03,0xd5,0x1f,0x4b,0x1b,0x68,0x5b,0x07,0xfb,0xd5,0xc2,0xf3,0x02,0x23,
0xfb,0xd5,0xc3,0xf3,0x02,0x23,0x4a,0xf6,0xaa,0x22,0x16,0x49,0x16,0x48,0x0a,0x60, 0x1d,0x4a,0x4a,0xf6,0xaa,0x21,0x11,0x60,0x1c,0x49,0x1b,0x03,0x08,0x68,0xb3,0xf5,
0x02,0x68,0x1b,0x03,0xb3,0xf5,0xe0,0x4f,0x22,0xf4,0xe2,0x42,0x18,0xbf,0x43,0xf4, 0xe0,0x4f,0x18,0xbf,0x43,0xf4,0x80,0x73,0x20,0xf4,0xe2,0x40,0x03,0x43,0x0b,0x60,
0x80,0x73,0x13,0x43,0x03,0x60,0x45,0xf2,0xaa,0x53,0x0b,0x60,0x0f,0x4b,0x10,0x49, 0x45,0xf2,0xaa,0x53,0x13,0x60,0x00,0x23,0x15,0x4a,0x12,0x68,0x02,0xf0,0x0f,0x02,
0x01,0x22,0x1a,0x60,0x00,0x22,0x0a,0x60,0x1a,0x60,0x05,0x22,0xc3,0xf8,0x58,0x22, 0x93,0x42,0x14,0x4a,0x15,0xd2,0x13,0x60,0x13,0x4a,0x14,0x48,0x01,0x21,0x11,0x60,
0x4f,0xf0,0xff,0x32,0xc1,0xf8,0x8c,0x22,0xc1,0xf8,0x90,0x22,0x02,0x22,0xc3,0xf8, 0x00,0x21,0x01,0x60,0x11,0x60,0x05,0x21,0xc2,0xf8,0x58,0x12,0x4f,0xf0,0xff,0x31,
0x58,0x22,0x10,0xbd,0x00,0x00,0x09,0x40,0x24,0x00,0x03,0x40,0x08,0x13,0x00,0x50, 0xc0,0xf8,0x8c,0x12,0xc0,0xf8,0x90,0x12,0x02,0x21,0xc2,0xf8,0x58,0x12,0x01,0x33,
0x1c,0x00,0x03,0x40,0x64,0x20,0x03,0x40,0xa8,0x20,0x03,0x40,0x30,0x20,0x03,0x40, 0xe2,0xe7,0x00,0x23,0x13,0x60,0x10,0xbd,0x00,0x00,0x09,0x40,0x08,0x13,0x00,0x50,
0x34,0x20,0x03,0x40,0x2d,0xe9,0xf8,0x4f,0xd4,0x4d,0x29,0x68,0x11,0xf0,0x01,0x01, 0x24,0x00,0x03,0x40,0x1c,0x00,0x03,0x40,0x64,0x20,0x03,0x40,0xa8,0x20,0x03,0x40,
0x40,0xf0,0x95,0x81,0xdf,0xf8,0x90,0xe3,0x05,0x27,0xd1,0x4b,0xce,0xf8,0x00,0x70, 0x00,0x24,0x03,0x40,0x50,0x20,0x03,0x40,0x30,0x20,0x03,0x40,0x34,0x20,0x03,0x40,
0x1b,0x68,0x4f,0xf4,0x40,0x72,0xc3,0xf3,0x03,0x23,0x01,0x33,0xb2,0xfb,0xf3,0xf3, 0x2d,0xe9,0xf0,0x4f,0xc7,0x4b,0x85,0xb0,0x02,0x90,0x1b,0x68,0x4f,0xf0,0xfc,0x54,
0xdf,0xf8,0x78,0xc3,0xdf,0xf8,0x78,0x83,0xdc,0xf8,0x00,0x20,0xd8,0xf8,0x00,0x40, 0x23,0xf0,0x7f,0x43,0x01,0x93,0x00,0x22,0xc3,0x4b,0x1b,0x68,0x03,0xf0,0x0f,0x03,
0x92,0xb2,0x5a,0x43,0xc2,0xf3,0x8f,0x16,0x22,0x0c,0x12,0x04,0x32,0x43,0xc8,0xf8, 0x9a,0x42,0x80,0xf0,0x58,0x82,0xc1,0x48,0x03,0x68,0x13,0xf0,0x01,0x03,0x03,0x93,
0x00,0x20,0xc4,0x4a,0xc4,0x4c,0x12,0x68,0x26,0x68,0x5a,0x43,0xc3,0x4e,0x92,0x09, 0x40,0xf0,0x75,0x81,0xdf,0xf8,0x6c,0xc3,0x4f,0xf0,0x05,0x0e,0xbc,0x4b,0xcc,0xf8,
0x22,0x60,0x32,0x68,0x54,0xf8,0x24,0x8c,0xc2,0xf3,0x07,0x42,0x5a,0x43,0x28,0xf0, 0x00,0xe0,0x1b,0x68,0xdf,0xf8,0x60,0x83,0xc3,0xf3,0x03,0x23,0xd8,0xf8,0x00,0x60,
0xff,0x08,0xc2,0xf3,0x87,0x12,0xdf,0xf8,0x3c,0x93,0x42,0xea,0x08,0x02,0xdf,0xf8, 0x4f,0xf4,0x40,0x71,0x01,0x33,0xb1,0xfb,0xf3,0xf3,0xb6,0x4d,0xb6,0xb2,0x5e,0x43,
0x38,0x83,0x44,0xf8,0x24,0x2c,0xd9,0xf8,0x00,0xa0,0xd8,0xf8,0x00,0x20,0xca,0xf3, 0x29,0x68,0xc6,0xf3,0x8f,0x16,0x09,0x0c,0x09,0x04,0x31,0x43,0x29,0x60,0xb2,0x49,
0x07,0x4a,0x22,0xf0,0xff,0x02,0x4a,0xea,0x02,0x02,0xc8,0xf8,0x00,0x20,0xd9,0xf8, 0x0d,0x68,0xb2,0x49,0x5d,0x43,0xad,0x09,0x0e,0x68,0x0d,0x60,0xb0,0x4d,0x2e,0x68,
0x00,0x20,0xdf,0xf8,0x18,0xa3,0x12,0x0e,0x5a,0x43,0xda,0xf8,0x00,0x80,0x92,0x00, 0x51,0xf8,0x24,0x7c,0xc6,0xf3,0x07,0x46,0x5e,0x43,0x27,0xf0,0xff,0x07,0xc6,0xf3,
0x28,0xf4,0x7f,0x48,0x02,0xf4,0x7f,0x42,0x42,0xea,0x08,0x02,0xdf,0xf8,0x00,0x83, 0x87,0x16,0x3e,0x43,0x41,0xf8,0x24,0x6c,0xaa,0x4f,0xab,0x4e,0xd6,0xf8,0x00,0xa0,
0xca,0xf8,0x00,0x20,0xd8,0xf8,0x00,0x20,0xae,0xf5,0x09,0x7e,0x4f,0xea,0x12,0x6b, 0xd7,0xf8,0x00,0x90,0xca,0xf3,0x07,0x4a,0x29,0xf0,0xff,0x09,0x4a,0xea,0x09,0x09,
0x0b,0xfb,0x03,0xfb,0xda,0xf8,0x04,0x20,0xcb,0xf3,0x8f,0x1b,0x12,0x0c,0x12,0x04, 0xc7,0xf8,0x00,0x90,0x37,0x68,0x4f,0xea,0x17,0x6a,0x0a,0xfb,0x03,0xfa,0xa3,0x4f,
0x4b,0xea,0x02,0x02,0xca,0xf8,0x04,0x20,0xd9,0xf8,0x00,0x20,0xc2,0xf3,0x07,0x22, 0x4f,0xea,0x8a,0x0a,0xd7,0xf8,0x00,0x90,0x0a,0xf4,0x7f,0x4a,0x29,0xf4,0x7f,0x49,
0x53,0x43,0x9f,0x4a,0x9b,0x00,0xd2,0xf8,0x00,0x90,0x03,0xf4,0x7f,0x43,0x29,0xf4, 0x4a,0xea,0x09,0x09,0xc7,0xf8,0x00,0x90,0xdf,0xf8,0xd0,0x92,0xdf,0xf8,0xd0,0xa2,
0x7f,0x49,0x43,0xea,0x09,0x03,0xdf,0xf8,0xbc,0x92,0x13,0x60,0xd9,0xf8,0x00,0xa0, 0xd9,0xf8,0x00,0x70,0x4f,0xea,0x17,0x6b,0x0b,0xfb,0x03,0xfb,0xda,0xf8,0x00,0x70,
0x52,0xf8,0x24,0x3c,0x4f,0xea,0x1a,0x6a,0x23,0xf4,0x7f,0x43,0x43,0xea,0x0a,0x23, 0x3f,0x0c,0x3f,0x04,0x47,0xea,0x9b,0x17,0xca,0xf8,0x00,0x70,0x36,0x68,0xc6,0xf3,
0x42,0xf8,0x24,0x3c,0xd9,0xf8,0x00,0xa0,0x52,0xf8,0x24,0x3c,0xca,0xf3,0x07,0x4a, 0x07,0x26,0x73,0x43,0x92,0x4e,0x9b,0x00,0x37,0x68,0x03,0xf4,0x7f,0x43,0x27,0xf4,
0x23,0xf0,0xff,0x03,0x4a,0xea,0x03,0x03,0x42,0xf8,0x24,0x3c,0xd9,0xf8,0x00,0xa0, 0x7f,0x47,0x1f,0x43,0x37,0x60,0x8f,0x4b,0x8f,0x4e,0xd6,0xf8,0x00,0xa0,0x1f,0x68,
0x52,0xf8,0x1c,0x3c,0x0a,0xf4,0x7f,0x4a,0x23,0xf4,0x7f,0x43,0x4a,0xea,0x03,0x03, 0x4f,0xea,0x1a,0x6a,0x27,0xf4,0x7f,0x47,0x47,0xea,0x0a,0x27,0x1f,0x60,0xd6,0xf8,
0x42,0xf8,0x1c,0x3c,0xd9,0xf8,0x00,0x90,0x52,0xf8,0x1c,0x3c,0x5f,0xfa,0x89,0xf9, 0x00,0xa0,0x1f,0x68,0xca,0xf3,0x07,0x4a,0x27,0xf0,0xff,0x07,0x4a,0xea,0x07,0x07,
0x23,0xf0,0xff,0x03,0x49,0xea,0x03,0x03,0xdf,0xf8,0x5c,0x92,0x42,0xf8,0x1c,0x3c, 0x1f,0x60,0xd6,0xf8,0x00,0xa0,0x9f,0x68,0x0a,0xf4,0x7f,0x4a,0x27,0xf4,0x7f,0x47,
0x32,0x68,0xd9,0xf8,0x00,0x30,0x02,0xf4,0x70,0x42,0x23,0xf4,0x70,0x43,0x13,0x43, 0x4a,0xea,0x07,0x07,0x9f,0x60,0x37,0x68,0x9e,0x68,0xff,0xb2,0x26,0xf0,0xff,0x06,
0xc9,0xf8,0x00,0x30,0xd8,0xf8,0x00,0x20,0xdf,0xf8,0x40,0x82,0x02,0xf4,0x70,0x42, 0x3e,0x43,0x9e,0x60,0x2f,0x68,0xde,0x68,0x07,0xf4,0x70,0x47,0x26,0xf4,0x70,0x46,
0xd8,0xf8,0x00,0x30,0x23,0xf4,0x70,0x43,0x13,0x43,0xc8,0xf8,0x00,0x30,0x32,0x68, 0x3e,0x43,0xde,0x60,0xd9,0xf8,0x00,0x70,0x5e,0x68,0x07,0xf4,0x70,0x47,0x26,0xf4,
0x54,0xf8,0x24,0x3c,0x12,0x0e,0x23,0xf4,0x7f,0x43,0x43,0xea,0x02,0x23,0x44,0xf8, 0x70,0x46,0x3e,0x43,0x5e,0x60,0x2d,0x68,0x51,0xf8,0x24,0x3c,0x2d,0x0e,0x23,0xf4,
0x24,0x3c,0x70,0x4b,0x1b,0x68,0x62,0x6a,0xc3,0xf3,0x0b,0x06,0x22,0xf4,0x7f,0x63, 0x7f,0x43,0x43,0xea,0x05,0x23,0x41,0xf8,0x24,0x3c,0x70,0x4b,0x1d,0x68,0x70,0x4b,
0x23,0xf0,0x0f,0x03,0x33,0x43,0x6c,0x4e,0x63,0x62,0x32,0x68,0x63,0x6a,0x02,0xf4, 0xc5,0xf3,0x0b,0x05,0x19,0x68,0x21,0xf4,0x7f,0x61,0x21,0xf0,0x0f,0x01,0x29,0x43,
0x70,0x22,0x23,0xf4,0x70,0x23,0x13,0x43,0x63,0x62,0x68,0x4c,0x22,0x68,0xd8,0xf8, 0x6c,0x4d,0x19,0x60,0x2e,0x68,0x19,0x68,0x06,0xf4,0x70,0x26,0x21,0xf4,0x70,0x21,
0x58,0x30,0xc2,0xf3,0x83,0x42,0x23,0xf4,0x70,0x23,0x43,0xea,0x02,0x43,0xc8,0xf8, 0x31,0x43,0x19,0x60,0x68,0x4b,0x69,0x49,0x1f,0x68,0x0e,0x68,0xc7,0xf3,0x83,0x47,
0x58,0x30,0xdc,0xf8,0x00,0x30,0xd8,0xf8,0x58,0x20,0xc3,0xf3,0x0b,0x4c,0x22,0xf4, 0x26,0xf4,0x70,0x26,0x46,0xea,0x07,0x46,0x0e,0x60,0xd8,0xf8,0x00,0x70,0x0e,0x68,
0x7f,0x63,0x23,0xf0,0x0f,0x03,0x4c,0xea,0x03,0x03,0xc8,0xf8,0x58,0x30,0x23,0x68, 0xc7,0xf3,0x0b,0x47,0x26,0xf4,0x7f,0x66,0x26,0xf0,0x0f,0x06,0x3e,0x43,0x0e,0x60,
0xd8,0xf8,0x5c,0x20,0x4f,0xea,0xd3,0x5c,0x22,0xf0,0xff,0x73,0x23,0xf4,0x80,0x33, 0x5f,0x4e,0x1f,0x68,0x31,0x68,0xff,0x0d,0x21,0xf0,0xff,0x71,0x21,0xf4,0x80,0x31,
0x43,0xea,0x0c,0x43,0xc8,0xf8,0x5c,0x30,0x33,0x68,0x55,0x4a,0x0f,0x33,0x03,0xf0, 0x41,0xea,0x07,0x41,0x31,0x60,0x2d,0x68,0x5a,0x49,0x0f,0x35,0x05,0xf0,0x0f,0x05,
0x0f,0x03,0x13,0x60,0x26,0x68,0x53,0x68,0xc6,0xf3,0x80,0x56,0x23,0xf4,0x00,0x03, 0x0d,0x60,0x1e,0x68,0x4d,0x68,0xc6,0xf3,0x80,0x56,0x25,0xf4,0x00,0x05,0x45,0xea,
0x43,0xea,0xc6,0x53,0x53,0x60,0x53,0x68,0x4e,0x4e,0x43,0xf4,0x80,0x43,0x53,0x60, 0xc6,0x55,0x4d,0x60,0x4d,0x68,0x54,0x4f,0x45,0xf4,0x80,0x45,0x4d,0x60,0x02,0x21,
0x02,0x23,0xce,0xf8,0x24,0x32,0x4a,0xf6,0xaa,0x23,0xdf,0xf8,0x74,0xc1,0xce,0xf8, 0x52,0x4d,0xcc,0xf8,0x00,0x10,0x4a,0xf6,0xaa,0x21,0x29,0x60,0x50,0x49,0x3e,0x68,
0x00,0x30,0xdc,0xf8,0x00,0x30,0x32,0x68,0x03,0xf0,0x0f,0x08,0x22,0xf4,0x7f,0x02, 0xd1,0xf8,0x00,0xc0,0x06,0xf0,0x0f,0x08,0x2c,0xf4,0x7f,0x0c,0x4c,0xea,0x08,0x4c,
0x42,0xea,0x08,0x42,0xc3,0xf3,0x03,0x23,0x42,0xea,0x03,0x53,0xdf,0xf8,0x54,0x81, 0xc6,0xf3,0x03,0x26,0x4c,0xea,0x06,0x56,0x0e,0x60,0x4a,0x4e,0xd6,0xf8,0x00,0xc0,
0x33,0x60,0xd8,0xf8,0x00,0x30,0x32,0x68,0xc3,0xf3,0x03,0x49,0x22,0xf0,0xff,0x02, 0xd1,0xf8,0x00,0x80,0xcc,0xf3,0x03,0x49,0x28,0xf0,0xff,0x08,0x49,0xea,0x08,0x08,
0x49,0xea,0x02,0x02,0xc3,0xf3,0x03,0x63,0x42,0xea,0x03,0x13,0x33,0x60,0xdc,0xf8, 0xcc,0xf3,0x03,0x6c,0x48,0xea,0x0c,0x1c,0xc1,0xf8,0x00,0xc0,0x3f,0x68,0xd1,0xf8,
0x00,0x60,0xdf,0xf8,0x34,0xc1,0x06,0xf4,0x70,0x22,0xdc,0xf8,0x00,0x30,0x23,0xf4, 0x04,0xc0,0x07,0xf4,0x70,0x28,0x2c,0xf4,0x7f,0x0c,0x4c,0xea,0x08,0x0c,0xc7,0xf3,
0x7f,0x03,0x1a,0x43,0xc6,0xf3,0x03,0x63,0x42,0xea,0x03,0x53,0x32,0x4e,0xcc,0xf8, 0x03,0x67,0x4c,0xea,0x07,0x57,0x4f,0x60,0x3b,0x49,0x3c,0x4f,0xd1,0xf8,0x00,0x80,
0x00,0x30,0x32,0x68,0x5c,0xf8,0x08,0x3c,0xc2,0xf3,0x03,0x22,0x23,0xf0,0x0f,0x03, 0xd7,0xf8,0x00,0xc0,0xc8,0xf3,0x03,0x28,0x2c,0xf0,0x0f,0x0c,0x48,0xea,0x0c,0x0c,
0x13,0x43,0x4c,0xf8,0x08,0x3c,0xd8,0xf8,0x00,0x20,0xdc,0xf8,0x08,0x30,0x02,0xf4, 0xc7,0xf8,0x00,0xc0,0xd6,0xf8,0x00,0xc0,0x35,0x4e,0x0c,0xf4,0xf8,0x5c,0x37,0x68,
0xf8,0x52,0x23,0xf4,0xf8,0x53,0x13,0x43,0xcc,0xf8,0x08,0x30,0x32,0x68,0xdc,0xf8, 0x27,0xf4,0xf8,0x57,0x4c,0xea,0x07,0x07,0x37,0x60,0x0f,0x68,0xd6,0xf8,0x04,0xc0,
0x0c,0x30,0x12,0x0b,0x02,0xf4,0x70,0x42,0x23,0xf4,0x70,0x43,0x13,0x43,0xcc,0xf8, 0x3f,0x0b,0x07,0xf4,0x70,0x47,0x2c,0xf4,0x70,0x4c,0x47,0xea,0x0c,0x07,0x77,0x60,
0x0c,0x30,0x32,0x68,0x21,0x4e,0xc2,0xf3,0x04,0x42,0x33,0x68,0x23,0xf0,0x1f,0x03, 0x0f,0x68,0x2c,0x49,0xc7,0xf3,0x04,0x47,0x0e,0x68,0x26,0xf0,0x1f,0x06,0x3e,0x43,
0x13,0x43,0x33,0x60,0x22,0x68,0x1e,0x4c,0xc2,0xf3,0x01,0x42,0x23,0x68,0x23,0xf4, 0x0e,0x60,0x1e,0x68,0x28,0x4b,0xc6,0xf3,0x01,0x46,0x19,0x68,0x21,0xf4,0x40,0x11,
0x40,0x13,0x43,0xea,0x02,0x53,0x23,0x60,0x45,0xf2,0xaa,0x53,0x19,0x4a,0xce,0xf8, 0x41,0xea,0x06,0x51,0x19,0x60,0x45,0xf2,0xaa,0x53,0x2b,0x60,0x23,0x4b,0xc3,0xf8,
0x00,0x30,0x17,0x60,0x2b,0x68,0x43,0xf0,0x01,0x03,0x2b,0x60,0x11,0x60,0x16,0x4b, 0x00,0xe0,0x01,0x68,0x41,0xf0,0x01,0x01,0x01,0x60,0x03,0x99,0x19,0x60,0x20,0x4b,
0x16,0x4c,0x1b,0x68,0x16,0x4a,0x13,0xf0,0x02,0x0f,0x23,0x68,0x15,0x4d,0x43,0xf0, 0x48,0xe0,0x00,0xbf,0x14,0x24,0x03,0x40,0x00,0x24,0x03,0x40,0x40,0x00,0x03,0x40,
0x02,0x03,0x23,0x60,0x13,0x68,0x21,0x68,0x59,0xd0,0x3f,0xe0,0x40,0x00,0x03,0x40, 0x00,0x20,0x03,0x40,0x40,0x22,0x03,0x40,0x8c,0x11,0x00,0x50,0x44,0x22,0x03,0x40,
0x00,0x20,0x03,0x40,0x8c,0x11,0x00,0x50,0x44,0x22,0x03,0x40,0x74,0x11,0x00,0x50, 0x74,0x11,0x00,0x50,0x24,0x22,0x03,0x40,0x78,0x11,0x00,0x50,0x28,0x22,0x03,0x40,
0x34,0x22,0x03,0x40,0x84,0x11,0x00,0x50,0x80,0x11,0x00,0x50,0xb0,0x12,0x00,0x50, 0x34,0x22,0x03,0x40,0x10,0x22,0x03,0x40,0x70,0x11,0x00,0x50,0x84,0x11,0x00,0x50,
0x78,0x22,0x03,0x40,0x84,0x20,0x03,0x40,0x98,0x11,0x00,0x50,0x98,0x20,0x03,0x40, 0x68,0x22,0x03,0x40,0x80,0x11,0x00,0x50,0xb0,0x12,0x00,0x50,0x6c,0x22,0x03,0x40,
0xa8,0x20,0x03,0x40,0x3c,0x00,0x03,0x40,0x00,0x00,0x09,0x40,0x24,0x00,0x03,0x40, 0x70,0x22,0x03,0x40,0x78,0x22,0x03,0x40,0x90,0x11,0x00,0x50,0x64,0x20,0x03,0x40,
0x08,0x13,0x00,0x50,0x1c,0x00,0x03,0x40,0x88,0x22,0x03,0x40,0x88,0x11,0x00,0x50, 0x84,0x20,0x03,0x40,0x94,0x11,0x00,0x50,0x98,0x11,0x00,0x50,0x80,0x20,0x03,0x40,
0x40,0x22,0x03,0x40,0x78,0x11,0x00,0x50,0x24,0x22,0x03,0x40,0x28,0x22,0x03,0x40, 0x90,0x20,0x03,0x40,0x98,0x20,0x03,0x40,0xa8,0x20,0x03,0x40,0x3c,0x00,0x03,0x40,
0x7c,0x11,0x00,0x50,0x70,0x11,0x00,0x50,0x1c,0x22,0x03,0x40,0x14,0x22,0x03,0x40, 0x00,0x00,0x09,0x40,0x88,0x22,0x03,0x40,0x88,0x11,0x00,0x50,0x7c,0x11,0x00,0x50,
0x90,0x11,0x00,0x50,0x94,0x11,0x00,0x50,0x88,0x20,0x03,0x40,0x21,0xf4,0xe1,0x72, 0x2c,0x22,0x03,0x40,0x62,0x49,0x1b,0x68,0x62,0x48,0x13,0xf0,0x02,0x0f,0x62,0x4b,
0xc3,0xf3,0xc1,0x46,0x22,0xf0,0x01,0x02,0xc3,0xf3,0xc0,0x51,0x32,0x43,0x42,0xea, 0x1d,0x68,0x45,0xf0,0x02,0x05,0x1d,0x60,0x09,0x68,0x19,0xd0,0x1d,0x68,0xc1,0xf3,
0x01,0x22,0xc3,0xf3,0x41,0x51,0x42,0xea,0x81,0x12,0x22,0x60,0x22,0x68,0xd7,0x07, 0xc1,0x47,0x25,0xf4,0xe1,0x75,0x25,0xf0,0x01,0x05,0xc1,0xf3,0xc0,0x56,0x3d,0x43,
0x02,0xd5,0x2a,0x68,0x56,0x07,0xfc,0xd5,0xc3,0xf3,0x02,0x43,0x16,0xe0,0xc3,0xf3, 0x45,0xea,0x06,0x25,0xc1,0xf3,0x41,0x56,0x45,0xea,0x86,0x15,0x1d,0x60,0x1b,0x68,
0xc1,0x62,0xde,0x0f,0x42,0xea,0x06,0x26,0x21,0xf4,0xe1,0x72,0x22,0xf0,0x01,0x02, 0xdd,0x07,0x02,0xd5,0x03,0x68,0x5b,0x07,0xfc,0xd5,0xc1,0xf3,0x02,0x43,0x17,0xe0,
0x32,0x43,0xc3,0xf3,0x41,0x71,0x42,0xea,0x81,0x12,0x22,0x60,0x22,0x68,0xd4,0x07, 0x1d,0x68,0xcf,0x0f,0xc1,0xf3,0xc1,0x66,0x25,0xf4,0xe1,0x75,0x46,0xea,0x07,0x26,
0x02,0xd5,0x2a,0x68,0x51,0x07,0xfc,0xd5,0xc3,0xf3,0x02,0x63,0x4a,0xf6,0xaa,0x22, 0x25,0xf0,0x01,0x05,0x35,0x43,0xc1,0xf3,0x41,0x76,0x45,0xea,0x86,0x15,0x1d,0x60,
0x3a,0x49,0x3b,0x4c,0x0a,0x60,0x22,0x68,0x1b,0x03,0xb3,0xf5,0xe0,0x4f,0x22,0xf4, 0x1b,0x68,0xdf,0x07,0x02,0xd5,0x03,0x68,0x5e,0x07,0xfc,0xd5,0xc1,0xf3,0x02,0x63,
0xe2,0x42,0x18,0xbf,0x43,0xf4,0x80,0x73,0x13,0x43,0x23,0x60,0x45,0xf2,0xaa,0x53, 0x46,0x49,0x4a,0xf6,0xaa,0x25,0x0d,0x60,0x45,0x4d,0x1b,0x03,0x2e,0x68,0xb3,0xf5,
0x4f,0xf6,0xff,0x74,0x0b,0x60,0x33,0x4b,0x00,0x21,0x01,0x22,0x19,0x60,0x43,0xf8, 0xe0,0x4f,0x26,0xf4,0xe2,0x46,0x18,0xbf,0x43,0xf4,0x80,0x73,0x33,0x43,0x2b,0x60,
0x20,0x2c,0x31,0x4a,0x4f,0xf0,0x05,0x0e,0x14,0x60,0x30,0x4c,0x43,0xf8,0x20,0x1c, 0x45,0xf2,0xaa,0x53,0x0b,0x60,0x3f,0x4b,0x01,0x21,0x1a,0x60,0x43,0xf8,0x20,0x1c,
0x02,0xf5,0xec,0x72,0x10,0x23,0xc4,0xf8,0x00,0xe0,0x13,0x60,0x2c,0x4b,0x15,0x26, 0x3d,0x49,0x4f,0xf6,0xff,0x75,0x0d,0x60,0x3c,0x4f,0x00,0x25,0x43,0xf8,0x20,0x5c,
0x1e,0x60,0x02,0x26,0x26,0x60,0x2b,0x4e,0x37,0x68,0xc4,0xf8,0x00,0xe0,0xdf,0xf8, 0x4f,0xf0,0x05,0x0e,0x03,0xf5,0x0e,0x73,0x10,0x21,0x39,0x4e,0xc3,0xf8,0x00,0xe0,
0xb4,0xe0,0xce,0xf8,0x00,0x10,0xce,0xf8,0x04,0x10,0x18,0xb1,0x31,0x68,0x41,0xf4, 0x39,0x60,0x15,0x21,0x31,0x60,0x02,0x21,0x19,0x60,0x36,0x49,0xd1,0xf8,0x00,0xc0,
0x00,0x01,0x31,0x60,0x02,0x21,0x05,0x20,0x21,0x60,0x20,0x60,0x08,0x20,0x10,0x60, 0xc3,0xf8,0x00,0xe0,0xdf,0xf8,0xdc,0xe0,0xce,0xf8,0x00,0x50,0xce,0xf8,0x04,0x50,
0x15,0x22,0x1a,0x60,0x21,0x60,0x2b,0x68,0x9a,0x07,0xfc,0xd4,0x1e,0x4b,0x1b,0x68, 0x02,0x9d,0x1d,0xb1,0x0d,0x68,0x45,0xf4,0x00,0x05,0x0d,0x60,0xdf,0xf8,0xc8,0xe0,
0x13,0xf0,0x10,0x0f,0x14,0xbf,0x04,0x25,0x00,0x25,0xff,0xf7,0x1b,0xfd,0x3b,0x02, 0x02,0x25,0x1d,0x60,0xce,0xf8,0x00,0x40,0x4f,0xf0,0x05,0x0e,0xc3,0xf8,0x00,0xe0,
0x07,0xd4,0x05,0x23,0x23,0x60,0x33,0x68,0x23,0xf4,0x00,0x03,0x33,0x60,0x02,0x23, 0x4f,0xf0,0x08,0x0e,0xc7,0xf8,0x00,0xe0,0x15,0x27,0x37,0x60,0x1d,0x60,0x05,0x68,
0x23,0x60,0xbd,0xb9,0x15,0x4b,0x16,0x48,0x19,0x68,0x03,0xf5,0x10,0x53,0x04,0x33, 0xad,0x07,0x18,0xd5,0xfb,0xe7,0x24,0x4b,0x24,0x48,0x1a,0x68,0x03,0xf5,0x10,0x53,
0x1a,0x68,0xc9,0xb2,0x02,0xf0,0x0f,0x02,0x51,0x43,0x1b,0x68,0x14,0x22,0x03,0xf0, 0x04,0x33,0x19,0x68,0xd2,0xb2,0x01,0xf0,0x0f,0x01,0x1b,0x68,0x51,0x43,0x03,0xf0,
0x0f,0x03,0x9b,0x02,0xc3,0xeb,0x81,0x21,0x01,0xf6,0xd8,0x71,0xbd,0xe8,0xf8,0x4f, 0x0f,0x03,0x9b,0x02,0xc3,0xeb,0x81,0x21,0x01,0xf6,0xd8,0x71,0x14,0x22,0xff,0xf7,
0xff,0xf7,0xea,0xbc,0x28,0x46,0xbd,0xe8,0xf8,0x8f,0x00,0xbf,0x64,0x20,0x03,0x40, 0xe7,0xfc,0x05,0x46,0x16,0xe0,0x1a,0x48,0x00,0x68,0x10,0xf0,0x10,0x0f,0x0c,0xbf,
0xa8,0x20,0x03,0x40,0x50,0x20,0x03,0x40,0x34,0x20,0x03,0x40,0x88,0x22,0x03,0x40, 0x00,0x25,0x04,0x25,0x1c,0xf4,0x00,0x0f,0x07,0xd1,0x05,0x20,0x18,0x60,0x08,0x68,
0xb4,0x22,0x03,0x40,0x7c,0x22,0x03,0x40,0x54,0x20,0x03,0x40,0x2c,0x00,0x03,0x40, 0x20,0xf4,0x00,0x00,0x08,0x60,0x02,0x21,0x19,0x60,0x01,0x99,0x0c,0x44,0x0d,0xb9,
0xf4,0x0e,0x00,0x20,0xc0,0x22,0x03,0x40,0x08,0xb5,0x01,0x1c,0x00,0x22,0x00,0x20, 0x01,0x32,0x71,0xe5,0xff,0xf7,0xda,0xfc,0x28,0x46,0x05,0xb0,0xbd,0xe8,0xf0,0x8f,
0x00,0x23,0x00,0xf0,0xeb,0xf8,0x08,0xbc,0x02,0xbc,0x08,0x47,0x10,0xb5,0x00,0x21, 0x08,0x13,0x00,0x50,0x1c,0x00,0x03,0x40,0x24,0x00,0x03,0x40,0x64,0x20,0x03,0x40,
0x04,0x1c,0x00,0xf0,0x5d,0xf9,0x05,0x4b,0x18,0x68,0xc3,0x6b,0x00,0x2b,0x01,0xd0, 0xa8,0x20,0x03,0x40,0x50,0x20,0x03,0x40,0x34,0x20,0x03,0x40,0x0c,0x22,0x03,0x40,
0x00,0xf0,0x06,0xf8,0x20,0x1c,0xff,0xf7,0xa7,0xfc,0xc0,0x46,0x0c,0x0f,0x00,0x20, 0xb4,0x22,0x03,0x40,0x7c,0x22,0x03,0x40,0x2c,0x00,0x03,0x40,0xe4,0x0e,0x00,0x20,
0x18,0x47,0xc0,0x46,0x38,0xb5,0x0a,0x4b,0x0a,0x4c,0xe4,0x1a,0xa4,0x10,0x0a,0xd0, 0x54,0x20,0x03,0x40,0xc0,0x22,0x03,0x40,0x10,0x21,0x03,0x40,0x10,0xb5,0x00,0x21,
0x09,0x4a,0xa5,0x18,0xad,0x00,0xed,0x18,0x2b,0x68,0x01,0x3c,0x00,0xf0,0x0e,0xf8, 0x04,0x1c,0x00,0xf0,0xdf,0xf8,0x05,0x4b,0x18,0x68,0xc3,0x6b,0x00,0x2b,0x01,0xd0,
0x04,0x3d,0x00,0x2c,0xf8,0xd1,0x00,0xf0,0xcd,0xf9,0x38,0xbc,0x01,0xbc,0x00,0x47, 0x00,0xf0,0x06,0xf8,0x20,0x1c,0xff,0xf7,0x8b,0xfc,0xc0,0x46,0xfc,0x0e,0x00,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0x3f,0x18,0x47,0xc0,0x46, 0x18,0x47,0xc0,0x46,0x70,0xb5,0x10,0x4e,0x10,0x4d,0xad,0x1b,0xad,0x10,0x00,0x24,
0x70,0xb5,0x10,0x4e,0x10,0x4d,0xad,0x1b,0xad,0x10,0x00,0x24,0x00,0x2d,0x06,0xd0, 0x00,0x2d,0x06,0xd0,0xa3,0x00,0xf3,0x58,0x01,0x34,0x00,0xf0,0x1d,0xf8,0xa5,0x42,
0xa3,0x00,0xf3,0x58,0x01,0x34,0x00,0xf0,0x1d,0xf8,0xa5,0x42,0xf8,0xd1,0x00,0xf0, 0xf8,0xd1,0x00,0xf0,0xdb,0xf9,0x0a,0x4e,0x0a,0x4d,0xad,0x1b,0xad,0x10,0x00,0x24,
0xab,0xf9,0x0a,0x4e,0x0a,0x4d,0xad,0x1b,0xad,0x10,0x00,0x24,0x00,0x2d,0x06,0xd0, 0x00,0x2d,0x06,0xd0,0xa3,0x00,0xf3,0x58,0x01,0x34,0x00,0xf0,0x0d,0xf8,0xa5,0x42,
0xa3,0x00,0xf3,0x58,0x01,0x34,0x00,0xf0,0x0d,0xf8,0xa5,0x42,0xf8,0xd1,0x70,0xbc, 0xf8,0xd1,0x70,0xbc,0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,0xf0,0xb5,0x0f,0x2a,
0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,0x70,0xb5,0x0f,0x2a,0x34,0xd9,0x04,0x1c, 0x37,0xd9,0x03,0x1c,0x0b,0x43,0x9c,0x07,0x37,0xd1,0x16,0x1c,0x10,0x3e,0x36,0x09,
0x0c,0x43,0x0b,0x1c,0xa4,0x07,0x33,0xd1,0x15,0x1c,0x04,0x1c,0x10,0x3d,0x2d,0x09, 0x35,0x01,0x45,0x19,0x10,0x35,0x0c,0x1c,0x03,0x1c,0x27,0x68,0x1f,0x60,0x67,0x68,
0x01,0x35,0x2d,0x01,0x49,0x19,0x1e,0x68,0x26,0x60,0x5e,0x68,0x66,0x60,0x9e,0x68, 0x5f,0x60,0xa7,0x68,0x9f,0x60,0xe7,0x68,0xdf,0x60,0x10,0x33,0x10,0x34,0xab,0x42,
0xa6,0x60,0xde,0x68,0x10,0x33,0xe6,0x60,0x10,0x34,0x99,0x42,0xf3,0xd1,0x0f,0x23, 0xf3,0xd1,0x73,0x1c,0x1b,0x01,0xc5,0x18,0xc9,0x18,0x0f,0x23,0x13,0x40,0x03,0x2b,
0x45,0x19,0x13,0x40,0x03,0x2b,0x1d,0xd9,0x1c,0x1f,0x00,0x23,0xa4,0x08,0x01,0x34, 0x1d,0xd9,0x1c,0x1f,0xa4,0x08,0x01,0x34,0xa4,0x00,0x00,0x23,0xce,0x58,0xee,0x50,
0xa4,0x00,0xce,0x58,0xee,0x50,0x04,0x33,0xa3,0x42,0xfa,0xd1,0xed,0x18,0xc9,0x18, 0x04,0x33,0xa3,0x42,0xfa,0xd1,0xed,0x18,0xc9,0x18,0x03,0x23,0x1a,0x40,0x05,0xd0,
0x03,0x23,0x1a,0x40,0x05,0xd0,0x00,0x23,0xcc,0x5c,0xec,0x54,0x01,0x33,0x93,0x42, 0x00,0x23,0xcc,0x5c,0xec,0x54,0x01,0x33,0x93,0x42,0xfa,0xd1,0xf0,0xbc,0x02,0xbc,
0xfa,0xd1,0x70,0xbc,0x02,0xbc,0x08,0x47,0x05,0x1c,0x00,0x2a,0xf3,0xd1,0xf8,0xe7, 0x08,0x47,0x05,0x1c,0x00,0x2a,0xf3,0xd1,0xf8,0xe7,0x05,0x1c,0xf0,0xe7,0x1a,0x1c,
0x05,0x1c,0xf0,0xe7,0x1a,0x1c,0xf8,0xe7,0x70,0xb5,0x83,0x07,0x43,0xd0,0x54,0x1e, 0xf8,0xe7,0xc0,0x46,0xf0,0xb5,0x83,0x07,0x4a,0xd0,0x54,0x1e,0x00,0x2a,0x44,0xd0,
0x00,0x2a,0x3d,0xd0,0x0d,0x06,0x2d,0x0e,0x03,0x1c,0x03,0x26,0x03,0xe0,0x62,0x1e, 0x0e,0x06,0x36,0x0e,0x03,0x1c,0x03,0x25,0x03,0xe0,0x62,0x1e,0x00,0x2c,0x3c,0xd0,
0x00,0x2c,0x35,0xd0,0x14,0x1c,0x01,0x33,0x5a,0x1e,0x15,0x70,0x33,0x42,0xf6,0xd1, 0x14,0x1c,0x01,0x33,0x5a,0x1e,0x16,0x70,0x2b,0x42,0xf6,0xd1,0x03,0x2c,0x2b,0xd9,
0x03,0x2c,0x24,0xd9,0xff,0x25,0x0d,0x40,0x2a,0x02,0x15,0x43,0x2a,0x04,0x15,0x43, 0xff,0x25,0x0d,0x40,0x2a,0x02,0x15,0x43,0x2a,0x04,0x15,0x43,0x0f,0x2c,0x15,0xd9,
0x0f,0x2c,0x11,0xd9,0x26,0x1c,0x10,0x3e,0x36,0x09,0x01,0x36,0x36,0x01,0x1a,0x1c, 0x27,0x1c,0x10,0x3f,0x3f,0x09,0x1e,0x1c,0x3a,0x01,0x10,0x36,0xb6,0x18,0x1a,0x1c,
0x9b,0x19,0x15,0x60,0x55,0x60,0x95,0x60,0xd5,0x60,0x10,0x32,0x93,0x42,0xf8,0xd1, 0x15,0x60,0x55,0x60,0x95,0x60,0xd5,0x60,0x10,0x32,0xb2,0x42,0xf8,0xd1,0x01,0x37,
0x0f,0x22,0x14,0x40,0x03,0x2c,0x0a,0xd9,0x26,0x1f,0xb6,0x08,0x01,0x36,0xb6,0x00, 0x3f,0x01,0x0f,0x22,0xdb,0x19,0x14,0x40,0x03,0x2c,0x0d,0xd9,0x27,0x1f,0xbf,0x08,
0x1a,0x1c,0x9b,0x19,0x20,0xc2,0x93,0x42,0xfc,0xd1,0x03,0x22,0x14,0x40,0x00,0x2c, 0xba,0x00,0x1e,0x1d,0xb6,0x18,0x1a,0x1c,0x20,0xc2,0xb2,0x42,0xfc,0xd1,0x01,0x37,
0x06,0xd0,0x09,0x06,0x1c,0x19,0x09,0x0e,0x19,0x70,0x01,0x33,0xa3,0x42,0xfb,0xd1, 0xbf,0x00,0x03,0x22,0xdb,0x19,0x14,0x40,0x00,0x2c,0x06,0xd0,0x0a,0x06,0x12,0x0e,
0x70,0xbc,0x02,0xbc,0x08,0x47,0x14,0x1c,0x03,0x1c,0xc9,0xe7,0xf8,0xb5,0x44,0x46, 0x1c,0x19,0x1a,0x70,0x01,0x33,0xa3,0x42,0xfb,0xd1,0xf0,0xbc,0x02,0xbc,0x08,0x47,
0x5f,0x46,0x56,0x46,0x4d,0x46,0x9b,0x46,0x30,0x4b,0xf0,0xb4,0x1c,0x68,0xa4,0x23, 0x14,0x1c,0x03,0x1c,0xc2,0xe7,0xc0,0x46,0x08,0xb5,0x04,0x4b,0x00,0x2b,0x02,0xd0,
0x5b,0x00,0x05,0x1c,0xe0,0x58,0x0e,0x1c,0x90,0x46,0x00,0x28,0x4d,0xd0,0x43,0x68, 0x03,0x48,0x00,0xf0,0x9b,0xf8,0x08,0xbc,0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,
0x1f,0x2b,0x0f,0xdc,0x5c,0x1c,0x00,0x2d,0x23,0xd1,0x02,0x33,0x9b,0x00,0x44,0x60, 0xc1,0x0d,0x00,0x20,0xf0,0xb5,0x5f,0x46,0x56,0x46,0x4d,0x46,0x44,0x46,0xf0,0xb4,
0x1e,0x50,0x00,0x20,0x3c,0xbc,0x90,0x46,0x99,0x46,0xa2,0x46,0xab,0x46,0xf8,0xbc, 0x43,0x4b,0x1b,0x68,0x85,0xb0,0x01,0x93,0x49,0x33,0xff,0x33,0x02,0x90,0x03,0x93,
0x02,0xbc,0x08,0x47,0x22,0x4b,0x00,0x2b,0x3c,0xd0,0xc8,0x20,0x40,0x00,0xaf,0xf3, 0x0f,0x1c,0x01,0x98,0xa4,0x21,0x49,0x00,0x42,0x58,0x90,0x46,0x00,0x2a,0x4b,0xd0,
0x00,0x80,0x00,0x28,0x36,0xd0,0xa4,0x22,0x00,0x23,0x52,0x00,0xa1,0x58,0x43,0x60, 0x03,0x98,0x81,0x46,0x41,0x46,0x4e,0x68,0x74,0x1e,0x42,0xd4,0x45,0x46,0xa3,0x00,
0x01,0x60,0xa0,0x50,0x40,0x32,0x83,0x50,0x04,0x32,0x83,0x50,0x01,0x24,0x00,0x2d, 0x88,0x35,0xed,0x18,0xc6,0x20,0xc4,0x23,0x01,0x36,0x5b,0x00,0x40,0x00,0xb6,0x00,
0xdb,0xd0,0x9a,0x00,0x91,0x46,0x81,0x44,0x42,0x46,0x88,0x21,0x4f,0x46,0x7a,0x50, 0x9b,0x46,0x82,0x46,0x46,0x44,0xc3,0x44,0xc2,0x44,0x08,0xe0,0x2b,0x1c,0x80,0x33,
0xc4,0x22,0x52,0x00,0x90,0x46,0x80,0x44,0x42,0x46,0x87,0x39,0x99,0x40,0x12,0x68, 0x1b,0x68,0xbb,0x42,0x05,0xd0,0x04,0x3d,0x04,0x3e,0x01,0x3c,0x29,0xd3,0x00,0x2f,
0x0a,0x43,0x94,0x46,0x8a,0x46,0x42,0x46,0x61,0x46,0x11,0x60,0x84,0x22,0x49,0x46, 0xf4,0xd1,0x41,0x46,0x4a,0x68,0x01,0x3a,0x33,0x68,0xa2,0x42,0x30,0xd0,0x00,0x22,
0x5f,0x46,0x52,0x00,0x8f,0x50,0x02,0x2d,0xbf,0xd1,0x02,0x1c,0x55,0x46,0x8d,0x32, 0x32,0x60,0x00,0x2b,0xef,0xd0,0x40,0x46,0x59,0x46,0x40,0x68,0x01,0x22,0x09,0x68,
0xff,0x32,0x11,0x68,0x0d,0x43,0x15,0x60,0xb7,0xe7,0x20,0x1c,0x4d,0x30,0xff,0x30, 0xa2,0x40,0x00,0x90,0x11,0x42,0x20,0xd0,0x50,0x46,0x00,0x68,0x10,0x42,0x21,0xd1,
0xe0,0x50,0xac,0xe7,0x01,0x20,0x40,0x42,0xb4,0xe7,0xc0,0x46,0x0c,0x0f,0x00,0x20, 0x02,0x98,0x29,0x68,0x00,0xf0,0x40,0xf8,0x41,0x46,0x49,0x68,0x00,0x9a,0x91,0x42,
0x00,0x00,0x00,0x00,0x08,0xb5,0x04,0x4b,0x00,0x2b,0x02,0xd0,0x03,0x48,0xff,0xf7, 0xb7,0xd1,0x4a,0x46,0x12,0x68,0x42,0x45,0xb3,0xd1,0x04,0x3d,0x04,0x3e,0x01,0x3c,
0x9b,0xfe,0x08,0xbc,0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,0x15,0x0b,0x00,0x20, 0xd5,0xd2,0x18,0x4a,0x00,0x2a,0x11,0xd1,0x05,0xb0,0x3c,0xbc,0x90,0x46,0x99,0x46,
0xf0,0xb5,0x56,0x46,0x5f,0x46,0x4d,0x46,0x44,0x46,0xf0,0xb4,0x0e,0x1c,0x3f,0x4b, 0xa2,0x46,0xab,0x46,0xf0,0xbc,0x01,0xbc,0x00,0x47,0x00,0xf0,0x25,0xf8,0xe3,0xe7,
0x1b,0x68,0x87,0xb0,0x03,0x93,0x49,0x33,0xff,0x33,0x01,0x90,0x04,0x93,0xa4,0x22, 0x4c,0x60,0xce,0xe7,0x28,0x68,0x00,0xf0,0x1f,0xf8,0xdd,0xe7,0x43,0x46,0x5b,0x68,
0x03,0x9b,0x52,0x00,0x9f,0x58,0x00,0x2f,0x4d,0xd0,0x04,0x9b,0x98,0x46,0x00,0x23, 0x40,0x46,0x00,0x2b,0x0d,0xd1,0x03,0x68,0x00,0x2b,0x0e,0xd0,0x49,0x46,0x0b,0x60,
0x9b,0x46,0xc4,0x23,0x5b,0x00,0x9c,0x46,0xbc,0x44,0x63,0x46,0x02,0x93,0xc6,0x23, 0xaf,0xf3,0x00,0x80,0x4b,0x46,0x1a,0x68,0x90,0x46,0x41,0x46,0x00,0x29,0x91,0xd1,
0x5b,0x00,0x9a,0x46,0x7c,0x68,0xa5,0x00,0x7d,0x19,0xba,0x44,0x01,0x3c,0x08,0xd5, 0xda,0xe7,0x03,0x68,0xc1,0x46,0x98,0x46,0xf7,0xe7,0x00,0x23,0xfa,0xe7,0xc0,0x46,
0x27,0xe0,0x6b,0x1d,0xff,0x33,0x1b,0x68,0xb3,0x42,0x04,0xd0,0x04,0x3d,0x01,0x3c, 0xfc,0x0e,0x00,0x20,0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,0x08,0xb5,0x01,0x1c,
0x1f,0xd3,0x00,0x2e,0xf5,0xd1,0x7b,0x68,0x01,0x3b,0x6a,0x68,0xa3,0x42,0x3e,0xd0, 0x00,0x22,0x00,0x20,0x00,0x23,0x00,0xf0,0x1f,0xf8,0x08,0xbc,0x02,0xbc,0x08,0x47,
0x5b,0x46,0x6b,0x60,0x00,0x2a,0xf1,0xd0,0x7b,0x68,0x99,0x46,0x01,0x23,0xa3,0x40, 0x38,0xb5,0x0a,0x4b,0x0a,0x4d,0xed,0x1a,0xad,0x10,0x0a,0xd0,0x01,0x3d,0xac,0x00,
0x02,0x99,0x09,0x68,0x05,0x91,0x19,0x42,0x26,0xd1,0x00,0xf0,0x43,0xf8,0x7b,0x68, 0xe4,0x18,0x00,0xe0,0x01,0x3d,0x23,0x68,0x00,0xf0,0x0c,0xf8,0x04,0x3c,0x00,0x2d,
0x4b,0x45,0xc4,0xd1,0x43,0x46,0x1b,0x68,0xbb,0x42,0xc0,0xd1,0x04,0x3d,0x01,0x3c, 0xf8,0xd1,0x00,0xf0,0x71,0xf8,0x38,0xbc,0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,
0xdf,0xd2,0x1b,0x4b,0x00,0x2b,0x0e,0xd0,0x7b,0x68,0x00,0x2b,0x27,0xd1,0x3b,0x68, 0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,0xf0,0xb5,0x4f,0x46,0x46,0x46,0xc0,0xb4,
0x00,0x2b,0x28,0xd0,0x42,0x46,0x38,0x1c,0x13,0x60,0xaf,0xf3,0x00,0x80,0x43,0x46, 0x98,0x46,0x2c,0x4b,0xa4,0x25,0x1b,0x68,0x6d,0x00,0x5c,0x59,0x83,0xb0,0x06,0x1c,
0x1f,0x68,0x00,0x2f,0xb5,0xd1,0x07,0xb0,0x3c,0xbc,0x90,0x46,0x99,0x46,0xa2,0x46, 0x0f,0x1c,0x91,0x46,0x01,0x93,0x00,0x2c,0x46,0xd0,0x65,0x68,0x1f,0x2d,0x1a,0xdd,
0xab,0x46,0xf0,0xbc,0x01,0xbc,0x00,0x47,0x51,0x46,0x09,0x68,0x19,0x42,0x08,0xd1, 0x25,0x4b,0x00,0x2b,0x02,0xd1,0x01,0x20,0x40,0x42,0x1c,0xe0,0xc8,0x20,0x40,0x00,
0x2b,0x1c,0x84,0x33,0x19,0x68,0x01,0x98,0x00,0xf0,0x14,0xf8,0xcf,0xe7,0x7c,0x60, 0xaf,0xf3,0x00,0x80,0x04,0x1e,0xf6,0xd0,0x00,0x25,0x45,0x60,0xa4,0x23,0x01,0x98,
0xc0,0xe7,0x2b,0x1c,0x84,0x33,0x18,0x68,0x00,0xf0,0x0c,0xf8,0xc7,0xe7,0x3b,0x68, 0x5b,0x00,0xc0,0x58,0x01,0x99,0x20,0x60,0xcc,0x50,0xc4,0x23,0x5b,0x00,0xe5,0x50,
0xb8,0x46,0x1f,0x1c,0xdd,0xe7,0x00,0x23,0xfa,0xe7,0xc0,0x46,0x0c,0x0f,0x00,0x20, 0xc6,0x23,0x5b,0x00,0xe5,0x50,0x00,0x2e,0x0c,0xd1,0x6b,0x1c,0x02,0x35,0xad,0x00,
0x00,0x00,0x00,0x00,0x10,0x47,0xc0,0x46,0xf8,0xb5,0xc0,0x46,0xf8,0xbc,0x08,0xbc, 0x63,0x60,0x2f,0x51,0x00,0x20,0x03,0xb0,0x0c,0xbc,0x90,0x46,0x99,0x46,0xf0,0xbc,
0x9e,0x46,0x70,0x47,0xf8,0xb5,0xc0,0x46,0xf8,0xbc,0x08,0xbc,0x9e,0x46,0x70,0x47, 0x02,0xbc,0x08,0x47,0xab,0x00,0xe3,0x18,0x88,0x22,0x48,0x46,0x98,0x50,0xc4,0x20,
0x00,0x00,0x00,0x00,0x24,0xf2,0xff,0x7f,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x40,0x00,0x22,0x18,0x10,0x68,0x01,0x21,0xa9,0x40,0x08,0x43,0x10,0x60,0x84,0x22,
0x28,0x15,0x00,0x20,0xff,0xff,0xff,0xc5,0xff,0xff,0xff,0xff,0xc5,0xff,0xff,0xff, 0x52,0x00,0x40,0x46,0x98,0x50,0x02,0x2e,0xdf,0xd1,0xc6,0x22,0x52,0x00,0xa3,0x18,
0xc5,0xc5,0xc5,0xff,0xc5,0xc5,0xc5,0xff,0x43,0x00,0x00,0x00,0x18,0x0f,0x00,0x20, 0x18,0x68,0x01,0x43,0x19,0x60,0xd8,0xe7,0x1c,0x1c,0x4d,0x34,0xff,0x34,0x5c,0x51,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x12,0x00,0x20, 0xb3,0xe7,0xc0,0x46,0xfc,0x0e,0x00,0x20,0x00,0x00,0x00,0x00,0xf8,0xb5,0xc0,0x46,
0x6c,0x12,0x00,0x20,0xd4,0x12,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xf8,0xbc,0x08,0xbc,0x9e,0x46,0x70,0x47,0xf8,0xb5,0xc0,0x46,0xf8,0xbc,0x08,0xbc,
0x9e,0x46,0x70,0x47,0x00,0x00,0x00,0x00,0xc8,0xf1,0xff,0x7f,0x01,0x00,0x00,0x00,
0x18,0x15,0x00,0x20,0xff,0xff,0xff,0xc5,0xff,0xff,0xff,0xff,0xc5,0xff,0xff,0xff,
0xc5,0xc5,0xc5,0xff,0xc5,0xc5,0xc5,0xff,0x43,0x00,0x00,0x00,0x08,0x0f,0x00,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf4,0x11,0x00,0x20,
0x5c,0x12,0x00,0x20,0xc4,0x12,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x0f,0x00,0x20, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x0e,0x00,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -307,8 +306,9 @@
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x18,0x0f,0x00,0x20,0xc1,0x00,0x00,0x20,0x91,0x00,0x00,0x20,0x00,0x00,0x00,0x00, 0x08,0x0f,0x00,0x20,0x61,0x00,0x00,0x20,0x35,0x00,0x00,0x20,0x00,0x00,0x00,0x00,
0x95,0x0d,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x69,0x0c,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

View File

@ -1,258 +1,257 @@
/* Autogenerated with ../../../../src/helper/bin2char.sh */ /* Autogenerated with ../../../../src/helper/bin2char.sh */
0x08,0xb5,0x00,0xbf,0x00,0xbf,0x00,0xbf,0x00,0xbf,0xdf,0xf8,0x1c,0xd0,0x07,0x48, 0x08,0xb5,0x00,0xbf,0x00,0xbf,0x00,0xbf,0x00,0xbf,0xdf,0xf8,0x1c,0xd0,0x07,0x48,
0x07,0x49,0x4f,0xf0,0x00,0x02,0x88,0x42,0xb8,0xbf,0x40,0xf8,0x04,0x2b,0xfa,0xdb, 0x07,0x49,0x4f,0xf0,0x00,0x02,0x88,0x42,0xb8,0xbf,0x40,0xf8,0x04,0x2b,0xff,0xf6,
0x00,0xf0,0xa8,0xf9,0xfe,0xe7,0x00,0x00,0xf0,0x0e,0x00,0x20,0x54,0x13,0x00,0x20, 0xfa,0xaf,0x00,0xf0,0x71,0xf9,0xfe,0xe7,0xe8,0x0e,0x00,0x20,0x4c,0x13,0x00,0x20,
0xfc,0x13,0x00,0x20,0x08,0xb5,0x07,0x4b,0x07,0x48,0x03,0x33,0x1b,0x1a,0x06,0x2b, 0xf4,0x13,0x00,0x20,0x10,0xb5,0x07,0x4c,0x23,0x78,0x00,0x2b,0x07,0xd1,0x06,0x4b,
0x04,0xd9,0x06,0x4b,0x00,0x2b,0x01,0xd0,0x00,0xf0,0x5c,0xf8,0x08,0xbc,0x01,0xbc,
0x00,0x47,0xc0,0x46,0x50,0x13,0x00,0x20,0x50,0x13,0x00,0x20,0x00,0x00,0x00,0x00,
0x08,0x48,0x09,0x49,0x09,0x1a,0x89,0x10,0x08,0xb5,0xcb,0x0f,0x59,0x18,0x49,0x10,
0x04,0xd0,0x06,0x4b,0x00,0x2b,0x01,0xd0,0x00,0xf0,0x44,0xf8,0x08,0xbc,0x01,0xbc,
0x00,0x47,0xc0,0x46,0x50,0x13,0x00,0x20,0x50,0x13,0x00,0x20,0x00,0x00,0x00,0x00,
0x10,0xb5,0x08,0x4c,0x23,0x78,0x00,0x2b,0x09,0xd1,0xff,0xf7,0xcb,0xff,0x06,0x4b,
0x00,0x2b,0x02,0xd0,0x05,0x48,0xaf,0xf3,0x00,0x80,0x01,0x23,0x23,0x70,0x10,0xbc, 0x00,0x2b,0x02,0xd0,0x05,0x48,0xaf,0xf3,0x00,0x80,0x01,0x23,0x23,0x70,0x10,0xbc,
0x01,0xbc,0x00,0x47,0x54,0x13,0x00,0x20,0x00,0x00,0x00,0x00,0xe0,0x0e,0x00,0x20, 0x01,0xbc,0x00,0x47,0x4c,0x13,0x00,0x20,0x00,0x00,0x00,0x00,0xd8,0x0e,0x00,0x20,
0x08,0xb5,0x0b,0x4b,0x00,0x2b,0x03,0xd0,0x0a,0x48,0x0b,0x49,0xaf,0xf3,0x00,0x80, 0x08,0xb5,0x09,0x4b,0x00,0x2b,0x03,0xd0,0x08,0x48,0x09,0x49,0xaf,0xf3,0x00,0x80,
0x0a,0x48,0x03,0x68,0x00,0x2b,0x04,0xd1,0xff,0xf7,0xc2,0xff,0x08,0xbc,0x01,0xbc, 0x08,0x48,0x03,0x68,0x00,0x2b,0x04,0xd0,0x07,0x4b,0x00,0x2b,0x01,0xd0,0x00,0xf0,
0x00,0x47,0x07,0x4b,0x00,0x2b,0xf7,0xd0,0x00,0xf0,0x0c,0xf8,0xf4,0xe7,0xc0,0x46, 0x0d,0xf8,0x08,0xbc,0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,0xd8,0x0e,0x00,0x20,
0x00,0x00,0x00,0x00,0xe0,0x0e,0x00,0x20,0x58,0x13,0x00,0x20,0x4c,0x13,0x00,0x20, 0x50,0x13,0x00,0x20,0x44,0x13,0x00,0x20,0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,
0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,0xd4,0x30,0x9f,0xe5,0x00,0x00,0x53,0xe3, 0xd8,0x30,0x9f,0xe5,0x00,0x00,0x53,0xe3,0xcc,0x30,0x9f,0x05,0x03,0xd0,0xa0,0xe1,
0xc8,0x30,0x9f,0x05,0x03,0xd0,0xa0,0xe1,0x00,0x20,0x0f,0xe1,0x0f,0x00,0x12,0xe3, 0x00,0x20,0x0f,0xe1,0x0f,0x00,0x12,0xe3,0x15,0x00,0x00,0x0a,0xd1,0xf0,0x21,0xe3,
0x15,0x00,0x00,0x0a,0xd1,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,0x01,0xaa,0x4d,0xe2, 0x03,0xd0,0xa0,0xe1,0x01,0xaa,0x4d,0xe2,0x0a,0x30,0xa0,0xe1,0xd7,0xf0,0x21,0xe3,
0x0a,0x30,0xa0,0xe1,0xd7,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,0x01,0x3a,0x43,0xe2, 0x03,0xd0,0xa0,0xe1,0x01,0x3a,0x43,0xe2,0xdb,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,
0xdb,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,0x01,0x3a,0x43,0xe2,0xd2,0xf0,0x21,0xe3, 0x01,0x3a,0x43,0xe2,0xd2,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,0x02,0x3a,0x43,0xe2,
0x03,0xd0,0xa0,0xe1,0x02,0x3a,0x43,0xe2,0xd3,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1, 0xd3,0xf0,0x21,0xe3,0x03,0xd0,0xa0,0xe1,0x02,0x39,0x43,0xe2,0xff,0x30,0xc3,0xe3,
0x02,0x39,0x43,0xe2,0xff,0x30,0xc3,0xe3,0xff,0x3c,0xc3,0xe3,0x04,0x30,0x03,0xe5, 0xff,0x3c,0xc3,0xe3,0x04,0x30,0x03,0xe5,0x00,0x20,0x53,0xe9,0xc0,0x20,0x82,0xe3,
0x00,0x20,0x53,0xe9,0xc0,0x20,0x82,0xe3,0x02,0xf0,0x21,0xe1,0x01,0xa8,0x43,0xe2, 0x02,0xf0,0x21,0xe1,0x01,0xa8,0x43,0xe2,0x00,0x10,0xb0,0xe3,0x01,0xb0,0xa0,0xe1,
0x00,0x10,0xb0,0xe3,0x01,0xb0,0xa0,0xe1,0x01,0x70,0xa0,0xe1,0x5c,0x00,0x9f,0xe5, 0x01,0x70,0xa0,0xe1,0x60,0x00,0x9f,0xe5,0x60,0x20,0x9f,0xe5,0x00,0x20,0x52,0xe0,
0x5c,0x20,0x9f,0xe5,0x00,0x20,0x52,0xe0,0x01,0x30,0x8f,0xe2,0x13,0xff,0x2f,0xe1, 0x01,0x30,0x8f,0xe2,0x13,0xff,0x2f,0xe1,0x00,0xf0,0x46,0xfd,0x11,0x4b,0x00,0x2b,
0x00,0xf0,0x42,0xfd,0x10,0x4b,0x00,0x2b,0x01,0xd0,0xfe,0x46,0x9f,0x46,0x0f,0x4b, 0x01,0xd0,0xfe,0x46,0x9f,0x46,0x10,0x4b,0x00,0x2b,0x01,0xd0,0xfe,0x46,0x9f,0x46,
0x00,0x2b,0x01,0xd0,0xfe,0x46,0x9f,0x46,0x00,0x20,0x00,0x21,0x04,0x00,0x0d,0x00, 0x00,0x20,0x00,0x21,0x04,0x00,0x0d,0x00,0x0e,0x48,0x00,0x28,0x02,0xd0,0x0e,0x48,
0x0d,0x48,0x00,0xf0,0x89,0xfc,0x00,0xf0,0xc3,0xfc,0x20,0x00,0x29,0x00,0x00,0xf0, 0x00,0xf0,0x26,0xfe,0x00,0xf0,0xc0,0xfc,0x20,0x00,0x29,0x00,0x00,0xf0,0xcc,0xf8,
0xd1,0xf8,0x00,0xf0,0x8b,0xfc,0x7b,0x46,0x18,0x47,0x00,0x00,0x11,0x00,0x00,0xef, 0x00,0xf0,0xa6,0xfc,0x7b,0x46,0x18,0x47,0x11,0x00,0x00,0xef,0x00,0x00,0x08,0x00,
0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x4c,0x13,0x00,0x20,
0x54,0x13,0x00,0x20,0xfc,0x13,0x00,0x20,0x15,0x0b,0x00,0x20,0x70,0xb5,0x04,0x46, 0xf4,0x13,0x00,0x20,0xb1,0x0d,0x00,0x20,0xc5,0x0d,0x00,0x20,0x70,0xb5,0x04,0x46,
0x0e,0x46,0x15,0x46,0x00,0x21,0x28,0x22,0x00,0xf0,0x0e,0xfd,0x26,0x61,0x65,0x62, 0x0e,0x46,0x15,0x46,0x00,0x21,0x28,0x22,0x00,0xf0,0x0e,0xfd,0x26,0x61,0x65,0x62,
0x00,0x21,0x84,0x22,0x02,0x48,0x00,0xf0,0x07,0xfd,0x00,0x20,0x70,0xbd,0x00,0xbf, 0x00,0x21,0x84,0x22,0x02,0x48,0x00,0xf0,0x07,0xfd,0x00,0x20,0x70,0xbd,0x00,0xbf,
0x70,0x13,0x00,0x20,0x10,0xb5,0x01,0x20,0x00,0xf0,0xac,0xf9,0x04,0x46,0x28,0xb9, 0x68,0x13,0x00,0x20,0x10,0xb5,0x01,0x20,0x00,0xf0,0xba,0xf9,0x04,0x46,0x28,0xb9,
0x01,0x21,0x84,0x22,0x03,0x48,0x00,0xf0,0xf7,0xfc,0x01,0xe0,0x40,0xf2,0x01,0x14, 0x01,0x21,0x84,0x22,0x03,0x48,0x00,0xf0,0xf7,0xfc,0x01,0xe0,0x40,0xf2,0x01,0x14,
0x20,0x46,0x10,0xbd,0x70,0x13,0x00,0x20,0x01,0x39,0xf8,0xb5,0x44,0x0b,0x08,0x44, 0x20,0x46,0x10,0xbd,0x68,0x13,0x00,0x20,0x01,0x39,0xf8,0xb5,0x44,0x0b,0x08,0x44,
0x45,0x0b,0x66,0x03,0xac,0x42,0x14,0xd8,0x0b,0x4f,0xe3,0x5d,0x6b,0xb9,0x30,0x46, 0x47,0x0b,0x65,0x03,0xbc,0x42,0x14,0xd8,0x0b,0x4e,0xa3,0x5d,0x6b,0xb9,0x28,0x46,
0x00,0xf0,0xfc,0xf8,0x38,0xb1,0x00,0x04,0x00,0xf4,0x7f,0x00,0x40,0xea,0x04,0x60, 0x00,0xf0,0xf8,0xf8,0x38,0xb1,0x00,0x04,0x00,0xf4,0x7f,0x00,0x40,0xea,0x04,0x60,
0x40,0xf4,0x81,0x70,0xf8,0xbd,0x01,0x23,0xe3,0x55,0x01,0x34,0x06,0xf5,0x00,0x56, 0x40,0xf4,0x81,0x70,0xf8,0xbd,0x01,0x23,0xa3,0x55,0x01,0x34,0x05,0xf5,0x00,0x55,
0xe8,0xe7,0x00,0x20,0xf8,0xbd,0x00,0xbf,0x70,0x13,0x00,0x20,0x2d,0xe9,0xf0,0x4f, 0xe8,0xe7,0x00,0x20,0xf8,0xbd,0x00,0xbf,0x68,0x13,0x00,0x20,0xb2,0xf5,0x00,0x5f,
0x53,0x1e,0x85,0xb0,0x0b,0x44,0x02,0x90,0x0d,0x46,0x4f,0xea,0x51,0x38,0x5b,0x0b, 0xf8,0xb5,0x07,0x46,0x0e,0x46,0x15,0x46,0x0b,0xd8,0x08,0x46,0x11,0x46,0xff,0xf7,
0x16,0x46,0x23,0x48,0x01,0x93,0x00,0x21,0x84,0x22,0x00,0xf0,0xbd,0xfc,0x4f,0xea, 0xd3,0xff,0x04,0x46,0x40,0xb9,0x38,0x46,0x31,0x46,0x2a,0x46,0x00,0xf0,0xe0,0xf8,
0x48,0x37,0xc5,0xf3,0x0c,0x0c,0x4f,0xf0,0x00,0x09,0x01,0x9b,0x98,0x45,0x32,0xd8, 0x02,0xe0,0x4f,0xf4,0x82,0x70,0xf8,0xbd,0x20,0x46,0xf8,0xbd,0x2d,0xe9,0xf0,0x4f,
0x74,0x19,0xdf,0xf8,0x70,0xb0,0xcd,0xf8,0x0c,0xc0,0x07,0xf5,0x00,0x5a,0x54,0x45, 0x53,0x1e,0x85,0xb0,0x0b,0x44,0x5b,0x0b,0x0c,0x46,0x4f,0x0b,0x83,0x46,0x15,0x46,
0x88,0xbf,0xc4,0xf3,0x0c,0x04,0x39,0x46,0x4f,0xf4,0x00,0x52,0x58,0x46,0x8c,0xbf, 0x20,0x48,0x03,0x93,0x00,0x21,0x84,0x22,0x00,0xf0,0xa6,0xfc,0x4f,0xea,0x47,0x38,
0x34,0x1b,0x34,0x46,0x00,0xf0,0x60,0xfc,0xdd,0xf8,0x0c,0xc0,0x02,0x9b,0x0b,0xeb, 0xc4,0xf3,0x0c,0x03,0x4f,0xf0,0x00,0x0a,0x03,0x9a,0x97,0x42,0x2e,0xd8,0x08,0xf5,
0x0c,0x00,0x03,0xeb,0x09,0x01,0x22,0x46,0x00,0xf0,0x56,0xfc,0x38,0x46,0x4f,0xf4, 0x00,0x5c,0x2e,0x19,0xdf,0xf8,0x60,0x90,0xcd,0xf8,0x04,0xc0,0x66,0x45,0x88,0xbf,
0x00,0x51,0x08,0xf1,0x01,0x08,0xff,0xf7,0x9f,0xff,0x68,0xb9,0x39,0x46,0x58,0x46, 0xc6,0xf3,0x0c,0x06,0x41,0x46,0x4f,0xf4,0x00,0x52,0x48,0x46,0x8c,0xbf,0xc6,0xeb,
0x4f,0xf4,0x00,0x52,0x25,0x44,0x00,0xf0,0xaf,0xf8,0x36,0x1b,0xc5,0xf3,0x0c,0x0c, 0x05,0x06,0x2e,0x46,0x02,0x93,0x00,0xf0,0x43,0xfc,0x02,0x9b,0x0b,0xeb,0x0a,0x01,
0xa1,0x44,0x57,0x46,0xc9,0xe7,0x00,0x20,0x05,0xb0,0xbd,0xe8,0xf0,0x8f,0x00,0xbf, 0x09,0xeb,0x03,0x00,0x32,0x46,0x00,0xf0,0x3b,0xfc,0x48,0x46,0x41,0x46,0x4f,0xf4,
0x70,0x13,0x00,0x20,0x00,0x60,0x00,0x20,0xb2,0xf5,0x00,0x5f,0xf8,0xb5,0x07,0x46, 0x00,0x52,0xff,0xf7,0xab,0xff,0x01,0x37,0xdd,0xf8,0x04,0xc0,0x38,0xb9,0x34,0x44,
0x0e,0x46,0x15,0x46,0x0b,0xd8,0x08,0x46,0x11,0x46,0xff,0xf7,0x7d,0xff,0x04,0x46, 0xc4,0xf3,0x0c,0x03,0xad,0x1b,0xb2,0x44,0xe0,0x46,0xcd,0xe7,0x00,0x20,0x05,0xb0,
0x40,0xb9,0x38,0x46,0x31,0x46,0x2a,0x46,0x00,0xf0,0x8e,0xf8,0x02,0xe0,0x4f,0xf4, 0xbd,0xe8,0xf0,0x8f,0x68,0x13,0x00,0x20,0x00,0x60,0x00,0x20,0x08,0xb5,0x00,0xf0,
0x82,0x70,0xf8,0xbd,0x20,0x46,0xf8,0xbd,0x08,0xb5,0x00,0xf0,0x85,0xf8,0x00,0x20, 0x87,0xf8,0x00,0x20,0x08,0xbd,0x00,0x00,0xf8,0xb5,0x32,0x48,0x32,0x49,0x33,0x4a,
0x08,0xbd,0x00,0x00,0xf8,0xb5,0x31,0x48,0x31,0x49,0x32,0x4a,0x32,0x4c,0xff,0xf7, 0x33,0x4d,0xff,0xf7,0x43,0xff,0x00,0x23,0x2b,0x60,0x2a,0x68,0x2d,0x4c,0x14,0x23,
0x3d,0xff,0x00,0x23,0x23,0x60,0x22,0x68,0x2c,0x4f,0x14,0x23,0x03,0xfb,0x02,0x73, 0x03,0xfb,0x02,0x43,0x08,0x33,0x5b,0x68,0x00,0x2b,0xf7,0xd0,0x2d,0x4b,0x1a,0x68,
0x08,0x33,0x5b,0x68,0x00,0x2b,0xf7,0xd0,0x2c,0x4b,0x1a,0x68,0x11,0x07,0xfb,0xd4, 0x12,0xf0,0x08,0x0f,0x19,0x46,0xf9,0xd1,0x2b,0x4e,0x2c,0x4f,0x33,0x68,0x3b,0x60,
0x2b,0x4d,0x2c,0x4e,0x2a,0x68,0x32,0x60,0x42,0xf0,0x33,0x02,0x2a,0x60,0x1a,0x68, 0x43,0xf0,0x33,0x03,0x33,0x60,0x0a,0x68,0x12,0x07,0xfc,0xd4,0x2b,0x68,0x14,0x22,
0x12,0x07,0xfc,0xd4,0x21,0x68,0x14,0x22,0x02,0xfb,0x01,0x73,0x98,0x68,0x01,0x38, 0x02,0xfb,0x03,0x41,0x89,0x68,0x01,0x39,0x04,0x29,0x26,0xd8,0xdf,0xe8,0x01,0xf0,
0x13,0x46,0x04,0x28,0x26,0xd8,0xdf,0xe8,0x00,0xf0,0x03,0x06,0x0e,0x16,0x1e,0x00, 0x03,0x06,0x0e,0x16,0x1e,0x00,0xff,0xf7,0x2d,0xff,0x20,0xe0,0x53,0x43,0xe2,0x18,
0xff,0xf7,0x28,0xff,0x20,0xe0,0x4b,0x43,0xfa,0x18,0x10,0x69,0xf9,0x58,0x52,0x68, 0x10,0x69,0xe1,0x58,0x52,0x68,0xff,0xf7,0xc1,0xff,0x18,0xe0,0x53,0x43,0xe2,0x18,
0xff,0xf7,0xc2,0xff,0x18,0xe0,0x4b,0x43,0xfa,0x18,0x10,0x69,0xf9,0x58,0x52,0x68, 0x10,0x69,0xe1,0x58,0x52,0x68,0xff,0xf7,0x51,0xff,0x10,0xe0,0x53,0x43,0xe2,0x18,
0xff,0xf7,0xa2,0xff,0x10,0xe0,0x4b,0x43,0xfa,0x18,0x10,0x69,0xf9,0x58,0x52,0x68, 0x10,0x69,0xe1,0x58,0x52,0x68,0xff,0xf7,0x61,0xff,0x08,0xe0,0x53,0x43,0xe2,0x18,
0xff,0xf7,0x44,0xff,0x08,0xe0,0x4b,0x43,0xfa,0x18,0xf8,0x58,0x51,0x68,0xff,0xf7, 0xe0,0x58,0x51,0x68,0xff,0xf7,0x20,0xff,0x01,0xe0,0x40,0xf2,0x05,0x10,0x3b,0x68,
0x1b,0xff,0x01,0xe0,0x40,0xf2,0x05,0x10,0x33,0x68,0x2b,0x60,0x0b,0x4b,0x1b,0x68, 0x33,0x60,0x0c,0x4b,0x1b,0x68,0x1b,0x07,0xfb,0xd4,0x2b,0x68,0x14,0x22,0x02,0xfb,
0x1b,0x07,0xfb,0xd4,0x22,0x68,0x14,0x23,0x03,0xfb,0x02,0x77,0xfb,0x68,0xf8,0x60, 0x03,0x44,0x10,0xb1,0xe3,0x68,0xe0,0x60,0xfe,0xe7,0xe2,0x68,0xe0,0x60,0x83,0xf0,
0x00,0xb1,0xfe,0xe7,0x82,0xf0,0x01,0x02,0x22,0x60,0xa4,0xe7,0xd8,0x1f,0x00,0x20, 0x01,0x03,0xa1,0xe7,0xd8,0x1f,0x00,0x20,0x00,0x20,0x00,0x20,0x00,0x40,0x00,0x20,
0x00,0x20,0x00,0x20,0x00,0x40,0x00,0x20,0xf4,0x13,0x00,0x20,0x00,0x40,0x03,0x40, 0xec,0x13,0x00,0x20,0x00,0x40,0x03,0x40,0x04,0x40,0x03,0x40,0xf0,0x13,0x00,0x20,
0x04,0x40,0x03,0x40,0xf8,0x13,0x00,0x20,0xfe,0xe7,0x00,0x00,0x08,0xb5,0x04,0x4b, 0xfe,0xe7,0x00,0x00,0x08,0xb5,0x04,0x4b,0x1b,0x68,0x5b,0x69,0x98,0x47,0x03,0x4b,
0x1b,0x68,0x5b,0x69,0x98,0x47,0x03,0x4b,0x00,0x22,0x1a,0x60,0x08,0xbd,0x00,0xbf, 0x00,0x22,0x1a,0x60,0x08,0xbd,0x00,0xbf,0xa8,0x01,0x00,0x10,0x84,0x04,0x60,0x42,
0xa8,0x01,0x00,0x10,0x84,0x04,0x60,0x42,0x08,0xb5,0x04,0x4b,0x1b,0x68,0x9b,0x69, 0x08,0xb5,0x04,0x4b,0x1b,0x68,0x9b,0x69,0x98,0x47,0x03,0x4b,0x00,0x22,0x1a,0x60,
0x98,0x47,0x03,0x4b,0x00,0x22,0x1a,0x60,0x08,0xbd,0x00,0xbf,0xa8,0x01,0x00,0x10, 0x08,0xbd,0x00,0xbf,0xa8,0x01,0x00,0x10,0x84,0x04,0x60,0x42,0x10,0xb5,0x3a,0x4b,
0x84,0x04,0x60,0x42,0x10,0xb5,0x33,0x4b,0x33,0x48,0x1b,0x68,0x33,0x4a,0x13,0xf0, 0x3a,0x4a,0x1b,0x68,0x13,0xf0,0x02,0x0f,0x39,0x4b,0x19,0x68,0x41,0xf0,0x02,0x01,
0x02,0x0f,0x03,0x68,0x43,0xf0,0x02,0x03,0x03,0x60,0x13,0x68,0x01,0x68,0x19,0xd0, 0x19,0x60,0x12,0x68,0x1a,0xd0,0x19,0x68,0x21,0xf4,0xe1,0x71,0xc2,0xf3,0xc1,0x04,
0x21,0xf4,0xe1,0x72,0xc3,0xf3,0xc1,0x04,0x22,0xf0,0x01,0x02,0x22,0x43,0xc3,0xf3, 0x21,0xf0,0x01,0x01,0xc2,0xf3,0xc0,0x10,0x21,0x43,0x41,0xea,0x00,0x21,0xc2,0xf3,
0xc0,0x11,0x42,0xea,0x01,0x22,0xc3,0xf3,0x41,0x11,0x42,0xea,0x81,0x12,0x02,0x60, 0x41,0x10,0x41,0xea,0x80,0x11,0x19,0x60,0x1b,0x68,0xdc,0x07,0x03,0xd5,0x2d,0x4b,
0x02,0x68,0xd4,0x07,0x03,0xd5,0x26,0x4a,0x12,0x68,0x50,0x07,0xfb,0xd5,0x03,0xf0, 0x1b,0x68,0x58,0x07,0xfb,0xd5,0x02,0xf0,0x07,0x03,0x19,0xe0,0x19,0x68,0x21,0xf4,
0x07,0x03,0x18,0xe0,0x21,0xf4,0xe1,0x72,0xc3,0xf3,0xc1,0x24,0x22,0xf0,0x01,0x02, 0xe1,0x71,0xc2,0xf3,0xc1,0x24,0x21,0xf0,0x01,0x01,0xc2,0xf3,0xc0,0x30,0x21,0x43,
0xc3,0xf3,0xc0,0x31,0x22,0x43,0x42,0xea,0x01,0x22,0xc3,0xf3,0x41,0x31,0x42,0xea, 0x41,0xea,0x00,0x21,0xc2,0xf3,0x41,0x30,0x41,0xea,0x80,0x11,0x19,0x60,0x1b,0x68,
0x81,0x12,0x02,0x60,0x02,0x68,0xd1,0x07,0x03,0xd5,0x19,0x4a,0x12,0x68,0x52,0x07, 0xd9,0x07,0x03,0xd5,0x1f,0x4b,0x1b,0x68,0x5b,0x07,0xfb,0xd5,0xc2,0xf3,0x02,0x23,
0xfb,0xd5,0xc3,0xf3,0x02,0x23,0x17,0x49,0x17,0x48,0x4a,0xf6,0xaa,0x22,0x0a,0x60, 0x1d,0x4a,0x4a,0xf6,0xaa,0x21,0x11,0x60,0x1c,0x49,0x1b,0x03,0x08,0x68,0xb3,0xf5,
0x02,0x68,0x1b,0x03,0xb3,0xf5,0xe0,0x4f,0x22,0xf4,0xe2,0x42,0x18,0xbf,0x43,0xf4, 0xe0,0x4f,0x18,0xbf,0x43,0xf4,0x80,0x73,0x20,0xf4,0xe2,0x40,0x03,0x43,0x0b,0x60,
0x80,0x73,0x13,0x43,0x03,0x60,0x45,0xf2,0xaa,0x53,0x0b,0x60,0x0f,0x4b,0x10,0x49, 0x45,0xf2,0xaa,0x53,0x13,0x60,0x00,0x23,0x15,0x4a,0x12,0x68,0x02,0xf0,0x0f,0x02,
0x01,0x22,0x1a,0x60,0x00,0x22,0x0a,0x60,0x1a,0x60,0x05,0x22,0xc3,0xf8,0x58,0x22, 0x93,0x42,0x14,0x4a,0x15,0xd2,0x13,0x60,0x13,0x4a,0x14,0x48,0x01,0x21,0x11,0x60,
0x4f,0xf0,0xff,0x32,0xc1,0xf8,0x8c,0x22,0xc1,0xf8,0x90,0x22,0x02,0x22,0xc3,0xf8, 0x00,0x21,0x01,0x60,0x11,0x60,0x05,0x21,0xc2,0xf8,0x58,0x12,0x4f,0xf0,0xff,0x31,
0x58,0x22,0x10,0xbd,0x10,0x00,0x09,0x40,0x24,0x00,0x03,0x40,0x08,0x13,0x00,0x50, 0xc0,0xf8,0x8c,0x12,0xc0,0xf8,0x90,0x12,0x02,0x21,0xc2,0xf8,0x58,0x12,0x01,0x33,
0x1c,0x00,0x03,0x40,0x64,0x20,0x03,0x40,0xa8,0x20,0x03,0x40,0x30,0x20,0x03,0x40, 0xe2,0xe7,0x00,0x23,0x13,0x60,0x10,0xbd,0x10,0x00,0x09,0x40,0x08,0x13,0x00,0x50,
0x34,0x20,0x03,0x40,0x2d,0xe9,0xf8,0x4f,0xd4,0x4d,0x29,0x68,0x11,0xf0,0x01,0x01, 0x24,0x00,0x03,0x40,0x1c,0x00,0x03,0x40,0x64,0x20,0x03,0x40,0xa8,0x20,0x03,0x40,
0x40,0xf0,0x95,0x81,0xdf,0xf8,0x90,0xe3,0xd1,0x4b,0xdf,0xf8,0x90,0xc3,0xdf,0xf8, 0x00,0x24,0x03,0x40,0x50,0x20,0x03,0x40,0x30,0x20,0x03,0x40,0x34,0x20,0x03,0x40,
0x90,0x83,0xdf,0xf8,0x90,0x93,0x05,0x27,0xce,0xf8,0x00,0x70,0x1b,0x68,0xc3,0xf3, 0x2d,0xe9,0xf0,0x4f,0x85,0xb0,0xc8,0x4b,0x02,0x90,0x1b,0x68,0x23,0xf0,0x7f,0x43,
0x03,0x23,0x4f,0xf4,0x40,0x72,0x01,0x33,0xb2,0xfb,0xf3,0xf3,0xdc,0xf8,0x00,0x20, 0x01,0x93,0x4f,0xf0,0xfc,0x54,0x00,0x22,0xc4,0x4b,0x1b,0x68,0x03,0xf0,0x0f,0x03,
0xd8,0xf8,0x00,0x40,0x92,0xb2,0x5a,0x43,0xc2,0xf3,0x8f,0x16,0x22,0x0c,0x12,0x04, 0x9a,0x42,0x80,0xf0,0x5a,0x82,0xc2,0x48,0x03,0x68,0x13,0xf0,0x01,0x03,0x03,0x93,
0x32,0x43,0xc8,0xf8,0x00,0x20,0xc3,0x4a,0xc3,0x4c,0x12,0x68,0x26,0x68,0xc3,0x4e, 0x40,0xf0,0x75,0x81,0xdf,0xf8,0x74,0xc3,0xbe,0x4b,0xdf,0xf8,0x74,0x83,0xbe,0x4d,
0x5a,0x43,0x92,0x09,0x22,0x60,0x32,0x68,0x54,0xf8,0x24,0x8c,0xc2,0xf3,0x07,0x42, 0x4f,0xf0,0x05,0x0e,0xcc,0xf8,0x00,0xe0,0x1b,0x68,0xd8,0xf8,0x00,0x60,0xc3,0xf3,
0x5a,0x43,0x28,0xf0,0xff,0x08,0xc2,0xf3,0x87,0x12,0x42,0xea,0x08,0x02,0xdf,0xf8, 0x03,0x23,0x4f,0xf4,0x40,0x71,0x01,0x33,0xb1,0xfb,0xf3,0xf3,0x29,0x68,0xb6,0xb2,
0x38,0x83,0x44,0xf8,0x24,0x2c,0xd9,0xf8,0x00,0xa0,0xd8,0xf8,0x00,0x20,0xca,0xf3, 0x5e,0x43,0x09,0x0c,0xc6,0xf3,0x8f,0x16,0x09,0x04,0x31,0x43,0x29,0x60,0xb3,0x49,
0x07,0x4a,0x22,0xf0,0xff,0x02,0x4a,0xea,0x02,0x02,0xc8,0xf8,0x00,0x20,0xd9,0xf8, 0x0d,0x68,0xb3,0x49,0x5d,0x43,0xad,0x09,0x0e,0x68,0x0d,0x60,0xb1,0x4d,0x2e,0x68,
0x00,0x20,0xdf,0xf8,0x18,0xa3,0x12,0x0e,0xda,0xf8,0x00,0x80,0x5a,0x43,0x92,0x00, 0x51,0xf8,0x24,0x7c,0xc6,0xf3,0x07,0x46,0x5e,0x43,0x27,0xf0,0xff,0x07,0xc6,0xf3,
0x28,0xf4,0x7f,0x48,0x02,0xf4,0x7f,0x42,0x42,0xea,0x08,0x02,0xdf,0xf8,0x00,0x83, 0x87,0x16,0x3e,0x43,0x41,0xf8,0x24,0x6c,0xab,0x4f,0xac,0x4e,0xd6,0xf8,0x00,0xa0,
0xca,0xf8,0x00,0x20,0xd8,0xf8,0x00,0x20,0x4f,0xea,0x12,0x6b,0xda,0xf8,0x04,0x20, 0xd7,0xf8,0x00,0x90,0xca,0xf3,0x07,0x4a,0x29,0xf0,0xff,0x09,0x4a,0xea,0x09,0x09,
0x0b,0xfb,0x03,0xfb,0x12,0x0c,0xcb,0xf3,0x8f,0x1b,0x12,0x04,0x4b,0xea,0x02,0x02, 0xc7,0xf8,0x00,0x90,0x37,0x68,0x4f,0xea,0x17,0x6a,0xa5,0x4f,0x0a,0xfb,0x03,0xfa,
0xca,0xf8,0x04,0x20,0xd9,0xf8,0x00,0x20,0xc2,0xf3,0x07,0x22,0x53,0x43,0xa0,0x4a, 0xd7,0xf8,0x00,0x90,0x4f,0xea,0x8a,0x0a,0x0a,0xf4,0x7f,0x4a,0x29,0xf4,0x7f,0x49,
0xd2,0xf8,0x00,0x90,0x9b,0x00,0x29,0xf4,0x7f,0x49,0x03,0xf4,0x7f,0x43,0x43,0xea, 0x4a,0xea,0x09,0x09,0xc7,0xf8,0x00,0x90,0xdf,0xf8,0xd8,0x92,0xdf,0xf8,0xd8,0xa2,
0x09,0x03,0xdf,0xf8,0xc0,0x92,0x13,0x60,0xd9,0xf8,0x00,0xa0,0x52,0xf8,0x24,0x3c, 0xd9,0xf8,0x00,0x70,0x4f,0xea,0x17,0x6b,0xda,0xf8,0x00,0x70,0x3f,0x0c,0x0b,0xfb,
0x4f,0xea,0x1a,0x6a,0x23,0xf4,0x7f,0x43,0x43,0xea,0x0a,0x23,0x42,0xf8,0x24,0x3c, 0x03,0xfb,0x3f,0x04,0x47,0xea,0x9b,0x17,0xca,0xf8,0x00,0x70,0x36,0x68,0xc6,0xf3,
0xd9,0xf8,0x00,0xa0,0x52,0xf8,0x24,0x3c,0xca,0xf3,0x07,0x4a,0x23,0xf0,0xff,0x03, 0x07,0x26,0x73,0x43,0x93,0x4e,0x37,0x68,0x9b,0x00,0x03,0xf4,0x7f,0x43,0x27,0xf4,
0x4a,0xea,0x03,0x03,0x42,0xf8,0x24,0x3c,0xd9,0xf8,0x00,0xa0,0x52,0xf8,0x1c,0x3c, 0x7f,0x47,0x1f,0x43,0x37,0x60,0x90,0x4b,0x90,0x4e,0xd6,0xf8,0x00,0xa0,0x1f,0x68,
0x0a,0xf4,0x7f,0x4a,0x23,0xf4,0x7f,0x43,0x4a,0xea,0x03,0x03,0x42,0xf8,0x1c,0x3c, 0x4f,0xea,0x1a,0x6a,0x27,0xf4,0x7f,0x47,0x47,0xea,0x0a,0x27,0x1f,0x60,0xd6,0xf8,
0xd9,0xf8,0x00,0x90,0x52,0xf8,0x1c,0x3c,0x5f,0xfa,0x89,0xf9,0x23,0xf0,0xff,0x03, 0x00,0xa0,0x1f,0x68,0xca,0xf3,0x07,0x4a,0x27,0xf0,0xff,0x07,0x4a,0xea,0x07,0x07,
0x49,0xea,0x03,0x03,0xdf,0xf8,0x60,0x92,0x42,0xf8,0x1c,0x3c,0x32,0x68,0xd9,0xf8, 0x1f,0x60,0xd6,0xf8,0x00,0xa0,0x9f,0x68,0x0a,0xf4,0x7f,0x4a,0x27,0xf4,0x7f,0x47,
0x00,0x30,0x02,0xf4,0x70,0x42,0x23,0xf4,0x70,0x43,0x13,0x43,0xc9,0xf8,0x00,0x30, 0x4a,0xea,0x07,0x07,0x9f,0x60,0x37,0x68,0x9e,0x68,0xff,0xb2,0x26,0xf0,0xff,0x06,
0xd8,0xf8,0x00,0x20,0xdf,0xf8,0x44,0x82,0xd8,0xf8,0x00,0x30,0x02,0xf4,0x70,0x42, 0x3e,0x43,0x9e,0x60,0x2f,0x68,0xde,0x68,0x07,0xf4,0x70,0x47,0x26,0xf4,0x70,0x46,
0x23,0xf4,0x70,0x43,0x13,0x43,0xc8,0xf8,0x00,0x30,0x32,0x68,0x54,0xf8,0x24,0x3c, 0x3e,0x43,0xde,0x60,0xd9,0xf8,0x00,0x70,0x5e,0x68,0x07,0xf4,0x70,0x47,0x26,0xf4,
0x12,0x0e,0x23,0xf4,0x7f,0x43,0x43,0xea,0x02,0x23,0x44,0xf8,0x24,0x3c,0x71,0x4b, 0x70,0x46,0x3e,0x43,0x5e,0x60,0x2d,0x68,0x51,0xf8,0x24,0x3c,0x2d,0x0e,0x23,0xf4,
0x1b,0x68,0x62,0x6a,0xc3,0xf3,0x0b,0x06,0x22,0xf4,0x7f,0x63,0x23,0xf0,0x0f,0x03, 0x7f,0x43,0x43,0xea,0x05,0x23,0x41,0xf8,0x24,0x3c,0x71,0x4b,0x1d,0x68,0x71,0x4b,
0x33,0x43,0x6d,0x4e,0x63,0x62,0x32,0x68,0x63,0x6a,0x02,0xf4,0x70,0x22,0x23,0xf4, 0x19,0x68,0x21,0xf4,0x7f,0x61,0xc5,0xf3,0x0b,0x05,0x21,0xf0,0x0f,0x01,0x29,0x43,
0x70,0x23,0x13,0x43,0x63,0x62,0x69,0x4c,0x22,0x68,0xd8,0xf8,0x58,0x30,0xc2,0xf3, 0x6d,0x4d,0x19,0x60,0x2e,0x68,0x19,0x68,0x06,0xf4,0x70,0x26,0x21,0xf4,0x70,0x21,
0x83,0x42,0x23,0xf4,0x70,0x23,0x43,0xea,0x02,0x43,0xc8,0xf8,0x58,0x30,0xdc,0xf8, 0x31,0x43,0x19,0x60,0x69,0x4b,0x6a,0x49,0x1f,0x68,0x0e,0x68,0xc7,0xf3,0x83,0x47,
0x00,0x30,0xd8,0xf8,0x58,0x20,0xc3,0xf3,0x0b,0x4c,0x22,0xf4,0x7f,0x63,0x23,0xf0, 0x26,0xf4,0x70,0x26,0x46,0xea,0x07,0x46,0x0e,0x60,0xd8,0xf8,0x00,0x70,0x0e,0x68,
0x0f,0x03,0x4c,0xea,0x03,0x03,0xc8,0xf8,0x58,0x30,0x23,0x68,0xd8,0xf8,0x5c,0x20, 0x26,0xf4,0x7f,0x66,0xc7,0xf3,0x0b,0x47,0x26,0xf0,0x0f,0x06,0x3e,0x43,0x0e,0x60,
0x4f,0xea,0xd3,0x5c,0x22,0xf0,0xff,0x73,0x23,0xf4,0x80,0x33,0x43,0xea,0x0c,0x43, 0x60,0x4e,0x1f,0x68,0x31,0x68,0x21,0xf0,0xff,0x71,0xff,0x0d,0x21,0xf4,0x80,0x31,
0xc8,0xf8,0x5c,0x30,0x33,0x68,0x56,0x4a,0xdf,0xf8,0xa4,0xc1,0x0f,0x33,0x03,0xf0, 0x41,0xea,0x07,0x41,0x31,0x60,0x2d,0x68,0x5b,0x49,0x5c,0x4f,0x0f,0x35,0x05,0xf0,
0x0f,0x03,0x13,0x60,0x26,0x68,0x53,0x68,0xc6,0xf3,0x80,0x56,0x23,0xf4,0x00,0x03, 0x0f,0x05,0x0d,0x60,0x1e,0x68,0x4d,0x68,0xc6,0xf3,0x80,0x56,0x25,0xf4,0x00,0x05,
0x43,0xea,0xc6,0x53,0x53,0x60,0x53,0x68,0x4e,0x4e,0x43,0xf4,0x80,0x43,0x53,0x60, 0x45,0xea,0xc6,0x55,0x4d,0x60,0x4d,0x68,0x45,0xf4,0x80,0x45,0x4d,0x60,0x02,0x21,
0x02,0x23,0xce,0xf8,0x00,0x30,0xae,0xf5,0x09,0x7e,0x4a,0xf6,0xaa,0x23,0xce,0xf8, 0x53,0x4d,0xcc,0xf8,0x00,0x10,0x4a,0xf6,0xaa,0x21,0x29,0x60,0x51,0x49,0x3e,0x68,
0x00,0x30,0xdc,0xf8,0x00,0x30,0x32,0x68,0x03,0xf0,0x0f,0x08,0x22,0xf4,0x7f,0x02, 0xd1,0xf8,0x00,0xc0,0x06,0xf0,0x0f,0x08,0x2c,0xf4,0x7f,0x0c,0x4c,0xea,0x08,0x4c,
0x42,0xea,0x08,0x42,0xc3,0xf3,0x03,0x23,0x42,0xea,0x03,0x53,0xdf,0xf8,0x54,0x81, 0xc6,0xf3,0x03,0x26,0x4c,0xea,0x06,0x56,0x0e,0x60,0x4b,0x4e,0xd6,0xf8,0x00,0xc0,
0x33,0x60,0xd8,0xf8,0x00,0x30,0x32,0x68,0xc3,0xf3,0x03,0x49,0x22,0xf0,0xff,0x02, 0xd1,0xf8,0x00,0x80,0xcc,0xf3,0x03,0x49,0x28,0xf0,0xff,0x08,0x49,0xea,0x08,0x08,
0x49,0xea,0x02,0x02,0xc3,0xf3,0x03,0x63,0x42,0xea,0x03,0x13,0x33,0x60,0xdc,0xf8, 0xcc,0xf3,0x03,0x6c,0x48,0xea,0x0c,0x1c,0xc1,0xf8,0x00,0xc0,0x3f,0x68,0xd1,0xf8,
0x00,0x60,0xdf,0xf8,0x34,0xc1,0xdc,0xf8,0x00,0x30,0x06,0xf4,0x70,0x22,0x23,0xf4, 0x04,0xc0,0x07,0xf4,0x70,0x28,0x2c,0xf4,0x7f,0x0c,0x4c,0xea,0x08,0x0c,0xc7,0xf3,
0x7f,0x03,0x1a,0x43,0xc6,0xf3,0x03,0x63,0x42,0xea,0x03,0x53,0x32,0x4e,0xcc,0xf8, 0x03,0x67,0x4c,0xea,0x07,0x57,0x4f,0x60,0x3c,0x49,0x3d,0x4f,0xd1,0xf8,0x00,0x80,
0x00,0x30,0x32,0x68,0x5c,0xf8,0x08,0x3c,0xc2,0xf3,0x03,0x22,0x23,0xf0,0x0f,0x03, 0xd7,0xf8,0x00,0xc0,0xc8,0xf3,0x03,0x28,0x2c,0xf0,0x0f,0x0c,0x48,0xea,0x0c,0x0c,
0x13,0x43,0x4c,0xf8,0x08,0x3c,0xd8,0xf8,0x00,0x20,0xdc,0xf8,0x08,0x30,0x02,0xf4, 0xc7,0xf8,0x00,0xc0,0xd6,0xf8,0x00,0xc0,0x36,0x4e,0x37,0x68,0x0c,0xf4,0xf8,0x5c,
0xf8,0x52,0x23,0xf4,0xf8,0x53,0x13,0x43,0xcc,0xf8,0x08,0x30,0x32,0x68,0xdc,0xf8, 0x27,0xf4,0xf8,0x57,0x4c,0xea,0x07,0x07,0x37,0x60,0x0f,0x68,0xd6,0xf8,0x04,0xc0,
0x0c,0x30,0x12,0x0b,0x02,0xf4,0x70,0x42,0x23,0xf4,0x70,0x43,0x13,0x43,0xcc,0xf8, 0x3f,0x0b,0x07,0xf4,0x70,0x47,0x2c,0xf4,0x70,0x4c,0x47,0xea,0x0c,0x07,0x77,0x60,
0x0c,0x30,0x32,0x68,0x21,0x4e,0x33,0x68,0xc2,0xf3,0x04,0x42,0x23,0xf0,0x1f,0x03, 0x0f,0x68,0x2d,0x49,0x0e,0x68,0xc7,0xf3,0x04,0x47,0x26,0xf0,0x1f,0x06,0x3e,0x43,
0x13,0x43,0x33,0x60,0x22,0x68,0x1e,0x4c,0x23,0x68,0xc2,0xf3,0x01,0x42,0x23,0xf4, 0x0e,0x60,0x1e,0x68,0x29,0x4b,0x19,0x68,0xc6,0xf3,0x01,0x46,0x21,0xf4,0x40,0x11,
0x40,0x13,0x43,0xea,0x02,0x53,0x1b,0x4a,0x23,0x60,0x45,0xf2,0xaa,0x53,0xce,0xf8, 0x41,0xea,0x06,0x51,0x19,0x60,0x45,0xf2,0xaa,0x53,0x2b,0x60,0x24,0x4b,0xc3,0xf8,
0x00,0x30,0x17,0x60,0x2b,0x68,0x43,0xf0,0x01,0x03,0x2b,0x60,0x11,0x60,0x16,0x4b, 0x00,0xe0,0x01,0x68,0x41,0xf0,0x01,0x01,0x01,0x60,0x03,0x99,0x19,0x60,0x21,0x4b,
0x16,0x4c,0x1b,0x68,0x16,0x4a,0x17,0x4d,0x13,0xf0,0x02,0x0f,0x23,0x68,0x43,0xf0, 0x21,0x49,0x1b,0x68,0x4a,0xe0,0x00,0xbf,0x14,0x24,0x03,0x40,0x00,0x24,0x03,0x40,
0x02,0x03,0x23,0x60,0x13,0x68,0x21,0x68,0x59,0xd0,0x3f,0xe0,0x40,0x00,0x03,0x40, 0x40,0x00,0x03,0x40,0x00,0x20,0x03,0x40,0x40,0x22,0x03,0x40,0x8c,0x11,0x00,0x50,
0x00,0x20,0x03,0x40,0x8c,0x11,0x00,0x50,0x44,0x22,0x03,0x40,0x74,0x11,0x00,0x50, 0x44,0x22,0x03,0x40,0x74,0x11,0x00,0x50,0x24,0x22,0x03,0x40,0x78,0x11,0x00,0x50,
0x34,0x22,0x03,0x40,0x84,0x11,0x00,0x50,0x80,0x11,0x00,0x50,0xb0,0x12,0x00,0x50, 0x28,0x22,0x03,0x40,0x34,0x22,0x03,0x40,0x10,0x22,0x03,0x40,0x70,0x11,0x00,0x50,
0x78,0x22,0x03,0x40,0x84,0x20,0x03,0x40,0x98,0x11,0x00,0x50,0x98,0x20,0x03,0x40, 0x84,0x11,0x00,0x50,0x68,0x22,0x03,0x40,0x80,0x11,0x00,0x50,0xb0,0x12,0x00,0x50,
0xa8,0x20,0x03,0x40,0x3c,0x00,0x03,0x40,0x10,0x00,0x09,0x40,0x24,0x00,0x03,0x40, 0x6c,0x22,0x03,0x40,0x70,0x22,0x03,0x40,0x78,0x22,0x03,0x40,0x90,0x11,0x00,0x50,
0x08,0x13,0x00,0x50,0x1c,0x00,0x03,0x40,0x88,0x22,0x03,0x40,0x88,0x11,0x00,0x50, 0x64,0x20,0x03,0x40,0x84,0x20,0x03,0x40,0x94,0x11,0x00,0x50,0x98,0x11,0x00,0x50,
0x40,0x22,0x03,0x40,0x78,0x11,0x00,0x50,0x24,0x22,0x03,0x40,0x28,0x22,0x03,0x40, 0x80,0x20,0x03,0x40,0x90,0x20,0x03,0x40,0x98,0x20,0x03,0x40,0xa8,0x20,0x03,0x40,
0x7c,0x11,0x00,0x50,0x70,0x11,0x00,0x50,0x1c,0x22,0x03,0x40,0x14,0x22,0x03,0x40, 0x3c,0x00,0x03,0x40,0x10,0x00,0x09,0x40,0x08,0x13,0x00,0x50,0x88,0x22,0x03,0x40,
0x90,0x11,0x00,0x50,0x94,0x11,0x00,0x50,0x88,0x20,0x03,0x40,0x21,0xf4,0xe1,0x72, 0x88,0x11,0x00,0x50,0x7c,0x11,0x00,0x50,0x2c,0x22,0x03,0x40,0x62,0x48,0x13,0xf0,
0xc3,0xf3,0xc1,0x46,0x22,0xf0,0x01,0x02,0xc3,0xf3,0xc0,0x51,0x32,0x43,0x42,0xea, 0x02,0x0f,0x62,0x4b,0x1d,0x68,0x45,0xf0,0x02,0x05,0x1d,0x60,0x09,0x68,0x19,0xd0,
0x01,0x22,0xc3,0xf3,0x41,0x51,0x42,0xea,0x81,0x12,0x22,0x60,0x22,0x68,0xd7,0x07, 0x1d,0x68,0x25,0xf4,0xe1,0x75,0xc1,0xf3,0xc1,0x47,0x25,0xf0,0x01,0x05,0xc1,0xf3,
0x02,0xd5,0x2a,0x68,0x56,0x07,0xfc,0xd5,0xc3,0xf3,0x02,0x43,0x16,0xe0,0xc3,0xf3, 0xc0,0x56,0x3d,0x43,0x45,0xea,0x06,0x25,0xc1,0xf3,0x41,0x56,0x45,0xea,0x86,0x15,
0xc1,0x62,0xde,0x0f,0x42,0xea,0x06,0x26,0x21,0xf4,0xe1,0x72,0x22,0xf0,0x01,0x02, 0x1d,0x60,0x1b,0x68,0xdd,0x07,0x02,0xd5,0x03,0x68,0x5b,0x07,0xfc,0xd5,0xc1,0xf3,
0x32,0x43,0xc3,0xf3,0x41,0x71,0x42,0xea,0x81,0x12,0x22,0x60,0x22,0x68,0xd4,0x07, 0x02,0x43,0x17,0xe0,0x1d,0x68,0xcf,0x0f,0xc1,0xf3,0xc1,0x66,0x25,0xf4,0xe1,0x75,
0x02,0xd5,0x2a,0x68,0x51,0x07,0xfc,0xd5,0xc3,0xf3,0x02,0x63,0x3b,0x49,0x3c,0x4c, 0x46,0xea,0x07,0x26,0x25,0xf0,0x01,0x05,0x35,0x43,0xc1,0xf3,0x41,0x76,0x45,0xea,
0x4a,0xf6,0xaa,0x22,0x0a,0x60,0x22,0x68,0x1b,0x03,0xb3,0xf5,0xe0,0x4f,0x22,0xf4, 0x86,0x15,0x1d,0x60,0x1b,0x68,0xdf,0x07,0x02,0xd5,0x03,0x68,0x5e,0x07,0xfc,0xd5,
0xe2,0x42,0x18,0xbf,0x43,0xf4,0x80,0x73,0x13,0x43,0x23,0x60,0x45,0xf2,0xaa,0x53, 0xc1,0xf3,0x02,0x63,0x46,0x49,0x47,0x4f,0x4a,0xf6,0xaa,0x25,0x0d,0x60,0x46,0x4d,
0x0b,0x60,0x34,0x4b,0x00,0x21,0x01,0x22,0x19,0x60,0x43,0xf8,0x20,0x2c,0x32,0x4a, 0x1b,0x03,0x2e,0x68,0xb3,0xf5,0xe0,0x4f,0x26,0xf4,0xe2,0x46,0x18,0xbf,0x43,0xf4,
0x4f,0xf6,0xff,0x74,0x14,0x60,0x31,0x4c,0x43,0xf8,0x20,0x1c,0x02,0xf5,0xec,0x72, 0x80,0x73,0x33,0x43,0x2b,0x60,0x45,0xf2,0xaa,0x53,0x0b,0x60,0x3f,0x4b,0x40,0x4e,
0x4f,0xf0,0x05,0x0e,0x10,0x23,0xc4,0xf8,0x00,0xe0,0x13,0x60,0x2c,0x4b,0x15,0x26, 0x1a,0x60,0x01,0x21,0x43,0xf8,0x20,0x1c,0x3e,0x49,0x4f,0xf6,0xff,0x75,0x0d,0x60,
0x1e,0x60,0x02,0x26,0x26,0x60,0x2b,0x4e,0x37,0x68,0xc4,0xf8,0x00,0xe0,0xdf,0xf8, 0x00,0x25,0x43,0xf8,0x20,0x5c,0x03,0xf5,0x0e,0x73,0x4f,0xf0,0x05,0x0e,0x10,0x21,
0xb4,0xe0,0xce,0xf8,0x00,0x10,0xce,0xf8,0x04,0x10,0x18,0xb1,0x31,0x68,0x41,0xf4, 0xc3,0xf8,0x00,0xe0,0x39,0x60,0x15,0x21,0x31,0x60,0x02,0x21,0x19,0x60,0x36,0x49,
0x00,0x01,0x31,0x60,0x02,0x21,0x05,0x20,0x21,0x60,0x20,0x60,0x08,0x20,0x10,0x60, 0xd1,0xf8,0x00,0xc0,0xc3,0xf8,0x00,0xe0,0xdf,0xf8,0xdc,0xe0,0xce,0xf8,0x00,0x50,
0x15,0x22,0x1a,0x60,0x21,0x60,0x2b,0x68,0x9a,0x07,0xfc,0xd4,0x1e,0x4b,0x1b,0x68, 0xce,0xf8,0x04,0x50,0x02,0x9d,0x1d,0xb1,0x0d,0x68,0x45,0xf4,0x00,0x05,0x0d,0x60,
0x13,0xf0,0x10,0x0f,0x14,0xbf,0x04,0x25,0x00,0x25,0xff,0xf7,0x1b,0xfd,0x3b,0x02, 0xdf,0xf8,0xc8,0xe0,0x02,0x25,0x1d,0x60,0xce,0xf8,0x00,0x40,0x4f,0xf0,0x05,0x0e,
0x07,0xd4,0x05,0x23,0x23,0x60,0x33,0x68,0x23,0xf4,0x00,0x03,0x33,0x60,0x02,0x23, 0xc3,0xf8,0x00,0xe0,0x4f,0xf0,0x08,0x0e,0xc7,0xf8,0x00,0xe0,0x15,0x27,0x37,0x60,
0x23,0x60,0xc5,0xb9,0x15,0x4b,0x16,0x48,0x19,0x68,0x03,0xf5,0x10,0x53,0x04,0x33, 0x1d,0x60,0x05,0x68,0xad,0x07,0x19,0xd5,0xfb,0xe7,0x24,0x4b,0x24,0x48,0x1a,0x68,
0x1a,0x68,0x1b,0x68,0x02,0xf0,0x0f,0x02,0xc9,0xb2,0x03,0xf0,0x0f,0x03,0x51,0x43, 0x03,0xf5,0x10,0x53,0x04,0x33,0x19,0x68,0x1b,0x68,0xd2,0xb2,0x01,0xf0,0x0f,0x01,
0x9b,0x02,0xc3,0xeb,0x81,0x21,0x01,0xf5,0xfe,0x51,0x18,0x31,0x14,0x22,0xbd,0xe8, 0x03,0xf0,0x0f,0x03,0x51,0x43,0x9b,0x02,0xc3,0xeb,0x81,0x21,0x01,0xf5,0xfe,0x51,
0xf8,0x4f,0xff,0xf7,0xe9,0xbc,0x28,0x46,0xbd,0xe8,0xf8,0x8f,0x64,0x20,0x03,0x40, 0x18,0x31,0x14,0x22,0xff,0xf7,0xe4,0xfc,0x05,0x46,0x16,0xe0,0x19,0x48,0x00,0x68,
0xa8,0x20,0x03,0x40,0x50,0x20,0x03,0x40,0x34,0x20,0x03,0x40,0x88,0x22,0x03,0x40, 0x10,0xf0,0x10,0x0f,0x0c,0xbf,0x00,0x25,0x04,0x25,0x1c,0xf4,0x00,0x0f,0x07,0xd1,
0xb4,0x22,0x03,0x40,0x7c,0x22,0x03,0x40,0x54,0x20,0x03,0x40,0x2c,0x00,0x03,0x40, 0x05,0x20,0x18,0x60,0x08,0x68,0x20,0xf4,0x00,0x00,0x08,0x60,0x02,0x21,0x19,0x60,
0xf4,0x0e,0x00,0x20,0xc0,0x22,0x03,0x40,0x08,0xb5,0x01,0x1c,0x00,0x22,0x00,0x20, 0x01,0x99,0x0c,0x44,0x0d,0xb9,0x01,0x32,0x6e,0xe5,0xff,0xf7,0xd7,0xfc,0x28,0x46,
0x00,0x23,0x00,0xf0,0xeb,0xf8,0x08,0xbc,0x02,0xbc,0x08,0x47,0x10,0xb5,0x00,0x21, 0x05,0xb0,0xbd,0xe8,0xf0,0x8f,0x00,0xbf,0x1c,0x00,0x03,0x40,0x24,0x00,0x03,0x40,
0x04,0x1c,0x00,0xf0,0x5d,0xf9,0x05,0x4b,0x18,0x68,0xc3,0x6b,0x00,0x2b,0x01,0xd0, 0x64,0x20,0x03,0x40,0x0c,0x22,0x03,0x40,0xa8,0x20,0x03,0x40,0x50,0x20,0x03,0x40,
0x00,0xf0,0x06,0xf8,0x20,0x1c,0xff,0xf7,0xa7,0xfc,0xc0,0x46,0x0c,0x0f,0x00,0x20, 0xb4,0x22,0x03,0x40,0x34,0x20,0x03,0x40,0x7c,0x22,0x03,0x40,0x2c,0x00,0x03,0x40,
0x18,0x47,0xc0,0x46,0x38,0xb5,0x0a,0x4b,0x0a,0x4c,0xe4,0x1a,0xa4,0x10,0x0a,0xd0, 0xec,0x0e,0x00,0x20,0x54,0x20,0x03,0x40,0xc0,0x22,0x03,0x40,0x10,0x21,0x03,0x40,
0x09,0x4a,0xa5,0x18,0xad,0x00,0xed,0x18,0x2b,0x68,0x01,0x3c,0x00,0xf0,0x0e,0xf8, 0x10,0xb5,0x00,0x21,0x04,0x1c,0x00,0xf0,0xdf,0xf8,0x05,0x4b,0x18,0x68,0xc3,0x6b,
0x04,0x3d,0x00,0x2c,0xf8,0xd1,0x00,0xf0,0xcd,0xf9,0x38,0xbc,0x01,0xbc,0x00,0x47, 0x00,0x2b,0x01,0xd0,0x00,0xf0,0x06,0xf8,0x20,0x1c,0xff,0xf7,0x89,0xfc,0xc0,0x46,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0x3f,0x18,0x47,0xc0,0x46, 0x04,0x0f,0x00,0x20,0x18,0x47,0xc0,0x46,0x70,0xb5,0x10,0x4e,0x10,0x4d,0xad,0x1b,
0x70,0xb5,0x10,0x4e,0x10,0x4d,0xad,0x1b,0xad,0x10,0x00,0x24,0x00,0x2d,0x06,0xd0, 0xad,0x10,0x00,0x24,0x00,0x2d,0x06,0xd0,0xa3,0x00,0xf3,0x58,0x01,0x34,0x00,0xf0,
0xa3,0x00,0xf3,0x58,0x01,0x34,0x00,0xf0,0x1d,0xf8,0xa5,0x42,0xf8,0xd1,0x00,0xf0, 0x1d,0xf8,0xa5,0x42,0xf8,0xd1,0x00,0xf0,0xdb,0xf9,0x0a,0x4e,0x0a,0x4d,0xad,0x1b,
0xab,0xf9,0x0a,0x4e,0x0a,0x4d,0xad,0x1b,0xad,0x10,0x00,0x24,0x00,0x2d,0x06,0xd0, 0xad,0x10,0x00,0x24,0x00,0x2d,0x06,0xd0,0xa3,0x00,0xf3,0x58,0x01,0x34,0x00,0xf0,
0xa3,0x00,0xf3,0x58,0x01,0x34,0x00,0xf0,0x0d,0xf8,0xa5,0x42,0xf8,0xd1,0x70,0xbc, 0x0d,0xf8,0xa5,0x42,0xf8,0xd1,0x70,0xbc,0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,
0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,
0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,0x70,0xb5,0x0f,0x2a,0x34,0xd9,0x04,0x1c, 0xf0,0xb5,0x0f,0x2a,0x37,0xd9,0x03,0x1c,0x0b,0x43,0x9c,0x07,0x37,0xd1,0x16,0x1c,
0x0c,0x43,0x0b,0x1c,0xa4,0x07,0x33,0xd1,0x15,0x1c,0x04,0x1c,0x10,0x3d,0x2d,0x09, 0x10,0x3e,0x36,0x09,0x35,0x01,0x45,0x19,0x10,0x35,0x0c,0x1c,0x03,0x1c,0x27,0x68,
0x01,0x35,0x2d,0x01,0x49,0x19,0x1e,0x68,0x26,0x60,0x5e,0x68,0x66,0x60,0x9e,0x68, 0x1f,0x60,0x67,0x68,0x5f,0x60,0xa7,0x68,0x9f,0x60,0xe7,0x68,0xdf,0x60,0x10,0x33,
0xa6,0x60,0xde,0x68,0x10,0x33,0xe6,0x60,0x10,0x34,0x99,0x42,0xf3,0xd1,0x0f,0x23, 0x10,0x34,0xab,0x42,0xf3,0xd1,0x73,0x1c,0x1b,0x01,0xc5,0x18,0xc9,0x18,0x0f,0x23,
0x45,0x19,0x13,0x40,0x03,0x2b,0x1d,0xd9,0x1c,0x1f,0x00,0x23,0xa4,0x08,0x01,0x34, 0x13,0x40,0x03,0x2b,0x1d,0xd9,0x1c,0x1f,0xa4,0x08,0x01,0x34,0xa4,0x00,0x00,0x23,
0xa4,0x00,0xce,0x58,0xee,0x50,0x04,0x33,0xa3,0x42,0xfa,0xd1,0xed,0x18,0xc9,0x18, 0xce,0x58,0xee,0x50,0x04,0x33,0xa3,0x42,0xfa,0xd1,0xed,0x18,0xc9,0x18,0x03,0x23,
0x03,0x23,0x1a,0x40,0x05,0xd0,0x00,0x23,0xcc,0x5c,0xec,0x54,0x01,0x33,0x93,0x42, 0x1a,0x40,0x05,0xd0,0x00,0x23,0xcc,0x5c,0xec,0x54,0x01,0x33,0x93,0x42,0xfa,0xd1,
0xfa,0xd1,0x70,0xbc,0x02,0xbc,0x08,0x47,0x05,0x1c,0x00,0x2a,0xf3,0xd1,0xf8,0xe7, 0xf0,0xbc,0x02,0xbc,0x08,0x47,0x05,0x1c,0x00,0x2a,0xf3,0xd1,0xf8,0xe7,0x05,0x1c,
0x05,0x1c,0xf0,0xe7,0x1a,0x1c,0xf8,0xe7,0x70,0xb5,0x83,0x07,0x43,0xd0,0x54,0x1e, 0xf0,0xe7,0x1a,0x1c,0xf8,0xe7,0xc0,0x46,0xf0,0xb5,0x83,0x07,0x4a,0xd0,0x54,0x1e,
0x00,0x2a,0x3d,0xd0,0x0d,0x06,0x2d,0x0e,0x03,0x1c,0x03,0x26,0x03,0xe0,0x62,0x1e, 0x00,0x2a,0x44,0xd0,0x0e,0x06,0x36,0x0e,0x03,0x1c,0x03,0x25,0x03,0xe0,0x62,0x1e,
0x00,0x2c,0x35,0xd0,0x14,0x1c,0x01,0x33,0x5a,0x1e,0x15,0x70,0x33,0x42,0xf6,0xd1, 0x00,0x2c,0x3c,0xd0,0x14,0x1c,0x01,0x33,0x5a,0x1e,0x16,0x70,0x2b,0x42,0xf6,0xd1,
0x03,0x2c,0x24,0xd9,0xff,0x25,0x0d,0x40,0x2a,0x02,0x15,0x43,0x2a,0x04,0x15,0x43, 0x03,0x2c,0x2b,0xd9,0xff,0x25,0x0d,0x40,0x2a,0x02,0x15,0x43,0x2a,0x04,0x15,0x43,
0x0f,0x2c,0x11,0xd9,0x26,0x1c,0x10,0x3e,0x36,0x09,0x01,0x36,0x36,0x01,0x1a,0x1c, 0x0f,0x2c,0x15,0xd9,0x27,0x1c,0x10,0x3f,0x3f,0x09,0x1e,0x1c,0x3a,0x01,0x10,0x36,
0x9b,0x19,0x15,0x60,0x55,0x60,0x95,0x60,0xd5,0x60,0x10,0x32,0x93,0x42,0xf8,0xd1, 0xb6,0x18,0x1a,0x1c,0x15,0x60,0x55,0x60,0x95,0x60,0xd5,0x60,0x10,0x32,0xb2,0x42,
0x0f,0x22,0x14,0x40,0x03,0x2c,0x0a,0xd9,0x26,0x1f,0xb6,0x08,0x01,0x36,0xb6,0x00, 0xf8,0xd1,0x01,0x37,0x3f,0x01,0x0f,0x22,0xdb,0x19,0x14,0x40,0x03,0x2c,0x0d,0xd9,
0x1a,0x1c,0x9b,0x19,0x20,0xc2,0x93,0x42,0xfc,0xd1,0x03,0x22,0x14,0x40,0x00,0x2c, 0x27,0x1f,0xbf,0x08,0xba,0x00,0x1e,0x1d,0xb6,0x18,0x1a,0x1c,0x20,0xc2,0xb2,0x42,
0x06,0xd0,0x09,0x06,0x1c,0x19,0x09,0x0e,0x19,0x70,0x01,0x33,0xa3,0x42,0xfb,0xd1, 0xfc,0xd1,0x01,0x37,0xbf,0x00,0x03,0x22,0xdb,0x19,0x14,0x40,0x00,0x2c,0x06,0xd0,
0x70,0xbc,0x02,0xbc,0x08,0x47,0x14,0x1c,0x03,0x1c,0xc9,0xe7,0xf8,0xb5,0x44,0x46, 0x0a,0x06,0x12,0x0e,0x1c,0x19,0x1a,0x70,0x01,0x33,0xa3,0x42,0xfb,0xd1,0xf0,0xbc,
0x5f,0x46,0x56,0x46,0x4d,0x46,0x9b,0x46,0x30,0x4b,0xf0,0xb4,0x1c,0x68,0xa4,0x23, 0x02,0xbc,0x08,0x47,0x14,0x1c,0x03,0x1c,0xc2,0xe7,0xc0,0x46,0x08,0xb5,0x04,0x4b,
0x5b,0x00,0x05,0x1c,0xe0,0x58,0x0e,0x1c,0x90,0x46,0x00,0x28,0x4d,0xd0,0x43,0x68, 0x00,0x2b,0x02,0xd0,0x03,0x48,0x00,0xf0,0x9b,0xf8,0x08,0xbc,0x01,0xbc,0x00,0x47,
0x1f,0x2b,0x0f,0xdc,0x5c,0x1c,0x00,0x2d,0x23,0xd1,0x02,0x33,0x9b,0x00,0x44,0x60, 0x00,0x00,0x00,0x00,0xc5,0x0d,0x00,0x20,0xf0,0xb5,0x5f,0x46,0x56,0x46,0x4d,0x46,
0x1e,0x50,0x00,0x20,0x3c,0xbc,0x90,0x46,0x99,0x46,0xa2,0x46,0xab,0x46,0xf8,0xbc, 0x44,0x46,0xf0,0xb4,0x43,0x4b,0x1b,0x68,0x85,0xb0,0x01,0x93,0x49,0x33,0xff,0x33,
0x02,0xbc,0x08,0x47,0x22,0x4b,0x00,0x2b,0x3c,0xd0,0xc8,0x20,0x40,0x00,0xaf,0xf3, 0x02,0x90,0x03,0x93,0x0f,0x1c,0x01,0x98,0xa4,0x21,0x49,0x00,0x42,0x58,0x90,0x46,
0x00,0x80,0x00,0x28,0x36,0xd0,0xa4,0x22,0x00,0x23,0x52,0x00,0xa1,0x58,0x43,0x60, 0x00,0x2a,0x4b,0xd0,0x03,0x98,0x81,0x46,0x41,0x46,0x4e,0x68,0x74,0x1e,0x42,0xd4,
0x01,0x60,0xa0,0x50,0x40,0x32,0x83,0x50,0x04,0x32,0x83,0x50,0x01,0x24,0x00,0x2d, 0x45,0x46,0xa3,0x00,0x88,0x35,0xed,0x18,0xc6,0x20,0xc4,0x23,0x01,0x36,0x5b,0x00,
0xdb,0xd0,0x9a,0x00,0x91,0x46,0x81,0x44,0x42,0x46,0x88,0x21,0x4f,0x46,0x7a,0x50, 0x40,0x00,0xb6,0x00,0x9b,0x46,0x82,0x46,0x46,0x44,0xc3,0x44,0xc2,0x44,0x08,0xe0,
0xc4,0x22,0x52,0x00,0x90,0x46,0x80,0x44,0x42,0x46,0x87,0x39,0x99,0x40,0x12,0x68, 0x2b,0x1c,0x80,0x33,0x1b,0x68,0xbb,0x42,0x05,0xd0,0x04,0x3d,0x04,0x3e,0x01,0x3c,
0x0a,0x43,0x94,0x46,0x8a,0x46,0x42,0x46,0x61,0x46,0x11,0x60,0x84,0x22,0x49,0x46, 0x29,0xd3,0x00,0x2f,0xf4,0xd1,0x41,0x46,0x4a,0x68,0x01,0x3a,0x33,0x68,0xa2,0x42,
0x5f,0x46,0x52,0x00,0x8f,0x50,0x02,0x2d,0xbf,0xd1,0x02,0x1c,0x55,0x46,0x8d,0x32, 0x30,0xd0,0x00,0x22,0x32,0x60,0x00,0x2b,0xef,0xd0,0x40,0x46,0x59,0x46,0x40,0x68,
0xff,0x32,0x11,0x68,0x0d,0x43,0x15,0x60,0xb7,0xe7,0x20,0x1c,0x4d,0x30,0xff,0x30, 0x01,0x22,0x09,0x68,0xa2,0x40,0x00,0x90,0x11,0x42,0x20,0xd0,0x50,0x46,0x00,0x68,
0xe0,0x50,0xac,0xe7,0x01,0x20,0x40,0x42,0xb4,0xe7,0xc0,0x46,0x0c,0x0f,0x00,0x20, 0x10,0x42,0x21,0xd1,0x02,0x98,0x29,0x68,0x00,0xf0,0x40,0xf8,0x41,0x46,0x49,0x68,
0x00,0x00,0x00,0x00,0x08,0xb5,0x04,0x4b,0x00,0x2b,0x02,0xd0,0x03,0x48,0xff,0xf7, 0x00,0x9a,0x91,0x42,0xb7,0xd1,0x4a,0x46,0x12,0x68,0x42,0x45,0xb3,0xd1,0x04,0x3d,
0x9b,0xfe,0x08,0xbc,0x01,0xbc,0x00,0x47,0x00,0x00,0x00,0x00,0x15,0x0b,0x00,0x20, 0x04,0x3e,0x01,0x3c,0xd5,0xd2,0x18,0x4a,0x00,0x2a,0x11,0xd1,0x05,0xb0,0x3c,0xbc,
0xf0,0xb5,0x56,0x46,0x5f,0x46,0x4d,0x46,0x44,0x46,0xf0,0xb4,0x0e,0x1c,0x3f,0x4b, 0x90,0x46,0x99,0x46,0xa2,0x46,0xab,0x46,0xf0,0xbc,0x01,0xbc,0x00,0x47,0x00,0xf0,
0x1b,0x68,0x87,0xb0,0x03,0x93,0x49,0x33,0xff,0x33,0x01,0x90,0x04,0x93,0xa4,0x22, 0x25,0xf8,0xe3,0xe7,0x4c,0x60,0xce,0xe7,0x28,0x68,0x00,0xf0,0x1f,0xf8,0xdd,0xe7,
0x03,0x9b,0x52,0x00,0x9f,0x58,0x00,0x2f,0x4d,0xd0,0x04,0x9b,0x98,0x46,0x00,0x23, 0x43,0x46,0x5b,0x68,0x40,0x46,0x00,0x2b,0x0d,0xd1,0x03,0x68,0x00,0x2b,0x0e,0xd0,
0x9b,0x46,0xc4,0x23,0x5b,0x00,0x9c,0x46,0xbc,0x44,0x63,0x46,0x02,0x93,0xc6,0x23, 0x49,0x46,0x0b,0x60,0xaf,0xf3,0x00,0x80,0x4b,0x46,0x1a,0x68,0x90,0x46,0x41,0x46,
0x5b,0x00,0x9a,0x46,0x7c,0x68,0xa5,0x00,0x7d,0x19,0xba,0x44,0x01,0x3c,0x08,0xd5, 0x00,0x29,0x91,0xd1,0xda,0xe7,0x03,0x68,0xc1,0x46,0x98,0x46,0xf7,0xe7,0x00,0x23,
0x27,0xe0,0x6b,0x1d,0xff,0x33,0x1b,0x68,0xb3,0x42,0x04,0xd0,0x04,0x3d,0x01,0x3c, 0xfa,0xe7,0xc0,0x46,0x04,0x0f,0x00,0x20,0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,
0x1f,0xd3,0x00,0x2e,0xf5,0xd1,0x7b,0x68,0x01,0x3b,0x6a,0x68,0xa3,0x42,0x3e,0xd0, 0x08,0xb5,0x01,0x1c,0x00,0x22,0x00,0x20,0x00,0x23,0x00,0xf0,0x1f,0xf8,0x08,0xbc,
0x5b,0x46,0x6b,0x60,0x00,0x2a,0xf1,0xd0,0x7b,0x68,0x99,0x46,0x01,0x23,0xa3,0x40, 0x02,0xbc,0x08,0x47,0x38,0xb5,0x0a,0x4b,0x0a,0x4d,0xed,0x1a,0xad,0x10,0x0a,0xd0,
0x02,0x99,0x09,0x68,0x05,0x91,0x19,0x42,0x26,0xd1,0x00,0xf0,0x43,0xf8,0x7b,0x68, 0x01,0x3d,0xac,0x00,0xe4,0x18,0x00,0xe0,0x01,0x3d,0x23,0x68,0x00,0xf0,0x0c,0xf8,
0x4b,0x45,0xc4,0xd1,0x43,0x46,0x1b,0x68,0xbb,0x42,0xc0,0xd1,0x04,0x3d,0x01,0x3c, 0x04,0x3c,0x00,0x2d,0xf8,0xd1,0x00,0xf0,0x71,0xf8,0x38,0xbc,0x01,0xbc,0x00,0x47,
0xdf,0xd2,0x1b,0x4b,0x00,0x2b,0x0e,0xd0,0x7b,0x68,0x00,0x2b,0x27,0xd1,0x3b,0x68, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x47,0xc0,0x46,0xf0,0xb5,0x4f,0x46,
0x00,0x2b,0x28,0xd0,0x42,0x46,0x38,0x1c,0x13,0x60,0xaf,0xf3,0x00,0x80,0x43,0x46, 0x46,0x46,0xc0,0xb4,0x98,0x46,0x2c,0x4b,0xa4,0x25,0x1b,0x68,0x6d,0x00,0x5c,0x59,
0x1f,0x68,0x00,0x2f,0xb5,0xd1,0x07,0xb0,0x3c,0xbc,0x90,0x46,0x99,0x46,0xa2,0x46, 0x83,0xb0,0x06,0x1c,0x0f,0x1c,0x91,0x46,0x01,0x93,0x00,0x2c,0x46,0xd0,0x65,0x68,
0xab,0x46,0xf0,0xbc,0x01,0xbc,0x00,0x47,0x51,0x46,0x09,0x68,0x19,0x42,0x08,0xd1, 0x1f,0x2d,0x1a,0xdd,0x25,0x4b,0x00,0x2b,0x02,0xd1,0x01,0x20,0x40,0x42,0x1c,0xe0,
0x2b,0x1c,0x84,0x33,0x19,0x68,0x01,0x98,0x00,0xf0,0x14,0xf8,0xcf,0xe7,0x7c,0x60, 0xc8,0x20,0x40,0x00,0xaf,0xf3,0x00,0x80,0x04,0x1e,0xf6,0xd0,0x00,0x25,0x45,0x60,
0xc0,0xe7,0x2b,0x1c,0x84,0x33,0x18,0x68,0x00,0xf0,0x0c,0xf8,0xc7,0xe7,0x3b,0x68, 0xa4,0x23,0x01,0x98,0x5b,0x00,0xc0,0x58,0x01,0x99,0x20,0x60,0xcc,0x50,0xc4,0x23,
0xb8,0x46,0x1f,0x1c,0xdd,0xe7,0x00,0x23,0xfa,0xe7,0xc0,0x46,0x0c,0x0f,0x00,0x20, 0x5b,0x00,0xe5,0x50,0xc6,0x23,0x5b,0x00,0xe5,0x50,0x00,0x2e,0x0c,0xd1,0x6b,0x1c,
0x00,0x00,0x00,0x00,0x10,0x47,0xc0,0x46,0xf8,0xb5,0xc0,0x46,0xf8,0xbc,0x08,0xbc, 0x02,0x35,0xad,0x00,0x63,0x60,0x2f,0x51,0x00,0x20,0x03,0xb0,0x0c,0xbc,0x90,0x46,
0x9e,0x46,0x70,0x47,0xf8,0xb5,0xc0,0x46,0xf8,0xbc,0x08,0xbc,0x9e,0x46,0x70,0x47, 0x99,0x46,0xf0,0xbc,0x02,0xbc,0x08,0x47,0xab,0x00,0xe3,0x18,0x88,0x22,0x48,0x46,
0x00,0x00,0x00,0x00,0x24,0xf2,0xff,0x7f,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x98,0x50,0xc4,0x20,0x40,0x00,0x22,0x18,0x10,0x68,0x01,0x21,0xa9,0x40,0x08,0x43,
0x8c,0x15,0x00,0x20,0xff,0xff,0xff,0xc5,0xff,0xff,0xff,0xff,0xc5,0xff,0xff,0xff, 0x10,0x60,0x84,0x22,0x52,0x00,0x40,0x46,0x98,0x50,0x02,0x2e,0xdf,0xd1,0xc6,0x22,
0xc5,0xc5,0xc5,0xff,0xc5,0xc5,0xc5,0xff,0x43,0x00,0x00,0x00,0x18,0x0f,0x00,0x20, 0x52,0x00,0xa3,0x18,0x18,0x68,0x01,0x43,0x19,0x60,0xd8,0xe7,0x1c,0x1c,0x4d,0x34,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x12,0x00,0x20, 0xff,0x34,0x5c,0x51,0xb3,0xe7,0xc0,0x46,0x04,0x0f,0x00,0x20,0x00,0x00,0x00,0x00,
0x6c,0x12,0x00,0x20,0xd4,0x12,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0xf8,0xb5,0xc0,0x46,0xf8,0xbc,0x08,0xbc,0x9e,0x46,0x70,0x47,0xf8,0xb5,0xc0,0x46,
0xf8,0xbc,0x08,0xbc,0x9e,0x46,0x70,0x47,0x00,0x00,0x00,0x00,0xc4,0xf1,0xff,0x7f,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x84,0x15,0x00,0x20,0xff,0xff,0xff,0xc5,
0xff,0xff,0xff,0xff,0xc5,0xff,0xff,0xff,0xc5,0xc5,0xc5,0xff,0xc5,0xc5,0xc5,0xff,
0x43,0x00,0x00,0x00,0x10,0x0f,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xfc,0x11,0x00,0x20,0x64,0x12,0x00,0x20,0xcc,0x12,0x00,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x0f,0x00,0x20,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x0f,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x33,0xcd,0xab,0x34,0x12,0x6d,0xe6, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0xec,0xde,0x05,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x0e,0x33,0xcd,0xab,0x34,0x12,0x6d,0xe6,0xec,0xde,0x05,0x00,0x0b,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -307,8 +306,9 @@
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x18,0x0f,0x00,0x20,0xc1,0x00,0x00,0x20,0x91,0x00,0x00,0x20,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x10,0x0f,0x00,0x20,0x61,0x00,0x00,0x20,
0x95,0x0d,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x35,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x6d,0x0c,0x00,0x20,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

View File

@ -42,7 +42,7 @@ typedef uint32_t (*flash_sector_erase_pntr_t) (uint32_t);
* *
******************************************************************************/ ******************************************************************************/
static void issue_fsm_command(flash_state_command_t command); static void issue_fsm_command(flash_state_command_t command);
static void enable_sectors_for_write(void); static void enable_sectors_for_write(uint32_t);
static uint32_t scale_cycle_values(uint32_t specified_timing, static uint32_t scale_cycle_values(uint32_t specified_timing,
uint32_t scale_value); uint32_t scale_value);
static void set_write_mode(void); static void set_write_mode(void);
@ -80,9 +80,14 @@ uint32_t flash_bank_erase(bool force_precondition)
uint32_t error_return; uint32_t error_return;
uint32_t sector_address; uint32_t sector_address;
uint32_t reg_val; uint32_t reg_val;
uint32_t bank_no;
uint32_t top_bank_start_addr = (HWREG(FLASH_BASE + FLASH_O_FCFG_B1_START) &
FLASH_FCFG_B1_START_B1_START_ADDR_M)
>> FLASH_FCFG_B1_START_B1_START_ADDR_S;
for (bank_no = 0; bank_no < flash_bank_count(); bank_no++) {
/* Enable all sectors for erase. */ /* Enable all sectors for erase. */
enable_sectors_for_write(); enable_sectors_for_write(bank_no);
/* Clear the Status register. */ /* Clear the Status register. */
issue_fsm_command(FAPI_CLEAR_STATUS); issue_fsm_command(FAPI_CLEAR_STATUS);
@ -97,6 +102,9 @@ uint32_t flash_bank_erase(bool force_precondition)
FLASH_FSM_ST_MACHINE_DO_PRECOND; FLASH_FSM_ST_MACHINE_DO_PRECOND;
HWREG(FLASH_BASE + FLASH_O_FSM_WR_ENA) = FSM_REG_WRT_DISABLE; HWREG(FLASH_BASE + FLASH_O_FSM_WR_ENA) = FSM_REG_WRT_DISABLE;
// Write address to FADDR register.
HWREG(FLASH_BASE + FLASH_O_FADDR) = ADDR_OFFSET + (bank_no * top_bank_start_addr);
/* Issue the bank erase command to the FSM. */ /* Issue the bank erase command to the FSM. */
issue_fsm_command(FAPI_ERASE_BANK); issue_fsm_command(FAPI_ERASE_BANK);
@ -107,9 +115,6 @@ uint32_t flash_bank_erase(bool force_precondition)
/* Update status. */ /* Update status. */
error_return = flash_check_fsm_for_error(); error_return = flash_check_fsm_for_error();
/* Disable sectors for erase. */
flash_disable_sectors_for_write();
/* Set configured precondition mode since it may have been forced on. */ /* Set configured precondition mode since it may have been forced on. */
if (!(reg_val & FLASH_FSM_ST_MACHINE_DO_PRECOND)) { if (!(reg_val & FLASH_FSM_ST_MACHINE_DO_PRECOND)) {
HWREG(FLASH_BASE + FLASH_O_FSM_WR_ENA) = FSM_REG_WRT_ENABLE; HWREG(FLASH_BASE + FLASH_O_FSM_WR_ENA) = FSM_REG_WRT_ENABLE;
@ -118,6 +123,10 @@ uint32_t flash_bank_erase(bool force_precondition)
HWREG(FLASH_BASE + FLASH_O_FSM_WR_ENA) = FSM_REG_WRT_DISABLE; HWREG(FLASH_BASE + FLASH_O_FSM_WR_ENA) = FSM_REG_WRT_DISABLE;
} }
if (error_return != FAPI_STATUS_SUCCESS)
break;
}
/* Program security data to default values in the customer configuration */ /* Program security data to default values in the customer configuration */
/* area within the flash top sector if erase was successful. */ /* area within the flash top sector if erase was successful. */
if (error_return == FAPI_STATUS_SUCCESS) { if (error_return == FAPI_STATUS_SUCCESS) {
@ -128,6 +137,9 @@ uint32_t flash_bank_erase(bool force_precondition)
CCFG_SIZE_SECURITY); CCFG_SIZE_SECURITY);
} }
/* Disable sectors for erase. */
flash_disable_sectors_for_write();
/* Return status of operation. */ /* Return status of operation. */
return error_return; return error_return;
} }
@ -161,9 +173,16 @@ uint32_t flash_program(uint8_t *data_buffer, uint32_t address, uint32_t count)
******************************************************************************/ ******************************************************************************/
void flash_disable_sectors_for_write(void) void flash_disable_sectors_for_write(void)
{ {
uint32_t bank_no;
/* Configure flash back to read mode */ /* Configure flash back to read mode */
set_read_mode(); set_read_mode();
for (bank_no = 0; bank_no < flash_bank_count(); bank_no++) {
/* Select flash bank. */
HWREG(FLASH_BASE + FLASH_O_FMAC) = bank_no;
/* Disable Level 1 Protection. */ /* Disable Level 1 Protection. */
HWREG(FLASH_BASE + FLASH_O_FBPROT) = FLASH_FBPROT_PROTL1DIS; HWREG(FLASH_BASE + FLASH_O_FBPROT) = FLASH_FBPROT_PROTL1DIS;
@ -180,6 +199,10 @@ void flash_disable_sectors_for_write(void)
HWREG(FLASH_BASE + FLASH_O_FSM_WR_ENA) = FSM_REG_WRT_DISABLE; HWREG(FLASH_BASE + FLASH_O_FSM_WR_ENA) = FSM_REG_WRT_DISABLE;
} }
// Select bank 0
HWREG(FLASH_BASE + FLASH_O_FMAC) = 0x0;
}
/****************************************************************************** /******************************************************************************
* *
* Issues a command to the Flash State Machine. * Issues a command to the Flash State Machine.
@ -214,7 +237,7 @@ static void issue_fsm_command(flash_state_command_t command)
* the FLASH_O_FSM_SECTOR1 register. * the FLASH_O_FSM_SECTOR1 register.
* *
******************************************************************************/ ******************************************************************************/
static void enable_sectors_for_write(void) static void enable_sectors_for_write(uint32_t bank_no)
{ {
/* Trim flash module for program/erase operation. */ /* Trim flash module for program/erase operation. */
trim_for_write(); trim_for_write();
@ -223,7 +246,7 @@ static void enable_sectors_for_write(void)
set_write_mode(); set_write_mode();
/* Select flash bank. */ /* Select flash bank. */
HWREG(FLASH_BASE + FLASH_O_FMAC) = 0x00; HWREG(FLASH_BASE + FLASH_O_FMAC) = bank_no;
/* Disable Level 1 Protection. */ /* Disable Level 1 Protection. */
HWREG(FLASH_BASE + FLASH_O_FBPROT) = FLASH_FBPROT_PROTL1DIS; HWREG(FLASH_BASE + FLASH_O_FBPROT) = FLASH_FBPROT_PROTL1DIS;

View File

@ -246,6 +246,46 @@ static inline uint32_t flash_check_fsm_for_ready(void)
return FAPI_STATUS_FSM_READY; return FAPI_STATUS_FSM_READY;
} }
/******************************************************************************
*
* Get the number of banks
*
* This function returns the number of bank of the flash.
*
* Returns the number of banks
*
******************************************************************************/
static inline uint32_t flash_bank_count(void)
{
uint32_t bank_count;
bank_count = (HWREG(FLASH_BASE + FLASH_O_FCFG_BANK) &
FLASH_FCFG_BANK_MAIN_NUM_BANK_M) >>
FLASH_FCFG_BANK_MAIN_NUM_BANK_S;
return bank_count;
}
/******************************************************************************
*
* Get the size of the bank.
*
* This function returns the size of the main bank in number of bytes.
*
* Returns the flash size in number of bytes.
*
******************************************************************************/
static inline uint8_t flash_bank_width(void)
{
uint8_t bank_width;
bank_width = (uint8_t)(((HWREG(FLASH_BASE + FLASH_O_FCFG_BANK) &
FLASH_FCFG_BANK_MAIN_BANK_WIDTH_M) >>
FLASH_FCFG_BANK_MAIN_BANK_WIDTH_S) >> 3);
return bank_width;
}
/****************************************************************************** /******************************************************************************
* *
* Erase a flash sector. * Erase a flash sector.

View File

@ -116,6 +116,10 @@
/* FMC Sequential Pump Information */ /* FMC Sequential Pump Information */
#define FLASH_O_FSEQPMP 0x000020A8 #define FLASH_O_FSEQPMP 0x000020A8
#define FLASH_O_FADDR 0x00002110
#define FLASH_O_FWPWRITE0 0x00002120
/* FMC FSM Command */ /* FMC FSM Command */
#define FLASH_O_FSM_CMD 0x0000220C #define FLASH_O_FSM_CMD 0x0000220C
@ -179,9 +183,14 @@
/* FMC FSM Sector Erased 2 */ /* FMC FSM Sector Erased 2 */
#define FLASH_O_FSM_SECTOR2 0x000022C4 #define FLASH_O_FSM_SECTOR2 0x000022C4
#define FLASH_O_FCFG_BANK 0x00002400
/* FMC Flash Bank 0 Starting Address */ /* FMC Flash Bank 0 Starting Address */
#define FLASH_O_FCFG_B0_START 0x00002410 #define FLASH_O_FCFG_B0_START 0x00002410
/* FMC Flash Bank 1 Starting Address */
#define FLASH_O_FCFG_B1_START 0x00002414
/* FMC Flash Bank 0 Sector Size 0 */ /* FMC Flash Bank 0 Sector Size 0 */
#define FLASH_O_FCFG_B0_SSIZE0 0x00002430 #define FLASH_O_FCFG_B0_SSIZE0 0x00002430
@ -1353,4 +1362,16 @@
* 1: DCDC and GLDO are bypassed and an external regulator supplies VDDR */ * 1: DCDC and GLDO are bypassed and an external regulator supplies VDDR */
#define AON_PMCTL_PWRCTL_EXT_REG_MODE 0x00000002 #define AON_PMCTL_PWRCTL_EXT_REG_MODE 0x00000002
/* Field: [3:0] MAIN_NUM_BANK */
#define FLASH_FCFG_BANK_MAIN_NUM_BANK_M 0x0000000F
#define FLASH_FCFG_BANK_MAIN_NUM_BANK_S 0
/* Field: [23:0] B1_START_ADDR */
#define FLASH_FCFG_B1_START_B1_START_ADDR_M 0x00FFFFFF
#define FLASH_FCFG_B1_START_B1_START_ADDR_S 0
/* Field: [15:4] MAIN_BANK_WIDTH */
#define FLASH_FCFG_BANK_MAIN_BANK_WIDTH_M 0x0000FFF0
#define FLASH_FCFG_BANK_MAIN_BANK_WIDTH_S 4
#endif /* #ifndef OPENOCD_LOADERS_FLASH_CC26XX_HW_REGS_H */ #endif /* #ifndef OPENOCD_LOADERS_FLASH_CC26XX_HW_REGS_H */

View File

@ -0,0 +1,35 @@
# SPDX-License-Identifier: GPL-2.0-or-later
TOOLCHAIN:=mipsel-linux-gnu-
CC:=$(TOOLCHAIN)gcc
OBJCOPY:=$(TOOLCHAIN)objcopy
CFLAGS:=-O2 -Wall -Wextra -fpic -Wno-int-to-pointer-cast
SRC=dw-spi.c
OBJ=$(patsubst %.c, %.o,$(SRC))
# sparx-iv
ifeq ($(TOOLCHAIN),mipsel-linux-gnu-)
CFLAGS+= -march=24kec
endif
all: \
$(TOOLCHAIN)transaction.inc \
$(TOOLCHAIN)erase.inc \
$(TOOLCHAIN)check_fill.inc \
$(TOOLCHAIN)program.inc \
$(TOOLCHAIN)read.inc
$(TOOLCHAIN)%.bin: $(OBJ)
$(OBJCOPY) --dump-section .$*=$@ $<
%.inc: %.bin
xxd -i > $@ < $<
.PHONY: clean
clean:
rm -rf .ccls-cache
find . \( \
-iname "*.o" \
-o -iname "*.bin" \
-o -iname "*.inc" \
\) -delete

View File

@ -0,0 +1,246 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/**
* @file
* Helper functions for DesignWare SPI Core driver.
* These helpers are loaded into CPU and execute Flash manipulation algorithms
* at full CPU speed. Due to inability to control nCS pin, this is the only way
* to communicate with Flash chips connected via DW SPI serial interface.
*
* In order to avoid using stack, all functions used in helpers are inlined.
* Software breakpoints are used to terminate helpers.
*
* Pushing byte to TX FIFO does not make byte immediately available in RX FIFO
* and nCS is only asserted when TX FIFO is not empty. General approach is to
* fill TX FIFO with as many bytes as possible, at the same time reading
* available bytes from RX FIFO.
*
* This file contains helper functions.
*/
#include "dw-spi.h"
#include "../../../../src/flash/nor/dw-spi-helper.h"
/**
* @brief Generic flash transaction.
*
* @param[in] arg: Function arguments.
*/
__attribute__((section(".transaction"))) void
transaction(struct dw_spi_transaction *arg)
{
register uint8_t *buffer_tx = (uint8_t *)arg->buffer;
register uint8_t *buffer_rx = buffer_tx;
register uint32_t size = arg->size;
register volatile uint8_t *status = (uint8_t *)arg->status_reg;
register volatile uint8_t *data = (uint8_t *)arg->data_reg;
wait_tx_finish(status);
flush_rx(status, data);
for (; size > 0; size--) {
send_u8(status, data, *buffer_tx++);
if (arg->read_flag && rx_available(status))
*buffer_rx++ = rcv_byte(data);
}
// Pushed all data to TX FIFO. Read bytes left in RX FIFO.
if (arg->read_flag) {
while (buffer_rx < buffer_tx) {
wait_rx_available(status);
*buffer_rx++ = rcv_byte(data);
}
}
RETURN;
}
/**
* @brief Check flash sectors are filled with pattern. Primary use for
* checking sector erase state.
*
* @param[in] arg: Function arguments.
*/
__attribute__((section(".check_fill"))) void
check_fill(struct dw_spi_check_fill *arg)
{
register uint32_t tx_size;
register uint32_t rx_size;
register uint32_t dummy_count;
register uint8_t filled;
register uint8_t *fill_status_array = (uint8_t *)arg->fill_status_array;
register volatile uint8_t *status = (uint8_t *)arg->status_reg;
register volatile uint8_t *data = (uint8_t *)arg->data_reg;
for (; arg->sector_count > 0; arg->sector_count--,
arg->address += arg->sector_size,
fill_status_array++) {
wait_tx_finish(status);
flush_rx(status, data);
/*
* Command byte and address bytes make up for dummy_count number of
* bytes, that must be skipped in RX FIFO before actual data arrives.
*/
send_u8(status, data, arg->read_cmd);
if (arg->four_byte_mode) {
dummy_count = 1 + 4; // Command byte + 4 address bytes
send_u32(status, data, arg->address);
} else {
dummy_count = 1 + 3; // Command byte + 3 address bytes
send_u24(status, data, arg->address);
}
for (tx_size = arg->sector_size, rx_size = arg->sector_size, filled = 1;
tx_size > 0; tx_size--) {
send_u8(status, data, 0); // Dummy write to push out read data.
if (rx_available(status)) {
if (dummy_count > 0) {
// Read data not arrived yet.
rcv_byte(data);
dummy_count--;
} else {
if (rcv_byte(data) != arg->pattern) {
filled = 0;
break;
}
rx_size--;
}
}
}
if (filled) {
for (; rx_size > 0; rx_size--) {
wait_rx_available(status);
if (rcv_byte(data) != arg->pattern) {
filled = 0;
break;
}
}
}
*fill_status_array = filled;
}
RETURN;
}
/**
* @brief Erase flash sectors.
*
* @param[in] arg: Function arguments.
*/
__attribute__((section(".erase"))) void
erase(struct dw_spi_erase *arg)
{
register uint32_t address = arg->address;
register uint32_t count = arg->sector_count;
register volatile uint8_t *status = (uint8_t *)arg->status_reg;
register volatile uint8_t *data = (uint8_t *)arg->data_reg;
for (; count > 0; count--, address += arg->sector_size) {
write_enable(status, data, arg->write_enable_cmd);
wait_write_enable(status, data, arg->read_status_cmd,
arg->write_enable_mask);
erase_sector(status, data, arg->erase_sector_cmd, address,
arg->four_byte_mode);
wait_busy(status, data, arg->read_status_cmd, arg->busy_mask);
}
RETURN;
}
/**
* @brief Flash program.
*
* @param[in] arg: Function arguments.
*/
__attribute__((section(".program"))) void
program(struct dw_spi_program *arg)
{
register uint8_t *buffer = (uint8_t *)arg->buffer;
register uint32_t buffer_size = arg->buffer_size;
register volatile uint8_t *status = (uint8_t *)arg->status_reg;
register volatile uint8_t *data = (uint8_t *)arg->data_reg;
register uint32_t page_size;
while (buffer_size > 0) {
write_enable(status, data, arg->write_enable_cmd);
wait_write_enable(status, data, arg->read_status_cmd,
arg->write_enable_mask);
wait_tx_finish(status);
send_u8(status, data, arg->program_cmd);
if (arg->four_byte_mode)
send_u32(status, data, arg->address);
else
send_u24(status, data, arg->address);
for (page_size = MIN(arg->page_size, buffer_size); page_size > 0;
page_size--, buffer_size--) {
send_u8(status, data, *buffer++);
}
arg->address += arg->page_size;
wait_busy(status, data, arg->read_status_cmd, arg->busy_mask);
}
RETURN;
}
/**
* @brief Read data from flash.
*
* @param[in] arg: Function arguments.
*/
__attribute__((section(".read"))) void
read(struct dw_spi_read *arg)
{
register uint32_t tx_size = arg->buffer_size;
register uint32_t rx_size = arg->buffer_size;
register uint32_t dummy_count;
register uint8_t *buffer = (uint8_t *)arg->buffer;
register volatile uint8_t *status = (uint8_t *)arg->status_reg;
register volatile uint8_t *data = (uint8_t *)arg->data_reg;
wait_tx_finish(status);
flush_rx(status, data);
/*
* Command byte and address bytes make up for dummy_count number of
* bytes, that must be skipped in RX FIFO before actual data arrives.
*/
send_u8(status, data, arg->read_cmd);
if (arg->four_byte_mode) {
dummy_count = 1 + 4; // Command byte + 4 address bytes
send_u32(status, data, arg->address);
} else {
dummy_count = 1 + 3; // Command byte + 3 address bytes
send_u24(status, data, arg->address);
}
for (; tx_size > 0; tx_size--) {
send_u8(status, data, 0); // Dummy write to push out read data.
if (rx_available(status)) {
if (dummy_count > 0) {
rcv_byte(data);
dummy_count--;
} else {
*buffer++ = rcv_byte(data);
rx_size--;
}
}
}
while (rx_size > 0) {
wait_rx_available(status);
if (dummy_count > 0) {
// Read data not arrived yet.
rcv_byte(data);
dummy_count--;
} else {
*buffer++ = rcv_byte(data);
rx_size--;
}
}
RETURN;
}

View File

@ -0,0 +1,313 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/**
* @file
* Helper functions for DesignWare SPI Core driver.
* These helpers are loaded into CPU and execute Flash manipulation algorithms
* at full CPU speed. Due to inability to control nCS pin, this is the only way
* to communicate with Flash chips connected via DW SPI serial interface.
*
* In order to avoid using stack, all functions used in helpers are inlined.
* Software breakpoints are used to terminate helpers.
*
* This file contains functions, common to helpers.
*/
#ifndef _DW_SPI_H_
#define _DW_SPI_H_
#include <stdint.h>
#include <sys/param.h>
#include "../../../../src/helper/types.h"
/**
* @brief SI busy status bit.
*
* Set when serial transfer is in progress, cleared when master is idle or
* disabled.
*/
#define DW_SPI_STATUS_BUSY 0x01
/**
* @brief SI TX FIFO not full status bit.
*
* Set when TX FIFO has room for one or more data-word.
*/
#define DW_SPI_STATUS_TFNF 0x02
/**
* @brief SI TX FIFO empty status bit.
*/
#define DW_SPI_STATUS_TFE 0x04
/**
* @brief SI RX FIFO not empty status bit.
*/
#define DW_SPI_STATUS_RFNE 0x08
/**
* @brief Return from helper function.
*/
#define RETURN \
do { \
asm("sdbbp\n\t"); \
return; \
} while (0)
/**
* @brief Append byte to TX FIFO.
*
* For each transferred byte, DW SPI controller receives a byte into RX FIFO.
* Slave data are read by pushing dummy bytes to TX FIFO.
*
* @param[in] dr: Pointer to DR register.
* @param[in] byte: Data to push.
*/
__attribute__((always_inline)) static inline void
_send_byte(volatile uint8_t *dr, uint8_t byte)
{
*dr = byte;
}
/**
* @brief Get byte from RX FIFO.
*
* Reading RX byte removes it from RX FIFO.
*
* @param[in] dr: Pointer to DR register.
* @return RX FIFO byte.
*/
__attribute__((always_inline)) static inline uint8_t
rcv_byte(volatile uint8_t *dr)
{
return *dr;
}
/**
* @brief Check transmission is currently in progress.
*
* @param[in] sr: Pointer to SR register.
* @retval 1: Transmission is in progress.
* @retval 0: Controller is idle or off.
*/
__attribute__((always_inline)) static inline int
tx_in_progress(volatile uint8_t *sr)
{
return (*sr ^ DW_SPI_STATUS_TFE) & (DW_SPI_STATUS_BUSY | DW_SPI_STATUS_TFE);
}
/**
* @brief Wait for controller to finish previous transaction.
*
* @param[in] sr: Pointer to SR register.
*/
__attribute__((always_inline)) static inline void
wait_tx_finish(volatile uint8_t *sr)
{
while (tx_in_progress(sr))
;
}
/**
* @brief Wait for room in TX FIFO.
*
* @param[in] sr: Pointer to SR register.
*/
__attribute__((always_inline)) static inline void
wait_tx_available(volatile uint8_t *sr)
{
while (!(*sr & DW_SPI_STATUS_TFNF))
;
}
/**
* @brief Check for data available in RX FIFO.
*
* @param[in] sr: Pointer to SR register.
* @retval 1: Data available.
* @retval 0: No data available.
*/
__attribute__((always_inline)) static inline int
rx_available(volatile uint8_t *sr)
{
return *sr & DW_SPI_STATUS_RFNE;
}
/**
* @brief Wait for data in RX FIFO.
*
* @param[in] sr: Pointer to SR register.
*/
__attribute__((always_inline)) static inline void
wait_rx_available(volatile uint8_t *sr)
{
while (!rx_available(sr))
;
}
/**
* @brief Flush RX FIFO.
*
* @param[in] sr: Pointer to SR register.
* @param[in] dr: Pointer to DR register.
*/
__attribute__((always_inline)) static inline void
flush_rx(volatile uint8_t *sr, volatile uint8_t *dr)
{
while (*sr & DW_SPI_STATUS_RFNE)
*dr;
}
/**
* @brief Append variable number of bytes to TX FIFO.
*
* @param[in] sr: Pointer to SR register.
* @param[in] dr: Pointer to DR register.
* @param[in] word: Data to append.
* @param[in] bytes: Number of bytes to append.
*/
__attribute__((always_inline)) static inline void
_send_bytes(volatile uint8_t *sr, volatile uint8_t *dr, uint32_t word,
int bytes)
{
for (register int i = bytes - 1; i >= 0; i--) {
wait_tx_available(sr);
_send_byte(dr, (word >> (i * 8)) & 0xff);
}
}
/**
* @brief Append 8 bit value to TX FIFO.
*
* @param[in] sr: Pointer to SR register.
* @param[in] dr: Pointer to DR register.
* @param[in] word: Data to push.
*/
__attribute__((always_inline)) static inline void
send_u8(volatile uint8_t *sr, volatile uint8_t *dr, uint8_t byte)
{
wait_tx_available(sr);
_send_byte(dr, byte);
}
/**
* @brief Append 24 bit value to TX FIFO.
*
* Used to send Flash addresses in 24 bit mode.
*
* @param[in] sr: Pointer to SR register.
* @param[in] dr: Pointer to DR register.
* @param[in] word: Data to push.
*/
__attribute__((always_inline)) static inline void
send_u24(volatile uint8_t *sr, volatile uint8_t *dr, uint32_t word)
{
_send_bytes(sr, dr, word, 3);
}
/**
* @brief Append 32 bit value to TX FIFO.
*
* @param[in] sr: Pointer to SR register.
* @param[in] dr: Pointer to DR register.
* @param[in] word: Data to push.
*/
__attribute__((always_inline)) static inline void
send_u32(volatile uint8_t *sr, volatile uint8_t *dr, uint32_t word)
{
_send_bytes(sr, dr, word, 4);
}
/**
* @brief Read chip status register.
*
* @param[in] sr: Pointer to SR register.
* @param[in] dr: Pointer to DR register.
* @param[in] stat_cmd: Read status command.
* @return Chip status.
*/
__attribute__((always_inline)) static inline uint8_t
read_status(volatile uint8_t *sr, volatile uint8_t *dr, uint8_t stat_cmd)
{
wait_tx_finish(sr);
flush_rx(sr, dr);
/*
* Don't bother with wait_tx_available() as TX FIFO is empty
* and we only send two bytes.
*/
_send_byte(dr, stat_cmd);
_send_byte(dr, 0); // Dummy write to push out read data.
wait_rx_available(sr);
rcv_byte(dr); // Dummy read to skip command byte.
wait_rx_available(sr);
return rcv_byte(dr);
}
/**
* @brief Enable Flash chip write.
*
* @param[in] sr: Pointer to SR register.
* @param[in] dr: Pointer to DR register.
* @param[in] we_cmd: Write enable command.
*/
__attribute__((always_inline)) static inline void
write_enable(volatile uint8_t *sr, volatile uint8_t *dr, uint8_t we_cmd)
{
wait_tx_finish(sr);
_send_byte(dr, we_cmd);
}
/**
* @brief Erase Flash sector.
*
* @param[in] sr: Pointer to SR register.
* @param[in] dr: Pointer to DR register.
* @param[in] erase_cmd: Erase sector cmd.
* @param[in] address: Sector address.
* @param[in] four_byte_mode: Device is in 32 bit mode flag.
*/
__attribute__((always_inline)) static inline void
erase_sector(volatile uint8_t *sr, volatile uint8_t *dr, uint8_t erase_cmd,
uint32_t address, uint8_t four_byte_mode)
{
wait_tx_finish(sr);
_send_byte(dr, erase_cmd);
if (four_byte_mode)
send_u32(sr, dr, address);
else
send_u24(sr, dr, address);
}
/**
* @brief Wait for write enable flag.
*
* @param[in] sr: Pointer to SR register.
* @param[in] dr: Pointer to DR register.
* @param[in] stat_cmd: Read status command.
* @param[in] we_mask: Write enable status mask.
*/
__attribute__((always_inline)) static inline void
wait_write_enable(volatile uint8_t *sr, volatile uint8_t *dr, uint8_t stat_cmd,
uint8_t we_mask)
{
while (!(read_status(sr, dr, stat_cmd) & we_mask))
;
}
/**
* @brief Wait while flash is busy.
*
* @param[in] sr: Pointer to SR register.
* @param[in] dr: Pointer to DR register.
* @param[in] stat_cmd: Read status command.
* @param[in] busy_mask: Flash busy mask.
*/
__attribute__((always_inline)) static inline void
wait_busy(volatile uint8_t *sr, volatile uint8_t *dr, uint8_t stat_cmd,
uint8_t busy_mask)
{
while (read_status(sr, dr, stat_cmd) & busy_mask)
;
}
#endif // _DW_SPI_H_

View File

@ -0,0 +1,39 @@
0x0b, 0x00, 0x82, 0x88, 0x1f, 0x00, 0x8a, 0x88, 0x0f, 0x00, 0x83, 0x88,
0x17, 0x00, 0x86, 0x88, 0x08, 0x00, 0x82, 0x98, 0x1c, 0x00, 0x8a, 0x98,
0x0c, 0x00, 0x83, 0x98, 0x14, 0x00, 0x86, 0x98, 0x25, 0x38, 0x80, 0x00,
0x54, 0x00, 0x40, 0x10, 0xf8, 0xff, 0x09, 0x24, 0x00, 0x00, 0x64, 0x90,
0x05, 0x00, 0x84, 0x30, 0x04, 0x00, 0x84, 0x38, 0xfc, 0xff, 0x80, 0x14,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x90, 0x08, 0x00, 0x42, 0x30,
0x07, 0x00, 0x40, 0x50, 0x25, 0x00, 0xe5, 0x90, 0x00, 0x00, 0xc2, 0x90,
0x00, 0x00, 0x62, 0x90, 0x08, 0x00, 0x42, 0x30, 0xfc, 0xff, 0x40, 0x14,
0x00, 0x00, 0x00, 0x00, 0x25, 0x00, 0xe5, 0x90, 0x00, 0x00, 0x62, 0x90,
0x02, 0x00, 0x42, 0x30, 0xfd, 0xff, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc5, 0xa0, 0x26, 0x00, 0xe2, 0x90, 0x45, 0x00, 0x40, 0x10,
0x03, 0x00, 0xe8, 0x88, 0x00, 0x00, 0xe8, 0x98, 0x18, 0x00, 0x05, 0x24,
0x00, 0x00, 0x62, 0x90, 0x02, 0x00, 0x42, 0x30, 0xfd, 0xff, 0x40, 0x10,
0x06, 0x10, 0xa8, 0x00, 0xff, 0x00, 0x42, 0x30, 0xf8, 0xff, 0xa5, 0x24,
0x00, 0x00, 0xc2, 0xa0, 0xf8, 0xff, 0xa9, 0x14, 0x05, 0x00, 0x0b, 0x24,
0x07, 0x00, 0xe8, 0x88, 0x04, 0x00, 0xe8, 0x98, 0x1e, 0x00, 0x00, 0x11,
0x25, 0x28, 0x00, 0x01, 0x00, 0x00, 0x62, 0x90, 0x02, 0x00, 0x42, 0x30,
0xfd, 0xff, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xa0,
0x00, 0x00, 0x62, 0x90, 0x08, 0x00, 0x42, 0x30, 0x06, 0x00, 0x40, 0x50,
0xff, 0xff, 0xa5, 0x24, 0x00, 0x00, 0xc2, 0x90, 0x25, 0x00, 0x60, 0x51,
0x24, 0x00, 0xec, 0x90, 0xff, 0xff, 0x6b, 0x25, 0xff, 0xff, 0xa5, 0x24,
0xf1, 0xff, 0xa0, 0x14, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x51,
0x01, 0x00, 0x04, 0x24, 0x24, 0x00, 0xe5, 0x90, 0x00, 0x00, 0x62, 0x90,
0x08, 0x00, 0x42, 0x30, 0xfd, 0xff, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xc2, 0x90, 0xff, 0x00, 0x42, 0x30, 0x04, 0x00, 0xa2, 0x14,
0xff, 0xff, 0x08, 0x25, 0xf7, 0xff, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x04, 0x24, 0x00, 0x00, 0x44, 0xa1, 0x0b, 0x00, 0xe2, 0x88,
0x01, 0x00, 0x4a, 0x25, 0x08, 0x00, 0xe2, 0x98, 0xff, 0xff, 0x42, 0x24,
0x0b, 0x00, 0xe2, 0xa8, 0x08, 0x00, 0xe2, 0xb8, 0x03, 0x00, 0xe4, 0x88,
0x07, 0x00, 0xe5, 0x88, 0x00, 0x00, 0xe4, 0x98, 0x04, 0x00, 0xe5, 0x98,
0x21, 0x20, 0x85, 0x00, 0x03, 0x00, 0xe4, 0xa8, 0xae, 0xff, 0x40, 0x14,
0x00, 0x00, 0xe4, 0xb8, 0x3f, 0x00, 0x00, 0x70, 0x08, 0x00, 0xe0, 0x03,
0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x42, 0x30, 0xed, 0xff, 0x82, 0x55,
0x00, 0x00, 0x44, 0xa1, 0xd9, 0xff, 0x00, 0x10, 0xff, 0xff, 0x08, 0x25,
0x00, 0x00, 0xe8, 0x98, 0x10, 0x00, 0x05, 0x24, 0x00, 0x00, 0x62, 0x90,
0x02, 0x00, 0x42, 0x30, 0xfd, 0xff, 0x40, 0x10, 0x06, 0x10, 0xa8, 0x00,
0xff, 0x00, 0x42, 0x30, 0xf8, 0xff, 0xa5, 0x24, 0x00, 0x00, 0xc2, 0xa0,
0xf8, 0xff, 0xa9, 0x14, 0x04, 0x00, 0x0b, 0x24, 0xbc, 0xff, 0x00, 0x10,
0x07, 0x00, 0xe8, 0x88

View File

@ -0,0 +1,39 @@
0x0b, 0x00, 0x88, 0x88, 0x25, 0x28, 0x80, 0x00, 0x03, 0x00, 0x86, 0x88,
0x0f, 0x00, 0x82, 0x88, 0x17, 0x00, 0x84, 0x88, 0x08, 0x00, 0xa8, 0x98,
0x00, 0x00, 0xa6, 0x98, 0x0c, 0x00, 0xa2, 0x98, 0x5f, 0x00, 0x00, 0x11,
0x14, 0x00, 0xa4, 0x98, 0xf8, 0xff, 0x07, 0x24, 0x1d, 0x00, 0xa9, 0x90,
0x00, 0x00, 0x43, 0x90, 0x05, 0x00, 0x63, 0x30, 0x04, 0x00, 0x63, 0x38,
0xfc, 0xff, 0x60, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0xa0,
0x1c, 0x00, 0xaa, 0x90, 0x1f, 0x00, 0xa9, 0x90, 0x00, 0x00, 0x43, 0x90,
0x05, 0x00, 0x63, 0x30, 0x04, 0x00, 0x63, 0x38, 0xfc, 0xff, 0x60, 0x14,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x90, 0x08, 0x00, 0x63, 0x30,
0x06, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x90,
0x00, 0x00, 0x43, 0x90, 0x08, 0x00, 0x63, 0x30, 0xfc, 0xff, 0x60, 0x14,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0xa0, 0x00, 0x00, 0x80, 0xa0,
0x00, 0x00, 0x43, 0x90, 0x08, 0x00, 0x63, 0x30, 0xfd, 0xff, 0x60, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x90, 0x00, 0x00, 0x43, 0x90,
0x08, 0x00, 0x63, 0x30, 0xfd, 0xff, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x83, 0x90, 0x24, 0x18, 0x23, 0x01, 0xe4, 0xff, 0x60, 0x10,
0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0xaa, 0x90, 0x21, 0x00, 0xa9, 0x90,
0x00, 0x00, 0x43, 0x90, 0x05, 0x00, 0x63, 0x30, 0x04, 0x00, 0x63, 0x38,
0xfc, 0xff, 0x60, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0xa0,
0x31, 0x00, 0x20, 0x11, 0x10, 0x00, 0x09, 0x24, 0x18, 0x00, 0x09, 0x24,
0x00, 0x00, 0x43, 0x90, 0x02, 0x00, 0x63, 0x30, 0xfd, 0xff, 0x60, 0x10,
0x06, 0x18, 0x26, 0x01, 0xff, 0x00, 0x63, 0x30, 0xf8, 0xff, 0x29, 0x25,
0xf9, 0xff, 0x27, 0x15, 0x00, 0x00, 0x83, 0xa0, 0x1c, 0x00, 0xaa, 0x90,
0x20, 0x00, 0xa9, 0x90, 0x00, 0x00, 0x43, 0x90, 0x05, 0x00, 0x63, 0x30,
0x04, 0x00, 0x63, 0x38, 0xfc, 0xff, 0x60, 0x14, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x43, 0x90, 0x08, 0x00, 0x63, 0x30, 0x06, 0x00, 0x60, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x90, 0x00, 0x00, 0x43, 0x90,
0x08, 0x00, 0x63, 0x30, 0xfc, 0xff, 0x60, 0x14, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x8a, 0xa0, 0x00, 0x00, 0x80, 0xa0, 0x00, 0x00, 0x43, 0x90,
0x08, 0x00, 0x63, 0x30, 0xfd, 0xff, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x83, 0x90, 0x00, 0x00, 0x43, 0x90, 0x08, 0x00, 0x63, 0x30,
0xfd, 0xff, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x90,
0x24, 0x18, 0x23, 0x01, 0xe4, 0xff, 0x60, 0x14, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0xa3, 0x88, 0xff, 0xff, 0x08, 0x25, 0x04, 0x00, 0xa3, 0x98,
0xa4, 0xff, 0x00, 0x15, 0x21, 0x30, 0xc3, 0x00, 0x3f, 0x00, 0x00, 0x70,
0x08, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x90,
0x02, 0x00, 0x63, 0x30, 0xfd, 0xff, 0x60, 0x10, 0x06, 0x18, 0x26, 0x01,
0xff, 0x00, 0x63, 0x30, 0xf8, 0xff, 0x29, 0x25, 0xf9, 0xff, 0x27, 0x15,
0x00, 0x00, 0x83, 0xa0, 0xd1, 0xff, 0x00, 0x10, 0x1c, 0x00, 0xaa, 0x90

View File

@ -0,0 +1,51 @@
0x13, 0x00, 0x88, 0x88, 0x25, 0x30, 0x80, 0x00, 0x0b, 0x00, 0x85, 0x88,
0x17, 0x00, 0x82, 0x88, 0x1f, 0x00, 0x84, 0x88, 0x10, 0x00, 0xc8, 0x98,
0x08, 0x00, 0xc5, 0x98, 0x14, 0x00, 0xc2, 0x98, 0x1c, 0x00, 0xc4, 0x98,
0x78, 0x00, 0x00, 0x11, 0xf8, 0xff, 0x07, 0x24, 0x25, 0x00, 0xc9, 0x90,
0x00, 0x00, 0x43, 0x90, 0x05, 0x00, 0x63, 0x30, 0x04, 0x00, 0x63, 0x38,
0xfc, 0xff, 0x60, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0xa0,
0x24, 0x00, 0xca, 0x90, 0x27, 0x00, 0xc9, 0x90, 0x00, 0x00, 0x43, 0x90,
0x05, 0x00, 0x63, 0x30, 0x04, 0x00, 0x63, 0x38, 0xfc, 0xff, 0x60, 0x14,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x90, 0x08, 0x00, 0x63, 0x30,
0x06, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x90,
0x00, 0x00, 0x43, 0x90, 0x08, 0x00, 0x63, 0x30, 0xfc, 0xff, 0x60, 0x14,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0xa0, 0x00, 0x00, 0x80, 0xa0,
0x00, 0x00, 0x43, 0x90, 0x08, 0x00, 0x63, 0x30, 0xfd, 0xff, 0x60, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x90, 0x00, 0x00, 0x43, 0x90,
0x08, 0x00, 0x63, 0x30, 0xfd, 0xff, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x83, 0x90, 0x24, 0x18, 0x23, 0x01, 0xe4, 0xff, 0x60, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x90, 0x05, 0x00, 0x63, 0x30,
0x04, 0x00, 0x63, 0x38, 0xfc, 0xff, 0x60, 0x14, 0x00, 0x00, 0x00, 0x00,
0x26, 0x00, 0xc9, 0x90, 0x00, 0x00, 0x43, 0x90, 0x02, 0x00, 0x63, 0x30,
0xfd, 0xff, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0xa0,
0x29, 0x00, 0xc3, 0x90, 0x47, 0x00, 0x60, 0x10, 0x03, 0x00, 0xca, 0x88,
0x00, 0x00, 0xca, 0x98, 0x18, 0x00, 0x09, 0x24, 0x00, 0x00, 0x43, 0x90,
0x02, 0x00, 0x63, 0x30, 0xfd, 0xff, 0x60, 0x10, 0x06, 0x18, 0x2a, 0x01,
0xff, 0x00, 0x63, 0x30, 0xf8, 0xff, 0x29, 0x25, 0x00, 0x00, 0x83, 0xa0,
0xf8, 0xff, 0x27, 0x15, 0x25, 0x58, 0x00, 0x01, 0x07, 0x00, 0xc3, 0x88,
0x04, 0x00, 0xc3, 0x98, 0x2b, 0x48, 0x03, 0x01, 0x0a, 0x58, 0x69, 0x00,
0x0d, 0x00, 0x60, 0x11, 0x21, 0x50, 0xab, 0x00, 0x00, 0x00, 0xa9, 0x90,
0x01, 0x00, 0xa5, 0x24, 0x00, 0x00, 0x43, 0x90, 0x02, 0x00, 0x63, 0x30,
0xfd, 0xff, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0xa0,
0xf9, 0xff, 0xaa, 0x54, 0x00, 0x00, 0xa9, 0x90, 0x07, 0x00, 0xc3, 0x88,
0x23, 0x40, 0x0b, 0x01, 0x04, 0x00, 0xc3, 0x98, 0x03, 0x00, 0xc9, 0x88,
0x00, 0x00, 0xc9, 0x98, 0x21, 0x18, 0x23, 0x01, 0x03, 0x00, 0xc3, 0xa8,
0x00, 0x00, 0xc3, 0xb8, 0x24, 0x00, 0xca, 0x90, 0x28, 0x00, 0xc9, 0x90,
0x00, 0x00, 0x43, 0x90, 0x05, 0x00, 0x63, 0x30, 0x04, 0x00, 0x63, 0x38,
0xfc, 0xff, 0x60, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x43, 0x90,
0x08, 0x00, 0x63, 0x30, 0x06, 0x00, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x83, 0x90, 0x00, 0x00, 0x43, 0x90, 0x08, 0x00, 0x63, 0x30,
0xfc, 0xff, 0x60, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8a, 0xa0,
0x00, 0x00, 0x80, 0xa0, 0x00, 0x00, 0x43, 0x90, 0x08, 0x00, 0x63, 0x30,
0xfd, 0xff, 0x60, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x90,
0x00, 0x00, 0x43, 0x90, 0x08, 0x00, 0x63, 0x30, 0xfd, 0xff, 0x60, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x90, 0x24, 0x18, 0x23, 0x01,
0xe4, 0xff, 0x60, 0x14, 0x00, 0x00, 0x00, 0x00, 0x8b, 0xff, 0x00, 0x55,
0x25, 0x00, 0xc9, 0x90, 0x3f, 0x00, 0x00, 0x70, 0x08, 0x00, 0xe0, 0x03,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xca, 0x98, 0x10, 0x00, 0x09, 0x24,
0x00, 0x00, 0x43, 0x90, 0x02, 0x00, 0x63, 0x30, 0xfd, 0xff, 0x60, 0x10,
0x06, 0x18, 0x2a, 0x01, 0xff, 0x00, 0x63, 0x30, 0xf8, 0xff, 0x29, 0x25,
0x00, 0x00, 0x83, 0xa0, 0xf8, 0xff, 0x27, 0x15, 0x25, 0x58, 0x00, 0x01,
0x07, 0x00, 0xc3, 0x88, 0x04, 0x00, 0xc3, 0x98, 0x2b, 0x48, 0x03, 0x01,
0x0a, 0x58, 0x69, 0x00, 0xbb, 0xff, 0x60, 0x15, 0x21, 0x50, 0xab, 0x00,
0xc6, 0xff, 0x00, 0x10, 0x03, 0x00, 0xc9, 0x88

View File

@ -0,0 +1,33 @@
0x0f, 0x00, 0x87, 0x88, 0x07, 0x00, 0x88, 0x88, 0x13, 0x00, 0x83, 0x88,
0x1b, 0x00, 0x85, 0x88, 0x0c, 0x00, 0x87, 0x98, 0x04, 0x00, 0x88, 0x98,
0x10, 0x00, 0x83, 0x98, 0x18, 0x00, 0x85, 0x98, 0x00, 0x00, 0x62, 0x90,
0x05, 0x00, 0x42, 0x30, 0x04, 0x00, 0x42, 0x38, 0xfc, 0xff, 0x40, 0x14,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x90, 0x08, 0x00, 0x42, 0x30,
0x07, 0x00, 0x40, 0x50, 0x20, 0x00, 0x86, 0x90, 0x00, 0x00, 0xa2, 0x90,
0x00, 0x00, 0x62, 0x90, 0x08, 0x00, 0x42, 0x30, 0xfc, 0xff, 0x40, 0x14,
0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x86, 0x90, 0x00, 0x00, 0x62, 0x90,
0x02, 0x00, 0x42, 0x30, 0xfd, 0xff, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xa6, 0xa0, 0x21, 0x00, 0x82, 0x90, 0x35, 0x00, 0x40, 0x10,
0x03, 0x00, 0x82, 0x88, 0x18, 0x00, 0x06, 0x24, 0xf8, 0xff, 0x09, 0x24,
0x00, 0x00, 0x82, 0x98, 0x25, 0x20, 0x40, 0x00, 0x00, 0x00, 0x62, 0x90,
0x02, 0x00, 0x42, 0x30, 0xfd, 0xff, 0x40, 0x10, 0x06, 0x10, 0xc4, 0x00,
0xff, 0x00, 0x42, 0x30, 0xf8, 0xff, 0xc6, 0x24, 0xf9, 0xff, 0xc9, 0x14,
0x00, 0x00, 0xa2, 0xa0, 0x05, 0x00, 0x06, 0x24, 0x23, 0x00, 0xe0, 0x10,
0x25, 0x20, 0xe0, 0x00, 0x00, 0x00, 0x62, 0x90, 0x02, 0x00, 0x42, 0x30,
0xfd, 0xff, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xa0,
0x00, 0x00, 0x62, 0x90, 0x08, 0x00, 0x42, 0x30, 0x06, 0x00, 0x40, 0x50,
0xff, 0xff, 0x84, 0x24, 0x00, 0x00, 0xa2, 0x90, 0x14, 0x00, 0xc0, 0x50,
0x00, 0x00, 0x02, 0xa1, 0xff, 0xff, 0xc6, 0x24, 0xff, 0xff, 0x84, 0x24,
0xf1, 0xff, 0x80, 0x14, 0x00, 0x00, 0x00, 0x00, 0x11, 0x00, 0xe0, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x90, 0x08, 0x00, 0x42, 0x30,
0xfd, 0xff, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x90,
0x03, 0x00, 0xc0, 0x50, 0xff, 0xff, 0xe7, 0x24, 0xf8, 0xff, 0x00, 0x10,
0xff, 0xff, 0xc6, 0x24, 0x06, 0x00, 0xe0, 0x10, 0x00, 0x00, 0x02, 0xa1,
0xf4, 0xff, 0x00, 0x10, 0x01, 0x00, 0x08, 0x25, 0xff, 0xff, 0xe7, 0x24,
0xec, 0xff, 0x00, 0x10, 0x01, 0x00, 0x08, 0x25, 0x3f, 0x00, 0x00, 0x70,
0x08, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x06, 0x24,
0xf8, 0xff, 0x09, 0x24, 0x00, 0x00, 0x82, 0x98, 0x25, 0x20, 0x40, 0x00,
0x00, 0x00, 0x62, 0x90, 0x02, 0x00, 0x42, 0x30, 0xfd, 0xff, 0x40, 0x10,
0x06, 0x10, 0xc4, 0x00, 0xff, 0x00, 0x42, 0x30, 0xf8, 0xff, 0xc6, 0x24,
0xf9, 0xff, 0xc9, 0x14, 0x00, 0x00, 0xa2, 0xa0, 0xcc, 0xff, 0x00, 0x10,
0x04, 0x00, 0x06, 0x24

View File

@ -0,0 +1,21 @@
0x03, 0x00, 0x85, 0x88, 0x0b, 0x00, 0x88, 0x88, 0x0f, 0x00, 0x83, 0x88,
0x17, 0x00, 0x86, 0x88, 0x00, 0x00, 0x85, 0x98, 0x08, 0x00, 0x88, 0x98,
0x0c, 0x00, 0x83, 0x98, 0x14, 0x00, 0x86, 0x98, 0x00, 0x00, 0x62, 0x90,
0x05, 0x00, 0x42, 0x30, 0x04, 0x00, 0x42, 0x38, 0xfc, 0xff, 0x40, 0x14,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x90, 0x08, 0x00, 0x42, 0x30,
0x06, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x90,
0x00, 0x00, 0x62, 0x90, 0x08, 0x00, 0x42, 0x30, 0xfc, 0xff, 0x40, 0x14,
0x00, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00,
0x25, 0x38, 0xa0, 0x00, 0x21, 0x40, 0x05, 0x01, 0x00, 0x00, 0xa9, 0x90,
0x01, 0x00, 0xa5, 0x24, 0x00, 0x00, 0x62, 0x90, 0x02, 0x00, 0x42, 0x30,
0xfd, 0xff, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc9, 0xa0,
0x1c, 0x00, 0x82, 0x90, 0x08, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x62, 0x90, 0x08, 0x00, 0x42, 0x30, 0x04, 0x00, 0x40, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x90, 0x01, 0x00, 0xe7, 0x24,
0xff, 0xff, 0xe2, 0xa0, 0xef, 0xff, 0xa8, 0x54, 0x00, 0x00, 0xa9, 0x90,
0x1c, 0x00, 0x82, 0x90, 0x0c, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00,
0x2b, 0x10, 0xe8, 0x00, 0x09, 0x00, 0x40, 0x10, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x62, 0x90, 0x08, 0x00, 0x42, 0x30, 0xfd, 0xff, 0x40, 0x10,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x90, 0x01, 0x00, 0xe7, 0x24,
0xf9, 0xff, 0x07, 0x15, 0xff, 0xff, 0xe2, 0xa0, 0x3f, 0x00, 0x00, 0x70,
0x08, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00

View File

@ -103,7 +103,7 @@ static void fespi_disable_hw_mode(volatile uint32_t *ctrl_base);
static void fespi_enable_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_wip(volatile uint32_t *ctrl_base);
static int fespi_write_buffer(volatile uint32_t *ctrl_base, static int fespi_write_buffer(volatile uint32_t *ctrl_base,
const uint8_t *buffer, unsigned offset, unsigned len, const uint8_t *buffer, unsigned int offset, unsigned int len,
uint32_t flash_info); uint32_t flash_info);
/* Can set bits 3:0 in result. */ /* Can set bits 3:0 in result. */
@ -113,7 +113,7 @@ static int fespi_write_buffer(volatile uint32_t *ctrl_base,
* after pprog_cmd * after pprog_cmd
*/ */
int flash_fespi(volatile uint32_t *ctrl_base, uint32_t page_size, int flash_fespi(volatile uint32_t *ctrl_base, uint32_t page_size,
const uint8_t *buffer, unsigned offset, uint32_t count, const uint8_t *buffer, unsigned int offset, uint32_t count,
uint32_t flash_info) uint32_t flash_info)
{ {
int result; int result;
@ -163,12 +163,12 @@ err:
return result; return result;
} }
static uint32_t fespi_read_reg(volatile uint32_t *ctrl_base, unsigned address) static uint32_t fespi_read_reg(volatile uint32_t *ctrl_base, unsigned int address)
{ {
return ctrl_base[address / 4]; return ctrl_base[address / 4];
} }
static void fespi_write_reg(volatile uint32_t *ctrl_base, unsigned address, uint32_t value) static void fespi_write_reg(volatile uint32_t *ctrl_base, unsigned int address, uint32_t value)
{ {
ctrl_base[address / 4] = value; ctrl_base[address / 4] = value;
} }
@ -188,7 +188,7 @@ static void fespi_enable_hw_mode(volatile uint32_t *ctrl_base)
/* Can set bits 7:4 in result. */ /* Can set bits 7:4 in result. */
static int fespi_txwm_wait(volatile uint32_t *ctrl_base) static int fespi_txwm_wait(volatile uint32_t *ctrl_base)
{ {
unsigned timeout = TIMEOUT; unsigned int timeout = TIMEOUT;
while (timeout--) { while (timeout--) {
uint32_t ip = fespi_read_reg(ctrl_base, FESPI_REG_IP); uint32_t ip = fespi_read_reg(ctrl_base, FESPI_REG_IP);
@ -209,7 +209,7 @@ static void fespi_set_dir(volatile uint32_t *ctrl_base, bool dir)
/* Can set bits 11:8 in result. */ /* Can set bits 11:8 in result. */
static int fespi_tx(volatile uint32_t *ctrl_base, uint8_t in) static int fespi_tx(volatile uint32_t *ctrl_base, uint8_t in)
{ {
unsigned timeout = TIMEOUT; unsigned int timeout = TIMEOUT;
while (timeout--) { while (timeout--) {
uint32_t txfifo = fespi_read_reg(ctrl_base, FESPI_REG_TXFIFO); uint32_t txfifo = fespi_read_reg(ctrl_base, FESPI_REG_TXFIFO);
@ -224,7 +224,7 @@ static int fespi_tx(volatile uint32_t *ctrl_base, uint8_t in)
/* Can set bits 15:12 in result. */ /* Can set bits 15:12 in result. */
static int fespi_rx(volatile uint32_t *ctrl_base, uint8_t *out) static int fespi_rx(volatile uint32_t *ctrl_base, uint8_t *out)
{ {
unsigned timeout = TIMEOUT; unsigned int timeout = TIMEOUT;
while (timeout--) { while (timeout--) {
uint32_t value = fespi_read_reg(ctrl_base, FESPI_REG_RXFIFO); uint32_t value = fespi_read_reg(ctrl_base, FESPI_REG_RXFIFO);
@ -252,7 +252,7 @@ static int fespi_wip(volatile uint32_t *ctrl_base)
if (result != ERROR_OK) if (result != ERROR_OK)
return result | ERROR_STACK(0x20000); return result | ERROR_STACK(0x20000);
unsigned timeout = TIMEOUT; unsigned int timeout = TIMEOUT;
while (timeout--) { while (timeout--) {
result = fespi_tx(ctrl_base, 0); result = fespi_tx(ctrl_base, 0);
if (result != ERROR_OK) if (result != ERROR_OK)
@ -273,7 +273,7 @@ static int fespi_wip(volatile uint32_t *ctrl_base)
/* Can set bits 23:20 in result. */ /* Can set bits 23:20 in result. */
static int fespi_write_buffer(volatile uint32_t *ctrl_base, static int fespi_write_buffer(volatile uint32_t *ctrl_base,
const uint8_t *buffer, unsigned offset, unsigned len, const uint8_t *buffer, unsigned int offset, unsigned int len,
uint32_t flash_info) uint32_t flash_info)
{ {
int result = fespi_tx(ctrl_base, SPIFLASH_WRITE_ENABLE); int result = fespi_tx(ctrl_base, SPIFLASH_WRITE_ENABLE);
@ -304,7 +304,7 @@ static int fespi_write_buffer(volatile uint32_t *ctrl_base,
if (result != ERROR_OK) if (result != ERROR_OK)
return result | ERROR_STACK(0x600000); return result | ERROR_STACK(0x600000);
for (unsigned i = 0; i < len; i++) { for (unsigned int i = 0; i < len; i++) {
result = fespi_tx(ctrl_base, buffer[i]); result = fespi_tx(ctrl_base, buffer[i]);
if (result != ERROR_OK) if (result != ERROR_OK)
return result | ERROR_STACK(0x700000); return result | ERROR_STACK(0x700000);

View File

@ -1,4 +1,13 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: Apache-2.0
/*
* The original version of this file did not reported any license nor
* copyright, but the author clearly stated that:
* "This file should be linked along with the [uC/OS-III user's] project
* to enable RTOS support for uC/OS-III."
* Such statement implies the willing to have this file's license compatible
* with the license Apache 2.0 of uC/OS-III.
*/
/* /*
* uC/OS-III does not provide a fixed layout for OS_TCB, which makes it * uC/OS-III does not provide a fixed layout for OS_TCB, which makes it

View File

@ -1,3 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-or-later
info_TEXINFOS += %D%/openocd.texi info_TEXINFOS += %D%/openocd.texi
%C%_openocd_TEXINFOS = %D%/fdl.texi %C%_openocd_TEXINFOS = %D%/fdl.texi

View File

@ -77,7 +77,12 @@ The read responses are encoded in ASCII as either digit 0 or 1.
If the use_remote_sleep option is set to 'yes', two additional requests may If the use_remote_sleep option is set to 'yes', two additional requests may
be sent: be sent:
D - Sleep for 1 millisecond Z - Sleep for 1 millisecond
d - Sleep for 1 microsecond z - Sleep for 1 microsecond
NOTE: Previously these were specified as 'D' and 'd', which conflicts with the
"SWD write 0 0" command defined above. Adapters that implement Dd for remote
sleep must be updated to work with Zz.
*/ */

View File

@ -97,6 +97,21 @@ OpenOCD project.
x = 0; x = 0;
} }
@endcode @endcode
- on <tt> if </tt> statements where the condition is split among multiple
lines, increase the indentation of the condition to prevent it to match
to the indentation of the <tt> then </tt> block due to length of 'if ('
being same of the TAB width of 4 characters. Use:
@code
if (CMD_ARGC < 3
|| CMD_ARGC > 8)
return ERROR_COMMAND_SYNTAX_ERROR;
@endcode
instead of:
@code
if (CMD_ARGC < 3 ||
CMD_ARGC > 8)
return ERROR_COMMAND_SYNTAX_ERROR;
@endcode
Finally, try to avoid lines of code that are longer than 72-80 columns: Finally, try to avoid lines of code that are longer than 72-80 columns:
@ -210,6 +225,21 @@ if (!buf) {
} }
@endcode @endcode
@section stylelogging Logging
Logging is intended to provide human-readable information to users.
Do not confuse logging with the output of commands.
The latter is intended for the result of a command and should be able to be processed by Tcl scripts.
- Use one of the following functions to generate log messages, never use `printf()` or similar functions.
- Use `LOG_ERROR()` to provide information in case an operation failed in an unrecoverable way. For example, if necessary memory cannot be allocated.
- Use `LOG_WARNING()` to inform the user of about an unexpected behavior that can be handled and the intended operation is still be performed. For example, in case a command is deprecated but is nevertheless executed.
- Use `LOG_INFO()` to provide insightful or necessary information to the user. For example, features or capabilities of a discovered target.
- Use `LOG_DEBUG()` to provide information for troubleshooting. For example, detailed information which makes it easier to debug a specific operation. Try to avoid flooding the log with frequently generated messages. For example, do not use LOG_DEBUG() in operations used for polling the target. Use LOG_DEBUG_IO() for such frequent messages.
- Use `LOG_DEBUG_IO()` to provide I/O related information for troubleshooting. For example, details about the communication between OpenOCD and a debug adapter.
- If the log message is related to a target, use the corresponding `LOG_TARGET_xxx()` functions.
- Do not use a period or exclamation mark at the end of a message.
*/ */
/** @page styledoxygen Doxygen Style Guide /** @page styledoxygen Doxygen Style Guide

View File

@ -1,24 +1,21 @@
.TH "OPENOCD" "1" "November 24, 2009" .TH "OPENOCD" "1" "June 18, 2024"
.SH "NAME" .SH "NAME"
openocd \- A free and open on\-chip debugging, in\-system programming and openocd \- A free and open on\-chip debugging, in\-system programming and
boundary\-scan testing tool for ARM and MIPS systems boundary\-scan testing tool for microcontrollers and other embedded devices
.SH "SYNOPSIS" .SH "SYNOPSIS"
.B openocd \fR[\fB\-fsdlcphv\fR] [\fB\-\-file\fR <filename>] [\fB\-\-search\fR <dirname>] [\fB\-\-debug\fR <debuglevel>] [\fB\-\-log_output\fR <filename>] [\fB\-\-command\fR <cmd>] [\fB\-\-pipe\fR] [\fB\-\-help\fR] [\fB\-\-version\fR] .B openocd \fR[\fB\-fsdlchv\fR] [\fB\-\-file\fR <filename>] [\fB\-\-search\fR <dirname>] [\fB\-\-debug\fR <debuglevel>] [\fB\-\-log_output\fR <filename>] [\fB\-\-command\fR <cmd>] [\fB\-\-help\fR] [\fB\-\-version\fR]
.SH "DESCRIPTION" .SH "DESCRIPTION"
.B OpenOCD .B OpenOCD
is an on\-chip debugging, in\-system programming and boundary\-scan is an on\-chip debugging, in\-system programming and boundary\-scan
testing tool for various ARM and MIPS systems. testing tool for various microcontrollers and other embedded devices.
.PP .PP
The debugger uses an IEEE 1149\-1 compliant JTAG TAP bus master to access Various different types of debug adapters as well as transport protocols like
on\-chip debug functionality available on ARM based microcontrollers or JTAG and SWD are supported by OpenOCD, please check the \fIopenocd\fR info page
system-on-chip solutions. For MIPS systems the EJTAG interface is supported. for the complete list.
.PP .PP
User interaction is realized through a telnet command line interface, User interaction is realized through a telnet command line interface,
a gdb (the GNU debugger) remote protocol server, and a simplified RPC a gdb (the GNU debugger) remote protocol server, and a simplified RPC
connection that can be used to interface with OpenOCD's Jim Tcl engine. connection that can be used to interface with OpenOCD's Jim Tcl engine.
.PP
OpenOCD supports various different types of JTAG interfaces/programmers,
please check the \fIopenocd\fR info page for the complete list.
.SH "OPTIONS" .SH "OPTIONS"
.TP .TP
.B "\-f, \-\-file <filename>" .B "\-f, \-\-file <filename>"
@ -68,8 +65,6 @@ Note that you will need to explicitly invoke
.I init .I init
if the command requires access to a target or flash. if the command requires access to a target or flash.
.TP .TP
.B "\-p, \-\-pipe"
Use pipes when talking to gdb.
.TP .TP
.B "\-h, \-\-help" .B "\-h, \-\-help"
Show a help text and exit. Show a help text and exit.
@ -82,8 +77,6 @@ Please report any bugs on the mailing list at
.SH "LICENCE" .SH "LICENCE"
.B OpenOCD .B OpenOCD
is covered by the GNU General Public License (GPL), version 2 or later. is covered by the GNU General Public License (GPL), version 2 or later.
.SH "SEE ALSO"
.BR jtag (1)
.PP .PP
The full documentation for The full documentation for
.B openocd .B openocd

File diff suppressed because it is too large Load Diff

2
jimtcl

@ -1 +1 @@
Subproject commit 1933e5457b9512d39ebbe11ed32578aada149f49 Subproject commit f160866171457474f7c4d6ccda70f9b77524407e

View File

@ -17,8 +17,12 @@ bin_PROGRAMS += %D%/openocd
if INTERNAL_JIMTCL if INTERNAL_JIMTCL
%C%_openocd_LDADD += $(top_builddir)/jimtcl/libjim.a %C%_openocd_LDADD += $(top_builddir)/jimtcl/libjim.a
else else
if HAVE_JIMTCL_PKG_CONFIG
%C%_openocd_LDADD += $(JIMTCL_LIBS)
else
%C%_openocd_LDADD += -ljim %C%_openocd_LDADD += -ljim
endif endif
endif
%C%_libopenocd_la_CPPFLAGS = %C%_libopenocd_la_CPPFLAGS =

View File

@ -11,14 +11,14 @@
#include "common.h" #include "common.h"
#include <helper/log.h> #include <helper/log.h>
unsigned get_flash_name_index(const char *name) unsigned int get_flash_name_index(const char *name)
{ {
const char *name_index = strrchr(name, '.'); const char *name_index = strrchr(name, '.');
if (!name_index) if (!name_index)
return 0; return 0;
if (name_index[1] < '0' || name_index[1] > '9') if (name_index[1] < '0' || name_index[1] > '9')
return ~0U; return ~0U;
unsigned requested; unsigned int requested;
int retval = parse_uint(name_index + 1, &requested); int retval = parse_uint(name_index + 1, &requested);
/* detect parsing error by forcing past end of bank list */ /* detect parsing error by forcing past end of bank list */
return (retval == ERROR_OK) ? requested : ~0U; return (retval == ERROR_OK) ? requested : ~0U;
@ -26,7 +26,7 @@ unsigned get_flash_name_index(const char *name)
bool flash_driver_name_matches(const char *name, const char *expected) bool flash_driver_name_matches(const char *name, const char *expected)
{ {
unsigned blen = strlen(name); unsigned int blen = strlen(name);
/* only match up to the length of the driver name... */ /* only match up to the length of the driver name... */
if (strncmp(name, expected, blen) != 0) if (strncmp(name, expected, blen) != 0)
return false; return false;

View File

@ -17,7 +17,7 @@
* name provides a suffix but it does not parse as an unsigned integer, * name provides a suffix but it does not parse as an unsigned integer,
* the routine returns ~0U. This will prevent further matching. * the routine returns ~0U. This will prevent further matching.
*/ */
unsigned get_flash_name_index(const char *name); unsigned int get_flash_name_index(const char *name);
/** /**
* Attempt to match the @c expected name with the @c name of a driver. * Attempt to match the @c expected name with the @c name of a driver.
* @param name The name of the driver (from the bank's device structure). * @param name The name of the driver (from the bank's device structure).

View File

@ -31,12 +31,12 @@
* @return Success or failure of the operation * @return Success or failure of the operation
*/ */
static int arm_code_to_working_area(struct target *target, static int arm_code_to_working_area(struct target *target,
const uint32_t *code, unsigned code_size, const uint32_t *code, unsigned int code_size,
unsigned additional, struct working_area **area) unsigned int additional, struct working_area **area)
{ {
uint8_t code_buf[code_size]; uint8_t code_buf[code_size];
int retval; int retval;
unsigned size = code_size + additional; unsigned int size = code_size + additional;
/* REVISIT this assumes size doesn't ever change. /* REVISIT this assumes size doesn't ever change.
* That's usually correct; but there are boards with * That's usually correct; but there are boards with

View File

@ -27,7 +27,7 @@ struct arm_nand_data {
struct working_area *copy_area; struct working_area *copy_area;
/** The chunk size is the page size or ECC chunk. */ /** The chunk size is the page size or ECC chunk. */
unsigned chunk_size; unsigned int chunk_size;
/** Where data is read from or written to. */ /** Where data is read from or written to. */
uint32_t data; uint32_t data;

View File

@ -389,9 +389,8 @@ static int at91sam9_read_page(struct nand_device *nand, uint32_t page,
uint32_t bit = parity & 0x0F; uint32_t bit = parity & 0x0F;
data[word] ^= (0x1) << bit; data[word] ^= (0x1) << bit;
LOG_INFO("Data word %d, bit %d corrected.", LOG_INFO("Data word %" PRIu32 ", bit %" PRIu32 " corrected.",
(unsigned) word, word, bit);
(unsigned) bit);
} }
} }
@ -533,7 +532,7 @@ COMMAND_HANDLER(handle_at91sam9_cle_command)
{ {
struct nand_device *nand = NULL; struct nand_device *nand = NULL;
struct at91sam9_nand *info = NULL; struct at91sam9_nand *info = NULL;
unsigned num, address_line; unsigned int num, address_line;
if (CMD_ARGC != 2) { if (CMD_ARGC != 2) {
command_print(CMD, "incorrect number of arguments for 'at91sam9 cle' command"); command_print(CMD, "incorrect number of arguments for 'at91sam9 cle' command");
@ -563,7 +562,7 @@ COMMAND_HANDLER(handle_at91sam9_ale_command)
{ {
struct nand_device *nand = NULL; struct nand_device *nand = NULL;
struct at91sam9_nand *info = NULL; struct at91sam9_nand *info = NULL;
unsigned num, address_line; unsigned int num, address_line;
if (CMD_ARGC != 2) if (CMD_ARGC != 2)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
@ -591,7 +590,7 @@ COMMAND_HANDLER(handle_at91sam9_rdy_busy_command)
{ {
struct nand_device *nand = NULL; struct nand_device *nand = NULL;
struct at91sam9_nand *info = NULL; struct at91sam9_nand *info = NULL;
unsigned num, base_pioc, pin_num; unsigned int num, base_pioc, pin_num;
if (CMD_ARGC != 3) if (CMD_ARGC != 3)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
@ -622,7 +621,7 @@ COMMAND_HANDLER(handle_at91sam9_ce_command)
{ {
struct nand_device *nand = NULL; struct nand_device *nand = NULL;
struct at91sam9_nand *info = NULL; struct at91sam9_nand *info = NULL;
unsigned num, base_pioc, pin_num; unsigned int num, base_pioc, pin_num;
if (CMD_ARGC != 3) if (CMD_ARGC != 3)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;

View File

@ -165,8 +165,8 @@ static struct nand_ecclayout nand_oob_8 = {
*/ */
static struct nand_device *get_nand_device_by_name(const char *name) static struct nand_device *get_nand_device_by_name(const char *name)
{ {
unsigned requested = get_flash_name_index(name); unsigned int requested = get_flash_name_index(name);
unsigned found = 0; unsigned int found = 0;
struct nand_device *nand; struct nand_device *nand;
for (nand = nand_devices; nand; nand = nand->next) { for (nand = nand_devices; nand; nand = nand->next) {
@ -194,7 +194,7 @@ struct nand_device *get_nand_device_by_num(int num)
return NULL; return NULL;
} }
COMMAND_HELPER(nand_command_get_device, unsigned name_index, COMMAND_HELPER(nand_command_get_device, unsigned int name_index,
struct nand_device **nand) struct nand_device **nand)
{ {
const char *str = CMD_ARGV[name_index]; const char *str = CMD_ARGV[name_index];
@ -202,7 +202,7 @@ COMMAND_HELPER(nand_command_get_device, unsigned name_index,
if (*nand) if (*nand)
return ERROR_OK; return ERROR_OK;
unsigned num; unsigned int num;
COMMAND_PARSE_NUMBER(uint, str, num); COMMAND_PARSE_NUMBER(uint, str, num);
*nand = get_nand_device_by_num(num); *nand = get_nand_device_by_num(num);
if (!*nand) { if (!*nand) {

View File

@ -209,7 +209,7 @@ int nand_correct_data(struct nand_device *nand, u_char *dat,
int nand_register_commands(struct command_context *cmd_ctx); int nand_register_commands(struct command_context *cmd_ctx);
/** helper for parsing a nand device command argument string */ /** helper for parsing a nand device command argument string */
COMMAND_HELPER(nand_command_get_device, unsigned name_index, COMMAND_HELPER(nand_command_get_device, unsigned int name_index,
struct nand_device **nand); struct nand_device **nand);

View File

@ -379,7 +379,7 @@ static int davinci_writepage_tail(struct nand_device *nand,
static int davinci_write_page_ecc1(struct nand_device *nand, uint32_t page, static int davinci_write_page_ecc1(struct nand_device *nand, uint32_t page,
uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size) uint8_t *data, uint32_t data_size, uint8_t *oob, uint32_t oob_size)
{ {
unsigned oob_offset; unsigned int oob_offset;
struct davinci_nand *info = nand->controller_priv; struct davinci_nand *info = nand->controller_priv;
struct target *target = nand->target; struct target *target = nand->target;
const uint32_t fcr_addr = info->aemif + NANDFCR; const uint32_t fcr_addr = info->aemif + NANDFCR;

View File

@ -33,7 +33,7 @@ static struct nand_flash_controller *nand_flash_controllers[] = {
struct nand_flash_controller *nand_driver_find_by_name(const char *name) struct nand_flash_controller *nand_driver_find_by_name(const char *name)
{ {
for (unsigned i = 0; nand_flash_controllers[i]; i++) { for (unsigned int i = 0; nand_flash_controllers[i]; i++) {
struct nand_flash_controller *controller = nand_flash_controllers[i]; struct nand_flash_controller *controller = nand_flash_controllers[i];
if (strcmp(name, controller->name) == 0) if (strcmp(name, controller->name) == 0)
return controller; return controller;
@ -42,7 +42,7 @@ struct nand_flash_controller *nand_driver_find_by_name(const char *name)
} }
int nand_driver_walk(nand_driver_walker_t f, void *x) int nand_driver_walk(nand_driver_walker_t f, void *x)
{ {
for (unsigned i = 0; nand_flash_controllers[i]; i++) { for (unsigned int i = 0; nand_flash_controllers[i]; i++) {
int retval = (*f)(nand_flash_controllers[i], x); int retval = (*f)(nand_flash_controllers[i], x);
if (retval != ERROR_OK) if (retval != ERROR_OK)
return retval; return retval;

View File

@ -107,7 +107,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
{ {
nand_fileio_init(state); nand_fileio_init(state);
unsigned minargs = need_size ? 4 : 3; unsigned int minargs = need_size ? 4 : 3;
if (minargs > CMD_ARGC) if (minargs > CMD_ARGC)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
@ -131,7 +131,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
} }
if (minargs < CMD_ARGC) { if (minargs < CMD_ARGC) {
for (unsigned i = minargs; i < CMD_ARGC; i++) { for (unsigned int i = minargs; i < CMD_ARGC; i++) {
if (!strcmp(CMD_ARGV[i], "oob_raw")) if (!strcmp(CMD_ARGV[i], "oob_raw"))
state->oob_format |= NAND_OOB_RAW; state->oob_format |= NAND_OOB_RAW;
else if (!strcmp(CMD_ARGV[i], "oob_only")) else if (!strcmp(CMD_ARGV[i], "oob_only"))

View File

@ -890,8 +890,7 @@ static int lpc3180_read_page(struct nand_device *nand,
if (mlc_isr & 0x8) { if (mlc_isr & 0x8) {
if (mlc_isr & 0x40) { if (mlc_isr & 0x40) {
LOG_ERROR("uncorrectable error detected: 0x%2.2x", LOG_ERROR("uncorrectable error detected: 0x%2.2" PRIx32, mlc_isr);
(unsigned)mlc_isr);
free(page_buffer); free(page_buffer);
free(oob_buffer); free(oob_buffer);
return ERROR_NAND_OPERATION_FAILED; return ERROR_NAND_OPERATION_FAILED;
@ -1275,7 +1274,7 @@ COMMAND_HANDLER(handle_lpc3180_select_command)
if ((CMD_ARGC < 1) || (CMD_ARGC > 3)) if ((CMD_ARGC < 1) || (CMD_ARGC > 3))
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
unsigned num; unsigned int num;
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
struct nand_device *nand = get_nand_device_by_num(num); struct nand_device *nand = get_nand_device_by_num(num);
if (!nand) { if (!nand) {

View File

@ -1386,8 +1386,7 @@ static int lpc32xx_read_page_mlc(struct nand_device *nand, uint32_t page,
if (mlc_isr & 0x8) { if (mlc_isr & 0x8) {
if (mlc_isr & 0x40) { if (mlc_isr & 0x40) {
LOG_ERROR("uncorrectable error detected: " LOG_ERROR("uncorrectable error detected: 0x%2.2" PRIx32, mlc_isr);
"0x%2.2x", (unsigned)mlc_isr);
return ERROR_NAND_OPERATION_FAILED; return ERROR_NAND_OPERATION_FAILED;
} }
@ -1743,7 +1742,7 @@ COMMAND_HANDLER(handle_lpc32xx_select_command)
if ((CMD_ARGC < 1) || (CMD_ARGC > 3)) if ((CMD_ARGC < 1) || (CMD_ARGC > 3))
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
unsigned num; unsigned int num;
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
struct nand_device *nand = get_nand_device_by_num(num); struct nand_device *nand = get_nand_device_by_num(num);
if (!nand) { if (!nand) {

View File

@ -86,10 +86,10 @@ enum mx_nf_finalize_action {
}; };
struct mx3_nf_flags { struct mx3_nf_flags {
unsigned target_little_endian:1; unsigned int target_little_endian:1;
unsigned nand_readonly:1; unsigned int nand_readonly:1;
unsigned one_kb_sram:1; unsigned int one_kb_sram:1;
unsigned hw_ecc_enabled:1; unsigned int hw_ecc_enabled:1;
}; };
struct mx3_nf_controller { struct mx3_nf_controller {

View File

@ -138,11 +138,11 @@ enum mxc_nf_finalize_action {
}; };
struct mxc_nf_flags { struct mxc_nf_flags {
unsigned target_little_endian:1; unsigned int target_little_endian:1;
unsigned nand_readonly:1; unsigned int nand_readonly:1;
unsigned one_kb_sram:1; unsigned int one_kb_sram:1;
unsigned hw_ecc_enabled:1; unsigned int hw_ecc_enabled:1;
unsigned biswap_enabled:1; unsigned int biswap_enabled:1;
}; };
struct mxc_nf_controller { struct mxc_nf_controller {

View File

@ -26,8 +26,10 @@ NOR_DRIVERS = \
%D%/cc26xx.c \ %D%/cc26xx.c \
%D%/cfi.c \ %D%/cfi.c \
%D%/dsp5680xx_flash.c \ %D%/dsp5680xx_flash.c \
%D%/dw-spi.c \
%D%/efm32.c \ %D%/efm32.c \
%D%/em357.c \ %D%/em357.c \
%D%/eneispif.c \
%D%/esirisc_flash.c \ %D%/esirisc_flash.c \
%D%/faux.c \ %D%/faux.c \
%D%/fespi.c \ %D%/fespi.c \
@ -88,6 +90,7 @@ NORHEADERS = \
%D%/cc26xx.h \ %D%/cc26xx.h \
%D%/cfi.h \ %D%/cfi.h \
%D%/driver.h \ %D%/driver.h \
%D%/dw-spi-helper.h \
%D%/imp.h \ %D%/imp.h \
%D%/non_cfi.h \ %D%/non_cfi.h \
%D%/ocl.h \ %D%/ocl.h \

View File

@ -79,7 +79,7 @@ static int aducm360_build_sector_list(struct flash_bank *bank)
/* sector size is 512 */ /* sector size is 512 */
bank->num_sectors = bank->size / FLASH_SECTOR_SIZE; bank->num_sectors = bank->size / FLASH_SECTOR_SIZE;
bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors); bank->sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors);
for (unsigned i = 0; i < bank->num_sectors; ++i) { for (unsigned int i = 0; i < bank->num_sectors; ++i) {
bank->sectors[i].offset = offset; bank->sectors[i].offset = offset;
bank->sectors[i].size = FLASH_SECTOR_SIZE; bank->sectors[i].size = FLASH_SECTOR_SIZE;
offset += bank->sectors[i].size; offset += bank->sectors[i].size;

View File

@ -124,7 +124,7 @@ FLASH_BANK_COMMAND_HANDLER(ambiqmicro_flash_bank_command)
if (CMD_ARGC < 6) if (CMD_ARGC < 6)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
ambiqmicro_info = calloc(sizeof(struct ambiqmicro_flash_bank), 1); ambiqmicro_info = calloc(1, sizeof(struct ambiqmicro_flash_bank));
bank->driver_priv = ambiqmicro_info; bank->driver_priv = ambiqmicro_info;

View File

@ -154,15 +154,15 @@ struct sam3_bank_private {
struct sam3_chip *chip; struct sam3_chip *chip;
/* so we can find the original bank pointer */ /* so we can find the original bank pointer */
struct flash_bank *bank; struct flash_bank *bank;
unsigned bank_number; unsigned int bank_number;
uint32_t controller_address; uint32_t controller_address;
uint32_t base_address; uint32_t base_address;
uint32_t flash_wait_states; uint32_t flash_wait_states;
bool present; bool present;
unsigned size_bytes; unsigned int size_bytes;
unsigned nsectors; unsigned int nsectors;
unsigned sector_size; unsigned int sector_size;
unsigned page_size; unsigned int page_size;
}; };
struct sam3_chip_details { struct sam3_chip_details {
@ -176,12 +176,12 @@ struct sam3_chip_details {
uint32_t chipid_cidr; uint32_t chipid_cidr;
const char *name; const char *name;
unsigned n_gpnvms; unsigned int n_gpnvms;
#define SAM3_N_NVM_BITS 3 #define SAM3_N_NVM_BITS 3
unsigned gpnvm[SAM3_N_NVM_BITS]; unsigned int gpnvm[SAM3_N_NVM_BITS];
unsigned total_flash_size; unsigned int total_flash_size;
unsigned total_sram_size; unsigned int total_sram_size;
unsigned n_banks; unsigned int n_banks;
#define SAM3_MAX_FLASH_BANKS 2 #define SAM3_MAX_FLASH_BANKS 2
/* these are "initialized" from the global const data */ /* these are "initialized" from the global const data */
struct sam3_bank_private bank[SAM3_MAX_FLASH_BANKS]; struct sam3_bank_private bank[SAM3_MAX_FLASH_BANKS];
@ -2029,7 +2029,7 @@ static int efc_get_result(struct sam3_bank_private *private, uint32_t *v)
} }
static int efc_start_command(struct sam3_bank_private *private, static int efc_start_command(struct sam3_bank_private *private,
unsigned command, unsigned argument) unsigned int command, unsigned int argument)
{ {
uint32_t n, v; uint32_t n, v;
int r; int r;
@ -2051,7 +2051,7 @@ do_retry:
case AT91C_EFC_FCMD_CLB: case AT91C_EFC_FCMD_CLB:
n = (private->size_bytes / private->page_size); n = (private->size_bytes / private->page_size);
if (argument >= n) if (argument >= n)
LOG_ERROR("*BUG*: Embedded flash has only %u pages", (unsigned)(n)); LOG_ERROR("*BUG*: Embedded flash has only %" PRIu32 " pages", n);
break; break;
case AT91C_EFC_FCMD_SFB: case AT91C_EFC_FCMD_SFB:
@ -2124,8 +2124,8 @@ do_retry:
* @param status - put command status bits here * @param status - put command status bits here
*/ */
static int efc_perform_command(struct sam3_bank_private *private, static int efc_perform_command(struct sam3_bank_private *private,
unsigned command, unsigned int command,
unsigned argument, unsigned int argument,
uint32_t *status) uint32_t *status)
{ {
@ -2220,7 +2220,7 @@ static int flashd_erase_entire_bank(struct sam3_bank_private *private)
* @param puthere - result stored here. * @param puthere - result stored here.
*/ */
/* ------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------ */
static int flashd_get_gpnvm(struct sam3_bank_private *private, unsigned gpnvm, unsigned *puthere) static int flashd_get_gpnvm(struct sam3_bank_private *private, unsigned int gpnvm, unsigned int *puthere)
{ {
uint32_t v; uint32_t v;
int r; int r;
@ -2261,10 +2261,10 @@ static int flashd_get_gpnvm(struct sam3_bank_private *private, unsigned gpnvm, u
* @param gpnvm GPNVM index. * @param gpnvm GPNVM index.
* @returns 0 if successful; otherwise returns an error code. * @returns 0 if successful; otherwise returns an error code.
*/ */
static int flashd_clr_gpnvm(struct sam3_bank_private *private, unsigned gpnvm) static int flashd_clr_gpnvm(struct sam3_bank_private *private, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
LOG_DEBUG("Here"); LOG_DEBUG("Here");
if (private->bank_number != 0) { if (private->bank_number != 0) {
@ -2293,10 +2293,10 @@ static int flashd_clr_gpnvm(struct sam3_bank_private *private, unsigned gpnvm)
* @param private info about the bank * @param private info about the bank
* @param gpnvm GPNVM index. * @param gpnvm GPNVM index.
*/ */
static int flashd_set_gpnvm(struct sam3_bank_private *private, unsigned gpnvm) static int flashd_set_gpnvm(struct sam3_bank_private *private, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
if (private->bank_number != 0) { if (private->bank_number != 0) {
LOG_ERROR("GPNVM only works with Bank0"); LOG_ERROR("GPNVM only works with Bank0");
@ -2346,8 +2346,8 @@ static int flashd_get_lock_bits(struct sam3_bank_private *private, uint32_t *v)
*/ */
static int flashd_unlock(struct sam3_bank_private *private, static int flashd_unlock(struct sam3_bank_private *private,
unsigned start_sector, unsigned int start_sector,
unsigned end_sector) unsigned int end_sector)
{ {
int r; int r;
uint32_t status; uint32_t status;
@ -2376,8 +2376,8 @@ static int flashd_unlock(struct sam3_bank_private *private,
* @param end_sector - last sector (inclusive) to lock * @param end_sector - last sector (inclusive) to lock
*/ */
static int flashd_lock(struct sam3_bank_private *private, static int flashd_lock(struct sam3_bank_private *private,
unsigned start_sector, unsigned int start_sector,
unsigned end_sector) unsigned int end_sector)
{ {
uint32_t status; uint32_t status;
uint32_t pg; uint32_t pg;
@ -2405,8 +2405,8 @@ static int flashd_lock(struct sam3_bank_private *private,
static uint32_t sam3_reg_fieldname(struct sam3_chip *chip, static uint32_t sam3_reg_fieldname(struct sam3_chip *chip,
const char *regname, const char *regname,
uint32_t value, uint32_t value,
unsigned shift, unsigned int shift,
unsigned width) unsigned int width)
{ {
uint32_t v; uint32_t v;
int hwidth, dwidth; int hwidth, dwidth;
@ -2491,7 +2491,7 @@ static const char *const sramsize[] = {
}; };
static const struct archnames { unsigned value; const char *name; } archnames[] = { static const struct archnames { unsigned int value; const char *name; } archnames[] = {
{ 0x19, "AT91SAM9xx Series" }, { 0x19, "AT91SAM9xx Series" },
{ 0x29, "AT91SAM9XExx Series" }, { 0x29, "AT91SAM9XExx Series" },
{ 0x34, "AT91x34 Series" }, { 0x34, "AT91x34 Series" },
@ -2867,8 +2867,8 @@ static int sam3_read_this_reg(struct sam3_chip *chip, uint32_t *goes_here)
r = target_read_u32(chip->target, reg->address, goes_here); r = target_read_u32(chip->target, reg->address, goes_here);
if (r != ERROR_OK) { if (r != ERROR_OK) {
LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08x, Err: %d", LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08" PRIx32 ", Err: %d",
reg->name, (unsigned)(reg->address), r); reg->name, reg->address, r);
} }
return r; return r;
} }
@ -2883,8 +2883,8 @@ static int sam3_read_all_regs(struct sam3_chip *chip)
r = sam3_read_this_reg(chip, r = sam3_read_this_reg(chip,
sam3_get_reg_ptr(&(chip->cfg), reg)); sam3_get_reg_ptr(&(chip->cfg), reg));
if (r != ERROR_OK) { if (r != ERROR_OK) {
LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08x, Error: %d", LOG_ERROR("Cannot read SAM3 register: %s @ 0x%08" PRIx32 ", Error: %d",
reg->name, ((unsigned)(reg->address)), r); reg->name, reg->address, r);
return r; return r;
} }
reg++; reg++;
@ -2951,7 +2951,7 @@ static int sam3_protect_check(struct flash_bank *bank)
{ {
int r; int r;
uint32_t v = 0; uint32_t v = 0;
unsigned x; unsigned int x;
struct sam3_bank_private *private; struct sam3_bank_private *private;
LOG_DEBUG("Begin"); LOG_DEBUG("Begin");
@ -3071,7 +3071,7 @@ static int sam3_get_details(struct sam3_bank_private *private)
const struct sam3_chip_details *details; const struct sam3_chip_details *details;
struct sam3_chip *chip; struct sam3_chip *chip;
struct flash_bank *saved_banks[SAM3_MAX_FLASH_BANKS]; struct flash_bank *saved_banks[SAM3_MAX_FLASH_BANKS];
unsigned x; unsigned int x;
LOG_DEBUG("Begin"); LOG_DEBUG("Begin");
details = all_sam3_details; details = all_sam3_details;
@ -3264,7 +3264,7 @@ static int sam3_protect(struct flash_bank *bank, int set, unsigned int first,
} }
static int sam3_page_read(struct sam3_bank_private *private, unsigned pagenum, uint8_t *buf) static int sam3_page_read(struct sam3_bank_private *private, unsigned int pagenum, uint8_t *buf)
{ {
uint32_t adr; uint32_t adr;
int r; int r;
@ -3283,7 +3283,7 @@ static int sam3_page_read(struct sam3_bank_private *private, unsigned pagenum, u
return r; return r;
} }
static int sam3_page_write(struct sam3_bank_private *private, unsigned pagenum, const uint8_t *buf) static int sam3_page_write(struct sam3_bank_private *private, unsigned int pagenum, const uint8_t *buf)
{ {
uint32_t adr; uint32_t adr;
uint32_t status; uint32_t status;
@ -3347,10 +3347,10 @@ static int sam3_write(struct flash_bank *bank,
uint32_t count) uint32_t count)
{ {
int n; int n;
unsigned page_cur; unsigned int page_cur;
unsigned page_end; unsigned int page_end;
int r; int r;
unsigned page_offset; unsigned int page_offset;
struct sam3_bank_private *private; struct sam3_bank_private *private;
uint8_t *pagebuffer; uint8_t *pagebuffer;
@ -3497,7 +3497,7 @@ COMMAND_HANDLER(sam3_handle_info_command)
if (!chip) if (!chip)
return ERROR_OK; return ERROR_OK;
unsigned x; unsigned int x;
int r; int r;
/* bank0 must exist before we can do anything */ /* bank0 must exist before we can do anything */
@ -3549,7 +3549,7 @@ need_define:
COMMAND_HANDLER(sam3_handle_gpnvm_command) COMMAND_HANDLER(sam3_handle_gpnvm_command)
{ {
unsigned x, v; unsigned int x, v;
int r, who; int r, who;
struct sam3_chip *chip; struct sam3_chip *chip;

View File

@ -134,15 +134,15 @@ struct sam4_bank_private {
struct sam4_chip *chip; struct sam4_chip *chip;
/* so we can find the original bank pointer */ /* so we can find the original bank pointer */
struct flash_bank *bank; struct flash_bank *bank;
unsigned bank_number; unsigned int bank_number;
uint32_t controller_address; uint32_t controller_address;
uint32_t base_address; uint32_t base_address;
uint32_t flash_wait_states; uint32_t flash_wait_states;
bool present; bool present;
unsigned size_bytes; unsigned int size_bytes;
unsigned nsectors; unsigned int nsectors;
unsigned sector_size; unsigned int sector_size;
unsigned page_size; unsigned int page_size;
}; };
struct sam4_chip_details { struct sam4_chip_details {
@ -156,12 +156,12 @@ struct sam4_chip_details {
uint32_t chipid_cidr; uint32_t chipid_cidr;
const char *name; const char *name;
unsigned n_gpnvms; unsigned int n_gpnvms;
#define SAM4_N_NVM_BITS 3 #define SAM4_N_NVM_BITS 3
unsigned gpnvm[SAM4_N_NVM_BITS]; unsigned int gpnvm[SAM4_N_NVM_BITS];
unsigned total_flash_size; unsigned int total_flash_size;
unsigned total_sram_size; unsigned int total_sram_size;
unsigned n_banks; unsigned int n_banks;
#define SAM4_MAX_FLASH_BANKS 2 #define SAM4_MAX_FLASH_BANKS 2
/* these are "initialized" from the global const data */ /* these are "initialized" from the global const data */
struct sam4_bank_private bank[SAM4_MAX_FLASH_BANKS]; struct sam4_bank_private bank[SAM4_MAX_FLASH_BANKS];
@ -1479,7 +1479,7 @@ static int efc_get_result(struct sam4_bank_private *private, uint32_t *v)
} }
static int efc_start_command(struct sam4_bank_private *private, static int efc_start_command(struct sam4_bank_private *private,
unsigned command, unsigned argument) unsigned int command, unsigned int argument)
{ {
uint32_t n, v; uint32_t n, v;
int r; int r;
@ -1501,7 +1501,7 @@ do_retry:
case AT91C_EFC_FCMD_CLB: case AT91C_EFC_FCMD_CLB:
n = (private->size_bytes / private->page_size); n = (private->size_bytes / private->page_size);
if (argument >= n) if (argument >= n)
LOG_ERROR("*BUG*: Embedded flash has only %u pages", (unsigned)(n)); LOG_ERROR("*BUG*: Embedded flash has only %" PRIu32 " pages", n);
break; break;
case AT91C_EFC_FCMD_SFB: case AT91C_EFC_FCMD_SFB:
@ -1574,8 +1574,8 @@ do_retry:
* @param status - put command status bits here * @param status - put command status bits here
*/ */
static int efc_perform_command(struct sam4_bank_private *private, static int efc_perform_command(struct sam4_bank_private *private,
unsigned command, unsigned int command,
unsigned argument, unsigned int argument,
uint32_t *status) uint32_t *status)
{ {
@ -1716,7 +1716,7 @@ static int flashd_erase_pages(struct sam4_bank_private *private,
* @param puthere - result stored here. * @param puthere - result stored here.
*/ */
/* ------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------ */
static int flashd_get_gpnvm(struct sam4_bank_private *private, unsigned gpnvm, unsigned *puthere) static int flashd_get_gpnvm(struct sam4_bank_private *private, unsigned int gpnvm, unsigned int *puthere)
{ {
uint32_t v; uint32_t v;
int r; int r;
@ -1757,10 +1757,10 @@ static int flashd_get_gpnvm(struct sam4_bank_private *private, unsigned gpnvm, u
* @param gpnvm GPNVM index. * @param gpnvm GPNVM index.
* @returns 0 if successful; otherwise returns an error code. * @returns 0 if successful; otherwise returns an error code.
*/ */
static int flashd_clr_gpnvm(struct sam4_bank_private *private, unsigned gpnvm) static int flashd_clr_gpnvm(struct sam4_bank_private *private, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
LOG_DEBUG("Here"); LOG_DEBUG("Here");
if (private->bank_number != 0) { if (private->bank_number != 0) {
@ -1789,10 +1789,10 @@ static int flashd_clr_gpnvm(struct sam4_bank_private *private, unsigned gpnvm)
* @param private info about the bank * @param private info about the bank
* @param gpnvm GPNVM index. * @param gpnvm GPNVM index.
*/ */
static int flashd_set_gpnvm(struct sam4_bank_private *private, unsigned gpnvm) static int flashd_set_gpnvm(struct sam4_bank_private *private, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
if (private->bank_number != 0) { if (private->bank_number != 0) {
LOG_ERROR("GPNVM only works with Bank0"); LOG_ERROR("GPNVM only works with Bank0");
@ -1846,8 +1846,8 @@ static int flashd_get_lock_bits(struct sam4_bank_private *private, uint32_t *v)
*/ */
static int flashd_unlock(struct sam4_bank_private *private, static int flashd_unlock(struct sam4_bank_private *private,
unsigned start_sector, unsigned int start_sector,
unsigned end_sector) unsigned int end_sector)
{ {
int r; int r;
uint32_t status; uint32_t status;
@ -1876,8 +1876,8 @@ static int flashd_unlock(struct sam4_bank_private *private,
* @param end_sector - last sector (inclusive) to lock * @param end_sector - last sector (inclusive) to lock
*/ */
static int flashd_lock(struct sam4_bank_private *private, static int flashd_lock(struct sam4_bank_private *private,
unsigned start_sector, unsigned int start_sector,
unsigned end_sector) unsigned int end_sector)
{ {
uint32_t status; uint32_t status;
uint32_t pg; uint32_t pg;
@ -1905,8 +1905,8 @@ static int flashd_lock(struct sam4_bank_private *private,
static uint32_t sam4_reg_fieldname(struct sam4_chip *chip, static uint32_t sam4_reg_fieldname(struct sam4_chip *chip,
const char *regname, const char *regname,
uint32_t value, uint32_t value,
unsigned shift, unsigned int shift,
unsigned width) unsigned int width)
{ {
uint32_t v; uint32_t v;
int hwidth, dwidth; int hwidth, dwidth;
@ -1991,7 +1991,7 @@ static const char *const sramsize[] = {
}; };
static const struct archnames { unsigned value; const char *name; } archnames[] = { static const struct archnames { unsigned int value; const char *name; } archnames[] = {
{ 0x19, "AT91SAM9xx Series" }, { 0x19, "AT91SAM9xx Series" },
{ 0x29, "AT91SAM9XExx Series" }, { 0x29, "AT91SAM9XExx Series" },
{ 0x34, "AT91x34 Series" }, { 0x34, "AT91x34 Series" },
@ -2374,8 +2374,8 @@ static int sam4_read_this_reg(struct sam4_chip *chip, uint32_t *goes_here)
r = target_read_u32(chip->target, reg->address, goes_here); r = target_read_u32(chip->target, reg->address, goes_here);
if (r != ERROR_OK) { if (r != ERROR_OK) {
LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08x, Err: %d", LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08" PRIx32 ", Err: %d",
reg->name, (unsigned)(reg->address), r); reg->name, reg->address, r);
} }
return r; return r;
} }
@ -2390,8 +2390,8 @@ static int sam4_read_all_regs(struct sam4_chip *chip)
r = sam4_read_this_reg(chip, r = sam4_read_this_reg(chip,
sam4_get_reg_ptr(&(chip->cfg), reg)); sam4_get_reg_ptr(&(chip->cfg), reg));
if (r != ERROR_OK) { if (r != ERROR_OK) {
LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08x, Error: %d", LOG_ERROR("Cannot read SAM4 register: %s @ 0x%08" PRIx32 ", Error: %d",
reg->name, ((unsigned)(reg->address)), r); reg->name, reg->address, r);
return r; return r;
} }
reg++; reg++;
@ -2444,7 +2444,7 @@ static int sam4_protect_check(struct flash_bank *bank)
{ {
int r; int r;
uint32_t v[4] = {0}; uint32_t v[4] = {0};
unsigned x; unsigned int x;
struct sam4_bank_private *private; struct sam4_bank_private *private;
LOG_DEBUG("Begin"); LOG_DEBUG("Begin");
@ -2557,7 +2557,7 @@ static int sam4_get_details(struct sam4_bank_private *private)
const struct sam4_chip_details *details; const struct sam4_chip_details *details;
struct sam4_chip *chip; struct sam4_chip *chip;
struct flash_bank *saved_banks[SAM4_MAX_FLASH_BANKS]; struct flash_bank *saved_banks[SAM4_MAX_FLASH_BANKS];
unsigned x; unsigned int x;
LOG_DEBUG("Begin"); LOG_DEBUG("Begin");
details = all_sam4_details; details = all_sam4_details;
@ -2796,7 +2796,7 @@ static int sam4_protect(struct flash_bank *bank, int set, unsigned int first,
} }
static int sam4_page_read(struct sam4_bank_private *private, unsigned pagenum, uint8_t *buf) static int sam4_page_read(struct sam4_bank_private *private, unsigned int pagenum, uint8_t *buf)
{ {
uint32_t adr; uint32_t adr;
int r; int r;
@ -2841,7 +2841,7 @@ static int sam4_set_wait(struct sam4_bank_private *private)
return r; return r;
} }
static int sam4_page_write(struct sam4_bank_private *private, unsigned pagenum, const uint8_t *buf) static int sam4_page_write(struct sam4_bank_private *private, unsigned int pagenum, const uint8_t *buf)
{ {
uint32_t adr; uint32_t adr;
uint32_t status; uint32_t status;
@ -2891,10 +2891,10 @@ static int sam4_write(struct flash_bank *bank,
uint32_t count) uint32_t count)
{ {
int n; int n;
unsigned page_cur; unsigned int page_cur;
unsigned page_end; unsigned int page_end;
int r; int r;
unsigned page_offset; unsigned int page_offset;
struct sam4_bank_private *private; struct sam4_bank_private *private;
uint8_t *pagebuffer; uint8_t *pagebuffer;
@ -3045,7 +3045,7 @@ COMMAND_HANDLER(sam4_handle_info_command)
if (!chip) if (!chip)
return ERROR_OK; return ERROR_OK;
unsigned x; unsigned int x;
int r; int r;
/* bank0 must exist before we can do anything */ /* bank0 must exist before we can do anything */
@ -3097,7 +3097,7 @@ need_define:
COMMAND_HANDLER(sam4_handle_gpnvm_command) COMMAND_HANDLER(sam4_handle_gpnvm_command)
{ {
unsigned x, v; unsigned int x, v;
int r, who; int r, who;
struct sam4_chip *chip; struct sam4_chip *chip;

View File

@ -560,7 +560,7 @@ static int at91sam7_read_part_info(struct flash_bank *bank)
if (bnk > 0) { if (bnk > 0) {
if (!t_bank->next) { if (!t_bank->next) {
/* create a new flash bank element */ /* create a new flash bank element */
struct flash_bank *fb = calloc(sizeof(struct flash_bank), 1); struct flash_bank *fb = calloc(1, sizeof(struct flash_bank));
if (!fb) { if (!fb) {
LOG_ERROR("No memory for flash bank"); LOG_ERROR("No memory for flash bank");
return ERROR_FAIL; return ERROR_FAIL;
@ -748,7 +748,7 @@ FLASH_BANK_COMMAND_HANDLER(at91sam7_flash_bank_command)
if (bnk > 0) { if (bnk > 0) {
if (!t_bank->next) { if (!t_bank->next) {
/* create a new bank element */ /* create a new bank element */
struct flash_bank *fb = calloc(sizeof(struct flash_bank), 1); struct flash_bank *fb = calloc(1, sizeof(struct flash_bank));
if (!fb) { if (!fb) {
LOG_ERROR("No memory for flash bank"); LOG_ERROR("No memory for flash bank");
return ERROR_FAIL; return ERROR_FAIL;

View File

@ -365,7 +365,7 @@ static const struct samd_family *samd_find_family(uint32_t id)
uint8_t family = SAMD_GET_FAMILY(id); uint8_t family = SAMD_GET_FAMILY(id);
uint8_t series = SAMD_GET_SERIES(id); uint8_t series = SAMD_GET_SERIES(id);
for (unsigned i = 0; i < ARRAY_SIZE(samd_families); i++) { for (unsigned int i = 0; i < ARRAY_SIZE(samd_families); i++) {
if (samd_families[i].processor == processor && if (samd_families[i].processor == processor &&
samd_families[i].series == series && samd_families[i].series == series &&
samd_families[i].family == family) samd_families[i].family == family)
@ -387,7 +387,7 @@ static const struct samd_part *samd_find_part(uint32_t id)
if (!family) if (!family)
return NULL; return NULL;
for (unsigned i = 0; i < family->num_parts; i++) { for (unsigned int i = 0; i < family->num_parts; i++) {
if (family->parts[i].id == devsel) if (family->parts[i].id == devsel)
return &family->parts[i]; return &family->parts[i];
} }

View File

@ -513,7 +513,7 @@ static int ath79_erase(struct flash_bank *bank, unsigned int first,
if (ath79_info->dev->erase_cmd == 0x00) if (ath79_info->dev->erase_cmd == 0x00)
return ERROR_FLASH_OPER_UNSUPPORTED; return ERROR_FLASH_OPER_UNSUPPORTED;
for (unsigned sector = first; sector <= last; sector++) { for (unsigned int sector = first; sector <= last; sector++) {
if (bank->sectors[sector].is_protected) { if (bank->sectors[sector].is_protected) {
LOG_ERROR("Flash sector %u protected", sector); LOG_ERROR("Flash sector %u protected", sector);
return ERROR_FAIL; return ERROR_FAIL;

View File

@ -85,6 +85,9 @@
#define SAME_SERIES_51 0x01 #define SAME_SERIES_51 0x01
#define SAME_SERIES_53 0x03 #define SAME_SERIES_53 0x03
#define SAME_SERIES_54 0x04 #define SAME_SERIES_54 0x04
#define PIC32CXSG_SERIES_41 0x07
#define PIC32CXSG_SERIES_60 0x00
#define PIC32CXSG_SERIES_61 0x02
/* Device ID macros */ /* Device ID macros */
#define SAMD_GET_PROCESSOR(id) (id >> 28) #define SAMD_GET_PROCESSOR(id) (id >> 28)
@ -148,6 +151,27 @@ static const struct samd_part same54_parts[] = {
{ 0x03, "SAME54N19A", 512, 192 }, { 0x03, "SAME54N19A", 512, 192 },
}; };
/* See PIC32CX SG41/SG60/SG61 Family Silicon Errata and Datasheet Clarifications
* DS80000985G */
/* Known PIC32CX-SG41 parts. */
static const struct samd_part pic32cxsg41_parts[] = {
{ 0x00, "PIC32CX1025SG41128", 1024, 256 },
{ 0x01, "PIC32CX1025SG41100", 1024, 256 },
{ 0x02, "PIC32CX1025SG41064", 1024, 256 },
};
/* Known PIC32CX-SG60 parts. */
static const struct samd_part pic32cxsg60_parts[] = {
{ 0x00, "PIC32CX1025SG60128", 1024, 256 },
{ 0x01, "PIC32CX1025SG60100", 1024, 256 },
};
/* Known PIC32CX-SG61 parts. */
static const struct samd_part pic32cxsg61_parts[] = {
{ 0x00, "PIC32CX1025SG61128", 1024, 256 },
{ 0x01, "PIC32CX1025SG61100", 1024, 256 },
};
/* Each family of parts contains a parts table in the DEVSEL field of DID. The /* Each family of parts contains a parts table in the DEVSEL field of DID. The
* processor ID, family ID, and series ID are used to determine which exact * processor ID, family ID, and series ID are used to determine which exact
* family this is and then we can use the corresponding table. */ * family this is and then we can use the corresponding table. */
@ -169,6 +193,12 @@ static const struct samd_family samd_families[] = {
same53_parts, ARRAY_SIZE(same53_parts) }, same53_parts, ARRAY_SIZE(same53_parts) },
{ SAMD_PROCESSOR_M4, SAMD_FAMILY_E, SAME_SERIES_54, { SAMD_PROCESSOR_M4, SAMD_FAMILY_E, SAME_SERIES_54,
same54_parts, ARRAY_SIZE(same54_parts) }, same54_parts, ARRAY_SIZE(same54_parts) },
{ SAMD_PROCESSOR_M4, SAMD_FAMILY_E, PIC32CXSG_SERIES_41,
pic32cxsg41_parts, ARRAY_SIZE(pic32cxsg41_parts) },
{ SAMD_PROCESSOR_M4, SAMD_FAMILY_E, PIC32CXSG_SERIES_60,
pic32cxsg60_parts, ARRAY_SIZE(pic32cxsg60_parts) },
{ SAMD_PROCESSOR_M4, SAMD_FAMILY_E, PIC32CXSG_SERIES_61,
pic32cxsg61_parts, ARRAY_SIZE(pic32cxsg61_parts) },
}; };
struct samd_info { struct samd_info {
@ -194,7 +224,7 @@ static const struct samd_family *samd_find_family(uint32_t id)
uint8_t family = SAMD_GET_FAMILY(id); uint8_t family = SAMD_GET_FAMILY(id);
uint8_t series = SAMD_GET_SERIES(id); uint8_t series = SAMD_GET_SERIES(id);
for (unsigned i = 0; i < ARRAY_SIZE(samd_families); i++) { for (unsigned int i = 0; i < ARRAY_SIZE(samd_families); i++) {
if (samd_families[i].processor == processor && if (samd_families[i].processor == processor &&
samd_families[i].series == series && samd_families[i].series == series &&
samd_families[i].family == family) samd_families[i].family == family)
@ -216,7 +246,7 @@ static const struct samd_part *samd_find_part(uint32_t id)
if (!family) if (!family)
return NULL; return NULL;
for (unsigned i = 0; i < family->num_parts; i++) { for (unsigned int i = 0; i < family->num_parts; i++) {
if (family->parts[i].id == devsel) if (family->parts[i].id == devsel)
return &family->parts[i]; return &family->parts[i];
} }

View File

@ -55,8 +55,8 @@
struct samv_flash_bank { struct samv_flash_bank {
bool probed; bool probed;
unsigned size_bytes; unsigned int size_bytes;
unsigned gpnvm[SAMV_NUM_GPNVM_BITS]; unsigned int gpnvm[SAMV_NUM_GPNVM_BITS];
}; };
/* The actual sector size of the SAMV7 flash memory is 128K bytes. /* The actual sector size of the SAMV7 flash memory is 128K bytes.
@ -82,7 +82,7 @@ static int samv_efc_get_result(struct target *target, uint32_t *v)
} }
static int samv_efc_start_command(struct target *target, static int samv_efc_start_command(struct target *target,
unsigned command, unsigned argument) unsigned int command, unsigned int argument)
{ {
uint32_t v; uint32_t v;
samv_efc_get_status(target, &v); samv_efc_get_status(target, &v);
@ -100,7 +100,7 @@ static int samv_efc_start_command(struct target *target,
} }
static int samv_efc_perform_command(struct target *target, static int samv_efc_perform_command(struct target *target,
unsigned command, unsigned argument, uint32_t *status) unsigned int command, unsigned int argument, uint32_t *status)
{ {
int r; int r;
uint32_t v; uint32_t v;
@ -166,7 +166,7 @@ static int samv_erase_pages(struct target *target,
first_page | erase_pages, status); first_page | erase_pages, status);
} }
static int samv_get_gpnvm(struct target *target, unsigned gpnvm, unsigned *out) static int samv_get_gpnvm(struct target *target, unsigned int gpnvm, unsigned int *out)
{ {
uint32_t v; uint32_t v;
int r; int r;
@ -190,10 +190,10 @@ static int samv_get_gpnvm(struct target *target, unsigned gpnvm, unsigned *out)
return r; return r;
} }
static int samv_clear_gpnvm(struct target *target, unsigned gpnvm) static int samv_clear_gpnvm(struct target *target, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
if (gpnvm >= SAMV_NUM_GPNVM_BITS) { if (gpnvm >= SAMV_NUM_GPNVM_BITS) {
LOG_ERROR("invalid gpnvm %d, max: %d", gpnvm, SAMV_NUM_GPNVM_BITS); LOG_ERROR("invalid gpnvm %d, max: %d", gpnvm, SAMV_NUM_GPNVM_BITS);
@ -209,10 +209,10 @@ static int samv_clear_gpnvm(struct target *target, unsigned gpnvm)
return r; return r;
} }
static int samv_set_gpnvm(struct target *target, unsigned gpnvm) static int samv_set_gpnvm(struct target *target, unsigned int gpnvm)
{ {
int r; int r;
unsigned v; unsigned int v;
if (gpnvm >= SAMV_NUM_GPNVM_BITS) { if (gpnvm >= SAMV_NUM_GPNVM_BITS) {
LOG_ERROR("invalid gpnvm %d, max: %d", gpnvm, SAMV_NUM_GPNVM_BITS); LOG_ERROR("invalid gpnvm %d, max: %d", gpnvm, SAMV_NUM_GPNVM_BITS);
return ERROR_FAIL; return ERROR_FAIL;
@ -231,7 +231,7 @@ static int samv_set_gpnvm(struct target *target, unsigned gpnvm)
} }
static int samv_flash_unlock(struct target *target, static int samv_flash_unlock(struct target *target,
unsigned start_sector, unsigned end_sector) unsigned int start_sector, unsigned int end_sector)
{ {
int r; int r;
uint32_t status; uint32_t status;
@ -251,7 +251,7 @@ static int samv_flash_unlock(struct target *target,
} }
static int samv_flash_lock(struct target *target, static int samv_flash_lock(struct target *target,
unsigned start_sector, unsigned end_sector) unsigned int start_sector, unsigned int end_sector)
{ {
uint32_t status; uint32_t status;
uint32_t pg; uint32_t pg;
@ -419,7 +419,7 @@ static int samv_protect(struct flash_bank *bank, int set, unsigned int first,
} }
static int samv_page_read(struct target *target, static int samv_page_read(struct target *target,
unsigned page_num, uint8_t *buf) unsigned int page_num, uint8_t *buf)
{ {
uint32_t addr = SAMV_FLASH_BASE + page_num * SAMV_PAGE_SIZE; uint32_t addr = SAMV_FLASH_BASE + page_num * SAMV_PAGE_SIZE;
int r = target_read_memory(target, addr, 4, SAMV_PAGE_SIZE / 4, buf); int r = target_read_memory(target, addr, 4, SAMV_PAGE_SIZE / 4, buf);
@ -430,7 +430,7 @@ static int samv_page_read(struct target *target,
} }
static int samv_page_write(struct target *target, static int samv_page_write(struct target *target,
unsigned pagenum, const uint8_t *buf) unsigned int pagenum, const uint8_t *buf)
{ {
uint32_t status; uint32_t status;
const uint32_t addr = SAMV_FLASH_BASE + pagenum * SAMV_PAGE_SIZE; const uint32_t addr = SAMV_FLASH_BASE + pagenum * SAMV_PAGE_SIZE;
@ -618,7 +618,7 @@ COMMAND_HANDLER(samv_handle_gpnvm_command)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
} }
unsigned v = 0; unsigned int v = 0;
if (!strcmp("show", CMD_ARGV[0])) { if (!strcmp("show", CMD_ARGV[0])) {
if (who == -1) { if (who == -1) {
showall: showall:

View File

@ -806,7 +806,7 @@ int cfi_flash_bank_cmd(struct flash_bank *bank, unsigned int argc, const char **
} }
bank->driver_priv = cfi_info; bank->driver_priv = cfi_info;
for (unsigned i = 6; i < argc; i++) { for (unsigned int i = 6; i < argc; i++) {
if (strcmp(argv[i], "x16_as_x8") == 0) if (strcmp(argv[i], "x16_as_x8") == 0)
cfi_info->x16_as_x8 = true; cfi_info->x16_as_x8 = true;
else if (strcmp(argv[i], "data_swap") == 0) else if (strcmp(argv[i], "data_swap") == 0)
@ -2219,8 +2219,7 @@ static int cfi_read(struct flash_bank *bank, uint8_t *buffer, uint32_t offset, u
uint8_t current_word[CFI_MAX_BUS_WIDTH]; uint8_t current_word[CFI_MAX_BUS_WIDTH];
int retval; int retval;
LOG_DEBUG("reading buffer of %i byte at 0x%8.8x", LOG_DEBUG("reading buffer of %" PRIi32 " byte at 0x%8.8" PRIx32, count, offset);
(int)count, (unsigned)offset);
if (bank->target->state != TARGET_HALTED) { if (bank->target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted"); LOG_ERROR("Target not halted");

View File

@ -58,10 +58,10 @@ struct cfi_flash_bank {
void *alt_ext; void *alt_ext;
/* calculated timeouts */ /* calculated timeouts */
unsigned word_write_timeout; unsigned int word_write_timeout;
unsigned buf_write_timeout; unsigned int buf_write_timeout;
unsigned block_erase_timeout; unsigned int block_erase_timeout;
unsigned chip_erase_timeout; unsigned int chip_erase_timeout;
/* memory accessors */ /* memory accessors */
int (*write_mem)(struct flash_bank *bank, target_addr_t addr, int (*write_mem)(struct flash_bank *bank, target_addr_t addr,

View File

@ -164,7 +164,7 @@ int default_flash_verify(struct flash_bank *bank,
void flash_bank_add(struct flash_bank *bank) void flash_bank_add(struct flash_bank *bank)
{ {
/* put flash bank in linked list */ /* put flash bank in linked list */
unsigned bank_num = 0; unsigned int bank_num = 0;
if (flash_banks) { if (flash_banks) {
/* find last flash bank */ /* find last flash bank */
struct flash_bank *p = flash_banks; struct flash_bank *p = flash_banks;
@ -242,8 +242,8 @@ void flash_free_all_banks(void)
struct flash_bank *get_flash_bank_by_name_noprobe(const char *name) struct flash_bank *get_flash_bank_by_name_noprobe(const char *name)
{ {
unsigned requested = get_flash_name_index(name); unsigned int requested = get_flash_name_index(name);
unsigned found = 0; unsigned int found = 0;
struct flash_bank *bank; struct flash_bank *bank;
for (bank = flash_banks; bank; bank = bank->next) { for (bank = flash_banks; bank; bank = bank->next) {

View File

@ -32,18 +32,18 @@ struct flash_sector {
uint32_t size; uint32_t size;
/** /**
* Indication of erasure status: 0 = not erased, 1 = erased, * Indication of erasure status: 0 = not erased, 1 = erased,
* other = unknown. Set by @c flash_driver_s::erase_check only. * other = unknown. Set by @c flash_driver::erase_check only.
* *
* This information must be considered stale immediately. * This information must be considered stale immediately.
* Don't set it in flash_driver_s::erase or a device mass_erase * Don't set it in flash_driver::erase or a device mass_erase
* Don't clear it in flash_driver_s::write * Don't clear it in flash_driver::write
* The flag is not used in a protection block * The flag is not used in a protection block
*/ */
int is_erased; int is_erased;
/** /**
* Indication of protection status: 0 = unprotected/unlocked, * Indication of protection status: 0 = unprotected/unlocked,
* 1 = protected/locked, other = unknown. Set by * 1 = protected/locked, other = unknown. Set by
* @c flash_driver_s::protect_check. * @c flash_driver::protect_check.
* *
* This information must be considered stale immediately. * This information must be considered stale immediately.
* A million things could make it stale: power cycle, * A million things could make it stale: power cycle,
@ -67,7 +67,7 @@ struct flash_sector {
* a major interface. * a major interface.
* *
* This structure will be passed as a parameter to the callbacks in the * This structure will be passed as a parameter to the callbacks in the
* flash_driver_s structure, some of which may modify the contents of * flash_driver structure, some of which may modify the contents of
* this structure of the area of flash that it defines. Driver writers * this structure of the area of flash that it defines. Driver writers
* may use the @c driver_priv member to store additional data on a * may use the @c driver_priv member to store additional data on a
* per-bank basis, if required. * per-bank basis, if required.
@ -250,7 +250,7 @@ int get_flash_bank_by_num(unsigned int num, struct flash_bank **bank);
* @param bank On output, contains a pointer to the bank or NULL. * @param bank On output, contains a pointer to the bank or NULL.
* @returns ERROR_OK on success, or an error indicating the problem. * @returns ERROR_OK on success, or an error indicating the problem.
*/ */
COMMAND_HELPER(flash_command_get_bank, unsigned name_index, COMMAND_HELPER(flash_command_get_bank, unsigned int name_index,
struct flash_bank **bank); struct flash_bank **bank);
/** /**
* Retrieves @a bank from a command argument, reporting errors parsing * Retrieves @a bank from a command argument, reporting errors parsing

View File

@ -29,7 +29,7 @@ struct flash_bank;
* flash bank DRIVERNAME ...parameters... * flash bank DRIVERNAME ...parameters...
* @endcode * @endcode
* *
* OpenOCD will search for the driver with a @c flash_driver_s::name * OpenOCD will search for the driver with a @c flash_driver::name
* that matches @c DRIVERNAME. * that matches @c DRIVERNAME.
* *
* The flash subsystem calls some of the other drivers routines a using * The flash subsystem calls some of the other drivers routines a using
@ -170,7 +170,7 @@ struct flash_driver {
/** /**
* Check the erasure status of a flash bank. * Check the erasure status of a flash bank.
* When called, the driver routine must perform the required * When called, the driver routine must perform the required
* checks and then set the @c flash_sector_s::is_erased field * checks and then set the @c flash_sector::is_erased field
* for each of the flash banks's sectors. * for each of the flash banks's sectors.
* *
* @param bank The bank to check * @param bank The bank to check
@ -182,7 +182,7 @@ struct flash_driver {
* Determine if the specific bank is "protected" or not. * Determine if the specific bank is "protected" or not.
* When called, the driver routine must must perform the * When called, the driver routine must must perform the
* required protection check(s) and then set the @c * required protection check(s) and then set the @c
* flash_sector_s::is_protected field for each of the flash * flash_sector::is_protected field for each of the flash
* bank's sectors. * bank's sectors.
* *
* If protection is not implemented, set method to NULL * If protection is not implemented, set method to NULL
@ -204,7 +204,7 @@ struct flash_driver {
int (*info)(struct flash_bank *bank, struct command_invocation *cmd); int (*info)(struct flash_bank *bank, struct command_invocation *cmd);
/** /**
* A more gentle flavor of flash_driver_s::probe, performing * A more gentle flavor of flash_driver::probe, performing
* setup with less noise. Generally, driver routines should test * setup with less noise. Generally, driver routines should test
* to see if the bank has already been probed; if it has, the * to see if the bank has already been probed; if it has, the
* driver probably should not perform its probe a second time. * driver probably should not perform its probe a second time.
@ -254,8 +254,10 @@ extern const struct flash_driver cc26xx_flash;
extern const struct flash_driver cc3220sf_flash; extern const struct flash_driver cc3220sf_flash;
extern const struct flash_driver cfi_flash; extern const struct flash_driver cfi_flash;
extern const struct flash_driver dsp5680xx_flash; extern const struct flash_driver dsp5680xx_flash;
extern const struct flash_driver dw_spi_flash;
extern const struct flash_driver efm32_flash; extern const struct flash_driver efm32_flash;
extern const struct flash_driver em357_flash; extern const struct flash_driver em357_flash;
extern const struct flash_driver eneispif_flash;
extern const struct flash_driver esirisc_flash; extern const struct flash_driver esirisc_flash;
extern const struct flash_driver faux_flash; extern const struct flash_driver faux_flash;
extern const struct flash_driver fespi_flash; extern const struct flash_driver fespi_flash;

View File

@ -31,8 +31,10 @@ static const struct flash_driver * const flash_drivers[] = {
&cc26xx_flash, &cc26xx_flash,
&cfi_flash, &cfi_flash,
&dsp5680xx_flash, &dsp5680xx_flash,
&dw_spi_flash,
&efm32_flash, &efm32_flash,
&em357_flash, &em357_flash,
&eneispif_flash,
&esirisc_flash, &esirisc_flash,
&faux_flash, &faux_flash,
&fm3_flash, &fm3_flash,
@ -90,7 +92,7 @@ static const struct flash_driver * const flash_drivers[] = {
const struct flash_driver *flash_driver_find_by_name(const char *name) const struct flash_driver *flash_driver_find_by_name(const char *name)
{ {
for (unsigned i = 0; flash_drivers[i]; i++) { for (unsigned int i = 0; flash_drivers[i]; i++) {
if (strcmp(name, flash_drivers[i]->name) == 0) if (strcmp(name, flash_drivers[i]->name) == 0)
return flash_drivers[i]; return flash_drivers[i];
} }

View File

@ -0,0 +1,102 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/**
* @file
* Driver for SPI NOR flash chips connected via DesignWare SPI Core.
*
* In order to avoid using stack, all helper function arguments are packed
* into a single struct, passed by pointer.
*
* Pointers are represented by 64 bit integers to make structs compatible
* with 64 bit targets.
*
* This file contains helper function argument structures.
*/
#ifndef OPENOCD_FLASH_NOR_DW_SPI_HELPER_H
#define OPENOCD_FLASH_NOR_DW_SPI_HELPER_H
#include <stdint.h>
/**
* @brief Arguments for transaction helper function.
*/
struct dw_spi_transaction {
uint64_t buffer;
///< Pointer to data buffer to send over SPI.
///< Return values are stored in place of output data when
///< dw_spi_transaction::read_flag is 1.
uint32_t size; ///< Size of dw_spi_transaction::buffer.
uint64_t status_reg; ///< Pointer to SR register.
uint64_t data_reg; ///< Pointer to DR register.
uint8_t read_flag;
///< When 1, store RX FIFO data to dw_spi_transaction::buffer.
} __attribute__((packed));
/**
* @brief Arguments for check_fill helper function.
*/
struct dw_spi_check_fill {
uint32_t address; ///< Starting address. Sector aligned.
uint32_t sector_size; ///< Sector size.
uint32_t sector_count; ///< Number of sectors to check.
uint64_t status_reg; ///< Pointer to SR register.
uint64_t data_reg; ///< Pointer to DR register.
uint64_t fill_status_array;
///< Pointer to array describing sectors fill status.
///< 1 if filled, 0 if not filled.
uint8_t pattern; ///< Fill pattern.
uint8_t read_cmd; ///< Read data command.
uint8_t four_byte_mode; ///< Four byte addressing mode flag.
} __attribute__((packed));
/**
* @brief Arguments for erase helper function.
*/
struct dw_spi_erase {
uint32_t address; ///< First sector address. Sector aligned.
uint32_t sector_size; ///< Sector size.
uint32_t sector_count; ///< Number of sectors to erase.
uint64_t status_reg; ///< Pointer to SR register.
uint64_t data_reg; ///< Pointer to DR register.
uint8_t read_status_cmd; ///< Read status command.
uint8_t write_enable_cmd; ///< Write enable command.
uint8_t erase_sector_cmd; ///< Erase sector command.
uint8_t write_enable_mask; ///< Write enable mask.
uint8_t busy_mask; ///< Busy mask.
uint8_t four_byte_mode; ///< Four byte addressing mode flag.
} __attribute__((packed));
/**
* @brief Arguments for program helper function.
*/
struct dw_spi_program {
uint32_t address;
///< First page address. Page aligned when write is crossing
///< the page boundary.
uint32_t page_size; ///< Page size.
uint64_t buffer; ///< Data buffer pointer.
uint32_t buffer_size; ///< Size of dw_spi_program::buffer.
uint64_t status_reg; ///< Pointer to SR register.
uint64_t data_reg; ///< Pointer to DR register.
uint8_t read_status_cmd; ///< Read status command.
uint8_t write_enable_cmd; ///< Write enable command.
uint8_t program_cmd; ///< Program command.
uint8_t write_enable_mask; ///< Write enable mask.
uint8_t busy_mask; ///< Busy mask.
uint8_t four_byte_mode; ///< Four byte addressing mode flag.
} __attribute__((packed));
/**
* @brief Arguments for read helper function.
*/
struct dw_spi_read {
uint32_t address; ///< First sector address.
uint64_t buffer; ///< Data buffer pointer.
uint32_t buffer_size; ///< Size of dw_spi_read::buffer.
uint64_t status_reg; ///< Pointer to SR register.
uint64_t data_reg; ///< Pointer to DR register.
uint8_t read_cmd; ///< Read data command.
uint8_t four_byte_mode; ///< Four byte addressing mode flag.
} __attribute__((packed));
#endif /* OPENOCD_FLASH_NOR_DW_SPI_HELPER_H */

1608
src/flash/nor/dw-spi.c Normal file

File diff suppressed because it is too large Load Diff

433
src/flash/nor/eneispif.c Normal file
View File

@ -0,0 +1,433 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2024 ENE Technology Inc.
* steven@ene.com.tw
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <helper/time_support.h>
#include <helper/bits.h>
#include <target/target.h>
#include <flash/nor/core.h>
#include <flash/nor/driver.h>
#include <flash/nor/spi.h>
#define ISPICFG 0x0000
#define ISPISTS 0x0004
#define ISPIADDR 0x0008
#define ISPICMD 0x000C
#define ISPIDAT 0x0100
#define ISPISTS_BUSY BIT(0)
#define STATUS1_QE BIT(1)
#define CFG_READ 0x372
#define CFG_WRITE 0x371
#define ISPI_CTRL_BASE 0x50101000
/* name read qread page erase chip device_id page erase flash
* _cmd _cmd _prog _cmd* _erase size size* size
* _cmd _cmd
*/
struct flash_device ene_flash_device =
FLASH_ID("ISPI flash", 0x03, 0x00, 0x02, 0x20, 0x60, 0x00132085, 0x100, 0x1000, 0x80000);
struct eneispif_flash_bank {
bool probed;
target_addr_t ctrl_base;
uint32_t dev_id;
const struct flash_device *dev;
};
FLASH_BANK_COMMAND_HANDLER(eneispif_flash_bank_command)
{
struct eneispif_flash_bank *eneispif_info;
LOG_DEBUG("%s", __func__);
if (CMD_ARGC < 6)
return ERROR_COMMAND_SYNTAX_ERROR;
eneispif_info = malloc(sizeof(struct eneispif_flash_bank));
if (!eneispif_info) {
LOG_ERROR("not enough memory");
return ERROR_FAIL;
}
bank->driver_priv = eneispif_info;
eneispif_info->probed = false;
eneispif_info->ctrl_base = ISPI_CTRL_BASE;
if (CMD_ARGC >= 7) {
COMMAND_PARSE_ADDRESS(CMD_ARGV[6], eneispif_info->ctrl_base);
LOG_INFO("ASSUMING ISPI device at ctrl_base = " TARGET_ADDR_FMT,
eneispif_info->ctrl_base);
}
return ERROR_OK;
}
static int eneispif_read_reg(struct flash_bank *bank, uint32_t *value, target_addr_t address)
{
struct target *target = bank->target;
struct eneispif_flash_bank *eneispif_info = bank->driver_priv;
int result = target_read_u32(target, eneispif_info->ctrl_base + address, value);
if (result != ERROR_OK) {
LOG_ERROR("%s error at " TARGET_ADDR_FMT, __func__,
eneispif_info->ctrl_base + address);
return result;
}
LOG_DEBUG("Read address " TARGET_ADDR_FMT " = 0x%" PRIx32,
eneispif_info->ctrl_base + address, *value);
return ERROR_OK;
}
static int eneispif_write_reg(struct flash_bank *bank, target_addr_t address, uint32_t value)
{
struct target *target = bank->target;
struct eneispif_flash_bank *eneispif_info = bank->driver_priv;
LOG_DEBUG("Write address " TARGET_ADDR_FMT " = 0x%" PRIx32,
eneispif_info->ctrl_base + address, value);
int result = target_write_u32(target, eneispif_info->ctrl_base + address, value);
if (result != ERROR_OK) {
LOG_ERROR("%s error writing 0x%" PRIx32 " to " TARGET_ADDR_FMT, __func__,
value, eneispif_info->ctrl_base + address);
return result;
}
return ERROR_OK;
}
static int eneispif_wait(struct flash_bank *bank)
{
int64_t start = timeval_ms();
while (1) {
uint32_t status;
if (eneispif_read_reg(bank, &status, ISPISTS) != ERROR_OK)
return ERROR_FAIL;
if (!(status & ISPISTS_BUSY))
break;
int64_t now = timeval_ms();
if (now - start > 1000) {
LOG_ERROR("Busy more than 1000ms.");
return ERROR_TARGET_TIMEOUT;
}
}
return ERROR_OK;
}
static int eneispi_erase_sector(struct flash_bank *bank, int sector)
{
int retval = ERROR_OK;
struct eneispif_flash_bank *eneispif_info = bank->driver_priv;
uint32_t offset;
uint32_t conf;
retval = eneispif_read_reg(bank, &conf, ISPICFG);
if (retval != ERROR_OK)
return retval;
offset = bank->sectors[sector].offset;
retval = eneispif_write_reg(bank, ISPIADDR, offset); /* Address */
if (retval != ERROR_OK)
goto done;
eneispif_write_reg(bank, ISPICFG, CFG_WRITE); /* Cmmmand enable */
eneispif_write_reg(bank, ISPICMD, SPIFLASH_WRITE_ENABLE); /* Write enable */
retval = eneispif_write_reg(bank, ISPICMD, eneispif_info->dev->erase_cmd); /* Erase page */
if (retval != ERROR_OK)
goto done;
retval = eneispif_wait(bank);
if (retval != ERROR_OK)
goto done;
done:
eneispif_write_reg(bank, ISPICFG, conf); /* restore */
return retval;
}
static int eneispif_erase(struct flash_bank *bank, unsigned int first, unsigned int last)
{
struct target *target = bank->target;
struct eneispif_flash_bank *eneispif_info = bank->driver_priv;
int retval = ERROR_OK;
LOG_DEBUG("%s: from sector %u to sector %u", __func__, first, last);
if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
if (last < first || last >= bank->num_sectors) {
LOG_ERROR("Flash sector invalid");
return ERROR_FLASH_SECTOR_INVALID;
}
if (!(eneispif_info->probed)) {
LOG_ERROR("Flash bank not probed");
return ERROR_FLASH_BANK_NOT_PROBED;
}
for (unsigned int sector = first; sector <= last; sector++) {
if (bank->sectors[sector].is_protected) {
LOG_ERROR("Flash sector %u protected", sector);
return ERROR_FAIL;
}
}
if (eneispif_info->dev->erase_cmd == 0x00)
return ERROR_FLASH_OPER_UNSUPPORTED;
for (unsigned int sector = first; sector <= last; sector++) {
retval = eneispi_erase_sector(bank, sector);
if (retval != ERROR_OK)
break;
}
return retval;
}
static int eneispif_protect(struct flash_bank *bank, int set, unsigned int first, unsigned int last)
{
for (unsigned int sector = first; sector <= last; sector++)
bank->sectors[sector].is_protected = set;
return ERROR_OK;
}
static int eneispif_write(struct flash_bank *bank, const uint8_t *buffer, uint32_t offset,
uint32_t count)
{
struct target *target = bank->target;
struct eneispif_flash_bank *eneispif_info = bank->driver_priv;
uint32_t page_size;
uint32_t conf;
int retval = ERROR_OK;
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");
return ERROR_TARGET_NOT_HALTED;
}
if (offset + count > eneispif_info->dev->size_in_bytes) {
LOG_WARNING("Write past end of flash. Extra data discarded.");
count = eneispif_info->dev->size_in_bytes - offset;
}
/* Check sector protection */
for (unsigned int sector = 0; sector < bank->num_sectors; sector++) {
/* Start offset in or before this sector? */
/* End offset in or behind this sector? */
if ((offset < (bank->sectors[sector].offset + bank->sectors[sector].size)) &&
((offset + count - 1) >= bank->sectors[sector].offset) &&
bank->sectors[sector].is_protected) {
LOG_ERROR("Flash sector %u protected", sector);
return ERROR_FAIL;
}
}
retval = eneispif_read_reg(bank, &conf, ISPICFG);
if (retval != ERROR_OK)
return retval;
eneispif_write_reg(bank, ISPICFG, CFG_WRITE); // Cmmmand enable
/* If no valid page_size, use reasonable default. */
page_size =
eneispif_info->dev->pagesize ? eneispif_info->dev->pagesize : SPIFLASH_DEF_PAGESIZE;
uint32_t page_offset = offset % page_size;
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;
eneispif_write_reg(bank, ISPICMD, SPIFLASH_WRITE_ENABLE); /* Write enable */
target_write_buffer(target, eneispif_info->ctrl_base + ISPIDAT, cur_count, buffer);
eneispif_write_reg(bank, ISPIADDR, offset);
retval = eneispif_write_reg(bank, ISPICMD,
(cur_count << 16) | eneispif_info->dev->pprog_cmd);
if (retval != ERROR_OK)
goto err;
page_offset = 0;
buffer += cur_count;
offset += cur_count;
count -= cur_count;
retval = eneispif_wait(bank);
if (retval != ERROR_OK)
goto err;
}
err:
eneispif_write_reg(bank, ISPICFG, conf); /* restore */
return retval;
}
/* Return ID of flash device */
/* On exit, SW mode is kept */
static int eneispif_read_flash_id(struct flash_bank *bank, uint32_t *id)
{
struct eneispif_flash_bank *eneispif_info = bank->driver_priv;
struct target *target = bank->target;
int retval;
uint32_t conf, value;
uint8_t buffer[4];
if (target->state != TARGET_HALTED) {
LOG_ERROR("Target not halted");
return ERROR_TARGET_NOT_HALTED;
}
retval = eneispif_read_reg(bank, &conf, ISPICFG);
if (retval != ERROR_OK)
return retval;
LOG_DEBUG("ISPCFG = (0x%08" PRIx32 ")", conf);
/* read ID from Receive Register */
eneispif_write_reg(bank, ISPICFG, CFG_WRITE); /* Cmmmand enable */
retval = eneispif_write_reg(bank, ISPICMD, (3 << 16) | SPIFLASH_READ_ID);
if (retval != ERROR_OK)
goto done;
retval = eneispif_wait(bank);
if (retval != ERROR_OK)
goto done;
retval = target_read_buffer(target, eneispif_info->ctrl_base + ISPIDAT, 3, buffer);
if (retval != ERROR_OK)
goto done;
value = (buffer[2] << 16) | (buffer[1] << 8) | buffer[0];
LOG_DEBUG("ISPDAT = (0x%08" PRIx32 ")", value);
*id = value;
done:
eneispif_write_reg(bank, ISPICFG, conf); // restore
return retval;
}
static int eneispif_probe(struct flash_bank *bank)
{
struct eneispif_flash_bank *eneispif_info = bank->driver_priv;
struct flash_sector *sectors;
uint32_t id;
int retval;
uint32_t sectorsize;
if (eneispif_info->probed)
free(bank->sectors);
eneispif_info->probed = false;
LOG_INFO("Assuming ISPI flash at address " TARGET_ADDR_FMT
" with controller at " TARGET_ADDR_FMT,
bank->base, eneispif_info->ctrl_base);
eneispif_write_reg(bank, ISPICFG, CFG_READ); /* RAM map enable */
retval = eneispif_read_flash_id(bank, &id);
if (retval != ERROR_OK)
return retval;
eneispif_info->dev_id = id;
eneispif_info->dev = &ene_flash_device;
LOG_INFO("Found flash device \'%s\' (ID 0x%08" PRIx32 ")", eneispif_info->dev->name,
eneispif_info->dev_id);
/* Set correct size value */
bank->size = eneispif_info->dev->size_in_bytes;
if (bank->size <= (1UL << 16))
LOG_WARNING("device needs 2-byte addresses - not implemented");
/* if no sectors, treat whole bank as single sector */
sectorsize = eneispif_info->dev->sectorsize ? eneispif_info->dev->sectorsize
: eneispif_info->dev->size_in_bytes;
/* create and fill sectors array */
bank->num_sectors = eneispif_info->dev->size_in_bytes / sectorsize;
sectors = malloc(sizeof(struct flash_sector) * bank->num_sectors);
if (!sectors) {
LOG_ERROR("not enough memory");
return ERROR_FAIL;
}
for (unsigned int sector = 0; sector < bank->num_sectors; sector++) {
sectors[sector].offset = sector * sectorsize;
sectors[sector].size = sectorsize;
sectors[sector].is_erased = -1;
sectors[sector].is_protected = 0;
}
bank->sectors = sectors;
eneispif_info->probed = true;
return ERROR_OK;
}
static int eneispif_auto_probe(struct flash_bank *bank)
{
struct eneispif_flash_bank *eneispif_info = bank->driver_priv;
if (eneispif_info->probed)
return ERROR_OK;
return eneispif_probe(bank);
}
static int eneispif_protect_check(struct flash_bank *bank)
{
/* Nothing to do. Protection is only handled in SW. */
return ERROR_OK;
}
static int get_eneispif_info(struct flash_bank *bank, struct command_invocation *cmd)
{
struct eneispif_flash_bank *eneispif_info = bank->driver_priv;
if (!(eneispif_info->probed)) {
command_print(cmd, "ENE ISPI flash bank not probed yet.");
return ERROR_OK;
}
command_print(cmd,
"ENE ISPI flash information:\n"
" Device \'%s\' (ID 0x%08" PRIx32 ")",
eneispif_info->dev->name, eneispif_info->dev_id);
return ERROR_OK;
}
const struct flash_driver eneispif_flash = {
.name = "eneispif",
.usage = "flash bank <name> 'eneispif' <base_address> <size> 0 0 <target> <ctrl_base>",
.flash_bank_command = eneispif_flash_bank_command,
.erase = eneispif_erase,
.protect = eneispif_protect,
.write = eneispif_write,
.read = default_flash_read,
.probe = eneispif_probe,
.auto_probe = eneispif_auto_probe,
.erase_check = default_flash_blank_check,
.protect_check = eneispif_protect_check,
.info = get_eneispif_info,
.free_driver_priv = default_flash_free_driver_priv,
};

View File

@ -531,7 +531,7 @@ static int fespi_write(struct flash_bank *bank, const uint8_t *buffer,
bin_size = sizeof(riscv64_bin); bin_size = sizeof(riscv64_bin);
} }
unsigned data_wa_size = 0; unsigned int data_wa_size = 0;
if (target_alloc_working_area(target, bin_size, &algorithm_wa) == ERROR_OK) { if (target_alloc_working_area(target, bin_size, &algorithm_wa) == ERROR_OK) {
retval = target_write_buffer(target, algorithm_wa->address, retval = target_write_buffer(target, algorithm_wa->address,
bin_size, bin); bin_size, bin);

View File

@ -107,7 +107,7 @@ static int fm4_flash_erase(struct flash_bank *bank, unsigned int first,
struct working_area *workarea; struct working_area *workarea;
struct reg_param reg_params[4]; struct reg_param reg_params[4];
struct armv7m_algorithm armv7m_algo; struct armv7m_algorithm armv7m_algo;
unsigned i; unsigned int i;
int retval; int retval;
const uint8_t erase_sector_code[] = { const uint8_t erase_sector_code[] = {
#include "../../../contrib/loaders/flash/fm4/erase.inc" #include "../../../contrib/loaders/flash/fm4/erase.inc"
@ -207,7 +207,7 @@ static int fm4_flash_write(struct flash_bank *bank, const uint8_t *buffer,
struct armv7m_algorithm armv7m_algo; struct armv7m_algorithm armv7m_algo;
uint32_t halfword_count = DIV_ROUND_UP(byte_count, 2); uint32_t halfword_count = DIV_ROUND_UP(byte_count, 2);
uint32_t result; uint32_t result;
unsigned i; unsigned int i;
int retval, retval2 = ERROR_OK; int retval, retval2 = ERROR_OK;
const uint8_t write_block_code[] = { const uint8_t write_block_code[] = {
#include "../../../contrib/loaders/flash/fm4/write.inc" #include "../../../contrib/loaders/flash/fm4/write.inc"

View File

@ -256,7 +256,7 @@
struct kinetis_flash_bank { struct kinetis_flash_bank {
struct kinetis_chip *k_chip; struct kinetis_chip *k_chip;
bool probed; bool probed;
unsigned bank_number; /* bank number in particular chip */ unsigned int bank_number; /* bank number in particular chip */
struct flash_bank *bank; struct flash_bank *bank;
uint32_t sector_size; uint32_t sector_size;
@ -285,9 +285,9 @@ struct kinetis_chip {
uint32_t fcfg2_maxaddr0_shifted; uint32_t fcfg2_maxaddr0_shifted;
uint32_t fcfg2_maxaddr1_shifted; uint32_t fcfg2_maxaddr1_shifted;
unsigned num_pflash_blocks, num_nvm_blocks; unsigned int num_pflash_blocks, num_nvm_blocks;
unsigned pflash_sector_size, nvm_sector_size; unsigned int pflash_sector_size, nvm_sector_size;
unsigned max_flash_prog_size; unsigned int max_flash_prog_size;
uint32_t pflash_base; uint32_t pflash_base;
uint32_t pflash_size; uint32_t pflash_size;
@ -337,7 +337,7 @@ struct kinetis_chip {
char name[40]; char name[40];
unsigned num_banks; unsigned int num_banks;
struct kinetis_flash_bank banks[KINETIS_MAX_BANKS]; struct kinetis_flash_bank banks[KINETIS_MAX_BANKS];
}; };
@ -425,7 +425,7 @@ static int kinetis_probe_chip_s32k(struct kinetis_chip *k_chip);
static int kinetis_auto_probe(struct flash_bank *bank); static int kinetis_auto_probe(struct flash_bank *bank);
static int kinetis_mdm_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value) static int kinetis_mdm_write_register(struct adiv5_dap *dap, unsigned int reg, uint32_t value)
{ {
LOG_DEBUG("MDM_REG[0x%02x] <- %08" PRIX32, reg, value); LOG_DEBUG("MDM_REG[0x%02x] <- %08" PRIX32, reg, value);
@ -453,7 +453,7 @@ static int kinetis_mdm_write_register(struct adiv5_dap *dap, unsigned reg, uint3
return ERROR_OK; return ERROR_OK;
} }
static int kinetis_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *result) static int kinetis_mdm_read_register(struct adiv5_dap *dap, unsigned int reg, uint32_t *result)
{ {
struct adiv5_ap *ap = dap_get_ap(dap, MDM_AP); struct adiv5_ap *ap = dap_get_ap(dap, MDM_AP);
if (!ap) { if (!ap) {
@ -479,7 +479,7 @@ static int kinetis_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uint32
return ERROR_OK; return ERROR_OK;
} }
static int kinetis_mdm_poll_register(struct adiv5_dap *dap, unsigned reg, static int kinetis_mdm_poll_register(struct adiv5_dap *dap, unsigned int reg,
uint32_t mask, uint32_t value, uint32_t timeout_ms) uint32_t mask, uint32_t value, uint32_t timeout_ms)
{ {
uint32_t val; uint32_t val;
@ -930,7 +930,7 @@ FLASH_BANK_COMMAND_HANDLER(kinetis_flash_bank_command)
k_chip = kinetis_get_chip(target); k_chip = kinetis_get_chip(target);
if (!k_chip) { if (!k_chip) {
k_chip = calloc(sizeof(struct kinetis_chip), 1); k_chip = calloc(1, sizeof(struct kinetis_chip));
if (!k_chip) { if (!k_chip) {
LOG_ERROR("No memory"); LOG_ERROR("No memory");
return ERROR_FAIL; return ERROR_FAIL;
@ -977,7 +977,7 @@ static void kinetis_free_driver_priv(struct flash_bank *bank)
static int kinetis_create_missing_banks(struct kinetis_chip *k_chip) static int kinetis_create_missing_banks(struct kinetis_chip *k_chip)
{ {
unsigned num_blocks; unsigned int num_blocks;
struct kinetis_flash_bank *k_bank; struct kinetis_flash_bank *k_bank;
struct flash_bank *bank; struct flash_bank *bank;
char base_name[69], name[87], num[11]; char base_name[69], name[87], num[11];
@ -1031,13 +1031,14 @@ static int kinetis_create_missing_banks(struct kinetis_chip *k_chip)
bank_idx - k_chip->num_pflash_blocks); bank_idx - k_chip->num_pflash_blocks);
} }
bank = calloc(sizeof(struct flash_bank), 1); bank = calloc(1, sizeof(struct flash_bank));
if (!bank) if (!bank)
return ERROR_FAIL; return ERROR_FAIL;
bank->target = k_chip->target; bank->target = k_chip->target;
bank->driver = &kinetis_flash; bank->driver = &kinetis_flash;
bank->default_padded_value = bank->erased_value = 0xff; bank->default_padded_value = bank->erased_value = 0xff;
bank->minimal_write_gap = FLASH_WRITE_GAP_SECTOR;
snprintf(name, sizeof(name), "%s.%s%s", snprintf(name, sizeof(name), "%s.%s%s",
base_name, class, num); base_name, class, num);
@ -1462,7 +1463,7 @@ static int kinetis_fill_fcf(struct flash_bank *bank, uint8_t *fcf)
uint32_t fprot = 0xffffffff; uint32_t fprot = 0xffffffff;
uint8_t fsec = 0xfe; /* set MCU unsecure */ uint8_t fsec = 0xfe; /* set MCU unsecure */
uint8_t fdprot = 0xff; uint8_t fdprot = 0xff;
unsigned num_blocks; unsigned int num_blocks;
uint32_t pflash_bit; uint32_t pflash_bit;
uint8_t dflash_bit; uint8_t dflash_bit;
struct flash_bank *bank_iter; struct flash_bank *bank_iter;
@ -1488,7 +1489,22 @@ static int kinetis_fill_fcf(struct flash_bank *bank, uint8_t *fcf)
kinetis_auto_probe(bank_iter); kinetis_auto_probe(bank_iter);
assert(bank_iter->prot_blocks); if (bank_iter->num_prot_blocks == 0) {
if (k_bank->flash_class == FC_PFLASH) {
LOG_ERROR("BUG: PFLASH bank %u has no protection blocks",
bank_idx);
} else {
LOG_DEBUG("skipping FLEX_NVM bank %u with no prot blocks (EE bkp only)",
bank_idx);
}
continue;
}
if (!bank_iter->prot_blocks) {
LOG_ERROR("BUG: bank %u has NULL protection blocks array",
bank_idx);
continue;
}
if (k_bank->flash_class == FC_PFLASH) { if (k_bank->flash_class == FC_PFLASH) {
for (unsigned int i = 0; i < bank_iter->num_prot_blocks; i++) { for (unsigned int i = 0; i < bank_iter->num_prot_blocks; i++) {
@ -2268,12 +2284,12 @@ static int kinetis_probe_chip(struct kinetis_chip *k_chip)
uint32_t ee_size = 0; uint32_t ee_size = 0;
uint32_t pflash_size_k, nvm_size_k, dflash_size_k; uint32_t pflash_size_k, nvm_size_k, dflash_size_k;
uint32_t pflash_size_m; uint32_t pflash_size_m;
unsigned num_blocks = 0; unsigned int num_blocks = 0;
unsigned maxaddr_shift = 13; unsigned int maxaddr_shift = 13;
struct target *target = k_chip->target; struct target *target = k_chip->target;
unsigned familyid = 0, subfamid = 0; unsigned int familyid = 0, subfamid = 0;
unsigned cpu_mhz = 120; unsigned int cpu_mhz = 120;
bool use_nvm_marking = false; bool use_nvm_marking = false;
char flash_marking[12], nvm_marking[2]; char flash_marking[12], nvm_marking[2];
char name[40]; char name[40];
@ -2894,7 +2910,7 @@ static int kinetis_probe(struct flash_bank *bank)
{ {
int result; int result;
uint8_t fcfg2_maxaddr0, fcfg2_pflsh, fcfg2_maxaddr1; uint8_t fcfg2_maxaddr0, fcfg2_pflsh, fcfg2_maxaddr1;
unsigned num_blocks, first_nvm_bank; unsigned int num_blocks, first_nvm_bank;
uint32_t size_k; uint32_t size_k;
struct kinetis_flash_bank *k_bank = bank->driver_priv; struct kinetis_flash_bank *k_bank = bank->driver_priv;
struct kinetis_chip *k_chip; struct kinetis_chip *k_chip;
@ -2939,7 +2955,7 @@ static int kinetis_probe(struct flash_bank *bank)
} else if (k_bank->bank_number < num_blocks) { } else if (k_bank->bank_number < num_blocks) {
/* nvm, banks start at address 0x10000000 */ /* nvm, banks start at address 0x10000000 */
unsigned nvm_ord = k_bank->bank_number - first_nvm_bank; unsigned int nvm_ord = k_bank->bank_number - first_nvm_bank;
uint32_t limit; uint32_t limit;
k_bank->flash_class = FC_FLEX_NVM; k_bank->flash_class = FC_FLEX_NVM;
@ -3138,8 +3154,8 @@ static int kinetis_blank_check(struct flash_bank *bank)
COMMAND_HANDLER(kinetis_nvm_partition) COMMAND_HANDLER(kinetis_nvm_partition)
{ {
int result; int result;
unsigned bank_idx; unsigned int bank_idx;
unsigned num_blocks, first_nvm_bank; unsigned int num_blocks, first_nvm_bank;
unsigned long par, log2 = 0, ee1 = 0, ee2 = 0; unsigned long par, log2 = 0, ee1 = 0, ee2 = 0;
enum { SHOW_INFO, DF_SIZE, EEBKP_SIZE } sz_type = SHOW_INFO; enum { SHOW_INFO, DF_SIZE, EEBKP_SIZE } sz_type = SHOW_INFO;
bool enable; bool enable;

View File

@ -134,7 +134,7 @@ struct kinetis_ke_flash_bank {
#define MDM_ACCESS_TIMEOUT 3000 /* iterations */ #define MDM_ACCESS_TIMEOUT 3000 /* iterations */
static int kinetis_ke_mdm_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value) static int kinetis_ke_mdm_write_register(struct adiv5_dap *dap, unsigned int reg, uint32_t value)
{ {
LOG_DEBUG("MDM_REG[0x%02x] <- %08" PRIX32, reg, value); LOG_DEBUG("MDM_REG[0x%02x] <- %08" PRIX32, reg, value);
@ -161,7 +161,7 @@ static int kinetis_ke_mdm_write_register(struct adiv5_dap *dap, unsigned reg, ui
return ERROR_OK; return ERROR_OK;
} }
static int kinetis_ke_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *result) static int kinetis_ke_mdm_read_register(struct adiv5_dap *dap, unsigned int reg, uint32_t *result)
{ {
struct adiv5_ap *ap = dap_get_ap(dap, 1); struct adiv5_ap *ap = dap_get_ap(dap, 1);
if (!ap) { if (!ap) {
@ -187,7 +187,7 @@ static int kinetis_ke_mdm_read_register(struct adiv5_dap *dap, unsigned reg, uin
return ERROR_OK; return ERROR_OK;
} }
static int kinetis_ke_mdm_poll_register(struct adiv5_dap *dap, unsigned reg, uint32_t mask, uint32_t value) static int kinetis_ke_mdm_poll_register(struct adiv5_dap *dap, unsigned int reg, uint32_t mask, uint32_t value)
{ {
uint32_t val; uint32_t val;
int retval; int retval;

View File

@ -272,7 +272,7 @@
#define LPC11XX_REG_SECTORS 24 #define LPC11XX_REG_SECTORS 24
typedef enum { enum lpc2000_variant {
LPC2000_V1, LPC2000_V1,
LPC2000_V2, LPC2000_V2,
LPC1700, LPC1700,
@ -282,10 +282,10 @@ typedef enum {
LPC1500, LPC1500,
LPC54100, LPC54100,
LPC_AUTO, LPC_AUTO,
} lpc2000_variant; };
struct lpc2000_flash_bank { struct lpc2000_flash_bank {
lpc2000_variant variant; enum lpc2000_variant variant;
uint32_t cclk; uint32_t cclk;
int cmd51_dst_boundary; int cmd51_dst_boundary;
int calc_checksum; int calc_checksum;

View File

@ -87,7 +87,7 @@ FLASH_BANK_COMMAND_HANDLER(max32xxx_flash_bank_command)
return ERROR_FLASH_BANK_INVALID; return ERROR_FLASH_BANK_INVALID;
} }
info = calloc(sizeof(struct max32xxx_flash_bank), 1); info = calloc(1, sizeof(struct max32xxx_flash_bank));
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[2], info->flash_size); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[2], info->flash_size);
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[6], info->flc_base); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[6], info->flc_base);
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[7], info->sector_size); COMMAND_PARSE_NUMBER(uint, CMD_ARGV[7], info->sector_size);
@ -202,14 +202,14 @@ static int max32xxx_protect_check(struct flash_bank *bank)
return ERROR_FLASH_BANK_NOT_PROBED; return ERROR_FLASH_BANK_NOT_PROBED;
if (!info->max326xx) { if (!info->max326xx) {
for (unsigned i = 0; i < bank->num_sectors; i++) for (unsigned int i = 0; i < bank->num_sectors; i++)
bank->sectors[i].is_protected = -1; bank->sectors[i].is_protected = -1;
return ERROR_FLASH_OPER_UNSUPPORTED; return ERROR_FLASH_OPER_UNSUPPORTED;
} }
/* Check the protection */ /* Check the protection */
for (unsigned i = 0; i < bank->num_sectors; i++) { for (unsigned int i = 0; i < bank->num_sectors; i++) {
if (i%32 == 0) if (i%32 == 0)
target_read_u32(target, info->flc_base + FLSH_PROT + ((i/32)*4), &temp_reg); target_read_u32(target, info->flc_base + FLSH_PROT + ((i/32)*4), &temp_reg);
@ -360,7 +360,7 @@ static int max32xxx_write_block(struct flash_bank *bank, const uint8_t *buffer,
struct armv7m_algorithm armv7m_info; struct armv7m_algorithm armv7m_info;
int retval = ERROR_OK; int retval = ERROR_OK;
/* power of two, and multiple of word size */ /* power of two, and multiple of word size */
static const unsigned buf_min = 128; static const unsigned int buf_min = 128;
/* for small buffers it's faster not to download an algorithm */ /* for small buffers it's faster not to download an algorithm */
if (wcount * 4 < buf_min) if (wcount * 4 < buf_min)
@ -388,8 +388,8 @@ static int max32xxx_write_block(struct flash_bank *bank, const uint8_t *buffer,
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
} }
LOG_DEBUG("retry target_alloc_working_area(%s, size=%u)", LOG_DEBUG("retry target_alloc_working_area(%s, size=%" PRIu32 ")",
target_name(target), (unsigned) buffer_size); target_name(target), buffer_size);
} }
target_write_buffer(target, write_algorithm->address, sizeof(write_code), target_write_buffer(target, write_algorithm->address, sizeof(write_code),
@ -903,7 +903,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_check_command)
} }
LOG_WARNING("s:<sector number> a:<address> p:<protection bit>"); LOG_WARNING("s:<sector number> a:<address> p:<protection bit>");
for (unsigned i = 0; i < bank->num_sectors; i += 4) { for (unsigned int i = 0; i < bank->num_sectors; i += 4) {
LOG_WARNING("s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d", LOG_WARNING("s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d | s:%03d a:0x%06x p:%d",
(i+0), (i+0)*info->sector_size, bank->sectors[(i+0)].is_protected, (i+0), (i+0)*info->sector_size, bank->sectors[(i+0)].is_protected,
(i+1), (i+1)*info->sector_size, bank->sectors[(i+1)].is_protected, (i+1), (i+1)*info->sector_size, bank->sectors[(i+1)].is_protected,

View File

@ -937,7 +937,7 @@ static int msp432_probe(struct flash_bank *bank)
if (is_main && MSP432P4 == msp432_bank->family_type) { if (is_main && MSP432P4 == msp432_bank->family_type) {
/* Create the info flash bank needed by MSP432P4 variants */ /* Create the info flash bank needed by MSP432P4 variants */
struct flash_bank *info = calloc(sizeof(struct flash_bank), 1); struct flash_bank *info = calloc(1, sizeof(struct flash_bank));
if (!info) if (!info)
return ERROR_FAIL; return ERROR_FAIL;

File diff suppressed because it is too large Load Diff

View File

@ -92,7 +92,7 @@ struct pic32mx_flash_bank {
* DEVID values as per PIC32MX Flash Programming Specification Rev N * DEVID values as per PIC32MX Flash Programming Specification Rev N
*/ */
static const struct pic32mx_devs_s { static const struct pic32mx_devs {
uint32_t devid; uint32_t devid;
const char *name; const char *name;
} pic32mx_devs[] = { } pic32mx_devs[] = {

View File

@ -102,10 +102,10 @@
struct psoc5lp_device { struct psoc5lp_device {
uint32_t id; uint32_t id;
unsigned fam; unsigned int fam;
unsigned speed_mhz; unsigned int speed_mhz;
unsigned flash_kb; unsigned int flash_kb;
unsigned eeprom_kb; unsigned int eeprom_kb;
}; };
/* /*
@ -245,7 +245,7 @@ static int psoc5lp_find_device(struct target *target,
const struct psoc5lp_device **device) const struct psoc5lp_device **device)
{ {
uint32_t device_id; uint32_t device_id;
unsigned i; unsigned int i;
int retval; int retval;
*device = NULL; *device = NULL;
@ -381,9 +381,9 @@ static int psoc5lp_spc_load_byte(struct target *target,
} }
static int psoc5lp_spc_load_row(struct target *target, static int psoc5lp_spc_load_row(struct target *target,
uint8_t array_id, const uint8_t *data, unsigned row_size) uint8_t array_id, const uint8_t *data, unsigned int row_size)
{ {
unsigned i; unsigned int i;
int retval; int retval;
retval = psoc5lp_spc_write_opcode(target, SPC_LOAD_ROW); retval = psoc5lp_spc_write_opcode(target, SPC_LOAD_ROW);
@ -853,7 +853,7 @@ static int psoc5lp_eeprom_write(struct flash_bank *bank,
{ {
struct target *target = bank->target; struct target *target = bank->target;
uint8_t temp[2]; uint8_t temp[2];
unsigned row; unsigned int row;
int retval; int retval;
if (offset % EEPROM_ROW_SIZE != 0) { if (offset % EEPROM_ROW_SIZE != 0) {
@ -1124,7 +1124,7 @@ static int psoc5lp_write(struct flash_bank *bank, const uint8_t *buffer,
struct working_area *code_area, *even_row_area, *odd_row_area; struct working_area *code_area, *even_row_area, *odd_row_area;
uint32_t row_size; uint32_t row_size;
uint8_t temp[2], buf[12], ecc_bytes[ROW_ECC_SIZE]; uint8_t temp[2], buf[12], ecc_bytes[ROW_ECC_SIZE];
unsigned array_id, row; unsigned int array_id, row;
int i, retval; int i, retval;
if (offset + byte_count > bank->size) { if (offset + byte_count > bank->size) {
@ -1183,7 +1183,7 @@ static int psoc5lp_write(struct flash_bank *bank, const uint8_t *buffer,
row < ROWS_PER_BLOCK && byte_count > 0; row++) { row < ROWS_PER_BLOCK && byte_count > 0; row++) {
bool even_row = (row % 2 == 0); bool even_row = (row % 2 == 0);
struct working_area *data_area = even_row ? even_row_area : odd_row_area; struct working_area *data_area = even_row ? even_row_area : odd_row_area;
unsigned len = MIN(ROW_SIZE, byte_count); unsigned int len = MIN(ROW_SIZE, byte_count);
LOG_DEBUG("Writing load command for array %u row %u at " TARGET_ADDR_FMT, LOG_DEBUG("Writing load command for array %u row %u at " TARGET_ADDR_FMT,
array_id, row, data_area->address); array_id, row, data_area->address);
@ -1307,8 +1307,8 @@ static int psoc5lp_protect_check(struct flash_bank *bank)
{ {
struct psoc5lp_flash_bank *psoc_bank = bank->driver_priv; struct psoc5lp_flash_bank *psoc_bank = bank->driver_priv;
uint8_t row_data[ROW_SIZE]; uint8_t row_data[ROW_SIZE];
const unsigned protection_bytes_per_sector = ROWS_PER_SECTOR * 2 / 8; const unsigned int protection_bytes_per_sector = ROWS_PER_SECTOR * 2 / 8;
unsigned i, k, num_sectors; unsigned int i, k, num_sectors;
int retval; int retval;
if (bank->target->state != TARGET_HALTED) { if (bank->target->state != TARGET_HALTED) {

View File

@ -18,7 +18,6 @@
#include "target/target.h" #include "target/target.h"
#include "target/cortex_m.h" #include "target/cortex_m.h"
#include "target/breakpoints.h" #include "target/breakpoints.h"
#include "target/target_type.h"
#include "target/algorithm.h" #include "target/algorithm.h"
/************************************************************************************************** /**************************************************************************************************
@ -224,6 +223,8 @@ static int ipc_poll_lock_stat(struct target *target, uint32_t ipc_id, bool lock_
{ {
int hr; int hr;
uint32_t reg_val; uint32_t reg_val;
struct armv7m_common *armv7m = target_to_armv7m(target);
bool is_cm0 = (armv7m->arm.arch == ARM_ARCH_V6M);
struct timeout to; struct timeout to;
timeout_init(&to, IPC_TIMEOUT_MS); timeout_init(&to, IPC_TIMEOUT_MS);
@ -245,7 +246,7 @@ static int ipc_poll_lock_stat(struct target *target, uint32_t ipc_id, bool lock_
return ERROR_OK; return ERROR_OK;
} }
if (target->coreid) { if (!is_cm0) {
LOG_WARNING("SROM API calls via CM4 target are supported on single-core PSoC6 devices only. " LOG_WARNING("SROM API calls via CM4 target are supported on single-core PSoC6 devices only. "
"Please perform all Flash-related operations via CM0+ target on dual-core devices."); "Please perform all Flash-related operations via CM0+ target on dual-core devices.");
} }
@ -486,7 +487,7 @@ static int psoc6_get_info(struct flash_bank *bank, struct command_invocation *cm
{ {
struct psoc6_target_info *psoc6_info = bank->driver_priv; struct psoc6_target_info *psoc6_info = bank->driver_priv;
if (psoc6_info->is_probed == false) if (!psoc6_info->is_probed)
return ERROR_FAIL; return ERROR_FAIL;
int hr = get_silicon_id(bank->target, &psoc6_info->silicon_id, &psoc6_info->protection); int hr = get_silicon_id(bank->target, &psoc6_info->silicon_id, &psoc6_info->protection);
@ -887,7 +888,8 @@ static int handle_reset_halt(struct target *target)
{ {
int hr; int hr;
uint32_t reset_addr; uint32_t reset_addr;
bool is_cm0 = (target->coreid == 0); struct armv7m_common *armv7m = target_to_armv7m(target);
bool is_cm0 = (armv7m->arm.arch == ARM_ARCH_V6M);
/* Halt target device */ /* Halt target device */
if (target->state != TARGET_HALTED) { if (target->state != TARGET_HALTED) {

View File

@ -12,7 +12,6 @@
#include "spi.h" #include "spi.h"
#include "sfdp.h" #include "sfdp.h"
#define SFDP_MAGIC 0x50444653
#define SFDP_ACCESS_PROT 0xFF #define SFDP_ACCESS_PROT 0xFF
#define SFDP_BASIC_FLASH 0xFF00 #define SFDP_BASIC_FLASH 0xFF00
#define SFDP_4BYTE_ADDR 0xFF84 #define SFDP_4BYTE_ADDR 0xFF84
@ -100,11 +99,11 @@ int spi_sfdp(struct flash_bank *bank, struct flash_device *dev,
goto err; goto err;
for (k = 0; k < nph; k++) { for (k = 0; k < nph; k++) {
uint8_t words = (pheaders[k].revision >> 24) & 0xFF; unsigned int words = (pheaders[k].revision >> 24) & 0xFF;
uint16_t id = (((pheaders[k].ptr) >> 16) & 0xFF00) | (pheaders[k].revision & 0xFF); uint16_t id = (((pheaders[k].ptr) >> 16) & 0xFF00) | (pheaders[k].revision & 0xFF);
uint32_t ptr = pheaders[k].ptr & 0xFFFFFF; uint32_t ptr = pheaders[k].ptr & 0xFFFFFF;
LOG_DEBUG("pheader %d len=0x%02" PRIx8 " id=0x%04" PRIx16 LOG_DEBUG("pheader %d len=0x%02x id=0x%04" PRIx16
" ptr=0x%06" PRIx32, k, words, id, ptr); " ptr=0x%06" PRIx32, k, words, id, ptr);
/* retrieve parameter table */ /* retrieve parameter table */

View File

@ -7,6 +7,8 @@
#ifndef OPENOCD_FLASH_NOR_SFDP_H #ifndef OPENOCD_FLASH_NOR_SFDP_H
#define OPENOCD_FLASH_NOR_SFDP_H #define OPENOCD_FLASH_NOR_SFDP_H
#define SFDP_MAGIC 0x50444653
/* per JESD216D 'addr' is *byte* based but must be word aligned, /* per JESD216D 'addr' is *byte* based but must be word aligned,
* 'buffer' is word based, word aligned and always little-endian encoded, * 'buffer' is word based, word aligned and always little-endian encoded,
* in the flash, 'addr_len' is 3 or 4, 'dummy' ***usually*** 8 * in the flash, 'addr_len' is 3 or 4, 'dummy' ***usually*** 8
@ -16,7 +18,7 @@
* *
* buffer contents is supposed to be returned in ***host*** endianness */ * buffer contents is supposed to be returned in ***host*** endianness */
typedef int (*read_sfdp_block_t)(struct flash_bank *bank, uint32_t addr, typedef int (*read_sfdp_block_t)(struct flash_bank *bank, uint32_t addr,
uint32_t words, uint32_t *buffer); unsigned int words, uint32_t *buffer);
extern int spi_sfdp(struct flash_bank *bank, struct flash_device *dev, extern int spi_sfdp(struct flash_bank *bank, struct flash_device *dev,
read_sfdp_block_t read_sfdp_block); read_sfdp_block_t read_sfdp_block);

View File

@ -859,7 +859,7 @@ static int sim3x_flash_info(struct flash_bank *bank, struct command_invocation *
* reg 3:2 - register * reg 3:2 - register
* reg 1:0 - no effect * reg 1:0 - no effect
*/ */
static int ap_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value) static int ap_write_register(struct adiv5_dap *dap, unsigned int reg, uint32_t value)
{ {
LOG_DEBUG("DAP_REG[0x%02x] <- %08" PRIX32, reg, value); LOG_DEBUG("DAP_REG[0x%02x] <- %08" PRIX32, reg, value);
@ -886,7 +886,7 @@ static int ap_write_register(struct adiv5_dap *dap, unsigned reg, uint32_t value
return ERROR_OK; return ERROR_OK;
} }
static int ap_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *result) static int ap_read_register(struct adiv5_dap *dap, unsigned int reg, uint32_t *result)
{ {
struct adiv5_ap *ap = dap_get_ap(dap, SIM3X_AP); struct adiv5_ap *ap = dap_get_ap(dap, SIM3X_AP);
if (!ap) { if (!ap) {
@ -912,7 +912,7 @@ static int ap_read_register(struct adiv5_dap *dap, unsigned reg, uint32_t *resul
return ERROR_OK; return ERROR_OK;
} }
static int ap_poll_register(struct adiv5_dap *dap, unsigned reg, uint32_t mask, uint32_t value, int timeout) static int ap_poll_register(struct adiv5_dap *dap, unsigned int reg, uint32_t mask, uint32_t value, int timeout)
{ {
uint32_t val; uint32_t val;
int retval; int retval;

View File

@ -453,7 +453,7 @@ FLASH_BANK_COMMAND_HANDLER(stellaris_flash_bank_command)
if (CMD_ARGC < 6) if (CMD_ARGC < 6)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
stellaris_info = calloc(sizeof(struct stellaris_flash_bank), 1); stellaris_info = calloc(1, sizeof(struct stellaris_flash_bank));
bank->base = 0x0; bank->base = 0x0;
bank->driver_priv = stellaris_info; bank->driver_priv = stellaris_info;
@ -530,7 +530,7 @@ static void stellaris_set_flash_timing(struct flash_bank *bank)
target_write_u32(target, SCB_BASE | USECRL, usecrl); target_write_u32(target, SCB_BASE | USECRL, usecrl);
} }
static const unsigned rcc_xtal[32] = { static const unsigned int rcc_xtal[32] = {
[0x00] = 1000000, /* no pll */ [0x00] = 1000000, /* no pll */
[0x01] = 1843200, /* no pll */ [0x01] = 1843200, /* no pll */
[0x02] = 2000000, /* no pll */ [0x02] = 2000000, /* no pll */
@ -569,7 +569,7 @@ static void stellaris_read_clock_info(struct flash_bank *bank)
struct stellaris_flash_bank *stellaris_info = bank->driver_priv; struct stellaris_flash_bank *stellaris_info = bank->driver_priv;
struct target *target = bank->target; struct target *target = bank->target;
uint32_t rcc, rcc2, pllcfg, sysdiv, usesysdiv, bypass, oscsrc; uint32_t rcc, rcc2, pllcfg, sysdiv, usesysdiv, bypass, oscsrc;
unsigned xtal; unsigned int xtal;
unsigned long mainfreq; unsigned long mainfreq;
target_read_u32(target, SCB_BASE | RCC, &rcc); target_read_u32(target, SCB_BASE | RCC, &rcc);
@ -1029,7 +1029,7 @@ static int stellaris_write_block(struct flash_bank *bank,
int retval = ERROR_OK; int retval = ERROR_OK;
/* power of two, and multiple of word size */ /* power of two, and multiple of word size */
static const unsigned buf_min = 128; static const unsigned int buf_min = 128;
/* for small buffers it's faster not to download an algorithm */ /* for small buffers it's faster not to download an algorithm */
if (wcount * 4 < buf_min) if (wcount * 4 < buf_min)
@ -1056,8 +1056,8 @@ static int stellaris_write_block(struct flash_bank *bank,
target_free_working_area(target, write_algorithm); target_free_working_area(target, write_algorithm);
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
} }
LOG_DEBUG("retry target_alloc_working_area(%s, size=%u)", LOG_DEBUG("retry target_alloc_working_area(%s, size=%" PRIu32 ")",
target_name(target), (unsigned) buffer_size); target_name(target), buffer_size);
} }
target_write_buffer(target, write_algorithm->address, target_write_buffer(target, write_algorithm->address,

View File

@ -1020,7 +1020,7 @@ static int stm32x_probe(struct flash_bank *bank)
assert(num_sectors > 0); assert(num_sectors > 0);
bank->num_sectors = num_sectors; bank->num_sectors = num_sectors;
bank->sectors = calloc(sizeof(struct flash_sector), num_sectors); bank->sectors = calloc(num_sectors, sizeof(struct flash_sector));
if (stm32x_otp_is_f7(bank)) if (stm32x_otp_is_f7(bank))
bank->size = STM32F7_OTP_SIZE; bank->size = STM32F7_OTP_SIZE;

View File

@ -120,6 +120,18 @@
* http://www.st.com/resource/en/reference_manual/dm00346336.pdf * http://www.st.com/resource/en/reference_manual/dm00346336.pdf
*/ */
/* STM32U0xxx series for reference.
*
* RM0503 (STM32U0xx)
* https://www.st.com/resource/en/reference_manual/rm0503-stm32u0-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf
*/
/* STM32U5xxx series for reference.
*
* RM0456 (STM32U5xx)
* http://www.st.com/resource/en/reference_manual/dm00477635.pdf
*/
/* Erase time can be as high as 25ms, 10x this and assume it's toast... */ /* Erase time can be as high as 25ms, 10x this and assume it's toast... */
#define FLASH_ERASE_TIMEOUT 250 #define FLASH_ERASE_TIMEOUT 250
@ -272,7 +284,7 @@ struct stm32l4_wrp {
}; };
/* human readable list of families this drivers supports (sorted alphabetically) */ /* human readable list of families this drivers supports (sorted alphabetically) */
static const char *device_families = "STM32C0/G0/G4/L4/L4+/L5/U5/WB/WL"; static const char *device_families = "STM32C0/G0/G4/L4/L4+/L5/U0/U5/WB/WL";
static const struct stm32l4_rev stm32l47_l48xx_revs[] = { static const struct stm32l4_rev stm32l47_l48xx_revs[] = {
{ 0x1000, "1" }, { 0x1001, "2" }, { 0x1003, "3" }, { 0x1007, "4" } { 0x1000, "1" }, { 0x1001, "2" }, { 0x1003, "3" }, { 0x1007, "4" }
@ -291,6 +303,10 @@ static const struct stm32l4_rev stm32c03xx_revs[] = {
{ 0x1000, "A" }, { 0x1001, "Z" }, { 0x1000, "A" }, { 0x1001, "Z" },
}; };
static const struct stm32l4_rev stm32c071xx_revs[] = {
{ 0x1001, "Z" },
};
static const struct stm32l4_rev stm32g05_g06xx_revs[] = { static const struct stm32l4_rev stm32g05_g06xx_revs[] = {
{ 0x1000, "A" }, { 0x1000, "A" },
}; };
@ -319,6 +335,10 @@ static const struct stm32l4_rev stm32g0b_g0cxx_revs[] = {
{ 0x1000, "A" }, { 0x1000, "A" },
}; };
static const struct stm32l4_rev stm32u0xx_revs[] = {
{ 0x1000, "A" },
};
static const struct stm32l4_rev stm32g43_g44xx_revs[] = { static const struct stm32l4_rev stm32g43_g44xx_revs[] = {
{ 0x1000, "A" }, { 0x2000, "B" }, { 0x2001, "Z" }, { 0x1000, "A" }, { 0x2000, "B" }, { 0x2001, "Z" },
}; };
@ -344,9 +364,17 @@ static const struct stm32l4_rev stm32g49_g4axx_revs[] = {
{ 0x1000, "A" }, { 0x1000, "A" },
}; };
static const struct stm32l4_rev stm32u53_u54xx_revs[] = {
{ 0x1000, "A" }, { 0x1001, "Z" },
};
static const struct stm32l4_rev stm32u57_u58xx_revs[] = { static const struct stm32l4_rev stm32u57_u58xx_revs[] = {
{ 0x1000, "A" }, { 0x1001, "Z" }, { 0x1003, "Y" }, { 0x2000, "B" }, { 0x1000, "A" }, { 0x1001, "Z" }, { 0x1003, "Y" }, { 0x2000, "B" },
{ 0x2001, "X" }, { 0x3000, "C" }, { 0x2001, "X" }, { 0x3000, "C" }, { 0x3001, "W" },
};
static const struct stm32l4_rev stm32u59_u5axx_revs[] = {
{ 0x3001, "X" },
}; };
static const struct stm32l4_rev stm32wba5x_revs[] = { static const struct stm32l4_rev stm32wba5x_revs[] = {
@ -418,6 +446,30 @@ static const struct stm32l4_part_info stm32l4_parts[] = {
.otp_base = 0x1FFF7000, .otp_base = 0x1FFF7000,
.otp_size = 1024, .otp_size = 1024,
}, },
{
.id = DEVID_STM32C071XX,
.revs = stm32c071xx_revs,
.num_revs = ARRAY_SIZE(stm32c071xx_revs),
.device_str = "STM32C071xx",
.max_flash_size_kb = 128,
.flags = F_NONE,
.flash_regs_base = 0x40022000,
.fsize_addr = 0x1FFF75A0,
.otp_base = 0x1FFF7000,
.otp_size = 1024,
},
{
.id = DEVID_STM32U53_U54XX,
.revs = stm32u53_u54xx_revs,
.num_revs = ARRAY_SIZE(stm32u53_u54xx_revs),
.device_str = "STM32U535/U545",
.max_flash_size_kb = 512,
.flags = F_HAS_DUAL_BANK | F_QUAD_WORD_PROG | F_HAS_TZ | F_HAS_L5_FLASH_REGS,
.flash_regs_base = 0x40022000,
.fsize_addr = 0x0BFA07A0,
.otp_base = 0x0BFA0000,
.otp_size = 512,
},
{ {
.id = DEVID_STM32G05_G06XX, .id = DEVID_STM32G05_G06XX,
.revs = stm32g05_g06xx_revs, .revs = stm32g05_g06xx_revs,
@ -574,6 +626,42 @@ static const struct stm32l4_part_info stm32l4_parts[] = {
.otp_base = 0x1FFF7000, .otp_base = 0x1FFF7000,
.otp_size = 1024, .otp_size = 1024,
}, },
{
.id = DEVID_STM32U031XX,
.revs = stm32u0xx_revs,
.num_revs = ARRAY_SIZE(stm32u0xx_revs),
.device_str = "STM32U031xx",
.max_flash_size_kb = 64,
.flags = F_NONE,
.flash_regs_base = 0x40022000,
.fsize_addr = 0x1FFF3EA0,
.otp_base = 0x1FFF6800,
.otp_size = 1024,
},
{
.id = DEVID_STM32U073_U083XX,
.revs = stm32u0xx_revs,
.num_revs = ARRAY_SIZE(stm32u0xx_revs),
.device_str = "STM32U073/U083xx",
.max_flash_size_kb = 256,
.flags = F_NONE,
.flash_regs_base = 0x40022000,
.fsize_addr = 0x1FFF6EA0,
.otp_base = 0x1FFF6800,
.otp_size = 1024,
},
{
.id = DEVID_STM32U59_U5AXX,
.revs = stm32u59_u5axx_revs,
.num_revs = ARRAY_SIZE(stm32u59_u5axx_revs),
.device_str = "STM32U59/U5Axx",
.max_flash_size_kb = 4096,
.flags = F_HAS_DUAL_BANK | F_QUAD_WORD_PROG | F_HAS_TZ | F_HAS_L5_FLASH_REGS,
.flash_regs_base = 0x40022000,
.fsize_addr = 0x0BFA07A0,
.otp_base = 0x0BFA0000,
.otp_size = 512,
},
{ {
.id = DEVID_STM32U57_U58XX, .id = DEVID_STM32U57_U58XX,
.revs = stm32u57_u58xx_revs, .revs = stm32u57_u58xx_revs,
@ -679,7 +767,8 @@ struct range {
}; };
static void bitmap_to_ranges(unsigned long *bitmap, unsigned int nbits, static void bitmap_to_ranges(unsigned long *bitmap, unsigned int nbits,
struct range *ranges, unsigned int *ranges_count) { struct range *ranges, unsigned int *ranges_count)
{
*ranges_count = 0; *ranges_count = 0;
bool last_bit = 0, cur_bit; bool last_bit = 0, cur_bit;
for (unsigned int i = 0; i < nbits; i++) { for (unsigned int i = 0; i < nbits; i++) {
@ -1916,8 +2005,11 @@ static int stm32l4_probe(struct flash_bank *bank)
case DEVID_STM32L43_L44XX: case DEVID_STM32L43_L44XX:
case DEVID_STM32C01XX: case DEVID_STM32C01XX:
case DEVID_STM32C03XX: case DEVID_STM32C03XX:
case DEVID_STM32C071XX:
case DEVID_STM32G05_G06XX: case DEVID_STM32G05_G06XX:
case DEVID_STM32G07_G08XX: case DEVID_STM32G07_G08XX:
case DEVID_STM32U031XX:
case DEVID_STM32U073_U083XX:
case DEVID_STM32L45_L46XX: case DEVID_STM32L45_L46XX:
case DEVID_STM32L41_L42XX: case DEVID_STM32L41_L42XX:
case DEVID_STM32G03_G04XX: case DEVID_STM32G03_G04XX:
@ -2000,10 +2092,22 @@ static int stm32l4_probe(struct flash_bank *bank)
stm32l4_info->bank1_sectors = num_pages / 2; stm32l4_info->bank1_sectors = num_pages / 2;
} }
break; break;
case DEVID_STM32U53_U54XX:
case DEVID_STM32U57_U58XX: case DEVID_STM32U57_U58XX:
/* if flash size is max (2M) the device is always dual bank case DEVID_STM32U59_U5AXX:
* otherwise check DUALBANK /* according to RM0456 Rev 4, Chapter 7.3.1 and 7.9.13
* U53x/U54x have 512K max flash size:
* 512K variants are always in DUAL BANK mode
* 256K and 128K variants can be in DUAL BANK mode if FLASH_OPTR:DUALBANK is set
* U57x/U58x have 2M max flash size:
* 2M variants are always in DUAL BANK mode
* 1M variants can be in DUAL BANK mode if FLASH_OPTR:DUALBANK is set
* U59x/U5Ax have 4M max flash size:
* 4M variants are always in DUAL BANK mode
* 2M variants can be in DUAL BANK mode if FLASH_OPTR:DUALBANK is set
* Note: flash banks are always contiguous
*/ */
page_size_kb = 8; page_size_kb = 8;
num_pages = flash_size_kb / page_size_kb; num_pages = flash_size_kb / page_size_kb;
stm32l4_info->bank1_sectors = num_pages; stm32l4_info->bank1_sectors = num_pages;
@ -2572,7 +2676,7 @@ static const struct command_registration stm32l4_exec_command_handlers[] = {
.name = "option_write", .name = "option_write",
.handler = stm32l4_handle_option_write_command, .handler = stm32l4_handle_option_write_command,
.mode = COMMAND_EXEC, .mode = COMMAND_EXEC,
.usage = "bank_id reg_offset value mask", .usage = "bank_id reg_offset value [mask]",
.help = "Write device option bit fields with provided value.", .help = "Write device option bit fields with provided value.",
}, },
{ {

View File

@ -89,7 +89,9 @@
#define DEVID_STM32L43_L44XX 0x435 #define DEVID_STM32L43_L44XX 0x435
#define DEVID_STM32C01XX 0x443 #define DEVID_STM32C01XX 0x443
#define DEVID_STM32C03XX 0x453 #define DEVID_STM32C03XX 0x453
#define DEVID_STM32U53_U54XX 0x455
#define DEVID_STM32G05_G06XX 0x456 #define DEVID_STM32G05_G06XX 0x456
#define DEVID_STM32U031XX 0x459
#define DEVID_STM32G07_G08XX 0x460 #define DEVID_STM32G07_G08XX 0x460
#define DEVID_STM32L49_L4AXX 0x461 #define DEVID_STM32L49_L4AXX 0x461
#define DEVID_STM32L45_L46XX 0x462 #define DEVID_STM32L45_L46XX 0x462
@ -102,8 +104,11 @@
#define DEVID_STM32L4P_L4QXX 0x471 #define DEVID_STM32L4P_L4QXX 0x471
#define DEVID_STM32L55_L56XX 0x472 #define DEVID_STM32L55_L56XX 0x472
#define DEVID_STM32G49_G4AXX 0x479 #define DEVID_STM32G49_G4AXX 0x479
#define DEVID_STM32U59_U5AXX 0x481
#define DEVID_STM32U57_U58XX 0x482 #define DEVID_STM32U57_U58XX 0x482
#define DEVID_STM32U073_U083XX 0x489
#define DEVID_STM32WBA5X 0x492 #define DEVID_STM32WBA5X 0x492
#define DEVID_STM32C071XX 0x493
#define DEVID_STM32WB1XX 0x494 #define DEVID_STM32WB1XX 0x494
#define DEVID_STM32WB5XX 0x495 #define DEVID_STM32WB5XX 0x495
#define DEVID_STM32WB3XX 0x496 #define DEVID_STM32WB3XX 0x496

View File

@ -1807,7 +1807,7 @@ err:
/* Read SFDP parameter block */ /* Read SFDP parameter block */
static int read_sfdp_block(struct flash_bank *bank, uint32_t addr, static int read_sfdp_block(struct flash_bank *bank, uint32_t addr,
uint32_t words, uint32_t *buffer) unsigned int words, uint32_t *buffer)
{ {
struct target *target = bank->target; struct target *target = bank->target;
struct stmqspi_flash_bank *stmqspi_info = bank->driver_priv; struct stmqspi_flash_bank *stmqspi_info = bank->driver_priv;
@ -1848,7 +1848,7 @@ static int read_sfdp_block(struct flash_bank *bank, uint32_t addr,
} }
} }
LOG_DEBUG("%s: addr=0x%08" PRIx32 " words=0x%08" PRIx32 " dummy=%u", LOG_DEBUG("%s: addr=0x%08" PRIx32 " words=0x%08x dummy=%u",
__func__, addr, words, *dummy); __func__, addr, words, *dummy);
/* Abort any previous operation */ /* Abort any previous operation */

View File

@ -68,7 +68,7 @@ static int str9xpec_erase_area(struct flash_bank *bank, unsigned int first,
static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector); static int str9xpec_set_address(struct flash_bank *bank, uint8_t sector);
static int str9xpec_write_options(struct flash_bank *bank); static int str9xpec_write_options(struct flash_bank *bank);
static int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, tap_state_t end_state) static int str9xpec_set_instr(struct jtag_tap *tap, uint32_t new_instr, enum tap_state end_state)
{ {
if (!tap) if (!tap)
return ERROR_TARGET_INVALID; return ERROR_TARGET_INVALID;

View File

@ -36,7 +36,7 @@ COMMAND_HELPER(flash_command_get_bank_probe_optional, unsigned int name_index,
if (*bank) if (*bank)
return ERROR_OK; return ERROR_OK;
unsigned bank_num; unsigned int bank_num;
COMMAND_PARSE_NUMBER(uint, name, bank_num); COMMAND_PARSE_NUMBER(uint, name, bank_num);
if (do_probe) { if (do_probe) {
@ -48,7 +48,7 @@ COMMAND_HELPER(flash_command_get_bank_probe_optional, unsigned int name_index,
} }
} }
COMMAND_HELPER(flash_command_get_bank, unsigned name_index, COMMAND_HELPER(flash_command_get_bank, unsigned int name_index,
struct flash_bank **bank) struct flash_bank **bank)
{ {
return CALL_COMMAND_HANDLER(flash_command_get_bank_probe_optional, return CALL_COMMAND_HANDLER(flash_command_get_bank_probe_optional,
@ -518,7 +518,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
uint64_t pattern; uint64_t pattern;
uint32_t count; uint32_t count;
struct target *target = get_current_target(CMD_CTX); struct target *target = get_current_target(CMD_CTX);
unsigned i; unsigned int i;
uint32_t wordsize; uint32_t wordsize;
int retval; int retval;
@ -1299,6 +1299,7 @@ COMMAND_HANDLER(handle_flash_bank_command)
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
LOG_ERROR("'%s' driver rejected flash bank at " TARGET_ADDR_FMT LOG_ERROR("'%s' driver rejected flash bank at " TARGET_ADDR_FMT
"; usage: %s", driver_name, c->base, driver->usage); "; usage: %s", driver_name, c->base, driver->usage);
free(c->name);
free(c); free(c);
return retval; return retval;
} }
@ -1316,7 +1317,7 @@ COMMAND_HANDLER(handle_flash_banks_command)
if (CMD_ARGC != 0) if (CMD_ARGC != 0)
return ERROR_COMMAND_SYNTAX_ERROR; return ERROR_COMMAND_SYNTAX_ERROR;
unsigned n = 0; unsigned int n = 0;
for (struct flash_bank *p = flash_bank_list(); p; p = p->next, n++) { for (struct flash_bank *p = flash_bank_list(); p; p = p->next, n++) {
command_print(CMD, "#%d : %s (%s) at " TARGET_ADDR_FMT ", size 0x%8.8" PRIx32 ", " command_print(CMD, "#%d : %s (%s) at " TARGET_ADDR_FMT ", size 0x%8.8" PRIx32 ", "
"buswidth %u, chipwidth %u", p->bank_number, "buswidth %u, chipwidth %u", p->bank_number,

View File

@ -16,7 +16,7 @@
* ---------------------------------------------------------------------- */ * ---------------------------------------------------------------------- */
struct tms470_flash_bank { struct tms470_flash_bank {
unsigned ordinal; unsigned int ordinal;
/* device identification register */ /* device identification register */
uint32_t device_ident_reg; uint32_t device_ident_reg;
@ -239,8 +239,8 @@ static int tms470_read_part_info(struct flash_bank *bank)
break; break;
default: default:
LOG_WARNING("Could not identify part 0x%02x as a member of the TMS470 family.", LOG_WARNING("Could not identify part 0x%02" PRIx32 " as a member of the TMS470 family.",
(unsigned)part_number); part_number);
return ERROR_FLASH_OPERATION_FAILED; return ERROR_FLASH_OPERATION_FAILED;
} }
@ -391,7 +391,7 @@ static int tms470_try_flash_keys(struct target *target, const uint32_t *key_set)
/* only perform the key match when 3VSTAT is clear */ /* only perform the key match when 3VSTAT is clear */
target_read_u32(target, 0xFFE8BC0C, &fmmstat); target_read_u32(target, 0xFFE8BC0C, &fmmstat);
if (!(fmmstat & 0x08)) { if (!(fmmstat & 0x08)) {
unsigned i; unsigned int i;
uint32_t fmbptr, fmbac2, orig_fmregopt; uint32_t fmbptr, fmbac2, orig_fmregopt;
target_write_u32(target, 0xFFE8BC04, fmmstat & ~0x07); target_write_u32(target, 0xFFE8BC04, fmmstat & ~0x07);
@ -455,7 +455,7 @@ static int tms470_unlock_flash(struct flash_bank *bank)
{ {
struct target *target = bank->target; struct target *target = bank->target;
const uint32_t *p_key_sets[5]; const uint32_t *p_key_sets[5];
unsigned i, key_set_count; unsigned int i, key_set_count;
if (keys_set) { if (keys_set) {
key_set_count = 5; key_set_count = 5;

View File

@ -130,8 +130,8 @@ static struct xcf_status read_status(struct flash_bank *bank)
jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE); jtag_add_ir_scan(bank->target->tap, &scan, TAP_IDLE);
jtag_execute_queue(); jtag_execute_queue();
ret.isc_error = ((irdata[0] >> 7) & 3) == 0b01; ret.isc_error = ((irdata[0] >> 7) & 3) == 1;
ret.prog_error = ((irdata[0] >> 5) & 3) == 0b01; ret.prog_error = ((irdata[0] >> 5) & 3) == 1;
ret.prog_busy = ((irdata[0] >> 4) & 1) == 0; ret.prog_busy = ((irdata[0] >> 4) & 1) == 0;
ret.isc_mode = ((irdata[0] >> 3) & 1) == 1; ret.isc_mode = ((irdata[0] >> 3) & 1) == 1;
@ -143,9 +143,9 @@ static int isc_enter(struct flash_bank *bank)
struct xcf_status status = read_status(bank); struct xcf_status status = read_status(bank);
if (true == status.isc_mode) if (status.isc_mode)
return ERROR_OK; return ERROR_OK;
else {
struct scan_field scan; struct scan_field scan;
scan.check_mask = NULL; scan.check_mask = NULL;
@ -165,7 +165,6 @@ static int isc_enter(struct flash_bank *bank)
return ERROR_OK; return ERROR_OK;
} }
}
static int isc_leave(struct flash_bank *bank) static int isc_leave(struct flash_bank *bank)
{ {
@ -174,7 +173,7 @@ static int isc_leave(struct flash_bank *bank)
if (!status.isc_mode) if (!status.isc_mode)
return ERROR_OK; return ERROR_OK;
else {
struct scan_field scan; struct scan_field scan;
scan.check_mask = NULL; scan.check_mask = NULL;
@ -195,7 +194,6 @@ static int isc_leave(struct flash_bank *bank)
return ERROR_OK; return ERROR_OK;
} }
}
static int sector_state(uint8_t wrpt, int sector) static int sector_state(uint8_t wrpt, int sector)
{ {
@ -528,7 +526,7 @@ static int isc_program_single_revision_btc(struct flash_bank *bank)
{ {
uint8_t buf[4]; uint8_t buf[4];
uint32_t btc = 0xFFFFFFFF; uint32_t btc = 0xFFFFFFFF;
btc &= ~0b1111; btc &= ~0xF;
btc |= ((bank->num_sectors - 1) << 2); btc |= ((bank->num_sectors - 1) << 2);
btc &= ~(1 << 4); btc &= ~(1 << 4);
h_u32_to_le(buf, btc); h_u32_to_le(buf, btc);

View File

@ -84,7 +84,7 @@ static int xmc1xxx_erase(struct flash_bank *bank, unsigned int first,
struct working_area *workarea; struct working_area *workarea;
struct reg_param reg_params[3]; struct reg_param reg_params[3];
struct armv7m_algorithm armv7m_algo; struct armv7m_algorithm armv7m_algo;
unsigned i; unsigned int i;
int retval; int retval;
const uint8_t erase_code[] = { const uint8_t erase_code[] = {
#include "../../../contrib/loaders/flash/xmc1xxx/erase.inc" #include "../../../contrib/loaders/flash/xmc1xxx/erase.inc"
@ -159,7 +159,7 @@ static int xmc1xxx_erase_check(struct flash_bank *bank)
struct reg_param reg_params[3]; struct reg_param reg_params[3];
struct armv7m_algorithm armv7m_algo; struct armv7m_algorithm armv7m_algo;
uint16_t val; uint16_t val;
unsigned i; unsigned int i;
int retval; int retval;
const uint8_t erase_check_code[] = { const uint8_t erase_check_code[] = {
#include "../../../contrib/loaders/flash/xmc1xxx/erase_check.inc" #include "../../../contrib/loaders/flash/xmc1xxx/erase_check.inc"
@ -245,7 +245,7 @@ static int xmc1xxx_write(struct flash_bank *bank, const uint8_t *buffer,
struct reg_param reg_params[4]; struct reg_param reg_params[4];
struct armv7m_algorithm armv7m_algo; struct armv7m_algorithm armv7m_algo;
uint32_t block_count = DIV_ROUND_UP(byte_count, NVM_BLOCK_SIZE); uint32_t block_count = DIV_ROUND_UP(byte_count, NVM_BLOCK_SIZE);
unsigned i; unsigned int i;
int retval; int retval;
const uint8_t write_code[] = { const uint8_t write_code[] = {
#include "../../../contrib/loaders/flash/xmc1xxx/write.inc" #include "../../../contrib/loaders/flash/xmc1xxx/write.inc"

View File

@ -5,7 +5,7 @@
# #
# program utility proc # program utility proc
# usage: program filename # usage: program filename
# optional args: verify, reset, exit and address # optional args: preverify, verify, reset, exit and address
# #
lappend _telnet_autocomplete_skip program_error lappend _telnet_autocomplete_skip program_error
@ -101,8 +101,8 @@ proc program {filename args} {
return return
} }
add_help_text program "write an image to flash, address is only required for binary images. verify, reset, exit are optional" add_help_text program "write an image to flash, address is only required for binary images. preverify, verify, reset, exit are optional"
add_usage_text program "<filename> \[address\] \[pre-verify\] \[verify\] \[reset\] \[exit\]" add_usage_text program "<filename> \[address\] \[preverify\] \[verify\] \[reset\] \[exit\]"
# stm32[f0x|f3x] uses the same flash driver as the stm32f1x # stm32[f0x|f3x] uses the same flash driver as the stm32f1x
proc stm32f0x args { eval stm32f1x $args } proc stm32f0x args { eval stm32f1x $args }

Some files were not shown because too many files have changed in this diff Show More