aboutsummaryrefslogtreecommitdiff
path: root/src/flash
AgeCommit message (Collapse)Author
2014-11-24nrf51: verify that UICR needs erasing before triggering an error about itJim Paris
If the UICR is already empty, there's no reason to return an error just because it can't be erased again. This happens, for example, when flashing UICR from GDB after a "monitor nrf51 mass_erase". Change-Id: Ia6d28c43189205fb5a7120b1c7312e45eb32edb7 Signed-off-by: Jim Paris <jim@jtan.com> Reviewed-on: http://openocd.zylin.com/2363 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-11-24nrf51: fix UICR eraseJim Paris
nrf51_erase_page() checks for (sector->offset == NRF51_UICR_BASE) to determine if the UICR should be erased. However, sector->offset for the UICR bank is set to 0 in nrf51_probe, so this code is never hit. Attempting to erase UICR ends up erasing the first flash sector. Use bank->base instead to determine if UICR is being erased. Change-Id: Ie5df0f9732f23662085ae2b713d64968cd801472 Signed-off-by: Jim Paris <jim@jtan.com> Reviewed-on: http://openocd.zylin.com/2362 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-11-24nrf51: fix UICR region sizeJim Paris
The UICR region is actually 0x100 bytes in size. Besides making the full region accessible, having the right value is important because GDB rounds flash addresses to the nearest multiple of the block size when determing which flash blocks to erase. Change-Id: I416c391cbfc7be41a03a9b9c6e42326c87391f38 Signed-off-by: Jim Paris <jim@jtan.com> Reviewed-on: http://openocd.zylin.com/2361 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2014-10-06stm32: add mass erase support for STM32LRémi PRUD'HOMME
The mass erase for STM32L was lack because the procedure is more complex than the procedure for the STM32F4xx. The reference manual RM0038 (L100 subfamily) page 79 is more accurate than the reference manual for the STM32L0xx. On the L0, the mass-erase erase also the EEPROM. This is a limit to mass erase on L0. The mass erase procedure is a command of telnet interface. Tested on Discovery L053 and Discovery L100. Change-Id: I6a1d7a3669789aea89c59a006ab2d883f3d827ca Signed-off-by: Rémi PRUD'HOMME <prudhomme.remi@gmail.com> Reviewed-on: http://openocd.zylin.com/2319 Tested-by: jenkins Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-10-06flash/nor/stellaris: implement protection statuses and proceduresPaul Fertser
This should make protection work as expected on all stellaris families, including the latest Tiva C Snowflake. Run-time tested on TM4C123x (Blizzard). Change-Id: Ia017edb119bec32382b08fc037b5bbc02dd9000c Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2267 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-10-06flash/nor/stellaris: actually enable protection and unprotection with ICDIPaul Fertser
This is still limited to pre-Snowflake parts and the first 64K of flash. Change-Id: I9ca872ada3d1a87dba6261464b2a72a15eda5ecf Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2264 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-10-06flash: constify driver data structuresSpencer Oliver
Change-Id: Ia5c3de48119f036e1d7a41be62a672a6fb37e59b Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/2293 Tested-by: jenkins
2014-10-06nuc1x: fix typosSpencer Oliver
Change-Id: Ia67b55ccb2bea71a99daa176def82960f487ca9f Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/2291 Tested-by: jenkins
2014-10-06at91samd: fix protect, add EEPROM and boot commandsAndrey Yurovsky
There were two problems with the _protect() feature: 1. The address written was off by a factor of two because the address register takes 16-bit rather than 8-bit addresses. As a result the wrong sectors were (un)protected with the protect command. This has been fixed. 2. The protection settings issued via the lock or unlock region commands don't persist after reset. Making them persist requires modifying the LOCK bits in the User Row using the infrastructure described below. The Atmel SAMD2x MCUs provide a User Row (the size of which is one page). This contains a few settings that users may wish to modify from the debugger, especially during production. This change adds commands to inspect and set: - EEPROM size, the size in bytes of the emulated EEPROM region of the Flash. - Bootloader size, the size in bytes of the protected "boot" section of the Flash. This is done by a careful read-modify-write of the special User Row page, avoiding erasing when possible and disallowing the changing of documented reserved bits. The Atmel SAMD20 datasheet was used for bit positions and descriptions, size tables, etc. and testing was done on a SAMD20 Xplained Pro board. It's technically possible to store arbitrary user data (ex: serial numbers, MAC addresses, etc) in the remaining portion of the User Row page (that is, beyond the first 64 bits of it). The infrastructure used by the eeprom and bootloader commands can be used to access this as well, and this seems safer than exposing the User Row as a normal Flash sector that openocd understands due to the delicate nature of some of the data stored there. Change-Id: I29ca1bdbdc7884bc0ba0ad18af1b6bab78c7ad38 Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-on: http://openocd.zylin.com/2326 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-10-06at91samd: add erase/secure commands, minor fixAndrey Yurovsky
Reference code for the SAMD2x disables caching in the NVM controller when issuing NVM commands. Let's do this as well to be consistent and safer. Add a "chip-erase" for the Atmel SAMD targets that issues a complete Chip Erase via the Device Service Unit (DSU). This can be used to "unlock" or otherwise unbrick a chip that can't be halted or inspected, allowing the user to reflash with new firmware. Add a "set-security" command which issues an SSB. Once that's done and the device is power-cycled, the flash cannot be written to until a "chip-erase" is issued. The chip-erase cannot be issued by openocd at this time because the device will not respond to a request for the DAP IDCODE. Change-Id: I80122f0bbf7e3aedffe052c1e77d69dc2dba25ed Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-on: http://openocd.zylin.com/2239 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-09-22flash/nor/tcl.c: Do not double probe banksAndrey Smirnov
Previous to this version the code of handle_flash_probe_command would probe a bank twice: first time by auto-probe through a call to flash_command_get_bank and second time by calling the probe function directly. This change adds a flash_command_get_bank_maybe_probe wich is a more generic version of the flash_command_get_bank, that would allow commands to decide whether auto-probing should be performed or not. Change-Id: If150ca9c169ffe05e8c7eba36338d333360811e3 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-on: http://openocd.zylin.com/2093 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-09-22flash/nor: add mrvlqspi flash controller driverMahavir Jain
This patch adds support for QSPI flash controller driver for Marvell's Wireless Microcontroller platform. For more information please refer, https://origin-www.marvell.com/microcontrollers/wi-fi-microcontroller-platform/ Following things have been tested on 88MC200 (Winbond W25Q80BV flash chip): 1. Flash sector level erase 2. Flash chip erase 3. Flash write in normal SPI mode 4. Flash fill (write and verify) in normal SPI mode Change-Id: If4414ae3f77ff170b84e426a35b66c44590c5e06 Signed-off-by: Mahavir Jain <mjain@marvell.com> Reviewed-on: http://openocd.zylin.com/2280 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-09-22flash/nor/spi: Add Winbond w25q32fv flash supportMahavir Jain
Change-Id: I2919d462e04b489cc793b82ec347838a08cb8c48 Signed-off-by: Mahavir Jain <mjain@marvell.com> Reviewed-on: http://openocd.zylin.com/2273 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-09-15flash: added new Spansion S25FL116K, S25FL132K, and S25FL164K devicesAnders
The new FL1-K family is replacing the FL-K family. The data from all three was based on the datasheet. In addition the 8MB S25FL164K was tested successfully with OpenOCD on a custom board. Change-Id: Idafeed86da12a481c0db92cc0de7ba28f50c2252 Signed-off-by: Anders <anders@openpuma.org> Reviewed-on: http://openocd.zylin.com/2281 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-09-15stm32lx: don't allow part_info to be uninitializedAndrey Yurovsky
It's possible for us to fail to read the part ID code so make sure that part_info is initialized to NULL before attempting to do so, otherwise we could proceed and use it uninitialized and then segfault. Change-Id: I0a3f3d3947690b66f0981b5046340449521e0b33 Signed-off-by: Jack Peel <jack.peel@synapse.com> Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-on: http://openocd.zylin.com/2276 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-09-08stm32f2x: added STM32F411xx series support.Nemui Trinomius
Added STM32F411xx series to flash driver. Tested on NUCLEO-F411RE board(STM32F411RET6). Change-Id: Id7d1f2858c09815a013e0590e65ad193fb039157 Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp> Reviewed-on: http://openocd.zylin.com/2258 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-09-08flash/nor/stellaris: add all Tiva C parts IDsPaul Fertser
Luckily, TI's website has predictable URLs for the datasheets, so it was trivial to download all the pdfs corresponding to the currently available 71 TivaC devices. Then they were processed with pdftotext and parsed by this script: BEGIN { capture = -1 } /^Device Identification 0 \(DID0\)$/ { state = "waitingclass0" } /^Device Identification 1 \(DID1\)$/ { state = "waitingpartno0" } /^CLASS$/ { if (state == "waitingclass0") state = "waitingclass" else if (state == "waitingclass") capture = 4 } /^PARTNO$/ { if (state == "waitingpartno0") state = "waitingpartno" else if (state == "waitingpartno") capture = 4 } (FNR == 3) { family = $2 } { if (capture >= 0) { if (capture == 0) { if (state == "waitingclass") class = $0 else if (state == "waitingpartno") partno = $0 } capture-- } } END { print "{" class ", " partno ", \"" family "\"}," } Change-Id: I6820c409fe535f08394c203276b5af4406fe8b92 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2262 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-09-08flash/nor/stellaris: improve support for Tiva C (Blizzard and Snowflake)Paul Fertser
This should make current Tiva C parts usable apart from the protection. Runtime tested on TM4C123GXL (Blizzard) and TM4C1294XL (Snowflake). Change-Id: Ia64e9d39fbd2b7049578bbfade72435e5203ddf5 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2257 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-08-19stm32lx: refactor and add support for STM32L0xxAndrey Yurovsky
This adds initial support for the STM32L0 family, specifically the ID code 417 variant. The 'L0 has 128B rather than 256B pages as well as a different number of pages per sector. It also has several key registers and register sets in different locations from the STM32L1xx parts. This change therefore takes the opportunity to reorganize part information into a const table (it was previously determined by a set of control statements) and abstracts away some of the low-level details to make them generic for L1 and L0 parts. We also include the first bank's size (for dual bank parts) in the new device information table (and correct that size for the 0x437 variant which is 256 rather than 192KB). The 'L0 parts will not use the built-in loader/helper for Flash writing. Tested on STM32L053 (dicovery board and Nucleo board) and STM32L152 (discovery board). Change-Id: I57f7a8ab02caee266de71b31ae82a50d85728a0b Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-on: http://openocd.zylin.com/2200 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-08-19flash: samd: add missing ID for SAMD20E18AAndrey Yurovsky
This was somehow missed in the chip ID table and of course that's exactly the one on my board (as such, tested on hardware). Change-Id: I212d7c729d979e0357f1d4635f40935e25fe6ff3 Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-on: http://openocd.zylin.com/2260 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-08-19flash/nor/stm32f1x: add STM32F302x6/8 IDs, clarify STM32F302xB/CPaul Fertser
Change-Id: I22afbe30f32b0ea9b59c3de8d15ce14bdc4763cc Reported-by: Luis Rodrigues <lfrodrigues@gmail.com> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2249 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-07-10Adding support for the Atmel SAMR21.Thomas Schmid
The Atmel SAMR21 is a Atmel SAMD21 with an Atmel RF233 in one package (two dies). Tested with the SAMR21 Xplained Pro eval kit. Change-Id: I1d79ea05834b925d7ec810527206fe86854e684b Signed-off-by: Thomas Schmid <thomas@rfranging.com> Reviewed-on: http://openocd.zylin.com/2194 Tested-by: jenkins Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-07-04kinetis : Added Kinetis-K Series MDM-AP ID.Nemui Trinomius
Kinetis-K series has ID:0x001C0000 on MDM-AP IDR register. Other Kinetis(L/M/V/E) series have ID:0x001C0020. Change-Id: Iada37038cd239f7331ba80a3673b36bf7e18c555 Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp> Reviewed-on: http://openocd.zylin.com/2195 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-06-22flash: samd: add SAMD10 and SAMD11 part IDsAndrey Yurovsky
Add part IDs for the new SAMD10 and SAMD11 parts within the Atmel SAMD family, they have the same Flash controller as the other samd parts and should be supported by the at91samd driver. Compile-tested only. Change-Id: I493ae96a7d7e8d19e607fd9a4b6544a982be42b3 Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-on: http://openocd.zylin.com/2170 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-06-22flash/nor/tcl.c: fix formatting in "rejected" error messagePaul Fertser
The error message (with the usage field unpopulated) looks like this, obviously missing at least a space before Usage: Error: 'fm3' driver rejected flash bank at 0x00000000Usage (null) Change-Id: I2a625676e784d02942823f972a201f7f4f810c68 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2161 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-06-22efm32 : Added ZeroGecko family support.Nemui Trinomius
Added Cortex-M0plus "ZeroGecko" Family to flash driver. Tested on EFM32ZG222F32. Change-Id: I1660b34ef6ee04837e97581504fff0faf84d1c6d Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp> Reviewed-on: http://openocd.zylin.com/1994 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-06-19stm32f1x: add STM32F33x support.Nemui Trinomius
Added STM32F33x series to flash driver. Tested on NUCLEO-F334R8 board(STM32F334R8T6). Change-Id: I2fe70d40eb7613a7a3cfa63d25fa83f7bc055fb4 Signed-off-by: Nemui Trinomius <nemuisan_kawausogasuki@live.jp> Reviewed-on: http://openocd.zylin.com/2174 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-06-18flash/nor/kinetis: prevent segfaulting with an HLAPaul Fertser
HLAs do not provide direct DAP access, so the best we can do about it is skipping it. Change-Id: I877ef8fd2d86e40e7442a637cdba182cfd60e05a Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2173 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-06-18flash/nor/at91sam4: add SAM4E16 supportMarco Cruz
Change-Id: I7ab4750073c9d34812b690996eef76fccf70c627 Signed-off-by: Marco Cruz <marco.caratuva@gmail.com> Reviewed-on: http://openocd.zylin.com/2157 Reviewed-by: Alexandre Pereira da Silva <aletes.xgr@gmail.com> Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-06-01Flash/LPC2000: Add support for auto-probing flash sizeCosmin Gorgovan
Adds support for auto-probing on devices which support the IAP Read Part ID command. Includes IDs for all LPC17XX, LPC13XX, LPC11XX and LPC11XXX devices with publicly available user manuals. To use auto-probing, select the 'auto' lpc2000 variant. Change-Id: Ic617c32925c9ebe0e9d9192ed8ddbfa08e9f0aaa Signed-off-by: Cosmin Gorgovan <cosmin@linux-geek.org> Reviewed-on: http://openocd.zylin.com/2075 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-06-01Flash/LPC2000: Add support for LPC11(x)xx, LPC13xxCosmin Gorgovan
LPC11(x)xx and LPC13xx devices are mostly compatible with the lpc1700 variant of the LPC2000 driver, but use a fixed flash sector size of 4KB. Change-Id: I033515f4ff6bc61d3b9babd27096f78c99cea927 Signed-off-by: Cosmin Gorgovan <cosmin@linux-geek.org> Reviewed-on: http://openocd.zylin.com/2071 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-06-01STM32F2x: Don't clear FLASH_OPTCR bits when locking registerElliott Partridge
stm32x_write_options is locking the FLASH_OPTCR register by writing 0x00000001 to it, which clears the other bits. This causes problems with subsequent flash operations; the hardware is probably seeing the write protection bits in the register set to '0' (protect), causing a WRPERR. This patch ORs the value of the register with 0x00000001, so that the only change is the lock bit itself. Change-Id: I0e3ca9aa6563ce1b57a01fc0faf7563b6b85f620 Signed-off-by: Elliott Partridge <elliott.partridge@gmail.com> Reviewed-on: http://openocd.zylin.com/2155 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-05-31flash/nor/stm32f1x: add support for F04x partsPaul Fertser
Ref. RM0091 Rev.6. Change-Id: I13bcdb1741edc59712e4fa1849fff38d17709fa7 Reported-by: efuentes@irc.freenode.net Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2150 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-05-16lpcspifi: setup a valid stack pointer before calling ROM code using stackAurelien Jacobs
The spifi_init_code blob is calling the spifi_init() function from the ROM. This ROM function is making use of the stack. So if the stack pointer is invalid, trying to execute this code leads to a double fault and the target_run_algorithm() call return with an error. This patch simply ensure that the stack pointer is properly setup before calling the spifi_init() ROM function. Change-Id: I42a2163cfc2c6dfe5ada97ae8eb2bb6d2e283ff7 Signed-off-by: Aurelien Jacobs <aurel@gnuage.org> Reviewed-on: http://openocd.zylin.com/1836 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-05-10kinetis: Revise CPU un-securing codeAndrey Smirnov
Old version of the code had several problems, among them are: * Located in a generic ADI source file instead of some Kinetis specific location * Incorrect MCU detection code that would read generic ARM ID registers * Presence of SRST line was mandatory * There didn't seem to be any place where after SRST line assertion it would be de-asserted. * Reset was asserted after waiting for "Flash Controller Ready" bit to be set, which contradicts official programming guide AN4835 * Mass erase algorithm implemented by that code was very strange: ** After mass erase was initiated instead of just polling for the state of "Mass Erase Acknowledged" bit the code would repeatedly initiate mass erase AND poll the state of the "Mass Erase Acknowledged" ** Instead of just polling for the state of "Flash Mass Erase in Progress"(bit 0 in Control register) to wait for the end of the mass erase operation the code would: write 0 to Control register, read out Status register ignoring the result and then read Control register again and see if it is zero. * dap_syssec_kinetis_mdmap assumed that previously selected(before it was called) AP was 0. This commit moves all of the code to kinetis flash driver and introduces three new commands: o "kinetis mdm check_security" -- the intent of that function is to be used as 'examine-end' hook for any Kinetis target that has that kind of JTAG/SWD security mechanism. o "kinetis mdm mass_erase"" -- This function removes secure status from MCU be performing special version of flash mass erase. o "kinetis mdm test_securing" -- Function that allows to test securing fucntionality. All it does is erase the page with flash security settings thus making MCU 'secured'. New version of the code implements the algorithms specified in AN4835 "Production Flash Programming Best Practices for Kinetis K- and L-series MCUs", specifically sections 4.1.1 and 4.2.1. It also adds KL26 MCU to the list of devices for which this security check is performed. Implementing that algorithm also allowed to simplify mass command in kinetis driver, since we no longer need to write security bytes. The result that the old version of mass erase code can now be acheived using 'kinetis mdm mass_erase' Tested on accidentally locked FRDM-KL26Z with KL26 Kinetis MCU. Change-Id: Ic085195edfd963dda9d3d4d8acd1e40cc366b16b Signed-off-by: Andrey Smrinov <andrew.smirnov@gmail.com> Reviewed-on: http://openocd.zylin.com/2034 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-05-05Fix some C99 format specifiersPaul Fertser
As exposed by arm-none-eabi build, fix the wrong modifiers. Change-Id: Ia6ce7c5c1d40e95059525c3e5d81b752df2fea7c Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2122 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-04-27nrf51: remove dereference of null pointerSpencer Oliver
found by clang 3.4. Change-Id: Id499b546f65acd7a719498bc97e33b21d1ba565a Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/2119 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Andrey Smirnov <andrew.smirnov@gmail.com>
2014-04-08flash/nor/at91sam3: remove sam3_page_write_opcodesPaul Fertser
Apparently this helper was never actually used, and current clang produces an unused const variable warning, so it's breaking the build. Change-Id: Ib088bef5e9c0a48942c1d417d46f738469ee7e28 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/2076 Tested-by: jenkins Reviewed-by: Xiaofan <xiaofanc@gmail.com>
2014-03-29at91smad: Fixes to 'samd_protect'Andrey Smirnov
Some fixes to 'samd_protect' including: - Fix a bug in which the value of 'set' parameter passed into the function was ignored so it was impossible to remove flash protection once it was set. - Check the protection status of the sector via 'is_protected' field of the corresponding 'flash_sector' structure to see if any actual HW manipulations needs to be done. - Change the way the errors during protection activation are handled. Now even in the case of error in the middle of protecting a number of sectors the subroutine would still update the state of the sector protection in sectors array so as to avoid cases where openocd thinks that the sector is not protected while it actually is. Change-Id: I4cc6445a98ec13bdd94c89f0711c17840738a215 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-on: http://openocd.zylin.com/2027 Tested-by: jenkins Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29at91samd: Bail early if trying to erase protected sectorAndrey Smirnov
Bail early if trying to erase protected sector and also do not double-erase already erased sectors. Change-Id: Ic2d39af48c3b8e10e78d52dd978b9bc01f671c6a Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-on: http://openocd.zylin.com/2026 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29at91samd: Bail early if trying to write to protected sectorAndrey Smirnov
Bail early if trying to write to protected sector also mark the sector we are writing to as dirty. Change-Id: I892f83461792e1cc2dcccade7aa65717831a6805 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-on: http://openocd.zylin.com/2025 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29at91samd: Remove 'first' and 'last' checks in 'samd_erase'Andrey Smirnov
Remove 'first' and 'last' checks in 'samd_protect' since those parameters are checked in 'handle_flash_erase_command'. Change-Id: I30e5598a9ab656d81055f26cc63e291377605300 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-on: http://openocd.zylin.com/2024 Tested-by: jenkins Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29Move ocl (at91sam7x flash loader) sources to contribPaul Fertser
Change-Id: Ib5c3c505a067d0e285a7b074cb6fddebfa6dda1e Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1904 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-03-29nrf51: Fix incorrect flash writing sequenceAndrey Smirnov
nRF51 doesn't have any sort of flash page cache so we need to write all of the data on the word-by-word basis and poll for "Flash Ready" bit each time. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Change-Id: I8caffbf69ebf9a69915724704ddbe270d1bb8d92 Reviewed-on: http://openocd.zylin.com/2050 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29nrf51: Remove unnecessary explicit type castingAndrey Smirnov
Change-Id: I523e81645434760649ea2c00e6f80c2b08d08d94 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Reviewed-on: http://openocd.zylin.com/2055 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29nrf51: Add UICR writing supportAndrey Smirnov
SoftDevice stack ihex binary, provided by Nordic expects being able to write data necessary for its correct operation at the adresses inside UICR. This patch exposes UICR region of flash as a second bank on the MCU to facilitate that. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Change-Id: Idbc140b8de027f60655f78043877b7c054eb06f9 Reviewed-on: http://openocd.zylin.com/2013 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29nrf51: Add a known devices table and simple chip type detection codeAndrey Smirnov
Unfortunately due to my oversight, the original version of the nrf51_probe function contained useless code that read the contents of DEVICEID[0] an DEVICEID[1] registers and did nothing about it(those registers had nothing to do with the device type information anyway). This commit fixes that code by changing its behavior to read the HWID field of CONFIGID register and looking up the corresponding device information in the know devices table. This information is useful when choosing the versions of SDK and SoftDevice for the chip using "nRF51822 compatibility matrix". Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Change-Id: Ibd80b35460df4278e86e0c2500b7dcc876eec10c Reviewed-on: http://openocd.zylin.com/2012 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-03-29AT91SAM4L: Fix bug when writing to flash at a non-zero offset, add debugAngus Gratton
output for flash page writes The offset wasn't being considered in the "full page" write codepath, so any writes at an offset were actually written out starting from page 0. Change-Id: I5e70a1f35f144b3edd1ce6d9df9af9b5da6cf194 Signed-off-by: Angus Gratton <gus@projectgus.com> Reviewed-on: http://openocd.zylin.com/1965 Tested-by: jenkins Reviewed-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29Support for sam3n0a sam3n0b sam3n00a sam3n00bAndreas Fritiofson
Change-Id: I70a04f5f9b0b20d42a677ea8781130e44be758d3 Signed-off-by: Stefan Arnold <sarnold@sh-sw.de> Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/2042 Tested-by: jenkins Reviewed-by: Stian Skjelstad <stian@nixia.no> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2014-03-29flash/nor/tcl: fix segfault on write_image misusePaul Fertser
"flash write_image (unlock|erase)" (without filename) was causing segmentation fault in strcmp(). This patch fixes it. Change-Id: Ia3b8c796f4107621d78605c02d2b8e123b1b207b Reported-by: ajkroll][ <ajkroll][@irc.freenode.net> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1970 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>