Add the AvrGcc toolchain to lock gcc version

Substitute documentation to reference AvrGcc by default, which locks gcc
to the dependency folder.

AnyAvrGcc is inteded to use any system/external gcc version (as the name
implies).
pull/194/head
Yuri D'Elia 2022-07-26 18:36:37 +02:00 committed by DRracer
parent 2117ee12de
commit 05aba7141b
5 changed files with 14 additions and 7 deletions

View File

@ -1,7 +1,7 @@
[ [
{ {
"name": "Local_gcc-avr-none-eabi", "name": "Local_gcc-avr-none-eabi",
"toolchainFile": "${workspaceFolder}/cmake/AnyAvrGcc.cmake", "toolchainFile": "${workspaceFolder}/cmake/AvrGcc.cmake",
"cmakeSettings": { "cmakeSettings": {
"CMAKE_MAKE_PROGRAM": "${workspaceFolder}/.dependencies/ninja-1.10.2/ninja" "CMAKE_MAKE_PROGRAM": "${workspaceFolder}/.dependencies/ninja-1.10.2/ninja"
} }

View File

@ -1,9 +1,7 @@
# Prusa-Firmware-MMU-Private # Prusa-Firmware-MMU-Private
## How to prepare build env and tools ## How to prepare build env and tools
Run `./utils/bootstrap.py`
run `./utils/bootstrap.py`
`bootstrap.py` will now download all the "missing" dependencies into the `.dependencies` folder: `bootstrap.py` will now download all the "missing" dependencies into the `.dependencies` folder:
- clang-format-9.0.0-noext - clang-format-9.0.0-noext
@ -14,7 +12,7 @@ run `./utils/bootstrap.py`
## How to build the preliminary project so far: ## How to build the preliminary project so far:
Now the process is the same as in the Buddy Firmware: Now the process is the same as in the Buddy Firmware:
``` ```
utils/build.py ./utils/build.py
``` ```
builds the firmware.hex in build/mmu_release builds the firmware.hex in build/mmu_release
@ -23,7 +21,7 @@ In case you'd like to build the project directly via cmake you can use an approa
``` ```
mkdir build mkdir build
cd build cd build
cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=../cmake/AnyAvrGcc.cmake cmake .. -G Ninja -DCMAKE_TOOLCHAIN_FILE=../cmake/AvrGcc.cmake
ninja ninja
``` ```

View File

@ -25,6 +25,7 @@ set(TOOLCHAIN_PREFIX avr-)
if(AVR_TOOLCHAIN_DIR) if(AVR_TOOLCHAIN_DIR)
# using toolchain set by AvrGcc.cmake (locked version) # using toolchain set by AvrGcc.cmake (locked version)
message("ToolChain dir is ${AVR_TOOLCHAIN_DIR}")
set(BINUTILS_PATH "${AVR_TOOLCHAIN_DIR}/bin") set(BINUTILS_PATH "${AVR_TOOLCHAIN_DIR}/bin")
else() else()
# search for ANY avr-gcc toolchain # search for ANY avr-gcc toolchain

6
cmake/AvrGcc.cmake Normal file
View File

@ -0,0 +1,6 @@
get_filename_component(PROJECT_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" DIRECTORY)
set(AVR_GCC_VERSION 7.3.0)
set(AVR_TOOLCHAIN_DIR "${PROJECT_CMAKE_DIR}/../.dependencies/gcc-avr-${AVR_GCC_VERSION}/")
include("${PROJECT_CMAKE_DIR}/AnyAvrGcc.cmake")

View File

@ -69,6 +69,7 @@ class BuildType(Enum):
class BuildConfiguration(ABC): class BuildConfiguration(ABC):
@abstractmethod @abstractmethod
def get_cmake_cache_entries(self): def get_cmake_cache_entries(self):
"""Convert the build configuration to CMake cache entries.""" """Convert the build configuration to CMake cache entries."""
@ -86,6 +87,7 @@ class BuildConfiguration(ABC):
class FirmwareBuildConfiguration(BuildConfiguration): class FirmwareBuildConfiguration(BuildConfiguration):
def __init__(self, def __init__(self,
build_type: BuildType, build_type: BuildType,
toolchain: Path = None, toolchain: Path = None,
@ -103,7 +105,7 @@ class FirmwareBuildConfiguration(BuildConfiguration):
@staticmethod @staticmethod
def default_toolchain() -> Path: def default_toolchain() -> Path:
return Path(__file__).resolve().parent.parent / 'cmake/AnyAvrGcc.cmake' return Path(__file__).resolve().parent.parent / 'cmake/AvrGcc.cmake'
def get_cmake_cache_entries(self): def get_cmake_cache_entries(self):
entries = [] entries = []