aboutsummaryrefslogtreecommitdiff
path: root/src/jtag
AgeCommit message (Collapse)AuthorFilesLines
2024-06-25Merge up to ad87fbd1cf28760795c4e18f3318a2d720e5a8a6 from upstreamEvgeniy Naydanov14-182/+190
Conflicts: * `doc/openocd.texi`: due to d382c95d57c0ad9ed2dcc83c95404babb7647708, resolved by selecting the upstream version. * `src/server/gdb_server.c`: between 944fe66f104e356c5fcd2b5c25200cebef9b389c and 92e8823ebdb6d01b41bb5d79af49501d525acd1d. Resolved by adopting the use of `LOG_TARGET_*`. * `src/target/target.c`: between 639e68a621b7ae8c4a296ca7e45b47075268fded and c5358c84ad0d3e7497498e0457cec7785f72910a, selected the version from `riscv-openocd`. Change-Id: Ic1327f25e147945e0ec82947a82452501e8ee5de
2024-06-23Remove other '_s' suffix from structsAntonio Borneo1-3/+3
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-23Remove '_s' suffix from structsMarc Schink8-172/+172
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-23remote_bitbang: fix assertion failure for the cases when connection is ↵Timur Golubovich1-1/+8
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-15pld/intel: remove idcodes from intel.cDaniel Anselmi1-2/+3
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-15fix GCC's `-Wcalloc-transposed-args` warningEvgeniy Naydanov2-2/+2
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-08jtag/drivers/ftdi: Use command_print instead of LOG_USER for get_signalMark Featherston1-2/+2
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-05-30Merge up to 437dde701c13e707e5fd912ef6403e09052e4d9b from upstreamEvgeniy Naydanov1-9/+9
Conflict in src/rtos/FreeRTOS.c due to fbea7d5d38d0dcbdd71cb574da9bd12c78b568cf -- resolved by replacing `target->type->name` with a call to `target_type_name()`. Change-Id: I56702c6133894458903de7a4d764903004aa8b86
2024-05-04jtag: linuxgpiod: minor alignment to coding styleAntonio Borneo1-9/+9
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-04-27Merge up to 04154af5d6cd5fe76a2583778379bdacb5aa6fb0 from upstreamEvgeniy Naydanov2-7/+7
Change-Id: I84c1566472e5416bc2a71afa5adaf63c6c7a4a75
2024-04-07jtag: linuxgpiod: drop extra parenthesisAntonio Borneo1-2/+2
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-07remote_bitbang: Change sleep commands to Zz to avoid conflict with SWDJ. Neuschäfer1-2/+2
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-07jtag: linuxgpiod: fix detection for line request biasAntonio Borneo1-3/+3
Commit 290eac04b93c ("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: 290eac04b93c ("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-03-28Merge up to a35e254c5383008cdacf7838a777f7f17af5eeb1 from upstreamEvgeniy Naydanov5-27/+180
Checkpatch-ignore: MACRO_ARG_REUSE, MACRO_ARG_PRECEDENCE Change-Id: Icd10f44d162054f8f32019a579ccbdda2cee7a91
2024-03-16ipdbg: split ipdbg command into multiple commandsDaniel Anselmi1-0/+128
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-16jtag/drivers/bitbang: limit SWD WAIT retries by timeoutTomas Vanek1-2/+16
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-16jtag/drivers/bitbang: use LOG_CUSTOM_LEVEL() macro for SWDTomas Vanek1-23/+33
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-16helper/log: add LOG_CUSTOM_LEVEL() macroTomas Vanek1-1/+2
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-16drivers/cmsis_dap, kitprog: use helper to derive err code from ackTomas Vanek2-2/+2
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-07Merge up to 07141132a7d787005c0829618a60b4a842be7847 from upstreamEvgeniy Naydanov4-1/+34
Change-Id: Ibca0c8093e2983e1ee199f79ed777f5136794195
2024-03-02src/jtag/drivers/mpsse: Add support for new FTDI chip types.Luca Rufer2-0/+24
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-02-24jtag/commands: fixed buffer overflowSydMontague1-1/+1
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-18driver: Add additional check for count of BYPASS devicesKirill Radkin1-0/+9
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-15Merge up to efdd5e09b1108e3bd35898a684817c01dc95cd93 from upstreamEvgeniy Naydanov38-120/+159
There is an ongoing discussion on https://review.openocd.org/c/openocd/+/8124 regarding 0d3d4c981ac77b600ce95c9ea6f1cdb280127342, but AFAIU it seems that the patch does not break anything. Change-Id: I48037504300e517b14e41a00f3bf978a16172d14
2024-02-11jtag interfaces: Reduce usage of global for jtag queueEvan Hunter31-65/+72
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-11jtag/drivers: fix reset logic handling in OpenJTAGN S1-7/+11
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-11jtag/drivers: OpenJTAG standard variant perf improvementN S1-1/+12
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-11jtag: fix jtag configure command containing eventsAntonio Borneo1-1/+1
Commit ea2e26f7d521 ("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: ea2e26f7d521 ("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-11jtag/mpsse: mpsse_flush should not treat LIBUSB_ERROR_INTERRUPTED as an errorParshintsev Anatoly1-14/+9
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-11jtag/drivers: Add vid_pid command to OpenJTAGN S1-0/+18
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-08jtag/adapter: retype adapter_gpio_config.{gpio,chip}_numVincent Fazio5-30/+34
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-04jtag/drivers/jlink: make jlink quiet polling target in -d 3Tomas Vanek1-2/+2
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-01-29Merge up to 9659a9b5e28dc615dfb508d301fdd8fa426c191b from upstreamEvgeniy Naydanov6-194/+196
Change-Id: I2fda9689d3465b3d8c8f3459b1ed954cb1d70fdc
2024-01-29contrib/firmware: Change USB interruption handling for JTAG/I2C communicationsAhmed BOUDJELIDA1-0/+0
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-29jtag/drivers: Add GPIO extender configuration function to ANGIE driverAhmed BOUDJELIDA2-4/+114
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-29jtag/drivers: give ANGIE a new PID after renumerationAhmed BOUDJELIDA2-6/+7
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-29jtag/drivers: correct the angie_reset functionAhmed BOUDJELIDA1-5/+7
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-29contrib/firmware: Add direction control for 'SCL' i2c signalAhmed BOUDJELIDA2-0/+0
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-29jtag/drivers: send bitstream size to firmware via libusbAhmed BOUDJELIDA1-10/+14
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-29jtag/drivers/cmsis_dap: use oocd_libusb_dev_mem_alloc() helperTomas Vanek1-23/+18
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: fd75e9e54270 (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-29drivers/libusb_helper: introduce oocd_libusb_dev_mem_alloc() helperTomas Vanek2-0/+79
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-21jtag/vdebug: add support for DAP6Jacek Wuwer1-23/+64
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-21jtag/vdebug: fix socket options on CYGWINJacek Wuwer1-1/+6
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-21jtag/drivers: Correct ANGIE driver and GPIO Extender configurationAhmed BOUDJELIDA1-47/+46
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-21jtag/drivers/cmsis_dap_usb_bulk: fix clang warningTomas Vanek1-1/+1
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: fd75e9e54270 (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-13jtag: rewrite jim_jtag_configure() as COMMAND_HANDLERAntonio Borneo3-123/+80
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-13contrib/firmware: Change USB interruption handling for JTAG/I2C communicationsAhmed BOUDJELIDA1-0/+0
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-13jtag/drivers: Add GPIO extender configuration function to ANGIE driverAhmed BOUDJELIDA2-4/+114
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-13jtag/drivers: give ANGIE a new PID after renumerationAhmed BOUDJELIDA2-6/+7
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-13jtag/drivers: correct the angie_reset functionAhmed BOUDJELIDA1-5/+7
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>