1. 07 Apr, 2019 2 commits
  2. 27 Mar, 2019 1 commit
  3. 08 Mar, 2019 1 commit
  4. 07 Feb, 2019 1 commit
  5. 04 Feb, 2019 1 commit
  6. 16 Jan, 2019 1 commit
  7. 02 Nov, 2018 1 commit
  8. 18 Jul, 2018 1 commit
  9. 10 Apr, 2018 1 commit
  10. 06 Apr, 2018 1 commit
  11. 14 Feb, 2018 1 commit
  12. 17 Jun, 2017 1 commit
  13. 24 Apr, 2017 1 commit
  14. 08 Dec, 2016 1 commit
    • Tomas Vanek's avatar
      flash/nor: at91samd protection bits write fix · 4732471b
      Tomas Vanek authored
      
      
      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: default avatarTomas Vanek <vanekt@fbl.cz>
      Reviewed-on: http://openocd.zylin.com/3550
      
      
      Tested-by: jenkins
      Reviewed-by: default avatarAndreas Fritiofson <andreas.fritiofson@gmail.com>
      4732471b
  15. 05 Nov, 2016 1 commit
  16. 13 Aug, 2016 1 commit
  17. 24 May, 2016 1 commit
  18. 05 May, 2016 3 commits
  19. 29 Dec, 2015 4 commits
  20. 20 Nov, 2015 3 commits
    • Tomas Vanek's avatar
      flash: at91samd: flash write code cleaning · 26a65f4f
      Tomas Vanek authored
      
      
      SAMD driver suffered from following problems:
      
      1) Flash was erased as an integral part of flash write.
      It was not documented so with usual workflow it resulted
      in erasing flash twice (and reducing flash lifespan)
      and in almost double flashing time.
      
      2) Sector erase was silently skipped if "is_erased" flag was set.
      "is_erased" logic was not reliable, e.g. when a row write
      was aborted after successful write of some pages, sector was
      still considered as erased. "is_erased" flag could not
      cope with flash writes from a user program.
      
      3) Writing of a block with start address unaligned to a flash page
      resulted in failed assert and OpenOCD abort.
      
      4) Disabling cache in bit 18 of 16-bit halfword never worked.
      MCU implements cache invalidate in hardware so there is no need
      to take care about. This bug was reported by Tony DiCola.
      
      New code does not erase flash in write operation.
      Instead it traditionally relies on erasing flash beforehand.
      "is_erased" logic and cache disabling is completely removed.
      It simplifies write procedure a lot and flash write is now faster.
      
      The change partly solves ticket #109 SAMD/SAM4L driver doubles flash erase.
      
      Change-Id: I582b497d01a351575533a1f8c9810a4413be0216
      Signed-off-by: default avatarTomas Vanek <vanekt@fbl.cz>
      Reviewed-on: http://openocd.zylin.com/3045
      
      
      Tested-by: jenkins
      Reviewed-by: default avatarSpencer Oliver <spen@spen-soft.co.uk>
      26a65f4f
    • Andreas Loehre's avatar
      flash: at91samd: Add SAML21 variant B device support and fix SAMC20/SAMC21 · b5fa1e4d
      Andreas Loehre authored
      
      
      This adds support for the Atmel SAML21 variant B parts.
      There is minimal change between the two variants, but in
      variant B the automatic page write which the at91samd flash
      driver relies on to be enabled is disabled by default.
      With this patch the write row function will now issue a page write
      command after each of the four pages in the row if the MANW (manual
      write) bit is set. This also fixes flash write for the SAMC20/SAMC21
      devices which have the MANW bit set by default as well.
      
      I have also moved the device ID (DID) register bitfield extraction
      from the find_part into helper macros. These can be used in the future
      if there are more workarounds for specific devices.
      
      Tested (programming) on:
      ATSAML21-XPRO
      ATSAML21-XPRO-B
      SAMC21 Xplained Pro
      SAMD21 Xplained Pro
      SAMD20 Xplained Pro
      
      Change-Id: I401a8aa1efd64730840c0d62cf49a1e880ea5900
      Signed-off-by: default avatarAndreas Loehre <alohre@gmail.com>
      Reviewed-on: http://openocd.zylin.com/2903
      
      
      Tested-by: jenkins
      Reviewed-by: default avatarTomas Vanek <vanekt@fbl.cz>
      b5fa1e4d
    • Tomas Vanek's avatar
      at91samd: handle reset run/halt in DSU · 751e2454
      Tomas Vanek authored
      Atmel introduced a "Device Service Unit" (DSU) that holds the CPU
      in reset if TCK is low when srst (RESET_N) is deasserted.
      Function is similar to SMAP in ATSAM4L, see http://openocd.zylin.com/2604
      
      Atmel's EDBG adapter handles DSU reset correctly without this change.
      
      An ordinary SWD adapter leaves TCK in its default state, low.
      So without this change any use of sysresetreq or srst
      locks the chip in reset state until power is cycled.
      
      A new function dsu_reset_deassert is called as reset-deassert-post event handler.
      It optionally prepares reset vector catch and DSU reset is released then.
      
      Additionally SWD clock comment is fixed in at91samdXX.cfg and clock is
      lowered a bit to ensure a margin for RC oscillator frequency deviation.
      adapter_nsrst_delay 100 is commented out because is no more necessary after
      http://openocd.zylin.com/2601
      
      
      
      Change-Id: I42e99b1b245f766616c0a0d939f60612c29bd16c
      Signed-off-by: default avatarTomas Vanek <vanekt@fbl.cz>
      Reviewed-on: http://openocd.zylin.com/2778
      
      
      Tested-by: jenkins
      Reviewed-by: default avatarSpencer Oliver <spen@spen-soft.co.uk>
      751e2454
  21. 06 Aug, 2015 1 commit
  22. 16 Apr, 2015 2 commits
  23. 11 Feb, 2015 1 commit
  24. 24 Nov, 2014 1 commit
  25. 06 Oct, 2014 2 commits
    • Andrey Yurovsky's avatar
      at91samd: fix protect, add EEPROM and boot commands · db4b2c25
      Andrey Yurovsky authored
      
      
      There were two problems with the _protect() feature:
      1. The address written was off by a factor of two because the address
      register takes 16-bit rather than 8-bit addresses.  As a result the
      wrong sectors were (un)protected with the protect command.  This has
      been fixed.
      2. The protection settings issued via the lock or unlock region commands
      don't persist after reset.  Making them persist requires modifying the
      LOCK bits in the User Row using the infrastructure described below.
      
      The Atmel SAMD2x MCUs provide a User Row (the size of which is one
      page).  This contains a few settings that users may wish to modify from
      the debugger, especially during production.  This change adds commands
      to inspect and set:
      - EEPROM size, the size in bytes of the emulated EEPROM region of the
        Flash.
      - Bootloader size, the size in bytes of the protected "boot" section of
        the Flash.
      
      This is done by a careful read-modify-write of the special User Row
      page, avoiding erasing when possible and disallowing the changing of
      documented reserved bits.  The Atmel SAMD20 datasheet was used for bit
      positions and descriptions, size tables, etc. and testing was done on a
      SAMD20 Xplained Pro board.
      
      It's technically possible to store arbitrary user data (ex: serial
      numbers, MAC addresses, etc) in the remaining portion of the User Row
      page (that is, beyond the first 64 bits of it).  The infrastructure used
      by the eeprom and bootloader commands can be used to access this as
      well, and this seems safer than exposing the User Row as a normal Flash
      sector that openocd understands due to the delicate nature of some of
      the data stored there.
      
      Change-Id: I29ca1bdbdc7884bc0ba0ad18af1b6bab78c7ad38
      Signed-off-by: default avatarAndrey Yurovsky <yurovsky@gmail.com>
      Reviewed-on: http://openocd.zylin.com/2326
      
      
      Tested-by: jenkins
      Reviewed-by: default avatarSpencer Oliver <spen@spen-soft.co.uk>
      db4b2c25
    • Andrey Yurovsky's avatar
      at91samd: add erase/secure commands, minor fix · 592d0d51
      Andrey Yurovsky authored
      
      
      Reference code for the SAMD2x disables caching in the NVM controller when
      issuing NVM commands.  Let's do this as well to be consistent and safer.
      
      Add a "chip-erase" for the Atmel SAMD targets that issues a complete Chip Erase
      via the Device Service Unit (DSU).  This can be used to "unlock" or otherwise
      unbrick a chip that can't be halted or inspected, allowing the user to reflash
      with new firmware.
      
      Add a "set-security" command which issues an SSB.  Once that's done and the
      device is power-cycled, the flash cannot be written to until a "chip-erase" is
      issued.  The chip-erase cannot be issued by openocd at this time because
      the device will not respond to a request for the DAP IDCODE.
      
      Change-Id: I80122f0bbf7e3aedffe052c1e77d69dc2dba25ed
      Signed-off-by: default avatarAndrey Yurovsky <yurovsky@gmail.com>
      Reviewed-on: http://openocd.zylin.com/2239
      
      
      Tested-by: jenkins
      Reviewed-by: default avatarSpencer Oliver <spen@spen-soft.co.uk>
      592d0d51
  26. 19 Aug, 2014 1 commit
  27. 10 Jul, 2014 1 commit
  28. 22 Jun, 2014 1 commit
  29. 05 May, 2014 1 commit
  30. 29 Mar, 2014 1 commit
    • Andrey Smirnov's avatar
      at91smad: Fixes to 'samd_protect' · dba153bb
      Andrey Smirnov authored
      
      
      Some fixes to 'samd_protect' including:
           - Fix a bug in which the value of 'set' parameter passed into the
           function was ignored so it was impossible to remove flash
           protection once it was set.
           - Check the protection status of the sector via 'is_protected'
           field of the  corresponding 'flash_sector' structure to see if
           any actual HW manipulations needs to be done.
           - Change the way the errors during protection activation are
           handled. Now even in the case of error in the middle of
           protecting a number of sectors the subroutine would still update
           the state of the sector protection in sectors array so as to
           avoid cases where openocd thinks that the sector is not protected
           while it actually is.
      
      Change-Id: I4cc6445a98ec13bdd94c89f0711c17840738a215
      Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
      Reviewed-on: http://openocd.zylin.com/2027
      
      
      Tested-by: jenkins
      Reviewed-by: default avatarAndrey Yurovsky <yurovsky@gmail.com>
      Reviewed-by: default avatarPaul Fertser <fercerpav@gmail.com>
      dba153bb