aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor
AgeCommit message (Collapse)Author
2019-11-27flash/nor/stm32h7x: fix option bytes handling to work with both banksTarek BOCHKATI
To achieve that we need to avoid using FLASH_REG_BASE_B0, and use bank registers instead: For dual bank devices, each option register is mapped in 2 addresses at the same offset from flash_bank_reg_base. This is true for OPTCR, OPTKEYR, OPTSR_CUR/PRG, OPTCCR according to RM0433 Rev6 (refer to section 3.9: FLASH registers) In stm32x_write_options, according to RM0433 Rev6, after OBL launch we should wait for OPTSR_CUR.BSY bit instead of FLASH_SR.QW Change-Id: Ie24a91f069d03c9233797390fc2e925c737dad90 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5291 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-11-27flash/nor/stm32h7x: remove stm32x_options.protection2Tarek BOCHKATI
Each bank had to store its options only, there is no need for bank1 to sneak into bank2 options. Furthermore, some variants do not have a second bank. Change-Id: I9229eb8ab4b5860ba2b0c5dbe626a54a84bca4d6 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5290 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-11-26flash/nor/nrf5: fix allocation of driver_priv and sector arrayTomas Vanek
Drop static pointer to allocated struct nrf5_info, iterate over the flash bank list to find previously allocated nrf5 instances. nrf5 is swd only device, so static allocation makes no harm, but we should avoid copying the wrong code to other flash drivers. Free sector array before allocating it to avoid memory leak on re-probing device. Change-Id: I781d8f4418a91c043f2393e5ecc5278fc6df3566 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4910 Tested-by: jenkins
2019-11-26flash/nor/nrf5: show RAM size on old nRF51 devices (rev 1, 2)Tomas Vanek
Change-Id: I2452c084b9bd9e401bd49e15791428a53df1cd1d Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4868 Tested-by: jenkins
2019-11-26flash/nor/nrf5: do not check FICR PPFC on nRF52Tomas Vanek
Change-Id: I6beee9b85a542040f2495513b5ba51bd8e1389db Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4867 Tested-by: jenkins
2019-11-26flash/nor/nrf5: rename registers by nRF seriesTomas Vanek
Change-Id: I70af671c52665b27a28508e06e7d3e5e40a621f7 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4866 Tested-by: jenkins
2019-11-26flash/nor/nrf5: refactor sector allocation to use alloc_block_array()Tomas Vanek
Change-Id: Ied8ea917cec492fc6bb8836a92d8c4ceaf3b499b Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4865 Tested-by: jenkins
2019-11-26flash/nor/nrf5: implement BPROT protection check for nRF52810,832Tomas Vanek
Also refuse 'flash protect' on any nRF52. Fail protection check on nRF52840 until ACL protection is implemented. Change-Id: I84fcf117427e4894147c3ad92e2a3597566b4fcf Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4864 Tested-by: jenkins
2019-11-26flash/nor/nrf5: detect newer devices without HWID tableTomas Vanek
nrf5 flash driver detected devices by looking up the HWID in the table of known devices. Unfortunately chips are produced with many different HWIDs for each type. All nRF52 devices have FICR INFO field suitable for device identification without need of HWID lookup. Some newer nRF51 devices have FICR INFO too although undocumented. Use this information to identify the device. nrf5_info() is reworked to show just concise info. Decoding FICR and UICR registers was moved from nrf5_info() to a new command 'nrf5 info' without functional changes. The flash bank for UICR page has the same size as program flash sector. Change-Id: I900095b9ae23ee995f8e2bef8539b75d00300da5 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4848 Tested-by: jenkins
2019-11-26flash/nor/nrf5: remove useless page padding and UICR autoeraseTomas Vanek
nRF5 flash controller can write a word at a time. Ask flash infrastructure to handle alignment and padding. Fix mixing of offset and address in nrf5_ll_flash_write() - the original code worked just because NRF5_FLASH_BASE is 0 Change-Id: Ibe8bdf899a1764cf4117b2deda1a4618eeb16697 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4819 Tested-by: jenkins
2019-10-18nrf5: update links to compatibility matrixes for nrf5x variantsMirko Vogt
Change-Id: If51aa992ccbb8c9a2e502b74827a36a62010546d Signed-off-by: Mirko Vogt <mirko.vogt@sensorberg.com> Reviewed-on: http://openocd.zylin.com/4843 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-10-18nrf5: Fix misuse of flash bank numberAndreas Fritiofson
Make driver_priv point directly into the corresponding chip bank structure and add a pointer to it to get back to its chip when it's needed. This removes the need to keep track of any bank number, either global or chip- local. In addition, it simplifies the cases where the chip structure was just used to access the chip bank fields; now they are directly accessible. Change-Id: Iaa353cd4fa7d8ff94c2ef69028c7cb32fade0420 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/4775 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-10-02efm32: use device-specific MSC base for EFM32TG11BChristian Meusel
According to the reference manual it should be 0x40000000. Flashing (and booting) a firmware with this MSC base was successful. Change-Id: I739e67d36555b8170a3b8e26f54cf1c09ce8424b Signed-off-by: Christian Meusel <christian.meusel@posteo.de> Reviewed-on: http://openocd.zylin.com/5263 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-09-24flash/nor/tcl: Fix usage of 'flash erase_sector' commandMarc Schink
Change-Id: I2141e377a0531cab8d1140049a2ee7721d30cfdc Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/5299 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-09-18esirisc_flash: Rename PAGE_SIZE to FLASH_PAGE_SIZEKhem Raj
PAGE_SIZE is defined in system includes on some systems, this would avoid the unintended conflict Fixes | src/flash/nor/esirisc_flash.c:95:9: error: 'PAGE_SIZE' macro redefined [-Werror,-Wmacro-redefined] | #define PAGE_SIZE 4096 | ^ | /mnt/a/yoe/build/tmp/work/core2-64-yoe-linux-musl/openocd/0.10+gitrAUTOINC+7ee618692f-r0/recipe-sysroot/usr/inclu de/limits.h:89:9: note: previous definition is here | #define PAGE_SIZE PAGESIZE Change-Id: I195b303fc88a7c848ca4e55fd6ba893796df55cc Signed-off-by: Khem Raj <raj.khem@gmail.com> Reviewed-on: http://openocd.zylin.com/5180 Tested-by: jenkins Reviewed-by: Steven Stallion <sstallion@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2019-09-08flash/nor/stm32h7x: remove unused 'pages_per_sector' from stm32h7x_part_infoTarek BOCHKATI
Change-Id: I1b79c25cada574e3a9849f506443c836bd707604 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5289 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Christopher Head <chead@zaber.com>
2019-09-08flash/nor/stm32h7x: remove flash size information from device nameTarek BOCHKATI
There is no sense in displaying the max size (2M) as there is variants of this device with reduced flash size Change-Id: I40574064d75fdf2a038044c81038a6d7abc6c4dd Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5288 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-09-08flash/nor: flash driver for Synwit SWM050 MCUsCaleb Szalacinski
SWM050 is a series of MCU product by Foshan Synwit Tech, which is available in TSSOP-8 or SSOP-16 packages. Adds flash driver for the internal 8KiB flash of the MCU. The registers are based on reverse engineering the J-Flash blob provided by the vendor. Also adds a pre-made cfg file. Change-Id: I0b29f0c0d062883542ee743e0750a4c6b6609ebd Signed-off-by: Icenowy Zheng <icenowy@aosc.io> Signed-off-by: Caleb Szalacinski <contact@skiboy.net> Reviewed-on: http://openocd.zylin.com/4927 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2019-08-04flash/nor/core: fix some minor typoTarek BOCHKATI
Change-Id: I03832b3e4a6eaadfd87729a3a898e0a2cd30931a Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5264 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2019-06-13flash/stm32h7x: fix register names to comply with RM0399 Rev2 and RM0433 Rev6Tarek BOCHKATI
Change-Id: I085d86a2a47f4aeef93a99238e3b80ee294d46df Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5192 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-05-14flash/nor: use command_print() in command "flash banks"Paul Fertser
The command uses LOG_USER() instead of command_print(). Fix it. This change was part of http://openocd.zylin.com/1815 from Paul Fertser and has been extracted and rebased to simplify the review. Change-Id: I92e5e5954a75b96093b3ed6af73a7536c063b639 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5083 Tested-by: jenkins
2019-05-14nor/niietcm4: fix indentationPaul Fertser
After replace CMD_CTX with CMD, the indentation is incorrect. Fix it. This change was part of http://openocd.zylin.com/1815 from Paul Fertser and has been extracted and rebased to simplify the review. Change-Id: I5d7c40227ceda2e9db8dab88088d74012d2254c4 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5082 Tested-by: jenkins
2019-05-14helper/command: change prototype of command_print/command_print_samelineAntonio Borneo
To prepare for handling TCL return values consistently, all calls to command_print/command_print_sameline should switch to CMD as first parameter. Change prototype of command_print() and command_print_sameline() to pass CMD instead of CMD_CTX. Since the first parameter is currently not used, the change can be done though scripts without manual coding. This patch is created using the command: sed -i PATTERN $(find src/ doc/ -type f) with all the following patters: 's/\(command_print(cmd\)->ctx,/\1,/' 's/\(command_print(CMD\)_CTX,/\1,/' 's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/' 's/\(command_print_sameline(cmd\)->ctx,/\1,/' 's/\(command_print_sameline(CMD\)_CTX,/\1,/' 's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/' This change is inspired by http://openocd.zylin.com/1815 from Paul Fertser but is now done through scripting. Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/5081 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-05-14nor/at91sam4: change prototype of get_current_sam4()Paul Fertser
To prepare for handling TCL return values consistently, all calls to command_print/command_print_sameline should be ready to switch to CMD as first parameter. Change prototype of get_current_sam4() to pass CMD instead of CMD_CTX. This change was part of http://openocd.zylin.com/1815 from Paul Fertser and has been extracted and rebased to simplify the review. Change-Id: I8dfa66f3f6be318d6ba89649279b1b4502f375d9 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5055 Tested-by: jenkins
2019-05-14nor/at91sam3: change prototype of get_current_sam3()Paul Fertser
To prepare for handling TCL return values consistently, all calls to command_print/command_print_sameline should be ready to switch to CMD as first parameter. Change prototype of get_current_sam3() to pass CMD instead of CMD_CTX. This change was part of http://openocd.zylin.com/1815 from Paul Fertser and has been extracted and rebased to simplify the review. Change-Id: Ia1e7af79d0fc89d229b4e10df37317a374bbab62 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5054 Tested-by: jenkins
2019-05-04stm32h7x: fix incorrect indentationChristopher Head
Change-Id: I5dc16031c38576d853774b6123c93be1e1b4aa96 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/5133 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-05-04flash/nor/stm32h7x: use of wait queue flag instead of the busy flagTarek BOCHKATI
Based on RM0433.rev5 > Section 3.3.9 : Flash program operations: QW1/2: this bit indicates that a write, erase or option byte change operation is pending in the write queue or command queue buffer. It remains high until the write operation is complete. It supersedes the BSY1/2 status bit. On this basis, stm32x_wait_status_busy is renamed accordingly to be 'stm32x_wait_flash_op_queue' Note : In this commit there is a fix of SR_ERROR_MASK value in flash loader algo Note : This modification is mandatory for revision X, and backward compatible with old revisions Change-Id: I59d2973317d76b01fbb0fb5e4a472a47d0a7a5b5 Signed-off-by: Laurent LEMELE <laurent.lemele@st.com> Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/4883 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-05-04flash/nor/atsame5: fix typo in dsu_reset_deassert help textTomas Vanek
Change-Id: Iebed1a160376717d19c5f56b2553f7d4d1eed3a7 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/5095 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins
2019-04-24flash/fespi: Use COMMAND_PARSE_ADDRESSTim Newsome
Signed-off-by: Tim Newsome <tim@sifive.com> Change-Id: If4d22fe1440f926271274820f96428718a127ac2 Reviewed-on: http://openocd.zylin.com/5100 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-10flash/stm32h7x: include IO_HSLV in user3_optionsChristopher Head
Bit 29 of OPTSR is IO_HSLV. It ought to be read in stm32x_read_options and written in stm32x_write_options. Adjust the bitmasks to do this. Change-Id: I785a5291c991c98b774177f960dc58f2b5e045e2 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4745 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-07Set empty usage field for commands that do not need parametersAntonio Borneo
The missing field causes runtime debug message BUG: command '%s' does not have the '.usage' field filled out While there, fix some minor typo in the help messages: s/deasert/deassert/ s/Deasert/Deassert/ Change-Id: If3dd18265cda103ca0d05609f67f4ca58e7cbb27 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5024 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-07flash/nor/str9xpec: fix help and usage for command "part_id"Antonio Borneo
Remove the numeric parameter <bank> from help and add it to usage Change-Id: I630ca5450955210299f54e16fe5c9e8e51b3b266 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5022 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2019-04-07flash/nor/at91samd: set usage for command "set-security"Antonio Borneo
The only allowed parameter is the string "enable" Change-Id: Iefdad38f1b4177e4194e58caf2be654357299ded Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5021 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-07command_registration: add empty usage field to chained commandsAntonio Borneo
Chained command require a subcommand as first argument. The usage field for chained commands is not really important because the "help" command will list all the subcommands with their respective usage. Add a empty usage field on all chained command. The command "jlink config" can be either followed by a subcommand or used alone, so use a dedicated usage string. Change-Id: I43c3f8a766f96a9bdab4e709e3c90713be41fcef Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5017 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-04-07flash/xmc4xxx: use coherent indentation in struct initializationAntonio Borneo
Keep using the same indentation rules while initializing struct command_registration. Change-Id: I900924600753ee7a72ca45da13db4112ab4b1522 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5015 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2019-04-07flash/kinetis: use coherent indentation in struct initializationAntonio Borneo
Keep using the same indentation rules while initializing struct command_registration. Change-Id: Ie69d9d6a786e1ef0abbcfd3eef89a61206238ebe Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5014 Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Tested-by: jenkins
2019-04-03flash/nor/core.h: clarify comment flash_sector::is_erasedTomas Vanek
Setting of flash_sector::is_erased in flash erase and mass erase is popular folklore. Make clear it is useless. Change-Id: Ide397eb6d24fc8fa38931e6c8a0693d39668a5d2 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4768 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com>
2019-03-27Constify struct flash_driver instancesChristopher Head
Instances of struct flash_driver are never written to at runtime. For a small amount of memory saving and also robustness (fewer things for stray pointer writes to hit), mark them const. Change-Id: Iadbbbc2fac0976d892699200000c5f02856729f3 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4803 Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-03-27flash/nor/core: adjust flash_iterate_address_range_inner() for 64-bitTomas Vanek
Use target_addr_t exclusively for comparison of sector boudaries and address range. Use the last addres for both address range end and sector end. It avoids problems with a flash bank mapped at the very end of target address space. Change-Id: Idf97c837453d97cbc4cf8a1c76ad799f4142f19e Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4985 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-03-14flash/stm32h7x: remove IWDG1_SW separate variableChristopher Head
Bit 4 in OPTSR is IWDG1_SW (the code originally called it IWDG1_HW, but the reference manual refers to it as IWDG1_SW). This is broken out into a separate variable, independent_watchdog_selection, in stm32x_options. However, this is not necessary: bit 4 is included in the user_options field, which includes all of bits 2 through 7, and independent_watchdog_selection is not referenced anywhere else. Delete the field and just rely on user_options to transport that bit, along with all the other bits it contains, between stm32x_read_options and stm32x_write_options. Change-Id: I4da63df9272cf091267b956c412b95671ea1d3c9 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4744 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-03-12flash/nor/tcl.c: use COMMAND_PARSE_ADDRESSTomas Vanek
instead of conditional compilation #if BUILD_TARGET64 Change-Id: I005ae0b3a4ed127c0f59219b1c6b185a2c76c76e Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4977 Tested-by: jenkins Reviewed-by: Tim Newsome <tim@sifive.com>
2019-03-08flash/nor: use target_addr_t for flash bank baseTim Newsome
This should allow users to configure flash at >32-bit addresses. Change-Id: I7c9d3c5762579011a2d9708e5317e5765349845c Signed-off-by: Tim Newsome <tim@sifive.com> Reviewed-on: http://openocd.zylin.com/4919 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-02-27flash: stm32f2/f4/f7: Add One-Time-Porgrammable (OTP) supportMoritz Fischer
The OTP is part of the flash memory. It has 512 (1024 for F7) bytes and is organized in 16 sectors with 32 (64 for F7) bytes each. The OTP is exposed as separate flash bank 1 and can be used with the usual flash commands. Writing the OTP can be done as follows: > stm32f2x otp 1 enable > flash write bank 1 foo.bin 0 > mdw 0x1fff7800 4 > verify_image foo.bin 0x1fff7800 > stm32f2x otp 1 disable Note: This patch is largely a rebase/cleanup of a patch from 2012 by Laurent Charpentier and he did most of the work. No new Clang-Analyzer warnings. Change-Id: I5e6371f6a7c7a9929c1d7907d6ba4724f9d20d97 Signed-off-by: Moritz Fischer <moritz.fischer@ettus.com> Reviewed-on: http://openocd.zylin.com/829 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-02-21Fix support for single-bank stm32l4 processorsArmin van der Togt
Recent patches for STM32L4+ assumed all STM32L4 processors have a dual- bank option. This is not the case for STM32L4{3,4,5,6}xx processors and therefore, these processors (like STM32L433) failed when attempting to flash the second half of the flash memory. This patch fixed this issue. Tested on STM32L433xC, STM32L476xG and STM32L471xG. Change-Id: I8262ba4f05190802c5868d753f3e7af50e581811 Signed-off-by: Armin van der Togt <armin@otheruse.nl> Reviewed-on: http://openocd.zylin.com/4913 Tested-by: jenkins Reviewed-by: Peter Tettelaar <peter@float-iot.nl> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Mark Schulte <mschulte@lyft.com>
2019-02-07at91samd: Add flash programming support for SAMC2?N* partsKevin Vermilion
Added id, name, flash size and RAM size for following parts to samc20_parts[]: SAMC20N18A SAMC20N17A And the following to samc21_parts[]: SAMC21N18A SAMC21N17A Change-Id: Ie8cf1c531a60bfaed6e814d436d232afb89dae3f Signed-off-by: Kevin Vermilion <kevin.vermilion@gmail.com> Reviewed-on: http://openocd.zylin.com/4880 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-02-07flash/nor/stm32f1x: Ability to change user option bytes.Jan Vojtech
Adds ability to change the user data in STM32F1x/STM32F3x MCU's option byte. Since OpenOCD prints the content of user data in option byte registers, it is seems logical to also provide a way how to change this data. Change-Id: Ie6cb756b4f11b5c6dabd34bc89434a358eb758ff Signed-off-by: Jan Vojtech <honza.vojtech@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4663 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
2019-02-07target algo: do not write reg_param if direction is PARAM_INTomas Vanek
Without this change xxx_start_algorithm() writes all register parameters no matter of their direction. It usually results in writing of uninitialized reg_params[].value - possibly reported by valgrind. While on it fix the wrong parameter direction in kinetis_disable_wdog_algo(). This bug did not have any impact because of unconditional write of reg_params. Change-Id: Ia9c6a7b37f77d5eb6e5f5463012dddd50471742b Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4813 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2019-02-05flash/nor: flash driver and cfg for SAM E54, E53, E51 and D51Tomas Vanek
The new Microchip (former Atmel) series powered by Cortex-M4 looks very similar to older M0+ powered SAM D2x at the first sight. Unfortunately the new series differs a lot in important details. NVMCTRL has different register addresses, moved important bits and even changed binary command set. An universal driver for all SAM D/E would be very complicated. That's why a new driver was derived. Tested on Microchip SAM E54 Xplained Pro kit (board cfg included). Adjusted for the restructured dap support. Checked by valgrind and clang static analyzer. Change-Id: I26c67047a552076f4b207b9b89285a53d69b4ca4 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4272 Tested-by: jenkins Reviewed-by: Andres Vahter <andres.vahter@gmail.com>
2019-02-04flash/nor/stm32f1x: use address instead of offset in stm32x_write_block()Tomas Vanek
stm32x_write_options() uses stm32x_write_block() at STM32_OB_RDP address. The change eliminates subtracting bank->base (and later adding it back). Change-Id: Icdd24afc7178b814be58e6033d4b93fdfb2d2a16 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4859 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Christopher Head <chead@zaber.com>
2019-02-04flash/nor/stm32f1x: fix minor error messagesTomas Vanek
Change-Id: I1e9e62979c4629c8ba1d5ae89ca7392259969eb6 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4858 Tested-by: jenkins Reviewed-by: Christopher Head <chead@zaber.com>