aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2017-12-14Fix cut and paste bug.Tim Newsome1-1/+1
Now reading 64-bit FPRs on 32-bit harts using scratch memory might work. Change-Id: Ie8c0fc689386c6e724ecab5e8c855e725fa8dd97
2017-12-14Use abstraction because Windows is not POSIXTim Newsome2-2/+13
Fixes #138 Change-Id: I4d9b49762e318fe91f1561ed315829b43daefef4
2017-12-12target: remove unused event definitionsTomas Vanek2-8/+0
Events reset-halt-pre, reset-halt-post, reset-wait-pre and reset-wait-post are not used anywhere. Change-Id: I9a0f94875b102d9b08f6c2fd9d73a9f05f8e8e79 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4285 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2017-12-12flash/nor/stm32f2x: fix erase on STM32F413/423Tomas Vanek1-4/+10
Theese devices do not have a gap in sector numbering. The driver translates sectors numbers 12 13... to 16 17... as used on dual bank flash devices. Therefore erase of sector 12 and above fails with error 'stm32x device protected' on F413/423. Drop sector number translation for devices without has_large_mem flag. Change-Id: I65531c0dfe02e2fd0f3d68f0615e0926e9901391 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4299 Tested-by: jenkins Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2017-12-12flash/nor/stm32f2x: fix protection block size for F767 in dual bank modeTomas Vanek1-1/+2
A protection block comprises two adjacent sectors in dual bank mode. As there are 64 and 128kB sectors joined in blocks 2 and 8, block size should be computed as a sum of sector sizes. Change-Id: Ie915df8cf7ca232c4565d7e0c514c8933e71fdfe Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4271 Tested-by: jenkins Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2017-12-12jtag: drivers: stlink: handle all versions with single configPaul Fertser4-28/+44
Extend HLA interface to allow multiple VID/PID pairs and use it to autodetect the connected stlink version. Change-Id: I35cd895b2260e23cf0e8fcb1fc11a78c2b99c69b Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3961 Tested-by: jenkins Reviewed-by: Karl Palsson <karlp@tweak.net.au> Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2017-12-11Fix build.Tim Newsome1-2/+2
Change-Id: I4e3a36fac77fefa271ae9facbaa990fa330501ae
2017-12-11Merge pull request #131 from riscv/small_progbufTim Newsome7-1018/+780
Support program buffers that are just 2 instructions large
2017-12-07stm8 : new targetAke Rehnman4-0/+2301
New STM8 target based mostly on mips4k. Target communication through STLINK/SWIM. No flash driver yet but it is still possible to program flash through load_image command. The usual target debug methods are implemented. Change-Id: I7216f231d3ac7c70cae20f1cd8463c2ed864a329 Signed-off-by: Ake Rehnman <ake.rehnman@gmail.com> Reviewed-on: http://openocd.zylin.com/3953 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2017-12-06flash: Add new stm32h7x driver supportAlexandre Torgue3-0/+1186
Add basic support for: -STM32H7x (Embedded flash 2M) Erase and write tested on stm32h743. Change-Id: Ie8d8786227cdeee39fcf5663167a053ad8dcef4c Signed-off-by: Rémi Prud'homme <remi.prudhomme@st.com> Signed-off-by: Alexandre TORGUE <alexandre.torgue@st.com> Reviewed-on: http://openocd.zylin.com/4181 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2017-12-06Only call cmsis_dap_cmd_DAP_SWD_Configure when swd_mode is enabledBas Vermeulen1-5/+8
The CMSIS-DAP used by NXP's LS1012ARDB board only supports JTAG, and not SWD. Calling cmsis_dap_cmd_DAP_SWD_Configure returns with an error (and doesn't actually do anything in the debugger). Wrap the call to cmsis_dap_cmd_DAP_SWD_Configure in a check for swd_mode, to make sure initialisation doesn't fail needlessly. Change-Id: Id7e568cb6e36886bd7c5b3699d198a77a51c28c9 Signed-off-by: Bas Vermeulen <bas@daedalean.ai> Reviewed-on: http://openocd.zylin.com/4294 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2017-12-06spi: add n25q256 flashRobert Jordens1-48/+50
* 256 MBit SPI flash * https://www.micron.com/~/media/documents/products/data-sheet/nor-flash/serial-nor/mt25q/die-rev-a/mt25q_qljs_l_256_aba_0.pdf spells out the entire zoo of IDs * used e.g. on Xilinx KCU105 Change-Id: I18b19292b4869627adb9071266271962fec68fb4 Signed-off-by: Robert Jordens <jordens@gmail.com> Reviewed-on: http://openocd.zylin.com/4186 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2017-12-06server/gdb: Use 'bool' instead of 'int' for boolean valuesMarc Schink1-17/+17
Change-Id: I71c2f2553a29e9ef167ff3313cc06c7b31c64190 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4278 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2017-12-06server/gdb: Use get_target_from_connection()Marc Schink1-30/+37
Change-Id: I2c66bf6da734a3b71e358553943e9fc3c6578c39 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4277 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2017-12-06target: Constify parameter of is_armv7m()Marc Schink1-1/+1
Change-Id: Ieea1b0dec88818e9e8d5c8c5d54aa8959556d77b Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4275 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2017-12-06rtos: Use 'bool' as return type for detect_rtos()Marc Schink9-29/+29
Change-Id: I91ad0431d44ed94f48d20c4690f8642d66f52a9b Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/4274 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2017-12-06adi_v5_swd: Add error message when SWD fails to connectJonas Norling1-1/+4
Error message instead of failing silently. Change-Id: Ie54a5bf68459d3c0e96cc38080ffad8de0a4b5ce Signed-off-by: Jonas Norling <jonas.norling@cyanconnode.com> Reviewed-on: http://openocd.zylin.com/4269 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-11-27Update encoding.h.Tim Newsome2-58/+216
Change-Id: Id653500aa525746e8824ff5fd2850c62c8c21c08
2017-11-16Add missing return.Tim Newsome1-0/+1
Change-Id: Ida32482903cdfd8eeb043088e84bb1f4f5ac673c
2017-11-14Merge pull request #127 from riscv/jtag_debugTim Newsome1-62/+10
Clean up this JTAG debug code.
2017-11-01Merge branch 'riscv' into small_progbufTim Newsome2-5/+1
Change-Id: I1d48cb1f8448ebbf98c8bb369928d1e7a7a78c75
2017-10-27Fix compile warning with new gcc.Tim Newsome1-1/+1
Change-Id: I14ebf597f41429c0fc3ebac8da9c9f62c78fb1ae
2017-10-27Support 64-bit FPRs on RV32.Tim Newsome3-34/+328
Because there is no instruction that moves just half of a 64-bit FPR to/from a GPR, we need to use scratch memory for this operation. This code can theoretically use: 1. DMI_DATA, if it is memory mapped in the target. 2. DMI_PROGBUF, if it is writable in the target. 3. A user-configured address. I have only tested this code very lightly. One reason is that gdb thinks that on RV32 harts every register is 32 bits wide. Another is that this is mostly proof-of-concept to satisfy the small program buffer code review, which I don't want to drag out forever. Existing tests don't realize that floating support was broken with RV32D, and don't realize that it still doesn't work because of the gdb problem mentioned above. This change improves Issue #110 but there's more work to be done. Change-Id: I99b8a36e5fea26f1d9e16e36cf99adc7be26b944
2017-10-27ftdi: Enable SWDIO output before sending data on itJonas Norling1-0/+3
The SWDIO buffer has to be enabled, by setting SWDIO_OE, for data on SWDIO to reach the target. Explicitly do this before sending the switch sequences for JTAG-to-SWD, etc. This makes the code insensitive to the state of SWDIO_OE specified in ftdi_layout_init. It used to work only on adapters with a non-inverted SWDIO_OE inited to 1, or inverted SWDIO_OE inited to 0. Change-Id: I4b9e520ac1c7ce2a437251a05fc036bc68de718e Signed-off-by: Jonas Norling <jonas.norling@cyanconnode.com> Reviewed-on: http://openocd.zylin.com/4270 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2017-10-27Cortex-M: Delete an unnecessary local variableChristopher Head1-5/+0
The dhcsr_save variable was used to save the value of cortex_m->dcb_dhcsr so it could be restored later. However, all writes in between the save and the restore use mem_ap_write_atomic_u32, not cortex_m_write_debug_halt_mask, which means cortex_m->dcb_dhcsr isn’t changed anyway. Delete the unnecessary local. Change-Id: I064a3134e21398e1ecfc9f1fa7efd7b020b52341 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4240 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-10-27Cortex-M: fix stale DHCSR cache valuesChristopher Head1-5/+4
In cortex_m_assert_reset, in two locations, DHCSR is written directly using mem_ap_write_u32. This means that the cached version, target_to_cm(target)->dcb_dhcsr, is not updated when these writes are performed, so subsequent writes to DHCSR that use cortex_m_write_debug_halt_mask will change those bits back to their old values which, unless modified in that particular invocation, come from the cache. This causes an actual, observable bug on an STM32F7 in which running “reset run” immediately after “program” can in some cases result in execution proceeding with C_MASKINTS set (it is cleared on line 1021 but is then set immediately afterward in cortex_m_clear_halt), causing failure of the application. Replace these mem_ap_write_u32 calls with cortex_m_write_debug_halt_mask calls to do the same jobs. Change-Id: Id35ca7f6057c2df2ba9cd67c53a73b50816d0b71 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4239 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-10-25Remove unused variables.Tim Newsome1-4/+0
Change-Id: I678d0a65c22792895375dc6916381f81af8f83e4
2017-10-24Remove more unused functionality.Tim Newsome1-6/+0
Change-Id: I43283b9556c959f891a587fb39bdd1ab9206e8af
2017-10-24Add a fence after memory writes.Tim Newsome1-7/+16
Change-Id: I5137479b685f735aa573cec5d40170016c40f597
2017-10-24Remove more unused code.Tim Newsome1-6/+0
Change-Id: I962660f58d948f85df6e073065e15e5d8f4a02b6
2017-10-24Remove more unused code.Tim Newsome1-48/+6
Change-Id: Id91237c163d86e8f4d039503ca33b4ad7571ecd1
2017-10-23Remove unused functionality.Tim Newsome2-268/+0
Change-Id: Ic70cebd62bbd04f7ae5566504fbb279a11de57f0
2017-10-23Properly fix memory read when encountering busy.Tim Newsome1-36/+101
Change-Id: I377054495e860076edc2f38d1cc0f11c23f98d3b
2017-10-23Fix GCC7 warnings about string truncationFreddie Chopin4-5/+5
GCC7 with -Wall warns about possible string truncation with snprint()-type functions with "directive output may be truncated writing 1 byte into a region of size between 0 and 9 [-Werror=format-truncation=]" + "note: ‘snprintf’ output between 5 and 14 bytes into a destination of size 12" (or similar). Fix this by increasing sizes of buffers. See https://gcc.gnu.org/gcc-7/changes.html Change-Id: Ib848f2a56dd658783534158947ae1be7c0e99d45 Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-on: http://openocd.zylin.com/4175 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins Reviewed-by: Andreas Bolsch <hyphen0break@gmail.com>
2017-10-23Fix GCC7 warnings about switch-case fallthroughsFreddie Chopin10-4/+17
GCC7 with -Wextra warns about switch-case blocks which fallthrough with "this statement may fall through [-Werror=implicit-fallthrough=]". This can be fixed by adding "special" comments: "/* fallthrough */". See https://gcc.gnu.org/gcc-7/changes.html Change-Id: Iba0be791dbdd86984489b2d9a0592bb59828da1e Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-on: http://openocd.zylin.com/4174 Tested-by: jenkins
2017-10-22arm: semihosting: set command line argumentsAndreas Fritiofson3-1/+47
Add "arm semihosting_cmdline [argv0 argv1 ...]" for setting the command line arguments for the debuggee. [andreas.fritiofson@gmail.com]: Dynamic allocation, empty default Change-Id: I831ddd161d602f251940e29608a154e9590fdee1 Signed-off-by: Christian Groessler <chris@groessler.org> Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3106 Tested-by: jenkins
2017-10-18Pay attention to impebreak.Tim Newsome4-64/+95
This required updating debug_defines.h, which caused a few other small cleanups as well. Change-Id: I3c2cb418d7eff3093d7664c5563b2af5e8b530eb
2017-10-18Remove unused functionality.Tim Newsome2-73/+3
Change-Id: I0c1464e2e6aa12d0cb1025ed0a7c1c483e7403b7
2017-10-18Still restore registers if an access failed.Tim Newsome1-8/+11
Change-Id: I11571f0926f69a34f95b4929f633fdecd3a4e810
2017-10-18Fix FPR access.Tim Newsome1-5/+8
Change-Id: I1379de87904f1cf40b45d1a5490249e3ba90d7d0
2017-10-18Differentiate "target not halted" messages.Tim Newsome2-8/+9
Change-Id: I8728fa007289d7af5c6791142e76eb5777c83ca4 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/4244 Tested-by: jenkins Reviewed-by: Liviu Ionescu <ilg@livius.net> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2017-10-18Document `struct reg` fields.Tim Newsome1-0/+15
Change-Id: I286316079e2e4d4f09427a4ffbecadb48c5dc9d9 Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/4250 Tested-by: jenkins Reviewed-by: Liviu Ionescu <ilg@livius.net> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2017-10-17Don't crash when encountering RV64.Tim Newsome1-7/+3
Change-Id: Ie915ce830c3499919e4918ad443a5e225cf8c4d9
2017-10-17Memory read/write works if the core can keep up.Tim Newsome1-11/+8
Change-Id: Ieca50ece266fbc9d2ff16a5cc2e6b4b926ad5e6f
2017-10-17MemTest64 passes.Tim Newsome2-4/+18
Change-Id: I75996b71c3f31025c89ef596a08e01d191405336
2017-10-16Memtest{16,32} pass.Tim Newsome4-217/+126
Change-Id: I15c2a4fd2bb9a7b30762d07f3b3a74d2f477746b
2017-10-13At least some memory writes work.Tim Newsome3-130/+94
Change-Id: I6fcf261341f10ec34df01bb844744439d02471a8
2017-10-12Register read/write might be working.Tim Newsome2-72/+67
Change-Id: I6c51d6157dde56d8cd666b4d30ec7bbc7a4bef9f
2017-10-12WIP; doesn't work.Tim Newsome5-174/+55
Change-Id: Ia407e82ccbd2044ad61e0845d285dd5765154476
2017-10-10Remove duplicate progbuf size variable.Tim Newsome1-21/+13
Change-Id: I662ff84d13ecfc7faae51406a4df57a3643116f0