Merge branch 'develop' into chipid_cleanup

pull/1216/head
nightwalker-87 2022-01-16 19:57:36 +01:00 zatwierdzone przez GitHub
commit e90ad8c26b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
19 zmienionych plików z 208 dodań i 385 usunięć

Wyświetl plik

@ -2,10 +2,14 @@
# v1.7.1
Release date: 2021-xx-xx
Release date: 2022-xx-xx
This release drops support for some older operating systems. Check project README for details.
Updated system requirements: Raised minimum version for `cmake` to 3.7.2.
Updated system requirements:
- `cmake` >= 3.10.2
- `libusb` >= 1.0.21
- `libgtk-dev` >= 3.22.30
Features:
@ -15,6 +19,9 @@ Features:
- Expanded and revised list of chips ([#1145](https://github.com/stlink-org/stlink/pull/1145), [#1164](https://github.com/stlink-org/stlink/pull/1164))
- [STM32H72X/3X]: Added full access to all device memory ([#1158](https://github.com/stlink-org/stlink/pull/1158), [#1159](https://github.com/stlink-org/stlink/pull/1159))
- Added support for STM32WLEx ([#1173](https://github.com/stlink-org/stlink/pull/1173))
- Added support for STLINK-V3 devices with no MSD ([#1185](https://github.com/stlink-org/stlink/pull/1185))
- Updated gdb-server.c to allow external memory access on STM32H73xx ([#1196](https://github.com/stlink-org/stlink/pull/1196), [#1197](https://github.com/stlink-org/stlink/pull/1197))
- Erase addr size / section of the flash memory with st-flash ([#1213](https://github.com/stlink-org/stlink/pull/1213))
Updates & changes:
@ -22,10 +29,12 @@ Updates & changes:
- Added instructions for bug-reports and feature-requests to contribution guidelines ([#906](https://github.com/stlink-org/stlink/pull/906))
- Added travis CI configuration for macOS 10.14 to maintain capability for 32-bit compilation ([#f5ada94](https://github.com/stlink-org/stlink/commit/f5ada9474cdb87ff37de0d4eb9e75622b5870646))
- Updated description of chip id 0x0457 to L01x/L02x ([#1143](https://github.com/stlink-org/stlink/pull/1143), [#1144](https://github.com/stlink-org/stlink/pull/1144))
- Drop execute bits from source code files ([#1167](https://github.com/stlink-org/stlink/pull/1167))
- Dropped execute bits from source code files ([#1167](https://github.com/stlink-org/stlink/pull/1167))
- Use proper Markdown headers for supported MCUs ([#1168](https://github.com/stlink-org/stlink/pull/1168))
- Removed redundant array ([#1178](https://github.com/stlink-org/stlink/pull/1178))
- Updated chip config files from the library structs ([#1181](https://github.com/stlink-org/stlink/pull/1181))
- [doc] Corrected file path in tutorial ([#1186](https://github.com/stlink-org/stlink/pull/1186))
- Improved chipid checks and printouts ([#1188](https://github.com/stlink-org/stlink/pull/1188))
Fixes:
- cmake: Install shared libraries in proper directories ([#1142](https://github.com/stlink-org/stlink/pull/1142))
@ -41,6 +50,9 @@ Fixes:
- Fixed few warnings for msvc about type conversion with possible lost data ([#1179](https://github.com/stlink-org/stlink/pull/1179))
- st-flash and other utilities search for chip files in the wrong directory ([#1180](https://github.com/stlink-org/stlink/pull/1180), commit [#c8fc656](https://github.com/stlink-org/stlink/commit/c8fc6561fead79ad49c09d82bab864745086792c))
- Fixed broken build on 32 bit systems ([#985](https://github.com/stlink-org/stlink/pull/985), [#1175](https://github.com/stlink-org/stlink/pull/1175), commit [#c8fc656](https://github.com/stlink-org/stlink/commit/c8fc6561fead79ad49c09d82bab864745086792c))
- Define 'SSIZE_MAX' if not defined ([#1183](https://github.com/stlink-org/stlink/pull/1183))
- Fixed compliation for OpenBSD 7.0 ([#1202](https://github.com/stlink-org/stlink/pull/1202))
- Included 'SSIZE_MAX' from 'limits.h' in 'src/common.c' ([#1207](https://github.com/stlink-org/stlink/pull/1207))
# v1.7.0

Wyświetl plik

@ -2,7 +2,7 @@
# General cmake settings
###
cmake_minimum_required(VERSION 3.7.2)
cmake_minimum_required(VERSION 3.10.2)
cmake_policy(SET CMP0042 NEW)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

Wyświetl plik

@ -38,7 +38,7 @@ It supports several so called STLINK programmer boards (and clones thereof) whic
- stand-alone programmer (STLINK-V3SET, STLINK-V3MINI, STLINK-V3MODS)
- on-board on some STM32 Nucleo boards (STLINK-V3E)
_\*)_ **Note: Support for the STLINK/V1 on macOS is limited to 10.14 - 10.15. Due to the deprecation and removal of macOS Kernel Extensions (KEXT) there will be no support for this programmer on macOS 11 or any later version.**
_\*)_ *Note: Support for the STLINK/V1 on macOS is limited to 10.15. Due to the deprecation and removal of macOS Kernel Extensions (KEXT) there will be no support for this programmer on macOS 11 or any later version.*
On the user level there is no difference in handling or operation between these different revisions.

Wyświetl plik

@ -72,7 +72,7 @@ elseif (WIN32 OR (EXISTS "/etc/debian_version" AND MINGW)) # Windows or MinGW-to
if (WIN32 AND NOT EXISTS "/etc/debian_version") # Skip this for Debian...
# Preparations for installing libusb library
set(LIBUSB_WIN_VERSION 1.0.23) # set libusb version
set(LIBUSB_WIN_VERSION 1.0.24) # set libusb version
set(LIBUSB_WIN_ARCHIVE libusb-${LIBUSB_WIN_VERSION}.7z)
if (WIN32 AND NOT EXISTS "/etc/debian_version") # ... on native Windows systems
set(LIBUSB_WIN_ARCHIVE_PATH ${CMAKE_BINARY_DIR}/${LIBUSB_WIN_ARCHIVE})

Wyświetl plik

@ -53,7 +53,7 @@ elseif (EXISTS "/etc/debian_version" AND NOT EXISTS WIN32) # Package-build is av
set(CPACK_DEBIAN_PACKAGE_RELEASE "1")
# CPACK_DEBIAN_PACKAGE_ARCHITECTURE --> Default: Output of dpkg --print-architecture
set(CPACK_DEBIAN_PACKAGE_DEPENDS "pkg-config, build-essential, debhelper (>=9), cmake (>= 3.4.2), libusb-1.0-0-dev (>= 1.0.20)")
set(CPACK_DEBIAN_PACKAGE_DEPENDS "pkg-config, build-essential, debhelper (>=9), cmake (>= 3.10.2), libusb-1.0-0-dev (>= 1.0.21)")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Nightwalker-87 <stlink-org>")
# CPACK_DEBIAN_PACKAGE_DESCRIPTION --> Default: CPACK_DEBIAN_PACKAGE_DESCRIPTION (as it is set)
# CPACK_DEBIAN_PACKAGE_SECTION --> Default: devel

Wyświetl plik

@ -1,7 +1,7 @@
Source: stlink
Priority: optional
Maintainer: Nightwalker-87 <stlink-org>
Build-Depends: cmake, dh-cmake, debhelper (>= 9), libusb-1.0-0-dev, libgtk-3-dev
Build-Depends: cmake (>= 3.10.2), dh-cmake, debhelper (>= 9), libusb-1.0-0-dev (>= 1.0.21), libgtk-3-dev (>= 3.22.30)
Standards-Version: 4.5.0
Rules-Requires-Root: no
Section: electronics

Wyświetl plik

@ -7,6 +7,8 @@ Andrea Mucignat
Andrew Andrianov [necromant]
Andrey Yurovsky
Andy Isaacson
Andreas Sandberg [andysan]
Antoine Faure [antoinefaure]
Anton [Ant-ON]
Áron Radics
A. Sheaff
@ -24,6 +26,7 @@ Chris Samuelson
Christian Deussen [nullsub]
Christophe Levantis
Craig Lilley
Crest [Crest]
Dan Dev
Dan Hepler
Daniel Campoverde [alx741]

Wyświetl plik

@ -7,7 +7,7 @@
On Windows users should ensure that the following software is installed:
- `git` (_optional, but recommended_)
- `cmake` (3.17.0 or later)
- `cmake`
- `MinGW-w64` (7.0.0 or later) with GCC toolchain 8.1.0
### Installation
@ -95,7 +95,7 @@ Install the following packages from your package repository:
- `git`
- `gcc` or `clang` or `mingw32-gcc` or `mingw64-gcc` (C-compiler; very likely gcc is already present)
- `build-essential` (on Debian based distros (Debian, Ubuntu))
- `cmake` (3.4.2 or later, use the latest version available from the repository)
- `cmake`
- `rpm` (on Debian based distros (Debian, Ubuntu), needed for package build with `make package`)
- `libusb-1.0`
- `libusb-1.0-0-dev` (development headers for building)

Wyświetl plik

@ -1,97 +1,104 @@
_Source:_ pkgs.org - [libusb](https://pkgs.org/search/?q=libusb); [cmake](https://pkgs.org/search/?q=cmake); [gtk](https://pkgs.org/search/?q=gtk) (as of May 2021)
_Source:_ [pkgs.org](https://pkgs.org/search) - libusb, cmake, gtk, libgtk) (as of Jan 2022)
## Supported Operating Systems
### Microsoft Windows
On Windows users should ensure that cmake 3.20.2 or any later version is installed.<br />
Up on compiling c-make will **automatically** download and install the latest compatible version of `libusb` (1.0.23 at the time of writing).
On Windows users should ensure that cmake **3.10.2** or any later version is installed.<br />
Up on compiling c-make will **automatically** download and install the latest compatible version of `libusb`.
- Windows 10
- Windows 8.1
### Apple macOS
| Package Repository | libusb<br />version | cmake<br />version | gtk-3<br />version | Supported macOS versions |
| ------------------ | ------------------- | ------------------ | ------------------ | ------------------------ |
| homebrew | 1.0.24 | 3.20.2 | 3.24.29<br />gtk+3 | 10.9 - 11.x |
| MacPorts | 1.0.24 | 3.20.2 | 3.24.29<br />gtk3 | 10.4 - 11.x |
| Package Repository | libusb | cmake | gtk-3-dev | Supported macOS versions |
| ------------------ | ------ | ------ | ------------------ | ------------------------ |
| homebrew | 1.0.24 | 3.22.1 | 3.24.30<br />gtk+3 | **10.10 - 12.x** |
| MacPorts | 1.0.24 | 3.22.1 | 3.24.31<br />gtk3 | **10.4 - 12.x** |
NOTE: In order to use a STLINK/V1 programmer on macOS, versions 10.14 or 10.15 are required.
NOTE: In order to use a STLINK/V1 programmer on macOS, version 10.15 is required.
### Linux-/Unix-based:
| Operating System | libusb | cmake | gtk-3 | Notes |
| ------------------------- | -------------------------------- | --------- | ----------- | ------------------------ |
| Debian Sid | 1.0.24 | 3.18.4 | 3.24.24 | |
| Debian 11 (Bullseye) | 1.0.24 | 3.18.4 | 3.24.24 | |
| Debian 10 (Buster) | 1.0.**22** | 3.13.4 | 3.24.**5** | |
| Debian 9 (Stretch) | 1.0.**21** | **3.7.2** | **3.22.11** | End of Support: Jun 2022 |
| | | | | |
| Ubuntu 21.04 (Hirsute) | 1.0.24 | 3.18.4 | 3.24.25 | End of Support: Jan 2022 |
| Ubuntu 20.04 LTS (Focal) | 1.0.23 | 3.16.3 | 3.24.**18** | |
| Ubuntu 18.04 LTS (Bionic) | 1.0.**21** | 3.10.2 | **3.22.30** | End of Support: Apr 2023 |
| | | | | |
| Fedora Rawhide [x64] | 1.0.24 (`libusbx`) | 3.20.2 | 3.24.29 | |
| Fedora 34 [x64] | 1.0.24 (`libusbx`) | 3.19.7 | 3.24.28 | |
| Fedora 33 [x64] | 1.0.23 (`libusbx`) | 3.18.3 | 3.24.23 | |
| | | | | |
| openSUSE Tumbleweed [x64] | 1.0.24 | 3.20.1 | 3.24.29 | |
| openSUSE Leap 15.3 [x64] | 1.0.**21** | 3.17.0 | 3.24.20 | |
| openSUSE Leap 15.2 [x64] | 1.0.**21** | 3.17.0 | 3.24.**14** | End of Support: Dec 2021 |
| | | | | |
| Alpine 3.14 | 1.0.24 | 3.20.3 | 4.2.1 | |
| Alpine 3.13 | 1.0.24 | 3.18.4 | 3.24.23 | End of Support: Nov 2022 |
| Alpine 3.12 | 1.0.23 | 3.17.2 | 3.24.22 | End of Support: May 2022 |
| Alpine 3.11 | 1.0.23 | 3.15.5 | 3.24.**13** | End of Support: Nov 2021 |
| | | | | |
| FreeBSD 13.x | 1.0.**16 - 18** (API 0x01000102) | 3.20.2 | 3.24.27 | |
| FreeBSD 12.x | 1.0.**16 - 18** (API 0x01000102) | 3.19.6 | 3.24.27 | |
| FreeBSD 11.x | 1.0.**16 - 18** (API 0x01000102) | 3.15.5 | 3.24.27 | End of Support: Sep 2021 |
| | | | | |
| Arch Linux | 1.0.24 | 3.20.2 | 3.24.29 | |
| KaOS [x64] | 1.0.24 | 3.20.2 | 3.24.29 | |
| Mageia Cauldron | 1.0.24 | 3.20.2 | 3.24.29 | |
| OpenMandriva Cooker | 1.0.24 | 3.20.2 | 3.24.29 | |
| PCLinuxOS [x64] | 1.0.24 | 3.20.2 | 3.24.29 | |
| Slackware Current | 1.0.24 | 3.20.2 | 3.24.28 | |
| Solus [x64] | 1.0.24 | 3.20.2 | 3.24.29 | |
| ALT Linux Sisyphus | 1.0.24 | 3.19.7 | 3.24.29 | |
| NetBSD 9.x | 1.0.24 | 3.19.7 | 3.24.27 | |
| NetBSD 8.x | 1.0.24 | 3.19.7 | 3.24.27 | |
| OpenMandriva Lx 4.2 | 1.0.24 | 3.19.3 | 3.24.24 | |
| Mageia 8 | 1.0.24 | 3.19.2 | 3.24.24 | End of Support: Aug 2022 |
| CentOS 8 Stream [x64] | 1.0.23 (`libusbx`) | 3.18.2 | **3.22.30** | |
| Adélie 1.0 | 1.0.23 | 3.16.4 | 3.24.23 | |
| ALT Linux P9 | 1.0.**22** | 3.16.3 | 3.24.**11** | |
| AlmaLinux 8 | 1.0.23 (`libusbx`) | 3.11.4 | 3.24.32 | |
| CentOS 8 [x64] | 1.0.23 (`libusbx`) | 3.11.4 | **3.22.30** | End of Support: Dec 2021 |
| Operating System | libusb | cmake | libgtk-dev | Notes |
| ------------------------- | ------------------------------ | ---------- | ----------- | ------------------------ |
| Debian Sid | 1.0.24 | 3.22.1 | 3.24.31 | |
| Debian 11 (Bullseye) | 1.0.24 | 3.18.4 | 3.24.24 | |
| Debian 10 (Buster) | 1.0.**22** | **3.13.4** | 3.24.**5** | |
| | | | | |
| Ubuntu 20.04 LTS (Focal) | 1.0.23 | 3.16.3 | 3.24.**18** | |
| Ubuntu 18.04 LTS (Bionic) | 1.0.**21** | **3.10.2** | 3.**22.30** | End of Support: Apr 2023 |
| | | | | |
| Fedora Rawhide [x64] | 1.0.24 | 3.22.3 | 3.24.31 | |
| Fedora 35 [x64] | 1.0.24 | 3.21.3 | 3.24.30 | |
| Fedora 34 [x64] | 1.0.24 (`libusbx`) | 3.19.7 | 3.24.28 | |
| | | | | |
| openSUSE Tumbleweed [x64] | 1.0.24 | 3.22.1 | 3.24.31 | |
| openSUSE Leap 15.3 [x64] | 1.0.**21** | 3.17.0 | 3.24.20 | End of Support: Dec 2022 |
| | | | | |
| Alpine 3.15 | 1.0.24 | 3.21.3 | 3.24.30 | |
| Alpine 3.14 | 1.0.24 | 3.20.3 | 3.24.28 | |
| Alpine 3.13 | 1.0.24 | 3.18.4 | 3.24.23 | End of Support: Nov 2022 |
| Alpine 3.12 | 1.0.23 | 3.17.2 | 3.24.22 | End of Support: May 2022 |
| | | | | |
| FreeBSD 13.x | 1.0.**16-18** (API 0x01000102) | 3.22.1 | 3.24.31 | |
| FreeBSD 12.x | 1.0.**16-18** (API 0x01000102) | 3.22.1 | 3.24.31 | |
| | | | | |
| NetBSD 9.x | 1.0.24 | 3.21.2 | 3.24.30 | |
| NetBSD 8.x | 1.0.24 | 3.19.7 | 3.24.27 | |
| | | | | |
| CentOS 9 Stream [x64] | 1.0.24 (`libusbx`) | 3.20.3 | 3.24.30 | |
| CentOS 8 Stream [x64] | 1.0.23 (`libusbx`) | 3.20.2 | 3.**22.30** | |
| | | | | |
| ALT Linux Sisyphus | 1.0.24 | 3.22.1 | 3.24.31 | |
| ALT Linux P10 | 1.0.24 | 3.20.5 | 3.24.31 | |
| ALT Linux P9 | 1.0.**22** | 3.16.3 | 3.24.29 | |
| | | | | |
| OpenMandriva Rolling | 1.0.24 | 3.22.1 | 3.24.31 | |
| OpenMandriva Cooker | 1.0.24 | 3.22.1 | 3.24.31 | |
| OpenMandriva Lx 4.2 | 1.0.24 | 3.19.3 | 3.24.24 | |
| | | | | |
| Arch Linux | 1.0.24 | 3.22.1 | - | |
| KaOS [x64] | 1.0.24 | 3.22.1 | 3.24.31 | |
| Mageia Cauldron | 1.0.24 | 3.22.1 | 3.24.31 | |
| PCLinuxOS [x64] | ? | 3.22.1 | 3.24.31 | |
| Solus [x64] | 1.0.24 | 3.22.1 | 3.24.30 | |
| Void Linux | 1.0.24 | 3.22.1 | 3.24.31 | |
| Slackware Current | 1.0.24 | 3.21.4 | 3.24.31 | |
| AlmaLinux 8 | 1.0.23 (`libusbx`) | 3.20.2 | 3.**22.30** | |
| Rocky Linux 8 [x64] | 1.0.23 | 3.20.2 | 3.**22.30** | |
| Mageia 8 | 1.0.24 | 3.19.2 | 3.24.24 | End of Support: Aug 2022 |
| Adélie 1.0 | 1.0.23 | 3.16.4 | 3.24.23 | |
## Unsupported Operating Systems (as of Release v1.7.1)
Systems with highlighted versions remain compatible with this toolset.
| Operating System | libusb | cmake | End of<br />OS-Support |
| ------------------------- | ---------------------- | ---------- | ---------------------- |
| Fedora 32 [x64] | **1.0.23** (`libusbx`) | **3.17.0** | May 2021 |
| Ubuntu 20.10 (Groovy) | **1.0.23** | **3.16.3** | Jul 2021 |
| NetBSD 7.x | **1.0.22** | **3.16.1** | Jun 2020 |
| Alpine 3.10 | **1.0.22** | **3.14.5** | May 2021 |
| Fedora 31 [x64] | **1.0.22** (`libusbx`) | **3.14.5** | Nov 2020 |
| Mageia 7.1 | **1.0.22** | **3.14.3** | Jun 2021 |
| Fedora 30 | **1.0.22** (`libusbx`) | **3.14.2** | May 2020 |
| Ubuntu 19.10 (Eoan) | **1.0.23** | **3.13.4** | Jul 2020 |
| Alpine 3.9 | **1.0.22** | **3.13.0** | Jan 2021 |
| openSUSE Leap 15.1 [x64] | **1.0.21** | **3.10.2** | Jan 2021 |
| Slackware 14.2 | 1.0.20 | 3.5.2 | |
| Ubuntu 16.04 LTS (Xenial) | 1.0.20 | 3.5.1 | Apr 2021 |
| OpenMandriva Lx 3.0x | 1.0.20 | 3.4.2 | |
| Debian 8 (Jessie) | 1.0.19 | 3.0.2 | Jun 2020 |
| CentOS 7 [x64] | 1.0.21 (`libusbx`) | 2.8.12.2 | Jun 2024 |
| Ubuntu 14.04 LTS (Trusty) | 1.0.17 | 2.8.12.2 | Apr 2019 |
| CentOS 6 | 1.0.9 (`libusbx`) | 2.8.12.2 | Nov 2020 |
| Slackware 14.1 | 1.0.9 | 2.8.12 | |
| Slackware 14.0 | 1.0.9 | 2.8.8 | |
| Operating System | libusb | cmake | End of<br />OS-Support |
| ------------------------ | ------------------------------ | ---------- | ---------------------- |
| CentOS 8 [x64] | 1.0.**23** (`libusbx`) | 3.**20.3** | Dec 2021 |
| Ubuntu 21.04 (Hirsute) | 1.0.**24** | 3.**18.4** | Jan 2022 |
| Fedora 33 [x64] | 1.0.**23** (`libusbx`) | 3.**18.3** | Nov 2021 |
| Fedora 32 [x64] | 1.0.**23** (`libusbx`) | 3.**17.0** | May 2021 |
| openSUSE Leap 15.2 [x64] | 1.0.**21** | 3.**17.0** | Dec 2021 |
| Ubuntu 20.10 (Groovy) | 1.0.**23** | 3.**16.3** | Jul 2021 |
| NetBSD 7.x | 1.0.**22** | 3.**16.1** | Jun 2020 |
| Alpine 3.11 | 1.0.**23** | 3.**15.5** | Nov 2021 |
| FreeBSD 11.x | 1.0.**16-18** (API 0x01000102) | 3.**15.5** | Sep 2021 |
| Alpine 3.10 | 1.0.**22** | 3.**14.5** | May 2021 |
| Fedora 31 [x64] | 1.0.**22**(`libusbx`) | 3.**14.5** | Nov 2020 |
| Mageia 7.1 | 1.0.**22** | 3.**14.3** | Jun 2021 |
| Fedora 30 | 1.0.**22**(`libusbx`) | 3.**14.2** | May 2020 |
| Ubuntu 19.10 (Eoan) | 1.0.**23** | 3.**13.4** | Jul 2020 |
| Alpine 3.9 | 1.0.**22** | 3.**13.0** | Jan 2021 |
| openSUSE Leap 15.1 [x64] | 1.0.**21** | 3.**10.2** | Jan 2021 |
| Debian 9 (Stretch) | 1.0.**21** | 3.7.2 | Jun 2022 |
| Slackware 14.2 | 1.0.20 | 3.5.2 | |
| OpenMandriva Lx 3.0x | 1.0.20 | 3.4.2 | |
| CentOS 7 [x64] | 1.0.**21** (`libusbx`) | 2.8.12.2 | Jun 2024 |
| Slackware 14.1 | 1.0.9 | 2.8.12 | |
| Slackware 14.0 | 1.0.9 | 2.8.8 | |
_All other operating systems which are not listed are unsupported._

Wyświetl plik

@ -264,6 +264,7 @@ int stlink_trace_enable(stlink_t* sl, uint32_t frequency);
int stlink_trace_disable(stlink_t* sl);
int stlink_trace_read(stlink_t* sl, uint8_t* buf, size_t size);
int stlink_erase_flash_mass(stlink_t* sl);
int stlink_erase_flash_section(stlink_t *sl, stm32_addr_t base_addr, size_t size, bool align_size);
int stlink_write_flash(stlink_t* sl, stm32_addr_t address, uint8_t* data, uint32_t length, uint8_t eraseonly);
int stlink_parse_ihex(const char* path, uint8_t erased_pattern, uint8_t * * mem, size_t * size, uint32_t * begin);
uint8_t stlink_get_erased_pattern(stlink_t *sl);
@ -278,6 +279,8 @@ int stlink_cpu_id(stlink_t *sl, cortex_m3_cpuid_t *cpuid);
int stlink_erase_flash_page(stlink_t* sl, stm32_addr_t flashaddr);
uint32_t stlink_calculate_pagesize(stlink_t *sl, uint32_t flashaddr);
int stlink_check_address_range_validity(stlink_t *sl, stm32_addr_t addr, size_t size);
int stlink_check_address_alignment(stlink_t *sl, stm32_addr_t addr);
uint16_t read_uint16(const unsigned char *c, const int pt);
void stlink_core_stat(stlink_t *sl);
void stlink_print_data(stlink_t *sl);

Wyświetl plik

@ -2575,30 +2575,81 @@ int stlink_erase_flash_page(stlink_t *sl, stm32_addr_t flashaddr) {
return check_flash_error(sl);
}
// Check if an address and size are within the flash
int stlink_check_address_range_validity(stlink_t *sl, stm32_addr_t addr, size_t size) {
if (addr < sl->flash_base || addr >= (sl->flash_base + sl->flash_size)) {
ELOG("Invalid address, it should be within 0x%08x - 0x%08lx\n", sl->flash_base, (sl->flash_base + sl->flash_size -1));
return (-1);
}
if ((addr + size) > (sl->flash_base + sl->flash_size)) {
ELOG("The size exceeds the size of the flash (0x%08lx bytes available)\n", (sl->flash_base + sl->flash_size - addr));
return (-1);
}
return 0;
}
// Check if an address is aligned with the beginning of a page
int stlink_check_address_alignment(stlink_t *sl, stm32_addr_t addr) {
stm32_addr_t page = sl->flash_base;
while (page < addr) {
page += stlink_calculate_pagesize(sl, page);
}
if (page != addr) {
return -1;
}
return 0;
}
int stlink_erase_flash_section(stlink_t *sl, stm32_addr_t base_addr, size_t size, bool align_size) {
// Check the address and size validity
if (stlink_check_address_range_validity(sl, base_addr, size) < 0) {
return -1;
}
// Make sure the requested address is aligned with the beginning of a page
if (stlink_check_address_alignment(sl, base_addr) < 0) {
ELOG("The address to erase is not aligned with the beginning of a page\n");
return -1;
}
stm32_addr_t addr = base_addr;
do {
size_t page_size = stlink_calculate_pagesize(sl, addr);
// Check if size is aligned with a page, unless we want to completely erase the last page
if ((addr + page_size) > (base_addr + size) && !align_size) {
ELOG("Invalid size (not aligned with a page). Page size at address %#x is %#lx\n", addr, page_size);
return -1;
}
if (stlink_erase_flash_page(sl, addr)) {
WLOG("Failed to erase_flash_page(%#x) == -1\n", addr);
return (-1);
}
fprintf(stdout, "-> Flash page at %#x erased (size: %#lx)\n", addr, page_size);
fflush(stdout);
// check the next page is within the range to erase
addr += page_size;
} while (addr < (base_addr + size));
fprintf(stdout, "\n");
return 0;
}
int stlink_erase_flash_mass(stlink_t *sl) {
int err = 0;
// TODO: User MER bit to mass-erase WB series.
if (sl->flash_type == STM32_FLASH_TYPE_L0_L1 ||
sl->flash_type == STM32_FLASH_TYPE_WB_WL) {
// erase each page
int i = 0, num_pages = (int)(sl->flash_size / sl->flash_pgsz);
if (sl->flash_type == STLINK_FLASH_TYPE_L0_L1 ||
sl->flash_type == STLINK_FLASH_TYPE_WB_WL) {
for (i = 0; i < num_pages; i++) {
// addr must be an addr inside the page
stm32_addr_t addr =
(stm32_addr_t)sl->flash_base + i * (stm32_addr_t)sl->flash_pgsz;
err = stlink_erase_flash_section(sl, sl->flash_base, sl->flash_size, false);
if (stlink_erase_flash_page(sl, addr)) {
WLOG("Failed to erase_flash_page(%#x) == -1\n", addr);
return (-1);
}
fprintf(stdout, "-> Flash page at %5d/%5d erased\n", i, num_pages);
fflush(stdout);
}
fprintf(stdout, "\n");
} else {
wait_flash_busy(sl);
clear_flash_error(sl);
@ -3088,7 +3139,6 @@ int stlink_flashloader_stop(stlink_t *sl, flash_loader_t *fl) {
int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t *base,
uint32_t len, uint8_t eraseonly) {
size_t off;
int ret;
flash_loader_t fl;
ILOG("Attempting to write %d (%#x) bytes to stm32 address: %u (%#x)\n", len,
@ -3096,22 +3146,13 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t *base,
// check addr range is inside the flash
stlink_calculate_pagesize(sl, addr);
if (addr < sl->flash_base) {
ELOG("addr too low %#x < %#x\n", addr, sl->flash_base);
return (-1);
} else if ((addr + len) < addr) {
ELOG("addr overruns\n");
return (-1);
} else if ((addr + len) > (sl->flash_base + sl->flash_size)) {
ELOG("addr too high\n");
return (-1);
} else if (addr & 1) {
ELOG("unaligned addr 0x%x\n", addr);
// Check the address and size validity
if (stlink_check_address_range_validity(sl, addr, len) < 0) {
return (-1);
} else if (len & 1) {
WLOG("unaligned len 0x%x -- padding with zero\n", len);
len += 1;
} else if (addr & (sl->flash_pgsz - 1)) {
} else if (stlink_check_address_alignment(sl, addr) < 0) {
ELOG("addr not a multiple of current pagesize (%u bytes), not supported, "
"check page start address and compare with flash module organisation "
"in related ST reference manual of your device.\n",
@ -3122,24 +3163,12 @@ int stlink_write_flash(stlink_t *sl, stm32_addr_t addr, uint8_t *base,
// make sure we've loaded the context with the chip details
stlink_core_id(sl);
// Erase each page
int page_count = 0;
for (off = 0; off < len;
off += stlink_calculate_pagesize(sl, addr + (uint32_t)off)) {
// addr must be an addr inside the page
if (stlink_erase_flash_page(sl, addr + (uint32_t)off) == -1) {
ELOG("Failed to erase_flash_page(%#x) == -1\n", (unsigned)(addr + off));
return (-1);
}
ILOG("Flash page at addr: 0x%08lx erased\n", (unsigned long)(addr + off));
page_count++;
// Erase this section of the flash
if (stlink_erase_flash_section(sl, addr, len, true) < 0) {
ELOG("Failed to erase the flash prior to writing\n");
return (-1);
}
ILOG("Finished erasing %d pages of %u (%#x) bytes\n", page_count,
(unsigned)(sl->flash_pgsz), (unsigned)(sl->flash_pgsz));
if (eraseonly) {
return (0);
}

Wyświetl plik

@ -28,7 +28,7 @@ static void cleanup(int signum) {
static void usage(void) {
puts("command line: ./st-flash [--debug] [--reset] [--connect-under-reset] [--hot-plug] [--opt] [--serial <serial>] [--format <format>] [--flash=<fsize>] [--freq=<kHz>] [--area=<area>] {read|write} [path] [addr] [size]");
puts("command line: ./st-flash [--debug] [--connect-under-reset] [--hot-plug] [--freq=<kHz>] [--serial <serial>] erase");
puts("command line: ./st-flash [--debug] [--connect-under-reset] [--hot-plug] [--freq=<kHz>] [--serial <serial>] erase [addr] [size]");
puts("command line: ./st-flash [--debug] [--freq=<kHz>] [--serial <serial>] reset");
puts(" <addr>, <serial> and <size>: Use hex format.");
puts(" <fsize>: Use decimal, octal or hex (prefix 0xXXX) format, optionally followed by k=KB, or m=MB (eg. --flash=128k)");
@ -169,7 +169,10 @@ int main(int ac, char** av) {
goto on_error;
}
} else if (o.cmd == FLASH_CMD_ERASE) {
err = stlink_erase_flash_mass(sl);
if (o.size > 0 && o.addr > 0)
err = stlink_erase_flash_section(sl, o.addr, o.size, false);
else
err = stlink_erase_flash_mass(sl);
if (err == -1) {
printf("stlink_erase_flash_mass() == -1\n");

Wyświetl plik

@ -234,7 +234,24 @@ int flash_get_opts(struct flash_opts* o, int ac, char** av) {
return(-1);
case FLASH_CMD_ERASE: // no more arguments expected
if (ac != 0) { return(-1); }
if (ac != 0 && ac != 2) { return(-1); }
if (ac == 2) {
uint32_t address;
result = get_integer_from_char_array(av[0], &address);
if (result != 0) {
return bad_arg ("addr");
} else {
o->addr = (stm32_addr_t) address;
}
uint32_t size;
result = get_integer_from_char_array(av[1], &size);
if (result != 0) {
return bad_arg ("size");
} else {
o->size = (size_t) size;
}
}
break;

Wyświetl plik

@ -2,9 +2,6 @@
ISMACOS=$(sw_vers -productVersion)
case $ISMACOS in
10.14*)
KEXT="stlink_shield_10_14.kext"
;;
10.15*)
KEXT="stlink_shield_10_15.kext"
;;

Wyświetl plik

@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>18G7016</string>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>com.libusb.stlink-shield</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>KEXT</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleSupportedPlatforms</key>
<array>
<string>MacOSX</string>
</array>
<key>CFBundleVersion</key>
<string>1.0.0</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>11C504</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>19B90</string>
<key>DTSDKName</key>
<string>macosx10.15</string>
<key>DTXcode</key>
<string>1130</string>
<key>DTXcodeBuild</key>
<string>11C504</string>
<key>IOKitPersonalities</key>
<dict>
<key>DeviceDriver</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.kpi.iokit</string>
<key>IOClass</key>
<string>IOService</string>
<key>IOProviderClass</key>
<string>IOUSBDevice</string>
<key>bcdDevice</key>
<integer>256</integer>
<key>idProduct</key>
<integer>14148</integer>
<key>idVendor</key>
<integer>1155</integer>
</dict>
<key>InterfaceDriver</key>
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.kpi.iokit</string>
<key>IOClass</key>
<string>IOService</string>
<key>IOProviderClass</key>
<string>IOUSBInterface</string>
<key>bConfigurationValue</key>
<integer>1</integer>
<key>bInterfaceNumber</key>
<integer>0</integer>
<key>idProduct</key>
<integer>14148</integer>
<key>idVendor</key>
<integer>1155</integer>
</dict>
</dict>
<key>LSMinimumSystemVersion</key>
<string>10.14</string>
<key>OSBundleLibraries</key>
<dict>
<key>com.apple.iokit.IOUSBFamily</key>
<string>1.8</string>
<key>com.apple.kpi.libkern</key>
<string>11.2.0</string>
</dict>
</dict>
</plist>

Wyświetl plik

@ -1,115 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>files</key>
<dict/>
<key>files2</key>
<dict/>
<key>rules</key>
<dict>
<key>^Resources/</key>
<true/>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^version.plist$</key>
<true/>
</dict>
<key>rules2</key>
<dict>
<key>.*\.dSYM($|/)</key>
<dict>
<key>weight</key>
<real>11</real>
</dict>
<key>^(.*/)?\.DS_Store$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>2000</real>
</dict>
<key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^.*</key>
<true/>
<key>^Info\.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^PkgInfo$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^Resources/.*\.lproj/</key>
<dict>
<key>optional</key>
<true/>
<key>weight</key>
<real>1000</real>
</dict>
<key>^Resources/.*\.lproj/locversion.plist$</key>
<dict>
<key>omit</key>
<true/>
<key>weight</key>
<real>1100</real>
</dict>
<key>^Resources/Base\.lproj/</key>
<dict>
<key>weight</key>
<real>1010</real>
</dict>
<key>^[^/]+$</key>
<dict>
<key>nested</key>
<true/>
<key>weight</key>
<real>10</real>
</dict>
<key>^embedded\.provisionprofile$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
<key>^version\.plist$</key>
<dict>
<key>weight</key>
<real>20</real>
</dict>
</dict>
</dict>
</plist>

Wyświetl plik

@ -8,7 +8,6 @@
/* Begin PBXFileReference section */
8CD33C31149BB80D0033D618 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8F9084FD24786F0F009109AD /* stlink_shield_10_14.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = stlink_shield_10_14.kext; sourceTree = BUILT_PRODUCTS_DIR; };
8F90850924786F39009109AD /* stlink_shield_10_15.kext */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = stlink_shield_10_15.kext; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@ -34,7 +33,6 @@
19C28FB6FE9D52B211CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8F9084FD24786F0F009109AD /* stlink_shield_10_14.kext */,
8F90850924786F39009109AD /* stlink_shield_10_15.kext */,
);
name = Products;
@ -60,26 +58,6 @@
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
8F9084F324786F0F009109AD /* stlink_shield_10_14 */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8F9084FA24786F0F009109AD /* Build configuration list for PBXNativeTarget "stlink_shield_10_14" */;
buildPhases = (
8F9084F424786F0F009109AD /* ShellScript */,
8F9084F524786F0F009109AD /* Headers */,
8F9084F624786F0F009109AD /* Resources */,
8F9084F824786F0F009109AD /* Sources */,
8F9084F924786F0F009109AD /* ShellScript */,
);
buildRules = (
);
dependencies = (
);
name = stlink_shield_10_14;
productInstallPath = "$(SYSTEM_LIBRARY_DIR)/Extensions";
productName = NanosMouse;
productReference = 8F9084FD24786F0F009109AD /* stlink_shield_10_14.kext */;
productType = "com.apple.product-type.kernel-extension.iokit";
};
8F9084FF24786F39009109AD /* stlink_shield_10_15 */ = {
isa = PBXNativeTarget;
buildConfigurationList = 8F90850624786F39009109AD /* Build configuration list for PBXNativeTarget "stlink_shield_10_15" */;
@ -120,7 +98,6 @@
projectDirPath = "";
projectRoot = "";
targets = (
8F9084F324786F0F009109AD /* stlink_shield_10_14 */,
8F9084FF24786F39009109AD /* stlink_shield_10_15 */,
);
};
@ -458,24 +435,6 @@
};
name = Release;
};
8F9084FB24786F0F009109AD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
8F9084FC24786F0F009109AD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
MACOSX_DEPLOYMENT_TARGET = 10.14;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
8F90850724786F39009109AD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@ -506,15 +465,6 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8F9084FA24786F0F009109AD /* Build configuration list for PBXNativeTarget "stlink_shield_10_14" */ = {
isa = XCConfigurationList;
buildConfigurations = (
8F9084FB24786F0F009109AD /* Debug */,
8F9084FC24786F0F009109AD /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
8F90850624786F39009109AD /* Build configuration list for PBXNativeTarget "stlink_shield_10_15" */ = {
isa = XCConfigurationList;
buildConfigurations = (