diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 72163fdf7..159161f72 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -7,196 +7,422 @@ on: branches: [master, develop, testing] jobs: - # Linux - job_linux_20_04_64_gcc: - name: ubuntu-20.04 gcc - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: sudo apt update && sudo apt-get install gcc-10 libusb-1.0.0-dev libgtk-3-dev rpm - - name: make debug - run: sudo make clean && make debug - - name: make test - run: sudo make clean && make test - - name: make release - run: sudo make clean && make release - - name: sudo make install - run: sudo make clean && sudo make install - - name: sudo make package - run: sudo make package - - name: sudo make uninstall - run: sudo make uninstall && sudo make clean + linux_64_bit: + strategy: + fail-fast: false + matrix: + config: + - name: Ubuntu20.04_x64 gcc9 + os : ubuntu-20.04 + cc : gcc-9 + cxx : g++-9 + packages: gcc-9 g++-9 - job_linux_20_04_32_gcc: - name: ubuntu-20.04 gcc 32-bit - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: sudo apt update && sudo apt-get install gcc-10 libusb-1.0.0-dev libgtk-3-dev rpm - - name: Set compiler flags - run: | - CFLAGS="$CFLAGS -m32" - CXXFLAGS="$CXXFLAGS -m32" - LDFLAGS="$LDFLAGS -m32" - - name: make debug - run: sudo make clean && make debug - - name: make test - run: sudo make clean && make test - - name: make release - run: sudo make clean && make release - - name: sudo make install - run: sudo make clean && sudo make install - - name: sudo make package - run: sudo make package - - name: sudo make uninstall - run: sudo make uninstall && sudo make clean + - name: Ubuntu20.04_x64 gcc10 + os : ubuntu-20.04 + cc : gcc-10 + cxx : g++-10 + packages: gcc-10 g++-10 - job_linux_20_04_64_clang: - name: ubuntu-20.04 clang - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: sudo apt update && sudo apt-get install clang-12 libusb-1.0.0-dev libgtk-3-dev rpm - - name: make debug - run: sudo make clean && make debug - - name: make test - run: sudo make clean && make test - - name: make release - run: sudo make clean && make release - - name: sudo make install - run: sudo make clean && sudo make install - - name: sudo make package - run: sudo make package - - name: sudo make uninstall - run: sudo make uninstall && sudo make clean + - name: Ubuntu20.04_x64 clang10 + os : ubuntu-20.04 + cc : clang-10 + cxx : clang++-10 + packages: gcc-9 g++-9 clang-10 - job_linux_20_04_32_clang: - name: ubuntu-20.04 clang 32-bit - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: sudo apt update && sudo apt-get install clang-12 libusb-1.0.0-dev libgtk-3-dev rpm - - name: Set compiler flags - run: | - CFLAGS="$CFLAGS -m32" - CXXFLAGS="$CXXFLAGS -m32" - LDFLAGS="$LDFLAGS -m32" - - name: make debug - run: sudo make clean && make debug - - name: make test - run: sudo make clean && make test - - name: make release - run: sudo make clean && make release - - name: sudo make install - run: sudo make clean && sudo make install - - name: sudo make package - run: sudo make package - - name: sudo make uninstall - run: sudo make uninstall && sudo make clean + - name: Ubuntu20.04_x64 clang12 + os : ubuntu-20.04 + cc : clang-12 + cxx : clang++-12 + packages: gcc-10 g++-10 clang-12 - job_linux_22_04_64_gcc: - name: ubuntu-22.04 gcc - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: sudo apt update && sudo apt-get install gcc-12 libusb-1.0.0-dev libgtk-4-dev rpm - - name: make debug - run: sudo make clean && make debug - - name: make test - run: sudo make clean && make test - - name: make release - run: sudo make clean && make release - - name: sudo make install - run: sudo make clean && sudo make install - - name: sudo make package - run: sudo make package - - name: sudo make uninstall - run: sudo make uninstall && sudo make clean - job_linux_22_04_32_gcc: - name: ubuntu-22.04 gcc 32-bit - runs-on: ubuntu-22.04 + + - name: Ubuntu22.04_x64 gcc10 + os: ubuntu-22.04 + cc: gcc-10 + cxx: g++-10 + packages: gcc-10 g++-10 + + - name: Ubuntu22.04_x64 gcc11 + os: ubuntu-22.04 + cc: gcc-11 + cxx: g++-11 + packages: gcc-11 g++-11 + + - name: Ubuntu22.04_x64 gcc12 + os: ubuntu-22.04 + cc: gcc-12 + cxx: g++-12 + packages: gcc-12 g++-12 + + - name: Ubuntu22.04_x64 clang11 + os: ubuntu-22.04 + cc: clang-11 + cxx: clang++-11 + packages: gcc-11 g++-11 clang-11 + + - name: Ubuntu22.04_x64 clang12 + os: ubuntu-22.04 + cc: clang-12 + cxx: clang++-12 + packages: gcc-12 g++-12 clang-12 + + - name: Ubuntu22.04_x64 clang13 + os: ubuntu-22.04 + cc: clang-13 + cxx: clang++-13 + packages: gcc-12 g++-12 clang-13 + + - name: Ubuntu22.04_x64 clang14 + os: ubuntu-22.04 + cc: clang-14 + cxx: clang++-14 + packages: gcc-12 g++-12 clang-14 + + - name: Ubuntu22.04_x64 clang15 + os: ubuntu-22.04 + cc: clang-15 + cxx: clang++-15 + packages: gcc-12 g++-12 clang-15 + + + + - name: Ubuntu24.04_x64 gcc10 + os: ubuntu-24.04 + cc: gcc-10 + cxx: g++-10 + packages: gcc-10 g++-10 + + - name: Ubuntu24.04_x64 gcc11 + os: ubuntu-24.04 + cc: gcc-11 + cxx: g++-11 + packages: gcc-11 g++-11 + + - name: Ubuntu24.04_x64 gcc12 + os: ubuntu-24.04 + cc: gcc-12 + cxx: g++-12 + packages: gcc-12 g++-12 + + - name: Ubuntu24.04_x64 gcc13 + os: ubuntu-24.04 + cc: gcc-13 + cxx: g++-13 + packages: gcc-12 g++-13 + + - name: Ubuntu24.04_x64 clang14 + os: ubuntu-24.04 + cc: clang-14 + cxx: clang++-14 + packages: gcc-13 g++-13 clang-14 + + - name: Ubuntu24.04_x64 clang15 + os: ubuntu-24.04 + cc: clang-15 + cxx: clang++-15 + packages: gcc-13 g++-13 clang-15 + + - name: Ubuntu24.04_x64 clang16 + os: ubuntu-24.04 + cc: clang-16 + cxx: clang++-16 + packages: gcc-13 g++-13 clang-16 + + - name: Ubuntu24.04_x64 clang17 + os: ubuntu-24.04 + cc: clang-17 + cxx: clang++-17 + packages: gcc-13 g++-13 clang-17 + + - name: Ubuntu24.04_x64 clang18 + os: ubuntu-24.04 + cc: clang-18 + cxx: clang++-18 + packages: gcc-13 g++-13 clang-18 + + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + env: + CC: ${{ matrix.config.cc }} + CXX: ${{ matrix.config.cxx }} + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + - name: Install dependencies - run: sudo apt update && sudo apt-get install gcc-12 libusb-1.0.0-dev libgtk-4-dev rpm - - name: Set compiler flags - run: | - CFLAGS="$CFLAGS -m32" - CXXFLAGS="$CXXFLAGS -m32" - LDFLAGS="$LDFLAGS -m32" - - name: make debug - run: sudo make clean && make debug - - name: make test - run: sudo make clean && make test - - name: make release - run: sudo make clean && make release - - name: sudo make install - run: sudo make clean && sudo make install - - name: sudo make package - run: sudo make package + run: sudo apt update && sudo apt-get install ${{ matrix.config.packages }} libusb-1.0.0-dev libgtk-3-dev rpm + + - name: environment preparation + run: mkdir -p ./build/{debug,release} + + - name: project configuration in debug + working-directory: ./build/debug + run: cmake ../.. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug + + - name: project build in debug + working-directory: ./build/debug + run: cmake --build . --target all + + - name: run tests + working-directory: ./build/debug + run: ctest --force-new-ctest-process + + - name: project configuration in release + working-directory: ./build/release + run: cmake ../.. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release + + - name: project build in release + working-directory: ./build/release + run: cmake --build . --target all + + - name: project installation + working-directory: ./build/release + run: sudo cmake --build . --target install + + - name: project packaging + working-directory: ./build/release + run: sudo cpack --config ./CPackSourceConfig.cmake ../debug/CPackSourceConfig.cmake + - name: sudo make uninstall - run: sudo make uninstall && sudo make clean + working-directory: ./build/release + run: sudo cmake --build . --target uninstall + + linux_32_bit: + strategy: + fail-fast: false + matrix: + config: + - name: Ubuntu20.04_x32 gcc9 + os : ubuntu-20.04 + cc : gcc-9 + cxx : g++-9 + packages: gcc-9-multilib g++-9-multilib + + - name: Ubuntu20.04_x32 gcc10 + os : ubuntu-20.04 + cc : gcc-10 + cxx : g++-10 + packages: gcc-10-multilib g++-10-multilib + + - name: Ubuntu20.04_x32 clang10 + os : ubuntu-20.04 + cc : clang-10 + cxx : clang++-10 + packages: gcc-9-multilib g++-9-multilib clang-10 + + - name: Ubuntu20.04_x32 clang12 + os : ubuntu-20.04 + cc : clang-12 + cxx : clang++-12 + packages: gcc-10-multilib g++-10-multilib clang-12 + + + + - name: Ubuntu22.04_x32 gcc10 + os: ubuntu-22.04 + cc: gcc-10 + cxx: g++-10 + packages: gcc-10-multilib g++-10-multilib + + - name: Ubuntu22.04_x32 gcc11 + os: ubuntu-22.04 + cc: gcc-11 + cxx: g++-11 + packages: gcc-11-multilib g++-11-multilib + + - name: Ubuntu22.04_x32 gcc12 + os: ubuntu-22.04 + cc: gcc-12 + cxx: g++-12 + packages: gcc-12-multilib g++-12-multilib + + - name: Ubuntu22.04_x32 clang11 + os: ubuntu-22.04 + cc: clang-11 + cxx: clang++-11 + packages: gcc-11-multilib g++-11-multilib clang-11 + + - name: Ubuntu22.04_x32 clang12 + os: ubuntu-22.04 + cc: clang-12 + cxx: clang++-12 + packages: gcc-12-multilib g++-12-multilib clang-12 + + - name: Ubuntu22.04_x32 clang13 + os: ubuntu-22.04 + cc: clang-13 + cxx: clang++-13 + packages: gcc-12-multilib g++-12-multilib clang-13 + + - name: Ubuntu22.04_x32 clang14 + os: ubuntu-22.04 + cc: clang-14 + cxx: clang++-14 + packages: gcc-12-multilib g++-12-multilib clang-14 + + - name: Ubuntu22.04_x32 clang15 + os: ubuntu-22.04 + cc: clang-15 + cxx: clang++-15 + packages: gcc-12-multilib g++-12-multilib clang-15 + + + + - name: Ubuntu24.04_x32 gcc10 + os: ubuntu-24.04 + cc: gcc-10 + cxx: g++-10 + packages: gcc-10-multilib g++-10-multilib + + - name: Ubuntu24.04_x32 gcc11 + os: ubuntu-24.04 + cc: gcc-11 + cxx: g++-11 + packages: gcc-11-multilib g++-11-multilib + + - name: Ubuntu24.04_x32 gcc12 + os: ubuntu-24.04 + cc: gcc-12 + cxx: g++-12 + packages: gcc-12-multilib g++-12-multilib + + - name: Ubuntu24.04_x32 gcc13 + os: ubuntu-24.04 + cc: gcc-13 + cxx: g++-13 + packages: gcc-12-multilib g++-13-multilib + + - name: Ubuntu24.04_x32 clang14 + os: ubuntu-24.04 + cc: clang-14 + cxx: clang++-14 + packages: gcc-13-multilib g++-13-multilib clang-14 + + - name: Ubuntu24.04_x32 clang15 + os: ubuntu-24.04 + cc: clang-15 + cxx: clang++-15 + packages: gcc-13-multilib g++-13-multilib clang-15 + + - name: Ubuntu24.04_x32 clang16 + os: ubuntu-24.04 + cc: clang-16 + cxx: clang++-16 + packages: gcc-13-multilib g++-13-multilib clang-16 + + - name: Ubuntu24.04_x32 clang17 + os: ubuntu-24.04 + cc: clang-17 + cxx: clang++-17 + packages: gcc-13-multilib g++-13-multilib clang-17 + + - name: Ubuntu24.04_x32 clang18 + os: ubuntu-24.04 + cc: clang-18 + cxx: clang++-18 + packages: gcc-13-multilib g++-13-multilib clang-18 + + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + env: + CC: ${{ matrix.config.cc }} + CXX: ${{ matrix.config.cxx }} + CFLAGS: -m32 + CXXFLAGS: -m32 + LDFLAGS: -m32 - job_linux_22_04_64_clang: - name: ubuntu-22.04 clang - runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 + + - name: Allow for i386 packages to be installed (used for libusb) + run: sudo dpkg --add-architecture i386 + - name: Install dependencies - run: sudo apt update && sudo apt-get install clang-14 libusb-1.0.0-dev libgtk-4-dev rpm - - name: make debug - run: sudo make clean && make debug - - name: make test - run: sudo make clean && make test - - name: make release - run: sudo make clean && make release - - name: sudo make install - run: sudo make clean && sudo make install - - name: sudo make package - run: sudo make package + run: sudo apt update && sudo apt-get install libc6-dev:i386 ${{ matrix.config.packages }} libusb-1.0.0-dev:i386 rpm + + - name: environment preparation + run: mkdir -p ./build/{debug,release} + + - name: project configuration in debug + working-directory: ./build/debug + run: cmake ../.. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug + + - name: project build in debug + working-directory: ./build/debug + run: cmake --build . --target all + + - name: run tests + working-directory: ./build/debug + run: ctest --force-new-ctest-process + + - name: project configuration in release + working-directory: ./build/release + run: cmake ../.. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release + + - name: project build in release + working-directory: ./build/release + run: cmake --build . --target all + + - name: project installation + working-directory: ./build/release + run: sudo cmake --build . --target install + + - name: project packaging + working-directory: ./build/release + run: sudo cpack --config ./CPackSourceConfig.cmake ../debug/CPackSourceConfig.cmake + - name: sudo make uninstall - run: sudo make uninstall && sudo make clean + working-directory: ./build/release + run: sudo cmake --build . --target uninstall - job_linux_22_04_32_clang: - name: ubuntu-22.04 clang 32-bit - runs-on: ubuntu-22.04 + job_windows_msvc: + name: windows MSVC + runs-on: windows-latest steps: - - uses: actions/checkout@v2 - - name: Install dependencies - run: sudo apt update && sudo apt-get install clang-14 libusb-1.0.0-dev libgtk-4-dev rpm - - name: Set compiler flags - run: | - CFLAGS="$CFLAGS -m32" - CXXFLAGS="$CXXFLAGS -m32" - LDFLAGS="$LDFLAGS -m32" - - name: make debug - run: sudo make clean && make debug - - name: make test - run: sudo make clean && make test - - name: make release - run: sudo make clean && make release - - name: sudo make install - run: sudo make clean && sudo make install - - name: sudo make package - run: sudo make package + - uses: actions/checkout@v4 + + - name: environment preparation + run: mkdir .\\build\\debug && mkdir .\\build\\release + + - name: project configuration in debug + working-directory: ./build/debug + run: cmake ..\\.. -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Debug + + - name: project build in debug + working-directory: ./build/debug + run: cmake --build . --target ALL_BUILD + + - name: run tests + working-directory: ./build/debug + run: ctest --force-new-ctest-process + + - name: project configuration in release + working-directory: ./build/release + run: cmake ..\\.. -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=Release + + - name: project build in release + working-directory: ./build/release + run: cmake --build . --target ALL_BUILD + + - name: project installation + working-directory: ./build/release + run: cmake --build . --target INSTALL + - name: sudo make uninstall - run: sudo make uninstall && sudo make clean + working-directory: ./build/release + run: cmake --build . --target uninstall # Linux MinGW cross compliation # job_linux_22_04_cross: # name: ubuntu-22.04 mingw64 # runs-on: ubuntu-22.04 # steps: -# - uses: actions/checkout@v2 +# - uses: actions/checkout@v4 # - name: Install dependencies -# run: sudo apt-get install gcc-12 libusb-1.0.0-dev libgtk-4-dev rpm mingw-w64 +# run: sudo apt-get install gcc-12 libusb-1.0.0-dev libgtk-3-dev rpm mingw-w64 # - name: Building Release for Windows (x86-64) ... # run: sudo mkdir -p build-mingw && cd build-mingw && sudo cmake \ # -DCMAKE_SYSTEM_NAME=Windows \ diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f8c2b3d3..0e8b85a42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ # v1.8.1 -Release date: 2024-09-01 +Release date: 2025-03-xx This release drops support for some older operating systems. Check project README for details. @@ -13,6 +13,8 @@ Updated system requirements: - `libgtk-dev` >= 3.24.18 Features: + +- Show all info during full erase ([#1363](https://github.com/stlink-org/stlink/pull/1363), commit [#6a6718b](https://github.com/stlink-org/stlink/commit/6a6718b3342b6c5e282a4e33325b9f97908a0692)) - Added support for STLINK-V3PWR ([#1388](https://github.com/stlink-org/stlink/pull/1388), [#1389](https://github.com/stlink-org/stlink/pull/1389)) - Dynamic SRAM size for F4 memory map ([#1390](https://github.com/stlink-org/stlink/pull/1390)) - Modifications to allow building of toolset in OpenBSD ([#1392](https://github.com/stlink-org/stlink/pull/1392)) @@ -21,26 +23,36 @@ Features: - Improvements for stlink-gui ([#1411](https://github.com/stlink-org/stlink/pull/1411)) - [STM32U575/585]: Added support for OTP bytes ([#1419](https://github.com/stlink-org/stlink/pull/1419)) - [STM32Gx]: Added erase support for multi-bank products ([#1420](https://github.com/stlink-org/stlink/pull/1420)) +- libusb-cmake as libusb provider and added support for MSVC ([#1424](https://github.com/stlink-org/stlink/pull/1424), [#1440](https://github.com/stlink-org/stlink/pull/1440)) +- [STM32L4Q5CG]: Added support for device ([#1438](https://github.com/stlink-org/stlink/pull/1438), [#1439](https://github.com/stlink-org/stlink/pull/1439)) Updates & changes: + +- [stlink-lib] Clarified warning message for data alignment ([#1371](https://github.com/stlink-org/stlink/pull/1371), commit [#40ee5f4](https://github.com/stlink-org/stlink/commit/40ee5f4bd1151cec65f291f0166429b061c6e5c0)) +- Rewrite commandline usage text for st-flash tool ([#1372](https://github.com/stlink-org/stlink/pull/1372), commit [#95862cc](https://github.com/stlink-org/stlink/commit/95862cc687203ca20e328804f149959c51da2947)) - Debian 11 x64 doesn't work with v1.8.0 because of incompatible glibc ([#1376](https://github.com/stlink-org/stlink/pull/1376), commit [#ece34ef](https://github.com/stlink-org/stlink/commit/ece34efbce579ca7d367c58f903ffa6dc7bd96e6)) - [STM32L4R5ZI]: gdb-multiarch uses wrong osabi ([#1386](https://github.com/stlink-org/stlink/pull/1386), [#1387](https://github.com/stlink-org/stlink/pull/1387), [#1394](https://github.com/stlink-org/stlink/pull/1394)) - [doc] STM32H573 reports chipid 0x000 ([#1398](https://github.com/stlink-org/stlink/pull/1398), commit [#3655871](https://github.com/stlink-org/stlink/commit/3655871f8dd97294bbee191c1c7341c8a129af2f)) Fixes: +- Can't build stlink 1.8.0 for Fedora ([#1365](https://github.com/stlink-org/stlink/pull/1365), [#1444](https://github.com/stlink-org/stlink/pull/1444), commit [#6a6718b](https://github.com/stlink-org/stlink/commit/6a6718b3342b6c5e282a4e33325b9f97908a0692)) +- Fixed include path for header file poll.h ([#1370](https://github.com/stlink-org/stlink/pull/1370), commit [#710e1d3](https://github.com/stlink-org/stlink/commit/710e1d3c3b72187769fcc6a4878c73e35ce03f9b)) - Cmake minimal version mismatch ([#1374](https://github.com/stlink-org/stlink/pull/1374), [#1375](https://github.com/stlink-org/stlink/pull/1375), commit [#1ee7f6b](https://github.com/stlink-org/stlink/commit/1ee7f6b6c05e305112bb070ae571ebbe26c55946)) - Added a graceful way to terminate st-util ([#1395](https://github.com/stlink-org/stlink/pull/1395), [#1396](https://github.com/stlink-org/stlink/pull/1396)) - [st-trace] Bug in function static bool read_trace( ) ([#1400](https://github.com/stlink-org/stlink/pull/1400), commit [#32ce4bf](https://github.com/stlink-org/stlink/commit/32ce4bf88a816fb6a9841a33e6c5f6b593a9b927)) - Fixed STM32H7 FLASH_OPTCR unlock sequence ([#1401](https://github.com/stlink-org/stlink/pull/1401), [#1416](https://github.com/stlink-org/stlink/pull/1416)) - Restored support for STM32G4 Cat4 device STM32G491 ([#1403](https://github.com/stlink-org/stlink/pull/1403), [#1414](https://github.com/stlink-org/stlink/pull/1414)) +- Target reset is less reliable on testing branch ([#1409](https://github.com/stlink-org/stlink/pull/1409), commit [#733893a](https://github.com/stlink-org/stlink/commit/733893a50b1cc9323765a62c456c129ed6807886)) - Fixed STM32H7 option byte programming ([#1417](https://github.com/stlink-org/stlink/pull/1417)) - Latest release stlink-1.8.0-win32 doesn't run ([#1364](https://github.com/stlink-org/stlink/pull/1364), [#1410](https://github.com/stlink-org/stlink/pull/1410), commit [#e493109](https://github.com/stlink-org/stlink/commit/e4931097f887d8a048d1d188388b82ced918cf08)) - Make path to .chip files relative to installation directory on Windows ([#1421](https://github.com/stlink-org/stlink/pull/1421)) +- Re-add support for STM32F411xC/xE option bytes read/write ([#1422](https://github.com/stlink-org/stlink/pull/1422)) - Replaced deprecated cmd to fix package uninstall ([#1426](https://github.com/stlink-org/stlink/pull/1426)) - Fixed compilation error -Wshorten-64-to-32 in stlink-lib/usb.c ([#1427](https://github.com/stlink-org/stlink/pull/1427)) - st-util cannot parse -V and -F options and --freq option results in a segmentation fault ([#1428](https://github.com/stlink-org/stlink/pull/1428), [#1429](https://github.com/stlink-org/stlink/pull/1429)) + # v1.8.0 Release date: 2024-02-01 @@ -148,6 +160,7 @@ Fixes: - stlink-gui: failed to allocate 139988352155568 bytes ([#1356](https://github.com/stlink-org/stlink/pull/1356)) - [STM32U575RGT6]: Verification failed at offset 43008 ([#1362](https://github.com/stlink-org/stlink/pull/1362), commit [#0145bae](https://github.com/stlink-org/stlink/commit/0145baeb2e3bac31bf9d3cbd0dab38d70618d46b)) + # v1.7.0 Release date: 2021-04-25 @@ -218,6 +231,7 @@ Fixes: - Applied missing changes to tests ([#1119](https://github.com/stlink-org/stlink/pull/1119)) - Fixed reading of chip ID on Cortex-M0+ core ([#1017](https://github.com/stlink-org/stlink/pull/1017), [#1125](https://github.com/stlink-org/stlink/pull/1125), [#1126](https://github.com/stlink-org/stlink/pull/1126), [#1133](https://github.com/stlink-org/stlink/pull/1133)) + # v1.6.1 Release date: 2020-06-01 @@ -315,6 +329,7 @@ Fixes: - Fixed udev rules installing to wrong directory ([#966](https://github.com/stlink-org/stlink/pull/966)) - Fixed formatting for options display in `st-flash` & `st-info` (commits [#c783d0e](https://github.com/stlink-org/stlink/commit/c783d0e777ccc83a7a8be26a4f4d3414e0478560) and [#562cd24](https://github.com/stlink-org/stlink/commit/562cd2496e696dbd22950925866aac662d81ee5f)) + # v1.6.0 Release date: 2020-02-20 @@ -367,6 +382,7 @@ General project updates: - Added `CODE_OF_CONDUCT` (Nightwalker-87) - Archived page from github project wiki to doc/wiki_old.md (Nightwalker-87) + # v1.5.1 Release date: 2018-09-13 @@ -400,6 +416,7 @@ Updates and fixes: - Return correct value on `EOF` for semihosting `SYS_READ` ([#726](https://github.com/stlink-org/stlink/pull/726), [#727](https://github.com/stlink-org/stlink/pull/727), [#728](https://github.com/stlink-org/stlink/pull/728), [#729](https://github.com/stlink-org/stlink/pull/729), [#730](https://github.com/stlink-org/stlink/pull/730), [#731](https://github.com/stlink-org/stlink/pull/731), [#732](https://github.com/stlink-org/stlink/pull/732)) - FreeBSD defines `LIBUSB_API_VERSION` instead of `LIBUSBX_API_VERSION` ([#733](https://github.com/stlink-org/stlink/pull/733)) + # v1.5.0 Release date: 2018-02-16 @@ -422,6 +439,7 @@ Updates and fixes: - Added debian/triggers to run `ldconfig` ([#664](https://github.com/stlink-org/stlink/pull/664)) - Fixed build on Fedora with GCC 8 ([#666](https://github.com/stlink-org/stlink/pull/666), [#667](https://github.com/stlink-org/stlink/pull/667), [#668](https://github.com/stlink-org/stlink/pull/668)) + # v1.4.0 Release date: 2017-07-01 @@ -449,6 +467,7 @@ Updates and fixes: - Fixed flashing to `F0 device` targets ([#594](https://github.com/stlink-org/stlink/pull/594), [#595](https://github.com/stlink-org/stlink/pull/595)) - Fixed wrong counting when flashing ([#605](https://github.com/stlink-org/stlink/pull/605)) + # v1.3.1 Release date: 2017-02-25 @@ -468,6 +487,7 @@ Updates and fixes: - Fixed incorrect release folder name in docs ([#560](https://github.com/stlink-org/stlink/pull/560)) - Fixed compilation when path includes spaces ([#561](https://github.com/stlink-org/stlink/pull/561)) + # v1.3.0 Release date: 2017-01-28 @@ -517,6 +537,7 @@ Updates and fixes: - Wrong extract command in `FindLibUSB.cmake` ([#510](https://github.com/stlink-org/stlink/pull/510), [#511](https://github.com/stlink-org/stlink/pull/511)) - Fixed compilation error on Ubuntu 16.10 ([#514](https://github.com/stlink-org/stlink/pull/514), [#525](https://github.com/stlink-org/stlink/pull/525)) + # v1.2.0 Release date: 2016-05-16 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ae38a474..733a6dff4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,7 @@ endif() ### find_package(libusb REQUIRED) +add_definitions(${LIBUSB_DEFINITIONS}) #only affects MSVC, For ssize-t ## Check for system-specific additional header files and libraries @@ -264,6 +265,13 @@ set_target_properties(${STLINK_LIB_SHARED} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} ) +# Since we're not using __declspec(dllexport), WINDOWS_EXPORT_ALL_SYMBOLS is mandatory for MSVC. +# This call will only affect MSVC, compilers/OSes ignore it. +# TODO: Use dllexport on the desired functions +set_target_properties(${STLINK_LIB_SHARED} PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS ON +) + # Link shared library if (WIN32) target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} ${SSP_LIB} wsock32 ws2_32) @@ -271,8 +279,23 @@ else () target_link_libraries(${STLINK_LIB_SHARED} ${LIBUSB_LIBRARY} ${SSP_LIB}) endif() -install(TARGETS ${STLINK_LIB_SHARED} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - +# For MSVC: +# shared libraries (.dll) go to `bin` +# their Import Libraries (aka: ImpLibs; .lib files) go to `lib` +if (MSVC) + install(TARGETS ${STLINK_LIB_SHARED} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +# For non-MSVC: +# shared libraries go to `lib` +# Archive destination is set to `lib` as failsafe +else() + install(TARGETS ${STLINK_LIB_SHARED} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif() ### # Static library diff --git a/cmake/modules/Findlibusb.cmake b/cmake/modules/Findlibusb.cmake index 15afb000c..1bbbe68ab 100644 --- a/cmake/modules/Findlibusb.cmake +++ b/cmake/modules/Findlibusb.cmake @@ -9,6 +9,7 @@ # LIBUSB_DEFINITIONS compiler switches required for using libusb include(FindPackageHandleStandardArgs) +include(FetchContent) if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") # FreeBSD; libusb is integrated into the system # libusb header file @@ -51,6 +52,42 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "OpenBSD") # OpenBSD; libus message(FATAL_ERROR "No libusb-1.0 library found on your system! Install libusb-1.0 from ports or packages.") endif() +elseif (MSVC) # Native Windows MSVC + + set(libusb_FIND_REQUIRED OFF) # Will either find it or download it, there's no missing it. + set(LIBUSB_DEFINITIONS "-D_SSIZE_T_DEFINED" "-Dssize_t=int64_t") # fix for ill-defined ssize-t + + # libusb header file + FIND_PATH(LIBUSB_INCLUDE_DIR + NAMES libusb.h + HINTS "C:/Program Files/libusb-1.0/include" "C:/Program Files (x86)/libusb-1.0/include" + PATH_SUFFIXES "libusb-1.0" + ) + + # libusb library + set(LIBUSB_NAME usb-1.0) + find_library(LIBUSB_LIBRARY + NAMES ${LIBUSB_NAME} + HINTS "C:/Program Files/libusb-1.0" "C:/Program Files (x86)/libusb-1.0" + ) + + FIND_PACKAGE_HANDLE_STANDARD_ARGS(libusb DEFAULT_MSG LIBUSB_LIBRARY LIBUSB_INCLUDE_DIR) + mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARY) + if (NOT LIBUSB_FOUND) + message(STATUS "No libusb-1.0 not installed into your system. Downloading and building it from source") + + FetchContent_Declare( + ${LIBUSB_NAME} + GIT_REPOSITORY https://github.com/libusb/libusb-cmake + GIT_TAG v1.0.27-0 + ) + + FetchContent_MakeAvailable(${LIBUSB_NAME}) + set(LIBUSB_FOUND ON) + set(LIBUSB_INCLUDE_DIR "") + set(LIBUSB_LIBRARY ${LIBUSB_NAME}) + mark_as_advanced(LIBUSB_FOUND LIBUSB_INCLUDE_DIR LIBUSB_LIBRARY) + endif() elseif (WIN32 OR (MINGW AND EXISTS "/etc/debian_version")) # Windows OR cross-build with MinGW-toolchain on Debian # MinGW: 64-bit or 32-bit? if (CMAKE_SIZEOF_VOID_P EQUAL 8) @@ -73,53 +110,42 @@ elseif (WIN32 OR (MINGW AND EXISTS "/etc/debian_version")) # Windows OR cro else () # ... download the package message(STATUS "downloading libusb ${LIBUSB_WIN_VERSION}") file(DOWNLOAD - https://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-${LIBUSB_WIN_VERSION}/libusb-${LIBUSB_WIN_VERSION}.7z/download - ${LIBUSB_WIN_ARCHIVE_PATH} EXPECTED_MD5 c72153fc5a32f3b942427b0671897a1a - ) + https://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-${LIBUSB_WIN_VERSION}/libusb-${LIBUSB_WIN_VERSION}.7z/download + ${LIBUSB_WIN_ARCHIVE_PATH} EXPECTED_MD5 c72153fc5a32f3b942427b0671897a1a + ) endif() file(MAKE_DIRECTORY ${LIBUSB_WIN_OUTPUT_FOLDER}) # Extract libusb package with cmake execute_process( - COMMAND ${CMAKE_COMMAND} -E tar xv ${LIBUSB_WIN_ARCHIVE_PATH} - WORKING_DIRECTORY ${LIBUSB_WIN_OUTPUT_FOLDER} - ) + COMMAND ${CMAKE_COMMAND} -E tar xv ${LIBUSB_WIN_ARCHIVE_PATH} + WORKING_DIRECTORY ${LIBUSB_WIN_OUTPUT_FOLDER} + ) # libusb header file FIND_PATH(LIBUSB_INCLUDE_DIR - NAMES libusb.h - HINTS ${LIBUSB_WIN_OUTPUT_FOLDER}/include - PATH_SUFFIXES libusb-1.0 - NO_DEFAULT_PATH - NO_CMAKE_FIND_ROOT_PATH - ) - - if (MINGW OR MSYS) - # libusb library (static) - set(LIBUSB_NAME libusb-1.0) - find_library(LIBUSB_LIBRARY - NAMES ${LIBUSB_NAME} - HINTS ${LIBUSB_WIN_OUTPUT_FOLDER}/MinGW${ARCH}/static + NAMES libusb.h + HINTS ${LIBUSB_WIN_OUTPUT_FOLDER}/include + PATH_SUFFIXES libusb-1.0 NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH - ) - else (MSVC) - # libusb library - set(LIBUSB_NAME libusb-1.0) - find_library(LIBUSB_LIBRARY + ) + + + # libusb library (static) + set(LIBUSB_NAME libusb-1.0) + find_library(LIBUSB_LIBRARY NAMES ${LIBUSB_NAME} - HINTS ${LIBUSB_WIN_OUTPUT_FOLDER}/MinGW${ARCH}/dll + HINTS ${LIBUSB_WIN_OUTPUT_FOLDER}/MinGW${ARCH}/static NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH - ) - endif() + ) endif() FIND_PACKAGE_HANDLE_STANDARD_ARGS(libusb DEFAULT_MSG LIBUSB_INCLUDE_DIR LIBUSB_LIBRARY) mark_as_advanced(LIBUSB_INCLUDE_DIR LIBUSB_LIBRARY) message(STATUS "Missing libusb library has been installed") - else () # all other OS (unix-based) # libusb header file FIND_PATH(LIBUSB_INCLUDE_DIR diff --git a/config/chips/C051xx.chip b/config/chips/C051xx.chip new file mode 100644 index 000000000..ebfb215db --- /dev/null +++ b/config/chips/C051xx.chip @@ -0,0 +1,14 @@ +# Chip-ID file for STM32C051xx device +# +dev_type STM32C051xx +ref_manual_id 0490 +chip_id 0x44C // STM32_CHIPID_C051xx +flash_type C0 +flash_size_reg 0x1fff75a0 +flash_pagesize 0x800 // 2 KB +sram_size 0x3000 // 12 KB +bootrom_base 0x1fff0000 +bootrom_size 0x1800 // 6 KB +option_base 0x1fff7800 // STM32_C0_OPTION_BYTES_BASE +option_size 0x80 // 128 B +flags none diff --git a/config/chips/C071xx.chip b/config/chips/C071xx.chip new file mode 100644 index 000000000..1bef25e0e --- /dev/null +++ b/config/chips/C071xx.chip @@ -0,0 +1,14 @@ +# Chip-ID file for STM32C071xx device +# +dev_type STM32C071xx +ref_manual_id 0490 +chip_id 0x493 // STM32_CHIPID_C071xx +flash_type C0 +flash_size_reg 0x1fff75a0 +flash_pagesize 0x800 // 2 KB +sram_size 0x6000 // 24 KB +bootrom_base 0x1fff0000 +bootrom_size 0x1800 // 6 KB +option_base 0x1fff7800 // STM32_C0_OPTION_BYTES_BASE +option_size 0x80 // 128 B +flags none diff --git a/config/chips/C091xx.chip b/config/chips/C091xx.chip new file mode 100644 index 000000000..d224b066c --- /dev/null +++ b/config/chips/C091xx.chip @@ -0,0 +1,14 @@ +# Chip-ID file for STM32_C091xx_C92xx device +# +dev_type STM32_C091xx_C92xx +ref_manual_id 0490 +chip_id 0x44D // STM32_CHIPID_C091xx_C92xx +flash_type C0 +flash_size_reg 0x1fff75a0 +flash_pagesize 0x800 // 2 KB +sram_size 0x9000 // 36 KB: C92xx: 30 KB + 6KB FDCAN RAM (RM490 rev. 5 2.4 FDCAN RAM) +bootrom_base 0x1fff0000 +bootrom_size 0x1800 // 6 KB +option_base 0x1fff7800 // STM32_C0_OPTION_BYTES_BASE +option_size 0x80 // 128 B +flags none diff --git a/config/chips/F09x.chip b/config/chips/F09x.chip index eb6dec428..44e33ee89 100644 --- a/config/chips/F09x.chip +++ b/config/chips/F09x.chip @@ -12,4 +12,3 @@ bootrom_size 0x2000 // 8 KB option_base 0x1ffff800 // STM32_F0_OPTION_BYTES_BASE option_size 0x10 // 16 B flags none - diff --git a/config/chips/F1xx_CL.chip b/config/chips/F1xx_CL.chip index 45f06d386..b4c86bdbb 100644 --- a/config/chips/F1xx_CL.chip +++ b/config/chips/F1xx_CL.chip @@ -12,4 +12,3 @@ bootrom_size 0x4800 // 18 KB option_base 0x1ffff800 // STM32_F0_OPTION_BYTES_BASE option_size 0x10 // 16 B flags swo - diff --git a/config/chips/F411xC_xE.chip b/config/chips/F411xC_xE.chip index ce93aea26..7e0000e4e 100644 --- a/config/chips/F411xC_xE.chip +++ b/config/chips/F411xC_xE.chip @@ -9,6 +9,6 @@ flash_pagesize 0x4000 // 16 KB sram_size 0x20000 // 128 KB bootrom_base 0x1fff0000 bootrom_size 0x7800 // 30 KB -option_base 0x0 -option_size 0x0 +option_base 0x40023c14 +option_size 0x04 flags swo diff --git a/config/chips/L45x_L46x.chip b/config/chips/L45x_L46x.chip index c32030be9..1082df091 100644 --- a/config/chips/L45x_L46x.chip +++ b/config/chips/L45x_L46x.chip @@ -13,4 +13,4 @@ option_base 0x0 option_size 0x0 flags swo otp_base 0x1fff7000 -otp_size 0x400 // 1 KB +otp_size 0x400 // 1 KB diff --git a/config/chips/L5x5xx.chip b/config/chips/L5x2xx.chip similarity index 100% rename from config/chips/L5x5xx.chip rename to config/chips/L5x2xx.chip diff --git a/config/chips/U031xx.chip b/config/chips/U031xx.chip new file mode 100644 index 000000000..02c017927 --- /dev/null +++ b/config/chips/U031xx.chip @@ -0,0 +1,14 @@ +# Chip-ID file for STM32U031xx device +# +dev_type STM32U031xx +ref_manual_id 0503 +chip_id 0x459 // STM32_CHIPID_U031xx +flash_type C0 +flash_size_reg 0x1fff3ea0 +flash_pagesize 0x800 // 2 KB +sram_size 0x3000 // 12 KB +bootrom_base 0x1fff0000 +bootrom_size 0x1400 // 5 KB +option_base 0x1fff7000 // STM32_U0_OPTION_BYTES_BASE +option_size 0x1000 // 4 KB +flags swo diff --git a/config/chips/U073xx_083xx.chip b/config/chips/U073xx_083xx.chip new file mode 100644 index 000000000..3f3681a24 --- /dev/null +++ b/config/chips/U073xx_083xx.chip @@ -0,0 +1,14 @@ +# Chip-ID file for STM32U073xx / STM32U083xx device +# +dev_type STM32U073xx_U083xx +ref_manual_id 0503 +chip_id 0x489 // STM32_CHIPID_U073xx_U083xx +flash_type C0 +flash_size_reg 0x1fff6ea0 +flash_pagesize 0x800 // 2 KB +sram_size 0xa000 // 40 KB +bootrom_base 0x1fff0000 +bootrom_size 0x1400 // 5 KB +option_base 0x1fff7000 // STM32_U0_OPTION_BYTES_BASE +option_size 0x1000 // 4 KB +flags swo diff --git a/config/chips/U535_U545.chip b/config/chips/U535_U545.chip index adc0560dd..d99b2310d 100644 --- a/config/chips/U535_U545.chip +++ b/config/chips/U535_U545.chip @@ -2,7 +2,7 @@ # dev_type STM32U535_U545 ref_manual_id 0456 -chip_id 0x455 // STM32U535/545 +chip_id 0x455 // STM32_CHIPID_U535_545 flash_type L5_U5_H5 flash_size_reg 0x0bfa07a0 flash_pagesize 0x2000 // 8 KB diff --git a/config/chips/U575_U585.chip b/config/chips/U575_U585.chip index 0b3c4f083..97b57719c 100644 --- a/config/chips/U575_U585.chip +++ b/config/chips/U575_U585.chip @@ -2,7 +2,7 @@ # dev_type STM32U575_U585 ref_manual_id 0456 -chip_id 0x482 // STM32U575/585 +chip_id 0x482 // STM32_CHIPID_U575_U585 flash_type L5_U5_H5 flash_size_reg 0x0bfa07a0 flash_pagesize 0x2000 // 8 KB diff --git a/config/chips/U59x_U5Ax.chip b/config/chips/U59x_U5Ax.chip index 9b45a411c..811b43a02 100644 --- a/config/chips/U59x_U5Ax.chip +++ b/config/chips/U59x_U5Ax.chip @@ -2,7 +2,7 @@ # dev_type STM32U59x_U5Ax ref_manual_id 0456 -chip_id 0x481 // STM32U59x/5Ax +chip_id 0x481 // STM32_CHIPID_U59x_5Ax flash_type L5_U5_H5 flash_size_reg 0x0bfa07a0 flash_pagesize 0x2000 // 8 KB diff --git a/config/chips/U55Fx_U5Gx.chip b/config/chips/U5Fx_U5Gx.chip similarity index 85% rename from config/chips/U55Fx_U5Gx.chip rename to config/chips/U5Fx_U5Gx.chip index b9c79b235..f574c7cbb 100644 --- a/config/chips/U55Fx_U5Gx.chip +++ b/config/chips/U5Fx_U5Gx.chip @@ -2,7 +2,7 @@ # dev_type STM32U5Fx_U5Gx ref_manual_id 0456 -chip_id 0x476 // STM32U5Fx5/5Gx +chip_id 0x476 // STM32_CHIPID_U5Fx5_5Gx flash_type L5_U5_H5 flash_size_reg 0x0bfa07a0 flash_pagesize 0x2000 // 8 KB diff --git a/contributors.txt b/contributors.txt index dacb4e4af..b2dfce0bc 100644 --- a/contributors.txt +++ b/contributors.txt @@ -4,6 +4,7 @@ Alexey Cherevatenko Alexey Panarin Anatoli Klassen [dev26th] Andrea Mucignat +Andreas Michelis [a-michelis] Andrew Andrianov [nekromant] Andrey Yurovsky Andy Isaacson diff --git a/debian/changelog b/debian/changelog index ce77e233a..cba1449e0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +stlink (1.8.0-1~bpo12+1) bookworm-backports; urgency=medium + + * Rebuild for bookworm-backports. + + -- Luca Boccassi Mon, 27 May 2024 23:04:19 +0100 + stlink (1.8.0-1) unstable; urgency=medium * Switch to gbp workflow, binary OSX blobs no longer included upstream @@ -8,6 +14,19 @@ stlink (1.8.0-1) unstable; urgency=medium -- Luca Boccassi Thu, 08 Feb 2024 19:28:19 +0000 +stlink (1.7.0+ds-2) unstable; urgency=medium + + [ Debian Janitor ] + * Remove constraints unnecessary since buster + * Set upstream metadata fields: Bug-Database, Bug-Submit, Repository- + Browse. + * Update standards version to 4.6.2, no changes needed. + + [ Chris Hofstaedtler ] + * use udev.pc to place udev rules (Closes: #1058829) + + -- Luca Boccassi Mon, 18 Dec 2023 15:01:19 +0100 + stlink (1.7.0+ds-1) unstable; urgency=medium * Merge tag 'v1.7.0' into debian. (Closes: #984356) diff --git a/debian/control b/debian/control index e2900cf62..ea2e3cc42 100644 --- a/debian/control +++ b/debian/control @@ -32,8 +32,7 @@ Architecture: linux-any Depends: libstlink1 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends} Description: Open source version of the STMicroelectronics STLINK Tools . - This package contains commandline utilities for stlink, and modprobe - and udev rules. + This package contains commandline utilities for stlink, modprobe and udev rules. Package: stlink-gui Architecture: linux-any diff --git a/debian/copyright b/debian/copyright index 17ec74960..a138e3881 100644 --- a/debian/copyright +++ b/debian/copyright @@ -4,35 +4,34 @@ Upstream-Contact: Nightwalker-87 <15526941+Nightwalker-87@users.noreply.github.c Source: https://github.com/stlink-org/stlink Files: * -Copyright: 2011-2021 The stlink project maintainers +Copyright: 2011-2024 The stlink project maintainers Martin Capitanio Fabien Lementec Jerry Jacobs Nightwalker-87 <15526941+Nightwalker-87@users.noreply.github.com> - and many other contributors... + and many other contributors... License: BSD-3-clause - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - . - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of Intel Corporation nor the names of its - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - . - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/debian/stlink-lib.symbols b/debian/libstlink1.symbols similarity index 100% rename from debian/stlink-lib.symbols rename to debian/libstlink1.symbols diff --git a/debian/rules b/debian/rules index 04a6aeb7b..7ca87b813 100755 --- a/debian/rules +++ b/debian/rules @@ -17,8 +17,8 @@ export deb_udevdir = $(shell pkg-config --variable=udevdir udev | sed s,^/,,) override_dh_auto_configure: dh_auto_configure -- \ - -DSTLINK_UDEV_RULES_DIR='/lib/udev/rules.d' - -DSTLINK_UDEV_RULES_DIR=/$(deb_udevdir)/rules.d + -DSTLINK_UDEV_RULES_DIR='/lib/udev/rules.d' + -DSTLINK_UDEV_RULES_DIR=/$(deb_udevdir)/rules.d override_dh_auto_install: dh_auto_install diff --git a/doc/compiling.md b/doc/compiling.md index 5cd709b21..7c1037c5f 100644 --- a/doc/compiling.md +++ b/doc/compiling.md @@ -1,7 +1,7 @@ # Compiling from sources -## Microsoft Windows (10, 11) +## Microsoft Windows - MINGW (10, 11) ### Common Requirements @@ -9,36 +9,78 @@ On Windows users should ensure that the following software is installed: - `git` (_optional, but recommended_) - `7zip` -- `cmake` - `MSYS2` ### Installation -1. Install `git` from -2. Install `cmake` from --> Binary distributions --> Windows x64 Installer
- Ensure that you add cmake to the $PATH system variable when following the instructions by the setup assistant. -3. Install `MSYS2` from
+1. Install `MSYS2` from
Follow the installation instructions on the website. -4. Install `mingw-w64` via the MSYS2 UCRT64 Shell: `pacman -S mingw-w64-x86_64-make` -5. Fetch the project sourcefiles by running `git clone https://github.com/stlink-org/stlink.git`from the command-line (cmd.exe)
+2. Install `mingw-w64` via the MSYS2 UCRT64 Shell: `pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-make mingw-w64-x86_64-gcc git` +3. Fetch the project sourcefiles by running `git clone https://github.com/stlink-org/stlink.git`from the command-line (cmd.exe)
or download and extract (`7zip`) the stlink zip-sourcefolder from the Release page on GitHub. ### Building 1. Open the command-line (cmd.exe) with administrator privileges -2. Move to the `stlink` directory with `cd C:\$Path-to-your-stlink-folder$\` -3. Execute `mingw64-build.bat` +2. Move to the `stlink` directory and execute `C:\$Path-to-your-stlink-folder$\mingw64-build.bat` Depending on the flavour of compilation the final executables will be placed in the following directories: - Local compilation: `\build-mingw\bin` - Local installation: `C:\Program Files (x86)\stlink\bin` - Package Generation (portable): `C:\Users\swift\Desktop\stlink\build-mingw\dist` +#### Removal: + +Remove `C:\Program Files (x86)\stlink\` and `C:\$Path-to-your-stlink-folder$`. + + **NOTE:** [ST-LINK drivers](https://www.st.com/en/development-tools/stsw-link009.html) are required for programmers to work with `stlink`. +## Microsoft Windows - MSVC (10, 11) + +### Common Requirements + +On Windows users should ensure that the following software is installed: + +- `git` (Required for building LibUSB if missing) +- `7zip` +- `cmake` +- `MSVC` Compiler (Tested with Visual Studio 2022 and Build Tools for Visual Studio 2022) + +### Installation + +1. Install `Build Tools for Visual Studio` from +2. Install `cmake` from --> Binary distributions --> Windows x64 Installer
+ Ensure that you add cmake to the $PATH system variable when following the instructions by the setup assistant. + Follow the installation instructions on the website. +3. Fetch the project source files by running `git clone https://github.com/stlink-org/stlink.git` from the command-line (`cmd.exe`/`powershell.exe`)
+ or download and extract (`7zip`) the latest stlink `.zip` release from the Release page on GitHub. + +### Building + +1. Open the command-line (`cmd.exe`/`powershell.exe`) with administrator privileges +2. Move to the `stlink` directory with `cd C:\$Path-to-your-stlink-folder$\` +3. Create a new `build` subdirectory and move into it with `cd .\build`. +4. Configure the project, using the following command: `cmake -G "Visual Studio 17 2022" .. -DCMAKE_BUILD_TYPE="Release"` +5. Build the project, using the following command: `cmake --build . --target ALL_BUILD` +6. Install the project, using the following command: `cmake --build . --target INSTALL` +7. Add the `bin` folder of the installation path (`C:\Program Files (x86)\stlink\bin`) to the `PATH` environment variables: + 1. Run `SystemPropertiesAdvanced.exe` + 2. press on `Environment Variables` button + 3. On `System Variables` list, find and select `Path` variable + 4. Press `Edit..` button bellow the list + 5. On the new Window, press `New` button + 6. On the new row, type the `bin` path of your installation (`C:\Program Files (x86)\stlink\bin`) + 7. Press `OK` button to all three windows to save your changes + +**NOTE:** + +1. [ST-LINK drivers](https://www.st.com/en/development-tools/stsw-link009.html) are required for programmers to work with `stlink`. +2. Package generation for MSVC is not yet implemented/tested. + ## Linux ### Common requirements diff --git a/doc/supported_devices.md b/doc/supported_devices.md index f2895edba..038386f55 100644 --- a/doc/supported_devices.md +++ b/doc/supported_devices.md @@ -9,6 +9,7 @@ More commonly these are: | STM32C0 | M0+ | | | STM32G0 | M0+ | | | STM32L0 | M0+ | | +| STM32U0 | M0+ | *preliminary, limited and partial support only!* | | STM32F10**0** | M3 | Value line | | STM32F10**1** | M3 | Access line | | STM32F10**2** | M3 | USB Access line | diff --git a/doc/tutorial.md b/doc/tutorial.md index db89bf034..2a858ac39 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -6,7 +6,7 @@ | --------------------- | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------- | | --flash=n[k, M] | st-flash | One can specify `--flash=128k` for example, to override the default value of 64k for the STM32F103C8T6 to assume 128k of flash being present. This option accepts decimal (128k), octal 0200k, or hex 0x80k values.
Leaving the multiplier out is equally valid, e.g.: `--flash=0x20000`. The size may be followed by an optional "k" or "M" to multiply the given value by 1k (1024) or 1M (1024 x 1024) respectively.
One can read arbitary addresses of memory out to a binary file with: `st-flash read out.bin 0x8000000 4096`. In this example `4096 bytes` are read and subsequently written to `out.bin`.
Binary files (here: `in.bin`) are written into flash memory with: `st-flash write in.bin 0x8000000` | v1.4.0 | | --format | st-flash | Specify file image format to read or write.
Valid formats are `binary` and `ihex`. | v1.3.0 | -| --freq=n[k, M] | st-info
st-flash
st-util | The frequency of the SWD/JTAG interface can be specified, to override the default 1800 kHz configuration.
This option solely accepts decimal values with the unit `Hz` being left out. Valid frequencies are:
`5k, 15k, 25k, 50k, 100k, 125k, 240k, 480k, 950k, 1200k (1.2M), 1800k (1.8M), 4000k (4M)`. | v1.6.1 | +| --freq=n[k, M] | st-info
st-flash
st-util | The frequency of the SWD/JTAG interface can be specified, to override the default 1800 kHz configuration.
This option solely accepts decimal values representing kHz. The prefix "k" may be added for better understanding, but has no effect. In addition, values can be interpreted as thousands of kHz thus representing MHz. This is achieved by using the prefix "M".
Valid frequencies are: `5k, 15k, 25k, 50k, 100k, 125k, 240k, 480k, 950k, 1200k (1.2M), 1800k (1.8M), 4000k (4M)`. | v1.6.1 | | --opt | st-flash | Optimisation can be enabled in order to skip flashing empty (0x00 or 0xff) bytes at the end of binary file.
This may cause some garbage data left after a flash operation. This option was enabled by default in earlier releases. | v1.6.1 | | --reset | st-flash | Trigger a reset after flashing. The default uses the hardware reset through `NRST` pin.
A software reset (via `AIRCR`; since v1.5.1) is used, if the hardware reset failed (`NRST` pin not connected). | v1.0.0 | | --connect-under-reset | st-info
st-flash
st-util | Connect under reset. Option makes it possible to connect to the device before code execution. This is useful when the target contains code that lets the device go to sleep, disables debug pins or other special code. | v1.6.1 | diff --git a/doc/version_support.md b/doc/version_support.md index f1ac1d3c6..9e611419c 100644 --- a/doc/version_support.md +++ b/doc/version_support.md @@ -65,22 +65,8 @@ Systems with highlighted versions remain compatible with this toolset. | 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 | -| ALT Linux P9 | 1.0.22 | 3.**16.3** | | -| 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 | +| ALT Linux P9 | 1.0.22 | 3.**16.3** | | Ubuntu 19.10 (Eoan) | 1.0.**23** | 3.13.4 | Jul 2020 | -| Alpine 3.9 | 1.0.22 | 3.13.0 | Jan 2021 | -| Debian 10 (Buster) | 1.0.22 | 3.13.4 | Jun 2024 | -| Ubuntu 18.04 LTS (Bionic) | 1.0.21 | 3.10.2 | Apr 2023 | -| 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 | Jan 2024 | -| OpenMandriva Lx 3.0x | 1.0.20 | 3.4.2 | Jul 2019 | -| CentOS / Rocky Linux / AlmaLinux 7 [x64] | 1.0.21 (`libusbx`) | 2.8.12.2 | Jun 2024 | _All other operating systems which are not listed are unsupported._ diff --git a/inc/stm32.h b/inc/stm32.h index 3b7079712..a7f33cd4e 100644 --- a/inc/stm32.h +++ b/inc/stm32.h @@ -103,21 +103,24 @@ enum stm32_chipids { STM32_CHIPID_F0 = 0x440, STM32_CHIPID_F412 = 0x441, STM32_CHIPID_F09x = 0x442, - STM32_CHIPID_C011xx = 0x443, /* RM0490 (revision 3), section 26.10.1 "DBG device ID code register (DBG_IDCODE)" */ + STM32_CHIPID_C011xx = 0x443, /* RM0490 (revision 5), section 30.10.1 "DBG device ID code register (DBG_IDCODE)" */ STM32_CHIPID_F0xx_SMALL = 0x444, STM32_CHIPID_F04 = 0x445, STM32_CHIPID_F303_HD = 0x446, /* high density */ STM32_CHIPID_L0_CAT5 = 0x447, STM32_CHIPID_F0_CAN = 0x448, STM32_CHIPID_F7 = 0x449, /* Nucleo F746ZG board */ + STM32_CHIPID_C051xx = 0x44C, /* RM0490 (revision 5), section 30.10.1 "DBG device ID code register (DBG_IDCODE)" */ + STM32_CHIPID_C091xx_C92xx = 0x44D, /* RM0490 (revision 5), section 30.10.1 "DBG device ID code register (DBG_IDCODE)" */ STM32_CHIPID_H74xxx = 0x450, /* RM0433, p.3189 */ STM32_CHIPID_F76xxx = 0x451, STM32_CHIPID_F72xxx = 0x452, /* Nucleo F722ZE board */ - STM32_CHIPID_C031xx = 0x453, /* RM0490 (revision 3), section 26.10.1 "DBG device ID code register (DBG_IDCODE)" */ + STM32_CHIPID_C031xx = 0x453, /* RM0490 (revision 5), section 30.10.1 "DBG device ID code register (DBG_IDCODE)" */ STM32_CHIPID_U535_U545 = 0x455, /* RM0456, p.3604 */ STM32_CHIPID_G0_CAT4 = 0x456, /* G051/G061 */ STM32_CHIPID_L0_CAT1 = 0x457, STM32_CHIPID_F410 = 0x458, + STM32_CHIPID_U031xx = 0x459, STM32_CHIPID_G0_CAT2 = 0x460, /* G07x/G08x */ STM32_CHIPID_L496x_L4A6x = 0x461, STM32_CHIPID_L45x_L46x = 0x462, @@ -137,6 +140,8 @@ enum stm32_chipids { STM32_CHIPID_U575_U585 = 0x482, /* RM0456, p.3604 */ STM32_CHIPID_H72x = 0x483, /* RM0468, p.3199 */ STM32_CHIPID_H5xx = 0x484, /* RM0481, p.3085 */ + STM32_CHIPID_U073xx_U083xx = 0x489, + STM32_CHIPID_C071xx = 0x493, /* RM0490 (revision 5), section 30.10.1 "DBG device ID code register (DBG_IDCODE)" */ STM32_CHIPID_WB55 = 0x495, STM32_CHIPID_WLE = 0x497, }; @@ -197,8 +202,8 @@ enum stm32_chipids { #define STM32WB_DBGMCU_APB1FZR1_WWDG_STOP 11 #define STM32WB_DBGMCU_APB1FZR1_IWDG_STOP 12 -#define STM32C0_RCC_AHBENR 0x40021038 // RM0490 (revision 3), section 5.4.25 "RCC register map" -#define STM32C0_RCC_DMAEN 0x00000001 // DMAEN // RM0490 (revision 3), section 5.4.25 "RCC register map" +#define STM32C0_RCC_AHBENR 0x40021038 // RM0490 (revision 5), section 6.4.24 "RCC register map" +#define STM32C0_RCC_DMAEN 0x00000001 // DMAEN // RM0490 (revision 5), section 6.4.24 "RCC register map" #define STM32F1_RCC_AHBENR 0x40021014 #define STM32F1_RCC_DMAEN 0x00000003 // DMA2EN | DMA1EN diff --git a/src/st-flash/flash.c b/src/st-flash/flash.c index 521cd2b4b..7b8ba34b8 100644 --- a/src/st-flash/flash.c +++ b/src/st-flash/flash.c @@ -259,6 +259,8 @@ int32_t main(int32_t ac, char** av) { if (stlink_reset(sl, RESET_AUTO)) { printf("Failed to reset device\n"); goto on_error; + } else { + stlink_run(sl, RUN_NORMAL); } } else { diff --git a/src/stlink-lib/helper.c b/src/stlink-lib/helper.c index 8fff8bc15..e0a9dd316 100644 --- a/src/stlink-lib/helper.c +++ b/src/stlink-lib/helper.c @@ -23,18 +23,29 @@ uint32_t time_ms() { } int32_t arg_parse_freq(const char *str) { - int32_t value = -1; - if (str != NULL) { - char* tail = NULL; - value = strtol(str, &tail, 10); - if (tail != NULL) { - if (tail[0] == 'M' && tail[1] == '\0') { - value = value*1000; - } - else if (tail[0] != '\0' && !(tail[0] == 'k' && tail[1] == '\0')) { - value = -1; // error - } - } + if (str == NULL) { + return -1; // faulty input } - return value; // frequency in kHz + + char* tail = NULL; + int32_t value = (uint32_t) strtol(str, &tail, 10); + + /* == Input value interpretation == + * + * These decimal values represent kHz. + * The prefix "k" may be added for better understanding, but has no effect. + * In addition, values can be interpreted as thousands of kHz thus representing MHz. + * This is achieved by using the prefix "M". + */ + + if (tail == NULL) { + return -1; // faulty integer conversion + } else if (tail[0] == '\0') { + return value; // no prefix: kHz + } else if ((tail[0] == 'k' || tail[0] == 'K') && tail[1] == '\0') { + return value; // k prefix: kHz + } else if (tail[0] == 'M' && tail[1] == '\0') { + return (value * 1000); // M prefix: MHz + } + return -1; // invalid prefix } diff --git a/src/stlink-lib/option_bytes.c b/src/stlink-lib/option_bytes.c index 8bf749ffe..228f388d9 100644 --- a/src/stlink-lib/option_bytes.c +++ b/src/stlink-lib/option_bytes.c @@ -1085,6 +1085,9 @@ int32_t stlink_read_option_bytes32(stlink_t *sl, uint32_t *option_byte) { switch (sl->chip_id) { case STM32_CHIPID_C011xx: case STM32_CHIPID_C031xx: + case STM32_CHIPID_C051xx: + case STM32_CHIPID_C071xx: + case STM32_CHIPID_C091xx_C92xx: return stlink_read_option_bytes_c0(sl, option_byte); case STM32_CHIPID_F2: return stlink_read_option_bytes_f2(sl, option_byte);