aboutsummaryrefslogtreecommitdiff
path: root/src/flash/nor/efm32.c
AgeCommit message (Collapse)AuthorFilesLines
2020-05-09flash/nor/efm32: Some small code cleanupsMarc Schink1-14/+9
Change-Id: I547970ce31435f75bae01d6d2cc96ebc9c15588c Signed-off-by: Marc Schink <dev@zapb.de> Reviewed-on: http://openocd.zylin.com/5420 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
2020-04-13flash/nor/efm32: Chip support extension (EFM32GG12B Giant)tscn921-0/+1
For flash/nor/efm32 the EFM32GG12B Giant chip has been added to the efm32_family along with its respective series and msc_rebase. Testen on EFM32GG12B390F board Change-Id: Idd7dfa93f26ac22566aed1be28f30db678cc0a25 Signed-off-by: tscn92 <tscn@kamstrup.com> Reviewed-on: http://openocd.zylin.com/5567 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
2020-02-08efm32: add EFR32ZG13P and EFR32ZG14P partsFrank Hunleth1-0/+2
This adds the EFR32 Zen Gecko Family parts. The device family values are found in table 4.7.11 of https://www.silabs.com/documents/public/reference-manuals/efr32xg14-rm.pdf. Change-Id: I3858b7ba815784b1150e2214a2833e8ff7d249e1 Signed-off-by: Frank Hunleth <fhunleth@troodon-software.com> Reviewed-on: http://openocd.zylin.com/5364 Tested-by: jenkins Reviewed-by: Marc Schink <dev@zapb.de>
2019-10-02efm32: use device-specific MSC base for EFM32TG11BChristian Meusel1-1/+1
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-05-14helper/command: change prototype of command_print/command_print_samelineAntonio Borneo1-1/+1
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>
2018-11-18efm32: correct erase address if bank->base != 0Andreas Kemnade1-1/+1
Prepare for additional flash banks not located at address 0 Change-Id: I60b78c917f94fa52bf24df9e3315536f776eec84 Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Reviewed-on: http://openocd.zylin.com/4440 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
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>
2018-02-14efm32: Refactor EFM32 chip family data, add more chipsJonas Norling1-126/+146
Add support for more EFM32/EFR32 Series 1 families. The family IDs come from the DEVICE_FAMILY list in the EFM32GG11 reference manual, which is the most up to date source I could find. Register locations have been checked against SiLab's header files. No datasheets or headers were available for EFR32MG2, EFR32xG14 and EFM32TG11B, so they are just assumed to follow the pattern. EFM32GG11B has the MSC registers on a different address compared to other chips. This commit attempts not to change current behavior when detecting chips. One detail that has changed is that PAGE_SIZE is read before applying the workaround for old Giant and Leopard Gecko revisions, but this is believed to be OK because the register exists but just has an invalid value in it. The manuals disagree on which of 120 and 121 is WG, so this commit leaves it as is. Change-Id: Ia152b0b9e323defc5158cb02d9a6b04a27008f2a Signed-off-by: Jonas Norling <jonas.norling@cyanconnode.com> Reviewed-on: http://openocd.zylin.com/4263 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz> Reviewed-by: Fredrik Hederstierna <fredrik@hederstierna.com>
2017-10-03flash: efm32: add support for EFR-familty (e.g. bluegecko)Andrea Merello1-28/+71
This patch adds support for Blue Gecko and Mighty Gecko chips from Silabs. They have different EFM32_MSC_REGBASE and LOCK register offset. Based on the original patch from Andreas Kemnade. Change-Id: I166c14960ced7c880b68083badd1b31372fefabe Cc: Andreas Kemnade <andreas@kemnade.info> Signed-off-by: Andrea Merello <andrea.merello@gmail.com> Reviewed-on: http://openocd.zylin.com/4034 Reviewed-by: Jonas Norling <jonas.norling@cyanconnode.com> Tested-by: jenkins Reviewed-by: Fredrik Hederstierna <fredrik@hederstierna.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-by: chrysn <chrysn@fsfe.org>
2017-06-30flash/nor/efm32: Support EZR32HG devices.Richard Watts1-1/+5
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>
2016-12-08flash/nor/efm32: Support flash size smaller than 32kkevin1-3/+3
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-05-24Remove FSF address from GPL noticesMarc Schink1-1/+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-05-20Fix spelling of ARM CortexAndreas Färber1-3/+3
It's Cortex-Xn, not Cortex Xn or cortex xn or cortex-xn or CORTEX-Xn or CortexXn. Further it's Cortex-M0+, not M0plus. Cf. http://www.arm.com/products/processors/index.php Consistently write it the official way, so that it stops propagating. Originally spotted in the documentation, it mainly affects code comments but also Atmel SAM3/SAM4/SAMV, NiietCM4 and SiM3x flash driver output. Found via: git grep -i "Cortex " git grep -i "Cortex-" | grep -v "Cortex-" | grep -v ".cpu" git grep -i "CortexM" Change-Id: Ic7b6ca85253e027f6f0f751c628d1a2a391fe914 Signed-off-by: Andreas Färber <afaerber@suse.de> Reviewed-on: http://openocd.zylin.com/3483 Tested-by: jenkins Reviewed-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2016-05-05Support for debug interface lock of EFM32 controllersLieven Hollevoet1-3/+44
The capability to lock the debug interface on EFM32 controllers was lacking in OpenOCD. After receiving some pointers by zapb_ and PaulFertser on IRC (thanks guys!) I have added this capability. This works by writing the required bits in the debug lock word to '0'. Note: there is currently no way to re-enable the debug interface from OpenOCD as doing this requires specific pin wiggling that is currently not implemented yet. However: having the capability to lock the debug interface is useful when building a volume programming jig. You can flash the program code, verify and then lock the debug interface so that the device cannot be read when it is deployed in the field. Change-Id: If2d562dfdb4b95519785a4395f755d9ae3d0cf12 Signed-off-by: Lieven Hollevoet <hollie@lika.be> Reviewed-on: http://openocd.zylin.com/3389 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@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-11-23efm32: remove duplicate part name decoding.Karl Palsson1-85/+70
The probe and info methods had duplicate sections decoding family names to generate a human friendly part name. Extract this to a common helper. Change-Id: I4c6309d83c601e154b7c14ad9c15c53854ee1e98 Signed-off-by: Karl Palsson <karlp@tweak.net.au> Reviewed-on: http://openocd.zylin.com/2932 Tested-by: jenkins Reviewed-by: Andreas Färber <afaerber@suse.de> Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2015-11-23efm32: basic Happy Gecko target supportKarl Palsson1-2/+10
Basic basic support to get running, magic numbers taken from revision 0.90 of the reference manual. Signed-off-by: Karl Palsson <karlp@tweak.net.au> Change-Id: Iff6ab94d30698f056ef09f7a856b7285fed8f441 Reviewed-on: http://openocd.zylin.com/2931 Tested-by: jenkins Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
2015-04-16flash: efm32: Add support for EZR32LG and EZR32WG.Marc Schink1-3/+19
This patch was tested with an EZR32WG Starter Kit. Change-Id: I0f7c619e715fe30e88e6da3bead0806dd3bce819 Signed-off-by: Marc Schink <openocd-dev@marcschink.de> Reviewed-on: http://openocd.zylin.com/2700 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-06-22efm32 : Added ZeroGecko family support.Nemui Trinomius1-3/+17
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-03-17flash: Constify write bufferAndreas Fritiofson1-3/+3
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-03-17flash/efm32: Fix bug in odd byte count paddingAndreas Fritiofson1-1/+1
Change-Id: I7fcd152a8501f399c6ac5a85fd62a84c82b030a0 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/2038 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-02-24EFM32 Wonder Gecko Family supportJoerg Fischer1-1/+22
Add support for EFM32 Wonder Gecko family to flash driver. This family has Cortex M4F core. Change-Id: If71511015403069e3e30cb9f19df12cd97ac49e8 Signed-off-by: Joerg Fischer <turboj@gmx.de> Reviewed-on: http://openocd.zylin.com/1968 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31Remove unnecessary castsAndreas Fritiofson1-2/+1
Change-Id: Ia97283707282ccccdc707c969f59337313b4e291 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1767 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31Clean up many C99 integer types format specifiersPaul Fertser1-6/+6
This eliminates most of the warnings reported when building for arm-none-eabi (newlib). Hsiangkai, there're many similar warnings left in your nds32 files, I didn't have the nerve to clean them all, probably you could pick it up. Change-Id: Id3bbe2ed2e3f1396290e55bea4c45068165a4810 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1674 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
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-05-08efm32: fix FTBFS on ARM due to alignment issuesPaul Fertser1-8/+8
The following warnings prevent OpenOCD from building: efm32.c: In function 'efm32x_read_lock_data': efm32.c:373:8: error: cast increases required alignment of target type [-Werror=cast-align] efm32.c:386:9: error: cast increases required alignment of target type [-Werror=cast-align] efm32.c:394:9: error: cast increases required alignment of target type [-Werror=cast-align] efm32.c:402:9: error: cast increases required alignment of target type [-Werror=cast-align] efm32.c: In function 'efm32x_get_page_lock': efm32.c:430:17: error: cast increases required alignment of target type [-Werror=cast-align] efm32.c: In function 'efm32x_set_page_lock': efm32.c:441:19: error: cast increases required alignment of target type [-Werror=cast-align] cc1: all warnings being treated as errors This patch is compile-tested only. Change-Id: Ia3a8f342e0f5e30c8ea4de9435c5c7a80bc100e3 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1370 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.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>
2013-01-18flash: EFM32 GG/LG page size detection fixRoman D1-8/+16
Fixed flash page size detection according to EFM32 GG/LG errata. MEM_INFO_PAGE_SIZE register containts invalid value in devices with revision number lower than 18 and should not be used. Change-Id: Idb2832246efcbbec2fd98a5c458f72a36df386fb Signed-off-by: Roman D <me@iamroman.org> Reviewed-on: http://openocd.zylin.com/1116 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-01-14flash: EFM32 flash implementationRoman D1-0/+977
Limited (no page unprotect, no block writes) implementation of EFM32 flash support. Verified with EFM32 development kit and STLink V2 adapter using SWD. Change-Id: I3db2054d9aa628a1fe4814430425db3c9959c71c Signed-off-by: Roman D <me@iamroman.org> Reviewed-on: http://openocd.zylin.com/1106 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>