aboutsummaryrefslogtreecommitdiff
path: root/src/flash
AgeCommit message (Collapse)Author
2017-08-10Support for STM32F722, F723, F413 and F423Andreas Bolsch
IDs for STM32F722, F723, F413 and F423 added, handling of PCROP for F722/723 and additional nWPRT bits for F413/423 implemented. The additional protection bit positions for F413/423 conflict with other options bits for the F7xx variants, additionally the last two sectors share a common bit. Protection for F413 and F767/777 now use protection blocks rather sectors for dealing with protections bits. Checking for halted state in 'lock' and 'unlock' removed: When PCROP is activated in F723, halted state is not detected properly, but lock/unlock sequence is required to disable PCROP. Tested with STM32F723E-Disco, STM32F413ZH-Nucleo. Change-Id: Ie6ddab47a9ae8461087d369b4f289b7f9d1e031c Signed-off-by: Andreas Bolsch <hyphen0break@gmail.com> Reviewed-on: http://openocd.zylin.com/4045 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2017-08-10stm32l1: Devid 0x429 only has 8bit flash size registerKarl Palsson
A footnote in RM0038r14. Change-Id: Ic31894d846fbbe917a7290b2b7ff8fb582bb65da Signed-off-by: Karl Palsson <karlp@tweak.net.au> Reviewed-on: http://openocd.zylin.com/4198 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2017-07-24flash Kinetis: fix probe for FlexNVM partitioned as EEPROM backupTomas Vanek
If a MCU has FlexNVM partitioned as EEPROM backup only (no data flash), kinetis_probe_chip() detects zero fcfg2_maxaddr1 and adjusts flash banks count to 1, what is obviously wrong. The change limits the test to devices without FlexNVM. Computation of program flash/FlexNVM blocks is now more robust. Missing case 0x07 is added to switch (fcfg1_depart) Change-Id: I0bd6030a0fe1ab62aeb0223bbdf2aee1505bf6a0 Reported-by: simon.haines@scalardata.com Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4180 Tested-by: jenkins Reviewed-by: Simon Haines <simon.haines@scalardata.com> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2017-07-24flash Kinetis: fix devices with smallest program flash (8 and 16 kB)Tomas Vanek
Change-Id: I2692b9877a7f877104528f279a69e8cc1cfbcdbf Reported-by: David Miller Lowe <milhead@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4173 Tested-by: jenkins Reviewed-by: Miller Lowe <miller.lowe@trailtech.net> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2017-06-30flash/nor/efm32: Support EZR32HG devices.Richard Watts
Recognise the family number for Silicon Labs EZR32HG devices and select the correct flash page size. Change-Id: I876e930f3a9f679557fa0d0acac33e9bbfb28c46 Signed-off-by: Richard Watts <rrw@kynesim.co.uk> Reviewed-on: http://openocd.zylin.com/3934 Tested-by: jenkins Reviewed-by: Fredrik Hederstierna <fredrik@hederstierna.com> Reviewed-by: Jonas Norling <jonas.norling@cyanconnode.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-06-17flash/nor/tcl: Make read_bank parameters optionalMarc Schink
Make 'offset' and 'length' parameters optional, if both are omitted simply read the whole flash bank. Additionally, check if the 'offset' and 'length' arguments are out of bounds of the flash bank. Change-Id: Ib9c1b0538a2c78ebcf702e2da11468dff407f8ff Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3862 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-06-17flash/nor/tcl: Respect flash bank boundary in write_bankMarc Schink
Respect the flash bank boundary and write only to the remaining part of the bank even if the file content is larger. Change-Id: I8f4c1b161c103a77bdb30c6bf052293b5ed48c41 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3861 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-06-17flash/nor/tcl: Make write_bank parameter optionalMarc Schink
Make the 'offset' parameter optional, if omitted simply start at the beginning of the flash bank. Additionally, check if the argument is out of bounds of the flash bank. Change-Id: I8e9632b539ad9e83211e1ac6a06da4c8109cbc60 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3860 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-06-17flash/nor/tcl: Respect flash bank boundary in verify_bankMarc Schink
Respect the flash bank boundary and compare only the remaining content of the bank even if the file content is larger. Change-Id: I4d75979c7893fdd4d18372fa6b0321a0486b4fa9 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3859 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-06-17flash Kinetis: Add support for newer KW seriesJoakim Nohlgård
Add support for flashing newer members of the NXP Kinetis KW family Supported devices: - KW20Z - KW30Z - KW40Z - KW21Z - KW31Z - KW41Z The earlier KW2xD and KW01Z devices are already supported by the code for the older K-series. Verified working on the FRDM-KW41Z development board. Tested flashing both via GDB `load` and directly via OpenOCD flash write commands. Change-Id: I73eae477127a8b54a33005b3b526b5439450a808 Signed-off-by: Joakim Nohlgård <joakim.nohlgard@eistec.se> Reviewed-on: http://openocd.zylin.com/4104 Tested-by: jenkins Reviewed-by: Johann Fischer <johann_fischer@posteo.de> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-06-17flash Kinetis: add KL28 deviceTomas Vanek
This device differs a lot from others in KL series. Unfortunately the System Integration Module, where device identification resides, moved to a new address so probe now have to try both addresses of SIM_SDID. Introduce a new bank creation option: -sim-base to ensure error free probe. WDOG32 is slightly different from KE1x and on different address. System Mode Controler changed layout to word aligned. Change-Id: I2c9dca0c4ad4228fcc941d6078d15f5e394833ff Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4059 Tested-by: jenkins Reviewed-by: Joakim Nohlgård <joakim.nohlgard@eistec.se> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-06-17flash Kinetis: handle all types of watchdog, disable in reset-initTomas Vanek
Active watchdog forces reset during armv7m_checksum_memory() in verify_image command if run just after reset init. COP watchdog in KL series and WDOG32 in KE1 series have longer timeout however they need to be disabled too. The change extends 'kinetis disable_wdog' command to optionally probe the chip and use appropriate algorithm to disable watchdog. Setting of cache type is also split from flash_support flags. Tcl command 'kinetis disable_wdog' is called in reset-init event. Change-Id: I3191e230f38b679ed74f2a97fe323ef8fb3fe22e Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3901 Tested-by: jenkins Reviewed-by: Joakim Nohlgård <joakim.nohlgard@eistec.se> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-06-17flash Kinetis: implement automatic bank creation based on device probeTomas Vanek
Kinetis flash driver services huge number of MCU types. They have one, two or four flash banks with option of FlexNVM. It would require ~36 config files just for Kx series, more for KLx, KVx and KE1x. The change implements alternative approach: - configuration file creates just one pflash bank (common for all devices) - when a device is probed, additional pflash or flexnvm banks are created based on flash layout of the connected MCU - created banks have names with optional numbering e.g. kx.pflash0 kx.pflash1 kx.flexnvm0 kx.flexnvm1 - the first bank gets renamed if numbering is used Automatic bank creation is enabled by tcl command 'kinetis create_banks'. Used solution has a drawback: other banks than pflash0 are not accessible until pflash0 is probed. Fortunately gdb attach and standard programming accesses banks in right sequence. Change-Id: I5b9037cbefdb8a4176b7715fbcc3af4da4c1ab60 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3925 Tested-by: jenkins Reviewed-by: Joakim Nohlgård <joakim.nohlgard@eistec.se> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-06-17flash Kinetis: split kinetis_chip from kinetis_flash_bankTomas Vanek
Kinetis flash driver probed and decoded chip repeatedly for each flash bank. Bank ordering used global bank number so multi-target configuration was broken. The change introduces kinetis_probe_chip() which reads SIM SDID and SIM FCFG registers, decodes Kinetis series and family and fills struct kinetis_chip. This probe runs once for all banks. struct kinetis_chip contains pointers to all flash banks embeded in the MCU. It simplifies iteration over all or specific MCU banks. kinetis_probe_chip() generates MCU name and some informational messages are improved. Change-Id: I990db5c63ba490667eec0e5459086d83936662fb Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3924 Tested-by: jenkins Reviewed-by: Joakim Nohlgård <joakim.nohlgard@eistec.se> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-06-17flash Kinetis: add KV5x familyTomas Vanek
Real time control MCU has a Cortex-M7 and numerous changes in flash layout. Introduced a new ID of MDM-AP. While on it a LOG_DEBUG format error fixed. Change-Id: I1018660ce0c3dd63ac5e2563408fabff3c3daef7 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3900 Tested-by: jenkins Reviewed-by: Joakim Nohlgård <joakim.nohlgard@eistec.se> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-06-17flash Kinetis: add KL8x family, fix erase checkTomas Vanek
Secure devices KL81Z7 and KL82Z7 have no SERIESID field in ID register so they have to be decoded in Kx branch (not KLx). The flash controller in KL8x and also in K8x devices does not implement FTFx_CMD_BLOCKSTAT command. Fix kinetis_blank_check() to work properly using FTFx_CMD_SECTSTAT command only. Introduce a new flag FS_NO_CMD_BLOCKSTAT to avoid use of FTFx_CMD_BLOCKSTAT on these devices. Change-Id: I3ff58718480acd8cce69f618f71667b6b1d9c4f3 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3898 Tested-by: jenkins Reviewed-by: Joakim Nohlgård <joakim.nohlgard@eistec.se> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-06-17flash Kinetis: add KE1xZ and KE1xF familiesTomas Vanek
The new Kinetis KE1x families use FTFE flash controller unlike KE0x. Also SDID coding corresponds to new K, KL and KV families. That's why KE1x is handled by kinetis driver instead of kinetis_ke Change-Id: Ibb73e28e41dfbb086e761e1f006b089825dab854 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3896 Tested-by: jenkins Reviewed-by: Joakim Nohlgård <joakim.nohlgard@eistec.se> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-06-17flash/nor: at91samd modified to use real erase sector sizeTomas Vanek
Before this change SAMD driver defined "sector" equal to a flash protection block. Oversize sectors (16kB for the biggest flash size) made problems for flashing firmware split to two or more parts. Removed superfluous test of sector protection before erase. Change-Id: I8e6a6bda6ccd91eda2df67ec48270c69faa1bdd1 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3546 Tested-by: jenkins Reviewed-by: Stian Skjelstad <stian@nixia.no> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-06-17flash/nor/at91sam4: remove FWS=6, rename at91samg to atsamgTomas Vanek
FWS=6 workaround removed, as this appears to be a copy-paste error from the SAM3X family. Originally addressed in http://openocd.zylin.com/3837 but not all occurences were removed. Atmel changed chip naming and removed 91 prefix for atsamg, samd... Change-Id: Ia2b43da82b2ff9b1c85fdb456a0a198ab095243d Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3926 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-06-02flash: nor: ath79: fix build failure due to recent MIPS changesPaul Fertser
Change-Id: I7139b0658f048afea2d16216c93e8946356a630d Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/4151 Tested-by: jenkins Reviewed-by: Salvador Arroyo <sarroyofdez@yahoo.es>
2017-05-31flash: Add support for Atheros (ath79) SPI interfaceTobias Diedrich
Supported SoCs: AR71xx, AR724x, AR91xx, AR93xx, QCA9558 Extended and revised version of my original patch submitted by Dmytro here: http://openocd.zylin.com/#/c/3390 This driver is using pure SPI mode, so the flash base address is not used except some flash commands (e.g. "flash program") need it to distinguish the banks. Example config with all 3 chip selects: flash bank flash0 ath79 0 0 0 0 $_TARGETNAME cs0 flash bank flash1 ath79 0x10000000 0 0 0 $_TARGETNAME cs1 flash bank flash2 ath79 0x20000000 0 0 0 $_TARGETNAME cs2 Example usage: > flash probe flash0 Found flash device 'win w25q128fv' (ID 0x001840ef) flash 'ath79' found at 0x00000000 > flash probe flash1 No SPI flash found > flash probe flash2 No SPI flash found > flash banks > flash read_bank flash0 /tmp/test.bin 0x00000000 0x1000 reading 4096 bytes from flash @0x00000000 wrote 4096 bytes to file /tmp/test.bin from flash bank 0 at offset 0x00000000 in 28.688066s (0.139 KiB/s) Change-Id: I5feb697722c07e83a9c1b361a9db7b06bc699aa8 Signed-off-by: Tobias Diedrich <ranma+openocd@tdiedrich.de> Reviewed-on: http://openocd.zylin.com/3612 Tested-by: jenkins Reviewed-by: Dmytro <dioptimizer@hotmail.com> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2017-05-08stm32l4: support flashing L45x/46x devicesJuha Niskanen
Also fixes incorrect comment about MSI range. Change-Id: If1339a00e50db44195dfcd5c767ba3f5d9035451 Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com> Reviewed-on: http://openocd.zylin.com/4122 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-05-08mips32, add support for micromips in debug modeSalvador Arroyo
Micromips is 16bit oriented, branch and jumps are 16 bit based. The upper half 16bits of a 32bit instruction with the major opcode, must go first in the instruction stream, hence the SWAP16 macro and swap16 array function, needed if the code is written as 32 bit word in little endian cores. Endianess info added to ejtag_iinfo. Pointer to ejtag_info and isa field added to pracc context. MIPS32 code are renamed to MIPS32_ISA_... To select the isa, the new code has an additional isa parameter (1 for micromips, 0 for mips32). In JR instruction the isa bit must be set to execute micromips code. The suffix u is added to the OP codes to avoid signed/unsigned comparison errors and to make sure the right shift is performed logically. The isa in debug mode is updated in the poll function. Code for miniprograms, in kernel mode, need to be converted. CFI code only for mips32. Change-Id: I79a8b637d49b0e2d92b6dd5eb5aa8aa0520bf938 Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es> Reviewed-on: http://openocd.zylin.com/4032 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-04-25stm32l4: support flashing L496 devicesJuha Niskanen
Change-Id: I3effc5b675c853433170391c5eaf46edc067b6e7 Signed-off-by: Juha Niskanen <juha.niskanen@haltian.com> Reviewed-on: http://openocd.zylin.com/4108 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-04-24mips32, pic32 use uint8_t in 8 bit scan functionSalvador Arroyo
Makes code shorter. Change-Id: I6cc01adffbea063ccb071ddf3a3e3d81727b29ce Signed-off-by: Salvador Arroyo <sarroyofdez@yahoo.es> Reviewed-on: http://openocd.zylin.com/4004 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-04-24Added 512K flashing support for em3587Byron Kubert
The Silicon Labs EM3587 and EM3588 may have 512K of flash. This fix allows for 512K to be specifiied on the command line when flashing a device. Change-Id: I18cc4bd0d14e1f2069066734a7396bcccf3de941 Signed-off-by: Byron Kubert <byronk@google.com> Reviewed-on: http://openocd.zylin.com/3795 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-04-24flash/nor/tcl: Make verify_bank parameter optionalMarc Schink
Make the 'offset' parameter optional, if omitted simply start at the beginning of the flash bank. Additionally, check if the argument is out of bounds of the flash bank. Change-Id: Id1959eee5c395666c35f26342c3c50134dd564e5 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3858 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-04-24flash/nor/tcl: Fix some format specifiersMarc Schink
Change-Id: I2255aede9713cb7ef538d7433dd900d8da7a51ad Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3857 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-04-24stm32lx: fix dual-bank configuration for Cat.5 and Cat.6 devicesCezaryGapinski
Default values for .first_bank_size_kb and .has_dual_banks fields described in stm32lx_parts[] do not fully describe the real device memory layouts. Basing on: STM32L0x1 RM0377 STM32L0x2 RM0376 STM32L0x3 RM0367 STM32Lxxxx RM0038 correct values for memory layouts were selected: id = 0x447 STM32L0xx (Cat.5) <- dual bank flash for size 192 or 128 KBytes, single bank for 64 KBytes id = 0x436 STM32L1xx (Cat.4 / Cat.3 - Medium + / High Density) <- only one size of the bank, default values are correct id = 0x437 STM32L1xx (Cat.5 / Cat.6) <- always dual bank, but size of the bank can be different For that reason .part_info field in struct stm32lx_flash_bank is a dynamic field with fields copied from stm32lx_parts[] and overwriten to correct values for specific chips and memory sizes. Change-Id: If638cb0a9916097bfd4eda77d64feaf1ef2d2147 Signed-off-by: Cezary Gapiński <cezary.gapinski@gmail.com> Reviewed-on: http://openocd.zylin.com/4074 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2017-04-24Fix flash writing on stm32l0Armin van der Togt
Fix "couldn't use loader, falling back to page memory writes" error on stm32l0 which was caused by the use of cortex-m3 instructions in the flash loader code. The loader is rewritten using cortex-m0 compatible instructions Signed-off-by: Armin van der Togt <armin@otheruse.nl> Change-Id: If23027b8e09f74e45129e1f8452a04bb994c424e Reviewed-on: http://openocd.zylin.com/4036 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-04-24flash/nor/at91samd: fix chip erase of a secured deviceTomas Vanek
'at91samd chip-erase' command did not work on secured device. Fix it changing address of DSU.CTRL register (see Atmel SAM D21 datasheet, 13.9. Intellectual Property Protection). While on it check error return of DSU.CTRL write. Change-Id: I83155a634a5458cdc0cc16c99c0e155eb1d8b3d6 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reported-by: Thomas Irmen <tirmen@gmx.net> Reviewed-on: http://openocd.zylin.com/4043 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-04-24Add support for the ATMEL SAM G55 Xplained Pro board and CPU.Jerome Lambourg
Change-Id: Iffe59dcf9f2cb1f5949c37d11fe0d2141a47f8da Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3922 Tested-by: jenkins Reviewed-by: Leo Zhang <liang.zhang@microchip.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-04-23nrf51: Add new HWID 0x008FDamyan Mitev
Add new entry in nrf51_known_devices_table for nRF51822 chip found on chinese Core51822 dev board. The chp has markings N51822 / QFAAH1 / 1630FW Nordic Semiconductor nRF51 Series Compatibility matrix confirms that this chip has 256K Flash and 16K RAM. Change-Id: I571d15913c6f6e02a6f09c883d7dfc5a66b57c28 Signed-off-by: Damyan Mitev <damyan_mitev@mail.bg> Reviewed-on: http://openocd.zylin.com/4091 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2017-04-23flash Kinetis: reduce a flash write message severity to infoJoakim Nohlgård
There is nothing the user can do if their device does not support sector programming, there is no reason to have this message at warning level. Change-Id: Ic9b7386e59b64fece7fbfdc543bdfeeed3eae73d Signed-off-by: Joakim Nohlgård <joakim.nohlgard@eistec.se> Reviewed-on: http://openocd.zylin.com/4105 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2017-03-29nrf51: Remove pointer castAndreas Fritiofson
Int may not be 32 bit long. Change-Id: I420f7efeb484eb35c1d7c20e1575b0b31ed8c9ff Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3930 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2017-02-13flash/nor: avrf: support atmega128rfa1Karl Palsson
Tested with a Dresden Elektronik deRFmega128 module. Change-Id: I91da3b11b60e78755360b08453ed368d6d396651 Signed-off-by: Karl Palsson <karlp@tweak.net.au> Reviewed-on: http://openocd.zylin.com/2790 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2017-02-10target: Add 64-bit target address supportDongxue Zhang
Define a target_addr_t type to support 32-bit and 64-bit addresses at the same time. Also define matching TARGET_PRI*ADDR format macros as well as a convenient TARGET_ADDR_FMT. In targets that are 32-bit (avr32, nds32, arm7/9/11, fm4, xmc1000) be least invasive by leaving the formatting unchanged apart from the type; for generic code adopt TARGET_ADDR_FMT as unified address format. Don't silently change gdb formatting here, leave that to later. Add COMMAND_PARSE_ADDRESS() macro to abstract the address type. Implement it using its own parse_target_addr() function, in the hopes of catching pointer type mismatches better. Add '--disable-target64' configure option to revert to previous 32-bit target address behavior. Change-Id: I2e91d205862ceb14f94b3e72a7e99ee0373a85d5 Signed-off-by: Dongxue Zhang <elta.era@gmail.com> Signed-off-by: David Ung <david.ung.42@gmail.com> [AF: Default to enabling (Paul Fertser), rename macros, simplify] Signed-off-by: Andreas Färber <afaerber@suse.de> Signed-off-by: Matthias Welwarsky <matthias.welwarsky@sysgo.com>
2017-01-15flash/nor: fix doc/help and range test for flash protectTomas Vanek
Commit 77a1c01ccbb1150ffe749a7373cf6c4dc15ecad0 introduced infrastructure for utilizing protection blocks of different size than erase sector. Parts of doc/help kept reading 'sector' instead of 'protection block'. flash_driver_protect() parameter range testing did not switched to bank->num_prot_blocks. This change fixes it. Change-Id: Iec301761190a1a1bcc4cb005a519b9e5e4fede51 Reported-by: Mark Odell <mark@odell.ws> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3917 Tested-by: jenkins Reviewed-by: Mark Odell <mrfirmware@gmail.com> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-12-08Convert to non-recursive makeAndreas Fritiofson
Change-Id: I11f8bc8553957e2ff083c09e72e16881e4d3bb6f Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/3865 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-12-08flash/nor/efm32: Support flash size smaller than 32kkevin
The current implementation fails on devices with less than 32k of flash (such as several devices in the Zero Gecko family) because the 'assert' assumes (incorrectly) that the number of flash banks will always be >= 32. This change ensures that at least one word of lock bits is always read in order to support devices with less than 32k of flash. Signed-off-by: Kevlar Harness <software@klystron.com> Change-Id: I59febe2cb690c893a5057a5f72918e146cf2afe4 Reviewed-on: http://openocd.zylin.com/3806 Tested-by: jenkins Reviewed-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-12-08at91sam4: Add missing SAM4S family CHIPIDs and remove FWS=6.Owen Kirby
Add missing CHIPID values for all SAM4S parts listed in revision K of Atmel-11100-32-bit Cortex-M4-Microcontroller-SAM4S_Datasheet.pdf. I have also removed the FWS=6 workaround, as this appears to be a copy-paste error from the SAM3X family. Change-Id: I1ce1d82911f39d6fcb8f04034f5c9c9bf2818466 Signed-off-by: Owen Kirby <oskirby@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3837 Tested-by: jenkins
2016-12-08at91sam4: Add flash description and chipid for SAM4Cxx variants.Owen Kirby
Chip ID and flash layout taken from Atmel-11102F-ATARM-SAM4C32-SAM4C16-SAM4C8-SAM4C4-Datasheet_27-Mar-15 and tested on a SAM4C32-EK (rev A). Change-Id: I68aae5b60994c0b5964ea9031d40bc76ba025675 Signed-off-by: Owen Kirby <oskirby@gmail.com> Reviewed-on: http://openocd.zylin.com/3527 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2016-12-08xmc4xxx: Add support for XMC4300Andreas Färber
XMC4300 can reuse the existing XMC4700/XMC4800 sectors support. Add support for XMC4300 AA to the info command. Change-Id: Id929a51d20c73bd869a4457ffedc48ad5fa3f2df Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3875 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2016-12-08flash/nor: at91samd protection bits write fixTomas Vanek
Flash protection set on a device with MANW=1 was lost after reset. Since #2903 the driver honored MANW bit and issued Write Page command just for main flash write. This change adds similar technique to samd_modify_user_row(). Minor code improvements: samd_check_error() returns error code corresponding to error type instead of bool. samd_check_error() does not clear STATUS register if no error bit is set. Eliminated double error check in call sequence samd_issue_nvmctrl_command() folowed by samd_check_error(). Missing error code ERROR_FLASH_PROTECTED added to src/flash/common.h. Change-Id: Icf59ab8803305d0cb3170c8a5089b8f9828b99f8 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3550 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-11-05flash at91samd, at91sam4l: fix improper use of mem_ap_ callTomas Vanek
Since merge of #3149 OpenOCD start with an unresponsive SAMD or SAM4L resulted in segfaults. First was in cortex_m_assert_reset (fixed by #3552), second was in samd_handle_reset_deassert() /sam4l_handle_reset_deassert(). The change replaces mem_ap_write_u32/8 by target_write_u32/8. It also takes better care about examining and polling target before debug control registers are set. It prevents lockup when 'reset halt' is issued on unresponsive cpu. Change-Id: I2516489f4771aebfc1118d174f527497b8a201ad Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3603 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-11-04flash: nor: mdr: do not mass erase when clearing INFO memoryPaul Fertser
The MDR parts have two kinds of memory: main (regular memory-mapped memory for code and data) and "info" (not memory-mapped). When OpenOCD is requested to erase the info memory block, it should do just that, instead of erasing everything including main memory. Change-Id: I498142ca50d4a7b669b7776180b0dbcea63a5328 Reported-by: Eldar Khayrullin <eldar.khayrullin@mail.ru> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/3853 Tested-by: jenkins Reviewed-by: Eldar Khayrullin <eldar.khayrullin@mail.ru> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-11-04flash Kinetis: Family K8x addedTomas Vanek
Change-Id: I8c090a6fe6c204ce20622006490f896c2a55292f Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3614 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-11-04flash Kinetis: add cache invalidate for KLx seriesTomas Vanek
Change-Id: I0177a052cbc380e01405dc139538b731b4f0ed62 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3565 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-11-04flash Kinetis: longword programming changed to flash_async_algorithmTomas Vanek
Change-Id: I9c40acfad37760c3dab454f2432817b2d420792d Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/3563 Reviewed-by: Steven Stallion <stallion@squareup.com> Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2016-11-04Tcl commands: Fix improper return status in flash commands and load_image.HarishKumar
Nand write command : nand_fileio_cleanup() always returns ERROR_OK. Due to this, handle_nand_write_command() retuns ERROR_OK in the case of nand failure. ERROR_FAIL should be returned. Flash erase_sector command : handle_flash_erase_command() always returns ERROR_OK even if the erase functionality of actual driver implementation fails. retval value should be returned. Flash write_bank command : handle_flash_write_bank_command() returns ERROR_OK even if fileio_open() and fileio_read fails. ERROR_FAIL should be returned. Load_image command : handle_load_image_command() retuns ERROR_OK even if image_open() fails. ERROR_FAIL should be returned. When the buffer is null, breaking the loop without setting retval = ERROR_FAIL would cause load_image to return ERROR_OK. Change-Id: Ice32f6036971ab5e8e4dd65edf54b394b001c80c Signed-off-by: HarishKumar <harishpresent@gmail.com> Reviewed-on: http://openocd.zylin.com/2431 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins