aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/stm32f1x.c
AgeCommit message (Collapse)AuthorFilesLines
2020-05-09coding style: let "else" follow the close braceAntonio Borneo1-2/+1
The statement "else" should not be on a new line when follows a close brace '}'. Fix it! Issue identified by checkpatch script from Linux kernel v5.1 using the command find src/ -type f -exec ./tools/scripts/checkpatch.pl \ -q --types ELSE_AFTER_BRACE -f {} \; Change-Id: I8af247ec3f75a69713d7cb1e73881254d16c189e Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/5623 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Tested-by: jenkins
2020-04-05flash/stm32f1x: fix maximum flash size for some devicesTarek BOCHKATI1-2/+18
For STM32F0xxx, according to RM0360 Rev 4 and RM0091 Rev 9, the accurate flash sizes are in RM0360, Table 4 and 5 DEV_ID=0x440 => F030x8 => 64K (64 * 1K) F05xxx => idem DEV_ID=0x442 => F030xC => 256K (128 * 2K) F09xxx => idem DEV_ID=0x444 => F030x4 => 16K (16 * 1K) F030x6 => 32K (32 * 1K) DEV_ID=0x445 => F070x6 => 32K (32 * 1K) F04xxx => idem DEV_ID=0x448 => F070xB => 128K (64 * 2K) For STM32 F100xx HD VL (0x428), max_flash_size_kb is 512 (was 128) refer to RM0041 Rev5: Table 5. Flash module organization (high-density value line devices) => (256 page of 2 Kbytes each) Change-Id: I4ead13093f8f4b8ec900482ee049a6fc83dcc664 Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-on: http://openocd.zylin.com/5444 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-03-07flash/nor/stm32f1x: Group and cleanup device listMarc Schink1-37/+37
Group device list based on the device family and add clear device family names. Change-Id: I7a2dab1d1c0c8d141df02656c1964cb2c3fcbcd1 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5423 Tested-by: jenkins Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
2020-02-23flash/nor/stm32f1x: Some small code cleanupsMarc Schink1-9/+6
Change-Id: I1fc08b96b179a1376af233b713ae50d6ad7867a0 Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5404 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2020-01-02flash/nor/stm32f1x: fix options reading from locked chipOleksandr Redchuk1-20/+6
In commit cea40152f82f52bfc718c7bda9fa4a9d70bf9cfd option bytes reading was changed to direct access to option bytes area. While there are no problems with stm32f0xx and stm32f3xx chips, option block (0x1ffff800..0x1ffff80F) is unreadable from locked stm32f10x chips. As a result, stm32f1x unlock command writes dirty values to user options, user data and write protection bits. Option bytes reading reverted from direct access to option bytes area to reading currently loaded bytes from FLASH_OBR/FLASH_WRPR registers. Tested on stm32f100, stm32f103, stm32f107 as well as on stm32f030 and stm32f303. Change-Id: Iad476351ffdaca5ace12e02272dacea7f3d08f52 Signed-off-by: Oleksandr Redchuk <real@real.kiev.ua> Reviewed-on: http://openocd.zylin.com/4940 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2019-05-14helper/command: change prototype of command_print/command_print_samelineAntonio Borneo1-20/+20
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-03-27Constify struct flash_driver instancesChristopher Head1-1/+1
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-02-07flash/nor/stm32f1x: Ability to change user option bytes.Jan Vojtech1-2/+12
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-04flash/nor/stm32f1x: use address instead of offset in stm32x_write_block()Tomas Vanek1-6/+4
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 Vanek1-3/+5
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>
2018-11-03flash/nor/stm32f1x: Use of protection blocks, improved option bytes handlingDominik Peklo1-218/+179
Handle write protection status in blocks instead of sectors, removing unnecessary complexity in the process. Now closer to stm32f2x. Support sequential modification of option bytes by read/modify/write directly to option bytes area instead of always starting with the currently loaded bytes from FLASH_OBR/WRPR registers. Added new command 'options_load' to force re-load of option bytes w/o having to power cycle target. Change-Id: I5c76191e29c17a1e11482df06379d10ca8d6d04d Signed-off-by: Dominik Peklo <dom.peklo@gmail.com> Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4576 Tested-by: jenkins Reviewed-by: Jan Vojtěch <honza.vojtech@gmail.com>
2018-07-03flash/nor/stm32: Eliminate working area leakChristopher Head1-1/+3
On a specific early-return path, an allocated working area was not freed. Free it. Change-Id: I7c8fe51ff475f191624086996be1c77251780b77 Signed-off-by: Christopher Head <chead@zaber.com> Reviewed-on: http://openocd.zylin.com/4520 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
2018-04-23flash/nor, contrib/loaders: add stm32 loaders Makefile and generated .incTomas Vanek1-38/+1
Flash loaders refactored to the new style - use generated .inc instead of hexadecimal machine code in the flash driver source. Change-Id: If65a2099589e210f9450819b467d67819fd841fc Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4439 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2018-04-04flash/nor: implement flash bank deallocation in drivers with simple allocTomas Vanek1-0/+1
All drivers which simply allocate one driver_priv memory block per each bank now use default_flash_free_driver_priv() Change-Id: I425bf4213c3632f02dbe11ab819c31eda9b2db62 Signed-off-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-on: http://openocd.zylin.com/4417 Tested-by: jenkins Reviewed-by: Liviu Dudau <liviu@dudau.co.uk> Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
2016-05-24Remove FSF address from GPL noticesMarc Schink1-3/+1
Also make GPL notices consistent according to: https://www.gnu.org/licenses/gpl-howto.html Change-Id: I84c9df40a774958a7ed91460c5d931cfab9f45ba Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/3488 Tested-by: jenkins Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-02-29Cleanup: removal of obsolete semicolonsAlexander Kurz1-2/+2
Obsolete C source code semicolons were removed using the semantic patch semicolon/semicolon.cocci, see coccinellery.org Change-Id: I153b4995a9e028ebaf5f58c947821dc78345a777 Signed-off-by: Alexander Kurz <akurz@blala.de> Reviewed-on: http://openocd.zylin.com/3367 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2015-02-02Add more STM32F3 IDs in target/stm32f3.cfg.Uwe Bonnes1-1/+18
Change-Id: I4c4462aa025639c4d20e6fa23c8845a69e60afc5 Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> Reviewed-on: http://openocd.zylin.com/2435 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2015-01-26stm32f07/9: Both devices have 256 kByte Flash Maximum.Uwe Bonnes1-7/+0
See RM0091, Rev.7. page 56. Change-Id: I9a98094d49739686f93e26a5112eb0a2a8a7c883 Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> Reviewed-on: http://openocd.zylin.com/2458 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-01-26stm32f0x: Remove duplicate code for revision string.Uwe Bonnes1-50/+20
As of RM0091, Rev. 7, all F0 have the same revisioning scheme. Change-Id: I0b344a1d3ca3f61f48fa151e83c549ca5333ae47 Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> Reviewed-on: http://openocd.zylin.com/2457 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-01-26stm32f09x: Print info in get_stm32x_info.Uwe Bonnes1-0/+14
Change-Id: I5f9b765fe04906e124e2c95ff6bf7193be9d4ce2 Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> Reviewed-on: http://openocd.zylin.com/2456 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2015-01-26flash/nor/stm32f1: Add handling of stm32f09, nearly same as stm32f07.Uwe Bonnes1-0/+8
Change-Id: I9cb2aa75decca0e8a065fe7f5353de44d6877274 Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> Reviewed-on: http://openocd.zylin.com/2394 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-08-19flash/nor/stm32f1x: add STM32F302x6/8 IDs, clarify STM32F302xB/CPaul Fertser1-2/+17
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-06-19stm32f1x: add STM32F33x support.Nemui Trinomius1-0/+18
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-05-31flash/nor/stm32f1x: add support for F04x partsPaul Fertser1-0/+15
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-03-17flash: Constify write bufferAndreas Fritiofson1-4/+4
Change-Id: Ic812098d3ed5a2992c26bb57d08ae350e2c5d5d8 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/2040 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-02-24stm32f1x: Fix option byte flag parsingAndreas Fritiofson1-4/+4
Change-Id: Ifa04e1f215ac5790db3d432cc0d7d532660459f2 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1963 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-02-11nor/flash/stm32f1x: add stm32f07x supportKuldeep Singh Dhaka1-4/+39
Added configuration to work with stm32f07x. Tested on stm32f072discovery with libopencm3 stm32f0 blink example. Change-Id: I63cdc9bf1f28f5951d6b4faac871cfde331c9c78 Signed-off-by: Kuldeep Singh Dhaka <kuldeepdhaka9@gmail.com> Reviewed-on: http://openocd.zylin.com/1921 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2014-02-04flash/nor/stm32f1x: fix format specifiers warningPaul Fertser1-2/+2
Caught by clang on OS X. Reported by Steffanx on IRC. Change-Id: Id77c7297c58e58c4e2aa8e5dafcb3a29a1f33f3d Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1879 Tested-by: jenkins Reviewed-by: Xiaofan <xiaofanc@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-12-14flash: revert incorrect stm32f1 default_padded_valueSpencer Oliver1-3/+0
Commit 2493671e2d9c352ea70edc8665b4c8f172ef1141 added a default flash padded value to the wrong file, should have been stm32lx.c not stm32f1x.c. Change-Id: Idab634a03ccb28609cc977a92ac2b138d1e8d859 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1833 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-10-31stm32f1x: Fix byte order bug and remove unnecessary castAndreas Fritiofson1-7/+7
Found by grepping for pointer casts. Change-Id: Ibd8f22a9e9ca71459ba0bedc8447a3623d0e4184 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1773 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-07stm32l: set default padded valueSpencer Oliver1-0/+3
The stm32l family has an erased value of 0x00, so overide the defaults used by OpenOCD. Change-Id: I314bdef1f8482fbcbd43e0f413247d3a35af869d Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1636 Tested-by: jenkins
2013-07-15flash/stm32*: Sync all device/rev IDs with reference manualsAndreas Fritiofson1-11/+19
Uppercase device/family names and change them to be more specific and consistent across all STM32 families. High-density STM32F10x has a Rev Y according to RM0008 Rev 14, so add it. I have a STM32F30x Rev Y, sitting on my desk, but it isn't described in the reference manual. Add it as well. Split the STM32L1xx Medium+ Density devices based on ID, to match the reference manual. If I read it correctly, the Medium+ devices have different revision mappings depending on their package/device ID. I have no real devices to examine, however. Change-Id: I5b95e5fa3cdeba219aa96838ea06ec1bb62bd921 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1497 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-07-15flash/stm32*: Rewrite info functionsAndreas Fritiofson1-174/+144
Factor out common bit masking and printing code and use intermediate strings to avoid buffer size handling. Change-Id: I7d8c12df11ade6cdca8c917b5524372daa498bf4 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1496 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-07-15flash/stm32*: Remove the halted check in protect_checkAndreas Fritiofson1-5/+0
These chips are capable of reading the flash registers while they're running. Change-Id: I76b90b2bae1aa79b5a063b2073faa5d3ed93cfd7 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1495 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-06-12stm32: add new stm32f0 device idSpencer Oliver1-1/+3
updated from RM0091 rev4. Change-Id: Ic5e46229b85ce3974ef3016724d29a94037ac577 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1435 Tested-by: jenkins
2013-06-05update files to correct FSF addressSpencer Oliver1-1/+1
Change-Id: I429f7fd51f77b0e7c86d7a7f110ca31afd76c173 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1426 Tested-by: jenkins Reviewed-by: Paul Fertser <fercerpav@gmail.com>
2013-03-06flash: fix stm32 failed probe using incorrect flash sizeSpencer Oliver1-2/+4
This fixes an issue if the device is manually probed after the initial probe fails due to being unable to read flash size register. In this situation the driver assumes the user has overridden the flash size when infact this may not be the case. It also seems on the older stm32f1 devices the flash register is not readable when locked, this does not seem to apply to the newer parts - f0, f3, f4. Change-Id: I125f872fcb2d962ca6705f97b62d957e2b31303b Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1187 Tested-by: jenkins Reviewed-by: Johan Almquist <johan.almquist@assaabloy.com> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2013-03-06stm32: update stm32f1x driver for f0x and f3x option bytesSpencer Oliver1-4/+14
The stm32f0 and stm32f3 share the same option byte location, but the format differs. Adding an option_offset fixes the broken options_read cmd and incorrectly setting Hardware Watchdog when unlocking a f3x device. Change-Id: I82d66b6198294ea9eedb44ca8b2fb368c0cb15e8 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1184 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2013-02-25stm32: enable flash bank size overrideSpencer Oliver1-0/+7
It has been seen on some stm32 targets that the flash size register that is probed by the driver may contain an invalid size. This change enables the user to override the probed value. Change-Id: I09359e59a96f9133d3d939670957d32a830a944e Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1132 Tested-by: jenkins Reviewed-by: Johan Almquist <johan.almquist@assaabloy.com>
2013-02-02armv7m: use ARM_MODE_THREAD core mode for algoorithm'sSpencer Oliver1-1/+1
This makes sure we are using privileged mode when executing any loaders. Change-Id: I18bf32ec92e1c76a66ab25e3712652bc3650b332 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1108 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-02-02armv7m: use generic arm::core_modeSpencer Oliver1-1/+1
To simplify things change over to using the generic core_mode struct rather than maintaining a armv7m specific one. Change-Id: Ibf32b785d896fef4f33307fabe0d8eb266f7086f Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/966 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-12-31flash: allow stm32f1x options_write args in any orderSpencer Oliver1-30/+37
Currently we have to supply the arg's to this cmd in a set order, this change fixes that issue. Change-Id: I14a15732e1917a91009e1ac14fba39ca1523c739 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/992 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-12-31flash: use correct stm32f1x option read maskSpencer Oliver1-2/+2
Make sure we do not mask out the BFB2 boot bank bit, as this is used on the larger XL devices. Change-Id: Iacfdf874140e409e0c4ca9b9aee8f5c2f90dc9be Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/991 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-12-31stm32f1x: fix stm32f0/f3 broken unlockSpencer Oliver1-1/+8
The STM32F0 and F3 devices use a different default RDP to configure a unlocked device, make sure we use that. Change-Id: I170779461412c4c202c2cfc8d90baedb7e388150 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/984 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-12-31stm32f1x: preserve user option byte dataSpencer Oliver1-2/+14
The user is able to use 2bytes of the options byte data for whatever purpose they wish. Make sure we preserve this during an option erase/write. Change-Id: Ibf951b11c59a148e671b1eb47fdc9b4f49ccae15 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/983 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-12-31flash: stm32f1x: write option bytes using the loaderSzymon Modzelewski1-60/+19
Some debuggers (stlink) can't issue 16 bit writes and have to use a loader to write flash memory. Currently the loader is not used for option bytes, causing stm32x_write_options to fail silently on such hardware. Fix this by using stm32x_write_block to write option bytes as well. Change-Id: I49c29d53ab5e162463cb349d4c89bef96467e587 Signed-off-by: Szymon Modzelewski <szmodzelewski@gmail.com> Reviewed-on: http://openocd.zylin.com/480 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2012-10-28flash: update stm32 flash driver versionsSpencer Oliver1-4/+8
Seems ST have changed the ref manual (RM0313 rev1) and reverted to using letters rather than numbers for the stm32f3x family. Change-Id: I3a87ec9b0b2447d57dfef98603d30e28fe9ac927 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/926 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Peter Stuge <peter@stuge.se>
2012-10-08stm32f1x: Increase options erase timeoutAndreas Fritiofson1-9/+14
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>
2012-10-08flash/nor: make all working area pointers localAndreas Fritiofson1-9/+7
Working area pointers shouldn't be re-used, so there's no point in storing them in the flash bank struct. Make all such pointers local. Change-Id: Iab65b4e8b475fed7fc72fb8928f54590fa69d260 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/865 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-10-02flash: add stm32f3 rev 2 flash supportSpencer Oliver1-0/+8
Change-Id: Ibab5112f5f70a609136d01ebc50530a334640d03 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/809 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>