Skip to content

Commit

Permalink
Merge pull request #329 from r2axz/master
Browse files Browse the repository at this point in the history
Fix incorrect TARGET_TRIPLET variable handling
  • Loading branch information
Hish15 authored Oct 8, 2023
2 parents 845373b + ff41f63 commit 9b5d77c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ These configuration variables are optional:
* `STM32_TOOLCHAIN_PATH` - where toolchain is located, **default**: `/usr`. Alternatively
you can add the folder containing the toolchain binaries to the system path. If both are given,
the `STM32_TOOLCHAIN_PATH` setting takes precedence
* `TARGET_TRIPLET` - toolchain target triplet, **default**: `arm-none-eabi`
* `STM32_TARGET_TRIPLET` - toolchain target triplet, **default**: `arm-none-eabi`
* `FREERTOS_PATH` - Path to the FreeRTOS kernel when compiling with a RTOS. Does not need to be
specified when using CMSIS

Expand All @@ -74,7 +74,7 @@ If you have access to a Unix shell, which is the default terminal on Linux, or t

```sh
export STM32_TOOLCHAIN_PATH="<ToolchainPath>"
export TARGET_TRIPLET=arm-none-eabi
export STM32_TARGET_TRIPLET=arm-none-eabi
export STM32_CUBE_<FAMILY>_PATH="<PathToCubeRoot>"
```

Expand All @@ -86,7 +86,7 @@ On Windows, you can use a Powershell script `path_helper.ps1`to set up the envir

```sh
$env:STM32_TOOLCHAIN_PATH = "<ToolchainPath>"
$env:TARGET_TRIPLET = arm-none-eabi
$env:STM32_TARGET_TRIPLET = arm-none-eabi
$env:STM32_CUBE_<FAMILY>_PATH="<PathToCubeRoot>"
```

Expand Down
10 changes: 8 additions & 2 deletions cmake/stm32/common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ if(NOT STM32_TOOLCHAIN_PATH)
endif()

if(NOT STM32_TARGET_TRIPLET)
set(STM32_TARGET_TRIPLET "arm-none-eabi")
message(STATUS "No STM32_TARGET_TRIPLET specified, using default: " ${STM32_TARGET_TRIPLET})
if(DEFINED ENV{STM32_TARGET_TRIPLET})
message(STATUS "Detected target triplet STM32_TARGET_TRIPLET in environmental variables: ")
message(STATUS "$ENV{STM32_TARGET_TRIPLET}")
set(STM32_TARGET_TRIPLET $ENV{STM32_TARGET_TRIPLET})
else()
set(STM32_TARGET_TRIPLET "arm-none-eabi")
message(STATUS "No STM32_TARGET_TRIPLET specified, using default: " ${STM32_TARGET_TRIPLET})
endif()
endif()

set(CMAKE_SYSTEM_NAME Generic)
Expand Down

0 comments on commit 9b5d77c

Please sign in to comment.