8000 GitHub - NoMore201/aurix-cmake-cpp: C++20 code sample for Aurix Tricore TC-33x family CPUs based on Blinky_LED_1_KIT_TC334_LK sample
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

NoMore201/aurix-cmake-cpp

Repository files navigation

Aurix C++ code sample

This is a code sample based on Blinky_LED_1_KIT_TC334_LK taken from Infineon/AURIX_code_examples rewritten using C++ 20 standard and open source EEESlab/tricore-gcc-toolchain-11.3.0.

It uses CMake as build system and provides configuration for Clangd, clang-tidy and clang-format tools.

Prerequisites

This project provides configuration for building code with open source tricore compiler, available at EEESlab/tricore-gcc-toolchain-11.3.0 (prebuilt binaries are available here). For any other compiler, manual configuration to match needed settings may be required.

Before building, compiler executables must be available from PATH.

Building

Using default CMake presets

This repository ships some CMake presets to ease building on different machines and to allow easy IDE integration.

To build from the command line, run following command from root folder of this repo:

$ cmake --preset debug
$ cmake --build out/debug

To get a list of existing Configure presets:

$ cmake --list-presets

Customize presets using local config

It's possible to customize cmake presets by defining a CMakeUserPresets.json file with new presets, inheriting from the default one.

As an example, the following user config file creates a new devel preset which enable cppcheck analysis and uses GNU Make as generator:

{
    "version": 2,
    "cmakeMinimumRequired": {
        "major": 3,
        "minor": 14,
        "patch": 0
    },
    "configurePresets": [
        {
            "name": "devel",
            "displayName": "Custom Devel",
            "generator": "Unix Makefiles",
            "binaryDir": "${sourceDir}/out/${presetName}",
            "inherits": [
                "default-build",
                "cppcheck"
            ],
            "cacheVariables": {
                "CMAKE_BUILD_TYPE": "Debug"
            }
        }
    ]
}

Then configure with the new preset:

$ cmake --preset devel
$ cmake --build out/devel

Manual CMake build

Project can be built manually with cmake if preset feature cannot be used.

The following command should build software in debug mode with the open source compiler:

$ cmake -DCMAKE_BUILD_TYPE=Debug \
    -DCMAKE_TOOLCHAIN_FILE=cmake/tricore_opensource_toolchain.cmake \
    -B out/localbuild \
    .

-- The C compiler identification is GNU 11.3.1
-- The CXX compiler identification is GNU 11.3.1
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/user/Workspace/tricore-gcc-toolchain-11.3.0/INSTALL/bin/tricore-elf-gcc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/user/Workspace/tricore-gcc-toolchain-11.3.0/INSTALL/bin/tricore-elf-g++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done (3.7s)
-- Generating done (0.0s)
-- Build files have been written to: /home/user/Workspace/aurix-cmake-code-sample/out/localbuild

About

C++20 code sample for Aurix Tricore TC-33x family CPUs based on Blinky_LED_1_KIT_TC334_LK sample

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0