Cache type register C0.C is read-only, and display
hard core configuration information.
This information is unlikely be changed in runtime.
- removed C0.C access when result is not used in
arm946e_invalidate_dcache()
- access C0.C only once per target, store result
in cp15_cache_info field of target structure
- fix cache index count calculation
Global variables 'dc' 'ic' had been used in the code
to keep target's state of D-cache and I-cache
on debug entry.
This may lead to incorrect operation in configurations
with multiple cores and unequal cache states.
Fix: move cache state to the appropriate bits of the
'cp15_control_reg' field (already present but unused).
Vaule of cp15 control register stored here on
arm946e_post_debug_entry(), and analyzed later
in arm946e_write_memory().
flash: stm32f1x: Pad odd byte writes early to avoid 16-bit writes
For odd byte counts, stm32x_write() pads the last byte and writes it using
a discrete 16-bit access. The stlink debugger can't issue 16-bit writes so
it fails for odd byte writes.
This patch changes stm32x_write() to pad odd byte writes into a new buffer
and use the normal code path with a single block write. The fallback path,
when working area cannot be allocated, has to use 16-bit writes though
which means that sufficient working area is required for stlink and odd
byte writes.
Change-Id: I4c5dc456300b6e1056f76b0095be8aceee3e954f Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/756 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Salvador Arroyo [Thu, 7 Jun 2012 14:44:34 +0000 (16:44 +0200)]
Bugfixes in mips32_pracc.c
When testing a pic32mx220f032b with different values
for adapter_khz and cpu clocks i was getting a lot of
corrupted data from the chip. From time to time
openocd fails with segmentation faults or is aborted
due to memory corruption.
Change-Id: I134743f75c477b3d55dc74ae4474598e153b4a4a Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/690 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
flash: reduce code duplication in stm32 flash probe
Remove a lot of the repetitive code in stm32f1x flash probe by converting
the large if-selector to a switch, moving the common checks outside it and
concentrating the failure handling to a single point.
Do the same with stm32f2x and stm32lx for consistency.
Change-Id: Ic0ecfb1533c49f5d2108cda5fd20c8372d7c71ef Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/746 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Vandra Akos [Sun, 27 May 2012 10:36:55 +0000 (12:36 +0200)]
lpc1768.cfg abstracted and moved to lpc17xx.cfg
- Moved variant-independent code to lpc17xx.cfg, which will be included from
lpc17??.cfg files automatically.
- lpc1768.cfg filled with variant-dependent code.
FT232H chips are new highspeed devices from FTDI. Basically these are a half of FT2232H (or a quarter of FT4232H), so only one channel which can be used as OpenOCD
interface. The chips are supported by libftdi 0.20 or later and by ftd2xx 2.08.12 or later.
Change-Id: Ic9a2c279167c3419a24f0d6befacbb83c4ffeb25 Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-on: http://openocd.zylin.com/736 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Alan Bowman [Wed, 25 Jul 2012 18:58:11 +0000 (19:58 +0100)]
Test the incoming debug_level, rather than the current.
The existing code tests the current debug_level for validity, allowing
the user to set it too high and never change it after that. The new
behaviour is to test the debug_level that the user has requested.
Based on ft2232.c but uses the MPSSE layer for low-level access, greatly
simplifying the JTAG logic. Remove all libftdi/FTD2XX code and all layout
specific code. Layout specifications are instead handled in Tcl.
Use a signal abstraction to enable Tcl configuration files to define
outputs for one or several FTDI GPIO. These outputs can then be
controlled using the ftdi_set_signal command. Special signal names are
reserved for nTRST, nSRST and LED (for blink) so that they, if defined,
will be used for their customary purpose.
Depending on the type of buffer attached to the FTDI GPIO, the outputs
have to be controlled differently. In order to support tristateable
signals such as nSRST, both a data GPIO and an output-enable GPIO can be
specified for each signal. The following output buffer configurations are
supported:
* Push-pull with one FTDI output as (non-)inverted data line
* Open drain with one FTDI output as (non-)inverted output-enable
* Tristate with one FTDI output as (non-)inverted data line and another
FTDI output as (non-)inverted output-enable
* Unbuffered, using the FTDI GPIO as a tristate output directly by
switching data and direction as necessary
The data and output-enables are specified as 16-bit bitmasks,
corresponding to the concatenation of the high and low FTDI GPIO
registers. To specify an unbuffered output, use the same bitmask
for both data and output-enable.
The adapter configuration file must also specify default values for the
FTDI data and direction GPIO registers, and the channel being used (if
different from 0).
Change-Id: I287a41d4c696cf5fc74eb10d5e63578b0dc7f826 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/452 Tested-by: jenkins Reviewed-by: Peter Stuge <peter@stuge.se>
This is a higher-level libftdi replacement for use when implementing
protocol drivers for FT2232, FT2232H or FT4232H. It takes care of device
open/close and, unlike libftdi, also MPSSE command abstraction, command
queueing, buffer handling and return data parsing.
The FTDI device is accessed through libusb-1.0 in asynchronous mode.
Change-Id: I051adb574dcc39f8ca9cd7f6dbe6ae4aeea5f4c8 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/451 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Peter Stuge <peter@stuge.se>
Spencer Oliver [Wed, 27 Jun 2012 22:25:07 +0000 (23:25 +0100)]
target: detect correct Cortex-M tar auto increment size
The ADIv5 spec guarentees that tar_autoincr_block will be 10bits.
Make this the default for Cortex-M family until we detect a Cortex-M3/M4,
we then change autoincrement to 12bits.
Change-Id: Ie8c89134aa036879bdd8a3c312cee9715dbc6913 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/730 Tested-by: jenkins Reviewed-by: simon qian <simonqian.openocd@gmail.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Vandra Akos [Fri, 25 May 2012 01:02:55 +0000 (03:02 +0200)]
target.c, jim_target_md using command_print_sameline
jim_target_md is supposed to print out results with command_print in
hexdump format. It was using command_print which appends a newline character
aftre every invocation. Using command_print_sameline instead
Vandra Akos [Thu, 24 May 2012 13:17:34 +0000 (15:17 +0200)]
target/target.c, jim_target_md refractored
- Added a few lines of comment before the function explaining the usage and the
output generated by the command
- Added a few lines of comment in the body explaining what is happening to improve
code readability
- Renamed a few variables to improve readability:
* a -> addr
* b -> dwidth
* c -> count
- Added a new variable, named byte to contain the number of bytes to read, instead
of overwriting the count parameter, to avoid confusion between the two values.
Interface drivers regularly need to keep track of where each part of a long
read buffer should be copied, once that data arrives. Both source and
destination are often at an arbitrary bit offset.
This queued bit-level copy can help with that, by allowing the driver to
perform postponed reads from the receive buffer already when building the
transmit buffer, and have those reads executed at a later time when data is
available.
For simplicity, it uses the linked list implementation list.h imported from
the Linux kernel.
Mike Crowe [Tue, 29 May 2012 20:23:27 +0000 (15:23 -0500)]
topic: flash: description/id added for ATSAM3SD8C
New flash description for ATSAM3SD8C used on SAM3S-EK2 development boards. Name used
is "at91sam3sd8c" and chipid is 0x29ab0a60. Mirrors description of other similar parts.
Change-Id: I7fc4b82e7969451645ab067223663f08b76d866b Signed-off-by: Mike Crowe <mpcrowe@gmail.com>
Reviewed-on: http://openocd.zylin.com/684 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
In the previous iteration, the page counter for erases would not be updated with
the erase size. This patch keeps the page counter synced with the sector counter.
kinetis: update support for all program flash granularities
Updates the Kinetis NOR flash support to handle all known block and sector
sizes. Previously only 2kiB sectors were hard-coded, now all four known
combinations non-volatile sector sizes are supported.
The premise of separating Kinetis Program Flash (PFLASH) from FlexNVM is
also introduced. This means each "block" of flash (in Freescale terms) is
treated as a bank in OpenOCD. Correspondingly, the existing board
configuration for the TWR-K60M512 eval system is updated to recognize two
banks instead of one.
A board config for the TWR-K60F120M is also added.
Bank and sector erase and programming has been checked with both of the
mentioned eval boards.
Change-Id: Iae2d10ebf8f548d0a3698df5430bbbe1ccadc58a Signed-off-by: Christopher Kilgour <techie@whiterocker.com>
Reviewed-on: http://openocd.zylin.com/663 Tested-by: jenkins Reviewed-by: Mathias Küster <kesmtp@freenet.de> Reviewed-by: Jan Dakinevich <jan.dakinevich@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Some versions of Segger's software do not select JTAG interface by default.
Do it in the intial setup.
Firmware version check code still present, with updated set of unsupported.
Note from Segger:
Alright, we were not aware of that OpenOCD does not select the interface
before it starts communicating with the target. A debugger should always
select the appropriate target interface before it starts communicating with the target,
since otherwise it could also happen that a previous session with another debugger
had selected SWD and the interface was not switched again by OpenOCD.
Change-Id: I5b4eab7e0e3625ec32be75a36d89e16d17e899bf Signed-off-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-on: http://openocd.zylin.com/667 Tested-by: jenkins Reviewed-by: Xiaofan <xiaofanc@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
OpenOCD does not work with the latest firmware versions
of Segger J-Link.
Latest working version: V4.42c
Unsupported versions: 4.44 to 4.46f, 4.20 to 4.30
Older versions of firmware can be found here:
http://www.segger.com/j-link-older-versions.html
The firmware versions does not correspond directly with
"Software and documentation pack for Windows", it may be
distinguished by the "compile" date in the information string.
Print an warning message if unsupported firmware version detected.
Change-Id: Id7d1f965b8ce2fdbcd0026a85ddd093e2fa48720 Signed-off-by: Alexander Osipenko <sipych@gmail.com>
Reviewed-on: http://openocd.zylin.com/666 Tested-by: jenkins Reviewed-by: Xiaofan <xiaofanc@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Liviu Ionescu [Tue, 29 May 2012 11:52:04 +0000 (14:52 +0300)]
docs: J-Link commands added to the manual
The J-Link related commands and configuration commands were added
to the "8.2 Interface Drivers" section of the manual.
(previously they were enumerated as comments).
The 'jlink pid' was marked as Config all other as Command.
A draft of a compatibility note was added, but probably
a table would be more appropriate.
Liviu Ionescu [Tue, 29 May 2012 16:41:02 +0000 (19:41 +0300)]
tools: initial.sh fixed to accept spaces in current path
When changing the path to the hooks folder, the path needs to be
surrounded by quotation marks, to avoid failures when the current
path contains spaces (not only legal, but a common case on
Mac OS X).
Peter Stuge [Mon, 14 May 2012 15:47:09 +0000 (17:47 +0200)]
docs: Fix incorrect -rtos option values
Commit 9ca1592cb9fe4e61ee5bc327345fdfc254c9fe13 started on documentation
for the -rtos option, but some of the documented values were incorrect so
we'll clean up the mess here.
Spencer Oliver [Fri, 11 May 2012 08:39:58 +0000 (09:39 +0100)]
stlink: add armv7m stlink handling
This enables us to better handle some of the low level functions that the
stlink does not support. It also enables us to share a few more of the
standard cortex_m3 functions if necessary.
Change-Id: I7a2c57450122012ec189245d8879d8967913e00e Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/637 Tested-by: jenkins
Aurelien Jacobs [Tue, 8 May 2012 18:53:18 +0000 (20:53 +0200)]
cfi: fix write_bank segfault with spansion flash on armv7m
cfi_spansion_write_block() passes an arm_algorithm struct to
target_run_algorithm() which in turn calls armv7m_start_algorithm()
which expect an armv7m_algorithm struct.
As armv7m_algorithm is bigger than arm_algorithm, when
armv7m_start_algorithm() writes in the struct, it overrun the buffer,
writting junk on the stack, which latter on generates a segfault.
This patch ensure we use a properly sized armv7m_algorithm struct
when the target is an armv7m.