rtos: Fix wrong allocation in linux_get_symbol_list_to_lookup
linux_get_symbol_list_to_lookup allocates to few memory. On 64 bit
systems the error did not show due to char* being twice its size,
leaving accidentally enough space.
This patch makes linux_get_symbol_list_to_lookup behave identical
to all other RTOS.
Freddie Chopin [Sat, 6 Oct 2012 07:49:28 +0000 (09:49 +0200)]
Fix serious bug in LPC2xxx/LPC17xx flash algorithm.
Flash algorithm for LPC17xx/LPC2xxx was trying to "reuse" previously
allocated working area on next flashing which is not possible -
working areas are freed automatically on reset. This caused all but
first flashing attempts to fail. As there is no point in storing pointer
to working area, it was converted to local variable.
This patch adds ChibiOS/RT support. This patch requires at least
ChibiOS/RT development version starting from SVN revision 4734.
Note, that the Thread structures depend not only on the target
but also on the ChibiOS configuration at build time.
To correct this ChibiOS includes a new "memory signature" which
specifies the offsets.
Special thanks go to Peter Stuge and Spencer Oliver for their
continous input and feedback to this patch.
rtos: Don't crash on qSymbol GDB packet when no RTOS is configured
Commit 43902905bbc8fdc9d764f3843d697161d9b5fd92 fixed a bug but also
introduced a regression. The RTOS GDB packet handler is always called,
not only when an RTOS is actually configured, so it is important to
check if an RTOS has been configured or not before actually processing
the qSymbol packet.
Change-Id: I1aed54f6c2817e1ebf99ddcda051df4554ea5a3a Signed-off-by: Peter Stuge <peter@stuge.se>
Reviewed-on: http://openocd.zylin.com/907 Tested-by: jenkins
Peter Horn [Mon, 8 Oct 2012 18:55:01 +0000 (20:55 +0200)]
rlink: Fix DTC command timeout
With the current timeout setting i = 10 in drtc_run_timeout()
I get "Error: too many retries waiting for DTC status" when
loading a program into the FLASH of an STM32F1.
By experimentation a value of i = 22 was found to be the minimum
on my system. Therefore the value has been increased to i = 50.
Change-Id: Ib67fc648ccaad305871b81c2c39e49de53c330a0 Signed-off-by: Peter Horn <peter.horn@bluewin.ch>
Reviewed-on: http://openocd.zylin.com/863 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
The erase time for the option byte page is not directly specified but is
assumed to be the same as the other pages (or mass erase) which is 20 to
40 ms. The current timeout value is 10 which means 10 ms plus the time to
poll the status flag that many times.
With faster interfaces or drivers (such as when using the ftdi driver
instead of the ft2232 driver) the adapter delay is not enough in some
cases, unless the jtag freq is reduced as a workaround. The result is a
"timed out waiting for flash" error when trying to write the options.
Increase the timeout to a minimum of 100 ms, which is in line with the
other erase timeouts. Also make defines of both the erase and the program
timeouts.
Change-Id: Ia86e71505033c52b60ef30092000689fbb547a18 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/902 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Peter Stuge [Thu, 4 Oct 2012 13:17:53 +0000 (15:17 +0200)]
rtos: Rewrite rtos_qsymbol() and fix auto-detect false positive
Matthias Blaicher submitted a patch at http://openocd.zylin.com/#/c/891/
to fix the false positive; when no RTOS was detected OpenOCD used the
last RTOS in the list.
While reviewing the code affected by Matthias' patch a rewrite seemed
appropriate, to make the code readable.
Matthias has abandoned his change and this change also fixes the false
positive.
Peter Stuge [Thu, 4 Oct 2012 12:35:18 +0000 (14:35 +0200)]
rtos: Rewrite rtos_try_next() for readability
The new code is almost functionally equivalent to the old.
The function now returns 0 instead of -1 if target->rtos has not yet
been allocated. All call sites only test for success, and in practise
that is also the only thing that matters; if the function successfully
iterated to the next RTOS or not.
Other than that the only difference is that the code is now readable.
Many thanks to Matthias Blaicher for the fix to the iteration error!
In FLASHD_ErasePages AT91C_EFC_FCMD_EPA is used to erase sectors.
According to the datasheet FARG[15:2] defines the page from which
the erase will start.This page must be modulo 4, 8, 16 or 32
according to the number of pages to erase. FARG[1:0] defines the
number of pages to be erased. Previously (firstpage << 2) was used
to conform to this, seems it should not be shifted... Changed it
to (firstPage) | erasePages.
Spencer Oliver [Thu, 4 Oct 2012 13:01:14 +0000 (14:01 +0100)]
build: fix broken ftd2xx bus blaster
If configure is executed without --enable-ft2232_ftd2xx then the bus blaster
or presto will fail to build with unresolved external ftd2xx_status_string.
Make sure we run the ftd2xx build test if --enable-usb_blaster_ftd2xx is enabled.
Change-Id: I09d270d6fcd083d77f6785b8969d9acb3dfef11d Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/892 Tested-by: jenkins Reviewed-by: Peter Stuge <peter@stuge.se>
Spencer Oliver [Mon, 24 Sep 2012 11:29:47 +0000 (12:29 +0100)]
ftdi: fix adapter_init rclk fallback
adapter_init expects jtag_get_speed (via ftdi_khz) to return a valid
fallback speed if the adapter does not support rclk. The call was failing
and so was the rest of the adapter init.
The makes the new ftdi driver emulate the old ftdi driver.
George Harris [Fri, 17 Aug 2012 00:53:32 +0000 (17:53 -0700)]
Added SPIFI flash driver, algorithms, and docs
Added a flash driver designed to allow program/erase of
memory-mapped SPI flash chips for LPC43xx/LPC18xx family
micros. This driver includes three algorithms - erase,
write, and SPIFI peripheral initialization (to allow
memory-mapped access after a reset). The driver has been
added to the flash driver table (drivers.c), and the
OpenOCD documentation has been updated to include the flash
driver configuration command.
George Harris [Fri, 17 Aug 2012 00:35:39 +0000 (17:35 -0700)]
SPI nor drivers refactor
Moved common SPI flash driver code (device table,
common commands) into flash/nor/spi.c and spi.h.
Updated flash/nor/stmsmi.c to reflect this refactor.
In at91sam3.c for Atmel SAM3 flash support, there are arithmetic errors in the functions sam3_page_read() and sam3_page_write().
Address locations are computed incorrectly due to an extra addition operation. This leads to memory locations being skipped during
flash writes and reads.
Smaller programs are written successfully into flash, with memory gaps, while larger programs of legitimate size fail because the
skipped memory is not utilized and therefore unavailable.
The changes address this condition, and have been tested with an Atmel SAM3X-EK evaluation board.
Spencer Oliver [Thu, 30 Aug 2012 11:53:34 +0000 (12:53 +0100)]
cortex_m: suggest using hardware srst if VECTRESET used
If the target does not support SYSRESETREQ we fall back to using VECTRESET.
This however does not reset the peripherals and we issue a warning to the user
to suggest using a reset-init script.
Also suggest that using hardware srst will give them the same functionality
as using SYSRESETREQ.
Change-Id: Ie1781c4b849fed66c52222e6539735537c879fb3 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/802 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Salvador Arroyo [Sat, 25 Aug 2012 14:22:58 +0000 (16:22 +0200)]
Pic32mx: make row programming work with any offset
In function pic32mx_write_block() if the parameter
offset is not a multiple of row size the row offset
(offset % row_size) will be ignored by the flash
controller, shifting the code to the beginning of
the row.
Word programming gets it right.
Change-Id: I134913e3d533688f791bbcb0c6e8983524197f3c Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es>
Reviewed-on: http://openocd.zylin.com/796 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Spencer Oliver [Tue, 21 Aug 2012 10:10:18 +0000 (11:10 +0100)]
server: warn if user changes server port after init
So the user can view the current port number these cmds were changed to COMMAND_ANY.
However this means that the user can also attempt to change the port number after init,
even though this is not supported. Issue a warning that this is not supported.
ftdi: fix overflow if last field of a scan is empty
The last bit of a scan is clocked during TAP movement so it's necessary
for the last field to have at least one bit. Strip trailing empty fields
and make sure the TAP is not affected if there's nothing to scan. Clients
probably shouldn't add empty fields so add a debug message to be able to
track and fix them.
Change-Id: I27552568bc11146570b9b99ed8a1ae81b5fb2c50 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/794 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
mpsse: check available buffer space even for discarded data scans
When there's no data to scan in or out, we still use the clock data out
command and fill the buffer with zeroes, so make sure the buffer is
checked for available space.
Change-Id: Ia6005c40c81f7fdb89379f1b5023fe383184d210 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/793 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
Spencer Oliver [Tue, 28 Aug 2012 11:19:26 +0000 (12:19 +0100)]
adapter: add 'adapter speed:' prefix to output
Currently only the adapter speed is printed, which can be rather misleading
when DEBUG_INFO is disabled, all the user sees is
6000 kHz
instead lets print
adapter speed: 6000 kHz
Freddie Chopin [Fri, 17 Aug 2012 09:54:24 +0000 (11:54 +0200)]
Add another scripts search path for Windows builds
Add single "scripts" folder to search path for Windows OpenOCD builds
that don't use cygwin
bin/openocd.exe
scripts/interface/dummy.cfg
scripts/target/at91eb40a.cfg
Do some refactoring of current code (thx to Andreas).
The number if longwords or "sections" (Freescale term) written for a Kinetis
flash write (4, 8, or 16 bytes depending on the part density/granularity) are
now rounded up to ensure there are no truncations when the desired write is
not a multiple of the minimum write size.
Always scan out all bits, but make sure only the allowed number of bytes
end up in the caller-provided buffer. Discard the rest by adding another
scan field when size < 4.
Rewrite the endianness callback to avoid reading outside allocated memory.
Make it directly usable as a callback without the need for a wrapper. Move
the shared callback to a more suitable home in arm7_9_common.
Salvador Arroyo [Sun, 5 Aug 2012 09:18:27 +0000 (11:18 +0200)]
Severe bug in Pracc code
The function wait_for_pracc_rw() fails if Pracc bit is 0.
The variable ejtag_ctrl is loaded with the content of the
control register in the first scan.
In the second scan Pracc bit is scanned out as 0, letting
the proccesor go. The result is unpredictable.
All the strange data corruption when scanning at certain
frequencies, or the strange delays needed when entering
or leaving fasdata area are retated to this bug.
Now the code works at any scan frequency, tested up to 15000Khz
and indepently of processor speed, tested at 31.25Khz and 4/8Mhz.
cfi: fix type-punning warnings in cfi_spansion_write_block
Retest the condition when needed, instead of abusing the common_magic
field as a flag. There are only two options here. Either it's an armv7m or
it's another arm. is_arm(...) will return true even for armv7m, so it's
imperative to check in the right order.
Change-Id: Ic227f19f7babf1b0b0fe075f9a3abc4eabc7d5f1 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/779 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>