Commit Graph

8513 Commits (967238fb6ff57f47bcae15c90113233c960cc573)

Author SHA1 Message Date
Tim Newsome 967238fb6f
Fix memory leaks. (#328)
Change-Id: Ic5262101b1a572cfcf91f29f813a24df3899fd0c
2018-11-12 13:02:11 -08:00
Tim Newsome f042dcb0a3
examine() should leave halted harts halted (#327)
Previously all harts would be resumed at the end of examine().
Fixes #326.

Change-Id: Id82b361e98f151911f8679538ee4b3c754efd6a5
2018-11-12 13:01:55 -08:00
Tim Newsome 498faf93e1
Add utility to combine runs of lines in log files. (#317)
Hopefully satisfies #193.

Change-Id: I427d763aeca2322b05ed88b42fd4a5f0446a654b
2018-11-12 12:55:35 -08:00
Tim Newsome d18c2f23d3
Doxygen style, too. (#325)
* Doxygen style, too.

Change-Id: I85e60e8577c4177ac7094ae41ee84357b292a89c

* More Doxygen.

Change-Id: Ic7477dce5459146f299e080cac1a3f133af7abdb
2018-11-07 13:53:52 -08:00
Tim Newsome 93de2c955c
Clean up fespi flashing code (#313)
* WIP upstream review feedback.

See http://openocd.zylin.com/#/c/4656/

The main change is to get rid of macros that contain a return statement.

Change-Id: Iff79a8aa7c40ee04a8d1f07d973f9b29d4899d5c

* Remove unaligned head/tail code.

From inspection it's not clear to me that this is necessary at all. I've
been unable to make a test case that results in anything besides a
4-byte aligned flash to happen. Sections that aren't multiples of 4 are
common, and appear to work fine.

Change-Id: Idb6109ca015ae06b9d8f16bd883f9c8f5c51087d

* Move fespi native code into contrib/loaders

As suggested by http://openocd.zylin.com/#/c/4656/

Change-Id: I275012aa8a1ef6a0e8a2ec8ebe8643d87de24407

* Reenable hw mode if errors happen without it.

Change-Id: I1220033c13d02e8a441992bd6daa0ec3b5acbfca

* Default flash to not protected.

Requested by upstream review.

Change-Id: I61753bd9909d7f21ef6624037a865072c18bd1d8
2018-11-06 10:40:02 -08:00
Greg Savin 626df7d04b
Remove unused extern declaration. (#324) 2018-11-05 17:18:55 -08:00
Greg Savin 6749c70a3a
Support for two-wire cJTAG OSCAN1 signaling thru FTDI devices with appropriate pinout (#320)
Added support for cJTAG OSCAN1 over FTDI MPSSE.
2018-11-05 13:39:38 -08:00
Tim Newsome 874cadca31
Conform to OpenOCD style. (#323)
Change-Id: I11b5b66e474d3e1d979b4db537363d025f8e2c9a
2018-11-05 12:27:56 -08:00
Tim Newsome 005cfca219
Install patchutils for the build. (#321)
* Install patchutils for the build.

This contains filterdiff, which we need to check that our changes
conform to OpenOCD style.

Change-Id: Id522f4e62fee3efad4e0e00933abfeada9635624

* Fix paths for filterdiff line.

Change-Id: Ic50e13c7fe64e65b2d2af0260fb19c07a9f10e20

* Conform to OpenOCD style.

Change-Id: I51660d30404c0a625b58c9bed2d948695575e72e
2018-11-05 11:50:09 -08:00
Tim Newsome ca1a1f8db7
Complete single step before returning. (#319)
This fixes the following error, that has been reported occasionally:
Error: 34072 2712 riscv-011.c:1175 reg_cache_get(): Register cache entry for 0 is invalid!
openocd: ../src/target/riscv/riscv-011.c:1176: reg_cache_get: Assertion `r->valid' failed.

The problem was that we'd tell the target to step, and then gdb (which
assumed the target halted already) asked to read a register before the
target had actually halted. With this fix the target is actually halted,
and everything works.

Change-Id: Icfcef456f3cec4bb352fb90186f5bbabb00a5ff8
2018-11-05 11:48:52 -08:00
Pavel S. Smirnov 60368dd62e FIX(src/target/riscv/riscv.c): riscv_add_breakpoint: RVC: invalid 32bit transactions size for 16bit aligned instruction (#322) 2018-11-05 11:34:44 -08:00
Tim Newsome 936c514bbf
Fix 0.11 memory leak. (#318)
Change-Id: I78dbdfc7d599b0edcfcae94070cdd7a552a1bc0c
2018-11-02 12:45:34 -07:00
Carsten Gosvig dc4fe85880 Old fixes from June (#311)
* Changed logging level

* Added logging statement

* Removed halt event when attaching to target

* Extended some packet handling

* Extended handling of rtos_hart_id and clearing of register cache

* Extended execute_fence to handle all harts

* Removing logging statement again

* Updated according to review comments

* Forgot to re-add the return statement

* Was removing too much for the if statement to work

* This needs to >= 3 now to handle both a fence and a fence.i
2018-10-30 11:29:00 -07:00
Tim Newsome e54511ffa4
Revert "Don't report exact watchpoint to gdb. (#300)" (#304)
This reverts commit 933cb875a8.

https://github.com/riscv/riscv-openocd/issues/295 was fixed in gdb.
2018-10-24 13:02:44 -07:00
Carsten Gosvig 983a07be64
Merge pull request #308 from riscv/eclipse_memory_read
Fixing Eclipse block memory read
2018-10-19 23:07:22 +02:00
cgsfv 9703c00b25 Moved comment and added initial buffer clearing 2018-10-19 17:47:58 +02:00
Tim Newsome 60c37e1679
dmi_scan() allocate bytes depending on abits value (#307)
* dmi_scan() allocate bytes depending on abits value

Fixes #303.

Change-Id: Iac45959cf342180c60cd0b5462f864ad81beddd2

* Incorporate review feedback.

Change-Id: I1cc7d20fed6f2d891bec0e858fca53ece450720c
2018-10-18 13:26:03 -07:00
Tim Newsome b986d29bc9
Fix segfault in riscv_deinit_target(). (#306)
This would happen when OpenOCD is unable to connect to the JTAG device.

Change-Id: I1785fd5f5a20db9b4b574bdddfe3eab9bdc0b0bc
2018-10-18 10:06:23 -07:00
Megan Wachs 35eed36ffd
Merge pull request #301 from riscv/mpsse_flush
Add wall clock timeout to mpsse_flush()
2018-09-18 09:36:19 -07:00
cgsfv 20db7afb82 Merge branch 'eclipse_memory_read' of github.com:riscv/riscv-openocd into eclipse_memory_read 2018-09-17 13:57:16 -07:00
cgsfv 0a31d919e3 Corrected wrong C syntax 2018-09-17 13:53:35 -07:00
cgsfv c3a744149c Use LOG_DEBUG for debug messages: Discard unexpected char 2018-09-17 13:53:35 -07:00
cgsfv 10a2823191 Read memory words individually if burst read fails 2018-09-17 13:53:35 -07:00
cgsfv 3ed62ebf0d Corrected wrong C syntax 2018-09-17 10:49:36 -07:00
Megan Wachs d6a1e27c89
Update mpsse.c
Include necessary header file
2018-09-17 09:39:31 -07:00
Tim Newsome af501f4905 Add wall clock timeout to mpsse_flush()
I think that libusb_handle_events_timeout_completed is supposed to make
progress or time out, but sometimes we hit a case where it makes no
progress, and mpsse_flush() loops forever. This wall clock timeout kicks
it out of that loop. OpenOCD appears to die afterwards, but that's still
an improvement.

Change-Id: Id9220557625834fb5b7dccf65251651a11a887f0
2018-09-12 09:08:19 -07:00
Tim Newsome 933cb875a8
Don't report exact watchpoint to gdb. (#300)
We should have a fix for #295 first.

Change-Id: Ic72a7a3fa866fbb5aaed22689adfebf9ce913b50
2018-09-06 15:39:25 -07:00
Ryan Macdonald 33aa058819
Merge pull request #235 from rmac-sifive/sba_tests
Tests for SBA feature
2018-09-04 10:00:48 -07:00
Ryan Macdonald 631f6cd55b More style fixes
Signed-off-by: Ryan Macdonald <rmac@sifive.com>
2018-08-31 14:30:17 -07:00
Ryan Macdonald 3516fd5019 Style fixes
Signed-off-by: Ryan Macdonald <rmac@sifive.com>
2018-08-31 14:29:09 -07:00
Ryan Macdonald 583c90e87c Add pass message for SBA and compliance tests
Signed-off-by: Ryan Macdonald <rmac@sifive.com>
2018-08-31 14:26:32 -07:00
Megan Wachs 4b29af433d Merge remote-tracking branch 'origin/riscv' into sba_tests 2018-08-31 09:02:55 -07:00
Andrew Waterman 167f0071d1
Merge pull request #298 from riscv/jimtcl-mirror
Don't use unreliably hosted submodules (git2cl, jimtcl, libjaylink)
2018-08-30 19:22:12 -07:00
Megan Wachs ebed910c2a
Merge pull request #137 from riscv/riscv-compliance
Add a RISC-V Compliance Test Command
2018-08-30 17:09:08 -07:00
Megan Wachs 24513fe51f riscv-compliance: fix comment typo 2018-08-30 15:37:15 -07:00
Tim Newsome a81b6d075a Exclude submodules from code style check. 2018-08-30 15:29:00 -07:00
Megan Wachs 7448f8780a riscv-compliance: fix whitespace 2018-08-30 11:30:14 -07:00
Megan Wachs 934440b80e riscv-compliance: incorporate review feedback 2018-08-30 11:26:05 -07:00
Andrew Waterman 53cb54d69a Flatten libjaylink submodule 2018-08-29 16:17:43 -07:00
Andrew Waterman b3ddfc70e8 Flatten git2cl submodule 2018-08-29 16:07:13 -07:00
Tim Newsome a0afcba66d
Fix typo. 2018-08-29 16:05:54 -07:00
Tim Newsome 2608b8e25d
Fix strange merge. 2018-08-29 16:00:51 -07:00
Tim Newsome 164415cfbe
Merge branch 'riscv' into sba_tests 2018-08-29 15:55:30 -07:00
Megan Wachs 34ee883aef Merge remote-tracking branch 'origin/riscv' into riscv-compliance-rebase 2018-08-29 15:47:54 -07:00
Megan Wachs 5a7f86b2f4
Use official mirror of jimtcl
The repo.or.cz version is often unavailable.

Presumably we want to do something similar for the other submodules, but I didn't find as obvious official mirrors for those.
2018-08-29 15:34:03 -07:00
Tim Newsome b4b2ec7d2d
Add command to expose custom registers (#293)
* Added `riscv expose_custom` command.

Seems to work for reading. I need to do some more testing for writes, as
well as minor cleanup.

Change-Id: I85d5d00897d5da4add4a6643b538be37d31a016f

* Conform to OpenOCD style.

Change-Id: I40a316f06f418d2b63d9e11aea03ef51da8d8faf

* Free all the memory allocated by register init.

Change-Id: I04e35ab54613f99708cee85e41fef989079adefc

* Properly document `riscv expose_custom`.

Change-Id: Id78a02b7a00c161df80f11b521a306e0cf3d7478
2018-08-29 14:22:50 -07:00
Tim Newsome 074b4fabed
Fix gdb_signal_reply() allocating too small buffer (#296)
In my test-case (64-bit OpenOCD, 64-bit target), OpenOCD ended up
sending gdb '$T05rwatch:1212340a00;thread:0000000000000002#89'
That's missing the final semi-colon after the thread id.

This fix increases the buffer size, and also removes the 0 padding on
the thread id.

This bug showed up when running MulticoreRtosSwitchActiveHartTest
against dual-hart, 64-bit spike.

Change-Id: I8c7d88e2d37b00cf3099f226a1a32671219802d5
2018-08-28 14:46:58 -07:00
Tim Newsome 58824330da
Match on qC, but not qCRC. (#294)
Now we pass MulticoreRtosSwitchActiveHartTest again.
It was broken by #292.

Change-Id: I61f0ae41efda09fd48f732b2122fed2400a43d29
2018-08-27 15:07:49 -07:00
craigblackmore 7897d40099 Handle hardware watchpoints hit by RV32 loads and stores (#291)
* Add riscv_hit_watchpoint function for RV32I loads and stores

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 RV32I load and store instructions
and could be extended for additional instructions in the future.

* 0.11: change debug reason for hw triggers to DBG_REASON_WATCHPOINT

This is to make sure riscv_hit_watchpoint is called to check for a data
address hit.

* Fix style issues

* Change %lx to PRIx64 to clear -m32 build errors

* Add clarifying comments/todos

* Fix types in format strings
2018-08-27 12:42:34 -07:00
craigblackmore 8ede238449 Handle the qC packet (#292)
* Handle the qC packet

GDB sends the qC packet to find out which thread OpenOCD is on

* Correct format string for qC packet
2018-08-27 12:42:21 -07:00