aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2024-10-30Merge pull request #1154 from en-sc/en-sc/dcsr-ebreak-halt-on-resetEvgeniy Naydanov1-1/+7
target/riscv: avoid unnecessary `dcsr.ebreak*` update on reset
2024-10-28[NFC] target/riscv: simplify code with MAX macrosMark Zhuang2-2/+2
slightly improves readability
2024-10-28Merge pull request #1149 from zqb-all/read-write-cross-pageEvgeniy Naydanov2-28/+78
riscv: fix read/write virtual memory across page boundaries
2024-10-25target/riscv: avoid unnecessary `dcsr.ebreak*` update on resetEvgeniy Naydanov1-1/+7
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-24[NFC] target/riscv: refactor riscv_read_memory,riscv_write_memoryMark Zhuang1-52/+35
Reduce duplicate code
2024-10-24target/riscv: fix cross-page misaligned access when mmu not enabledMark Zhuang1-13/+24
When mmu is disabled, simply call the physical read/write function
2024-10-24target/riscv: fix read/write virtual memory across page boundariesMark Zhuang2-12/+68
When read/write virtual addresses cross page boundaries, the physical addresses are not necessarily contiguous and need to call virt2phys again.
2024-10-24Merge pull request #1152 from fk-sc/translation-driversEvgeniy Naydanov5-52/+150
target/riscv: added translation drivers
2024-10-23target/riscv: added translation driversFarid Khaydari5-52/+150
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-20gdb_server: Improve const correctnessJan Matyas4-8/+8
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-20arm_adi_v5: Added Cortex-A55 debug unit identifierFlorian Fainelli1-0/+1
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-20target: riscv: remove non-trivial 'unsigned' castAntonio Borneo3-4/+4
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-20target: riscv: convert 'unsigned' to 'unsigned int'Antonio Borneo8-121/+121
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-18Merge pull request #1146 from en-sc/en-sc/select-dmi-bypassEvgeniy Naydanov2-4/+26
target/riscv: check other TAPs in `select_dmi()`
2024-10-16target/riscv: check other TAPs in `select_dmi()`Evgeniy Naydanov2-4/+26
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-12target: riscv: convert 'unsigned' to 'unsigned int'Antonio Borneo6-58/+58
Conversion done with checkpatch --fix-inplace -types UNSPECIFIED_INT Change-Id: I62fad88dd33716c24154d44c5a23ae2c0f7c4a4c Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
2024-10-08Merge pull request #1142 from en-sc/en-sc/from_upstreamEvgeniy Naydanov14-157/+232
Merge up to 1173473f662bbdf6d1499654568256257eee6cdd from upstream
2024-10-05helper/align.h: Fix macro IS_PWR_OF_2Jan Matyas1-1/+1
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: 9544cd653df1 ("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-05openocd: fix build with jimtcl 0.83Antonio Borneo2-0/+2
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-05jtag: bcm2835gpio: fix macro definitionAntonio Borneo1-9/+20
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-05target: arm: drop casts commented-outAntonio Borneo4-17/+17
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-05OpenOCD: drop comparison with true/falseAntonio Borneo9-49/+47
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-05target: drop comparison to NULLAntonio Borneo1-2/+2
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-05jtag: stlink_usb: drop comparison to NULLAntonio Borneo1-4/+4
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-05OpenOCD: fix code alignmentAntonio Borneo5-14/+14
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-05target: mem_ap: drop return from void functionAntonio Borneo1-1/+0
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-05flash: stm32l4x: fix open brace styleAntonio Borneo1-1/+2
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-05openocd: convert 'unsigned' to 'unsigned int'Antonio Borneo12-78/+78
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-05jtag: convert 'unsigned' to 'unsigned int'Antonio Borneo24-110/+110
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-05target: convert 'unsigned' to 'unsigned int'Antonio Borneo45-246/+248
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-05flash: convert 'unsigned' to 'unsigned int'Antonio Borneo35-178/+178
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-05target: use 'unsigned int' for smp groupAntonio Borneo2-2/+2
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-05openocd: fix conversion string for stdint valuesAntonio Borneo24-102/+78
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-05target/mips32: add dsp access support for gdbWalter Ji3-33/+163
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-05jep106: update to revision JEP106BK Sep 2024Antonio Borneo1-7/+60
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-05jtag: update constant names to follow code style guidelinesParshintsev Anatoly3-10/+10
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-05rtos: chibios: fix version displayAntonio Borneo1-8/+2
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-04Merge pull request #1140 from TommyMurphyTM1234/riscvEvgeniy Naydanov1-2/+1
Fix `riscv013_invalidate_cached_progbuf()`
2024-10-04Merge pull request #1127 from sunnyzhu-learning/Songhe-developEvgeniy Naydanov1-43/+68
target/riscv: Mismatch napot when mcontrol.maskmax is not expected
2024-10-03Merge up to 1173473f662bbdf6d1499654568256257eee6cdd from upstreamEvgeniy Naydanov14-157/+232
1ae6b07b45198618c3f0975fd49de59cf6c04e7a replaced `buf_cmp()` with `buf_eq()`, so a96a0a4e3993de7f7169a306aa0202e0f3e26f4f needs to be adjusted. Change-Id: I97f6a3518db9421dab2ae4dd2312f443e928b114
2024-10-03Fix riscv013_invalidate_cached_progbuf() off by one errorTommy Murphy1-2/+1
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-01flash/nor/atsame5: add PIC32CX-SG device IDsMatt Trescott1-0/+30
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-09-30Merge pull request #1134 from fk-sc/early-exit-supportEvgeniy Naydanov3-217/+344
target/riscv: early exit support for memory access operations
2024-09-27target/riscv: early exit support for memory access operationsFarid Khaydari3-217/+344
(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-26target/riscv: DMI logging improvementsEvgeniy Naydanov1-54/+99
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-25target/riscv: Mismatch napot when mcontrol.maskmax is not expectedzhusonghe1-43/+68
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-23target/riscv: move `riscv_log_dmi_scan`Evgeniy Naydanov3-84/+78
Change-Id: Iade30374331e9bde31a411b82056d47207cc39a8 Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
2024-09-21server/telnet: Restructure commandsMarc Schink2-7/+23
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-21server/gdb_server: improve error handling for `Z/z` packetEvgeniy Naydanov1-23/+14
* 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-21binarybuffer: Invert buf_cmp* return value and rename to buf_eq*Jessica Clarke4-20/+20
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>