Skip to content

Commit

Permalink
Bugfixes
Browse files Browse the repository at this point in the history
- Corrected paths for chip-id files (Closes #1180)
- Fixed 32-bit build (Closes #985) (Closes #1175)
- Patch for GitHub Actions Workflow (Ubuntu)
  • Loading branch information
Nightwalker-87 committed Aug 29, 2021
1 parent db8f789 commit c8fc656
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 107 deletions.
106 changes: 8 additions & 98 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: sudo apt-get install gcc-6 libusb-1.0.0-dev libgtk-3-dev rpm
run: sudo apt update && sudo apt-get install gcc-6 libusb-1.0.0-dev libgtk-3-dev rpm
- name: make debug
run: sudo make clean && make debug
- name: make test
Expand All @@ -35,7 +35,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: sudo apt-get install gcc-6 libusb-1.0.0-dev libgtk-3-dev rpm
run: sudo apt update && sudo apt-get install gcc-6 libusb-1.0.0-dev libgtk-3-dev rpm
- name: Set compiler flags
run: |
CFLAGS="$CFLAGS -m32"
Expand All @@ -60,7 +60,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
run: sudo apt update && sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
- name: make debug
run: sudo make clean && make debug
- name: make test
Expand All @@ -80,7 +80,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
run: sudo apt update && sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
- name: Set compiler flags
run: |
CFLAGS="$CFLAGS -m32"
Expand All @@ -105,7 +105,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install gcc-10 libusb-1.0.0-dev libgtk-3-dev rpm
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
Expand All @@ -125,7 +125,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install gcc-10 libusb-1.0.0-dev libgtk-3-dev rpm
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"
Expand All @@ -150,7 +150,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
run: sudo apt update && sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
- name: make debug
run: sudo make clean && make debug
- name: make test
Expand All @@ -170,7 +170,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
run: sudo apt update && sudo apt-get install clang-10 libusb-1.0.0-dev libgtk-3-dev rpm
- name: Set compiler flags
run: |
CFLAGS="$CFLAGS -m32"
Expand All @@ -191,96 +191,6 @@ jobs:

# macOS

# job_macos_10_14_64_gcc:
# name: macos-10.14 gcc
# runs-on: macos-10.14
# steps:
# - uses: actions/checkout@v2
# - name: Install dependencies
# run: brew install gcc libusb gtk+3
# - 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_macos_10_14_32_gcc:
# name: macos-10.14 gcc 32-bit
# runs-on: macos-10.14
# steps:
# - uses: actions/checkout@v2
# - name: Install dependencies
# run: brew install gcc libusb gtk+3
# - 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

# job_macos_10_14_64_clang:
# name: macos-10.14 clang
# runs-on: macos-10.14
# steps:
# - uses: actions/checkout@v2
# - name: Install dependencies
# run: brew install llvm libusb gtk+3
# - 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_macos_10_14_32_clang:
# name: macos-10.14 clang 32-bit
# runs-on: macos-10.14
# steps:
# - uses: actions/checkout@v2
# - name: Install dependencies
# run: brew install llvm libusb gtk+3
# - 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

job_macos_10_15_gcc:
name: macos-10.15 gcc
runs-on: macos-10.15
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:

steps:
- name: Install dependencies
run: sudo apt-get install gcc-10 libusb-1.0.0-dev libgtk-3-dev rpm
run: sudo apt update && sudo apt-get install gcc-10 libusb-1.0.0-dev libgtk-3-dev rpm
- name: Checkout repository
uses: actions/checkout@v2

Expand Down
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

set(CMAKE_STLINK_ETC_DIR etc)
set(CMAKE_ETC_CHIPS_DIR ${CMAKE_STLINK_ETC_DIR}/stlink/chips)
set(CMAKE_ETC_CHIPS_DIR_ABS ${CMAKE_INSTALL_PREFIX}/${CMAKE_ETC_CHIPS_DIR})
add_definitions( -DETC_STLINK_DIR="${CMAKE_ETC_CHIPS_DIR_ABS}" )


###
# General project settings
Expand All @@ -23,6 +18,11 @@ project(stlink C)
set(PROJECT_DESCRIPTION "Open source version of the STMicroelectronics ST-LINK Tools")
include(GNUInstallDirs) # Define GNU standard installation directories

## MCU configuration files
set(CMAKE_CHIPS_SUBDIR stlink/chips)
set(CMAKE_CHIPS_DIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_CHIPS_SUBDIR})
add_definitions( -DETC_STLINK_DIR="${CMAKE_CHIPS_DIR}" )

## Determine project version
include(${CMAKE_MODULE_PATH}/get_version.cmake)

Expand Down Expand Up @@ -287,8 +287,9 @@ install(TARGETS st-info DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS st-util DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS st-trace DESTINATION ${CMAKE_INSTALL_BINDIR})

# Install MCU configuration files
file(GLOB CHIP_FILES ${CMAKE_SOURCE_DIR}/config/chips/*.chip)
install(FILES ${CHIP_FILES} DESTINATION ${CMAKE_ETC_CHIPS_DIR})
install(FILES ${CHIP_FILES} DESTINATION ${CMAKE_CHIPS_DIR})


###
Expand Down
4 changes: 2 additions & 2 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2199,7 +2199,7 @@ static int map_file(mapped_file_t *mf, const char *path) {

if (sizeof(st.st_size) != sizeof(size_t)) {
// on 32 bit systems, check if there is an overflow
if (st.st_size > (off_t)INT32_MAX) {
if (st.st_size > (off_t)SSIZE_MAX) {
fprintf(stderr, "mmap() size_t overflow for file %s\n", path);
goto on_error;
}
Expand All @@ -2213,7 +2213,7 @@ static int map_file(mapped_file_t *mf, const char *path) {
goto on_error;
}

mf->len = st.st_size;
mf->len = (size_t)st.st_size;
error = 0; // success

on_error:
Expand Down

0 comments on commit c8fc656

Please sign in to comment.