Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs for tricore #3819

Merged
merged 6 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions examples/cross_build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Cross-building examples
cross_build/toolchain_packages
cross_build/android/ndk
cross_build/android/android_studio
cross_build/tricore
51 changes: 51 additions & 0 deletions examples/cross_build/tricore.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
.. _example_cross_build_tricore:


Building packages with Tricore compiler
=======================================

.. include:: ../../common/experimental_warning.inc


Tricore compiler is a popular compiler for embedded in some domains such as automotive.
Since Conan 2.7 there is some built-in support for this compiler:

- The default ``settings.yml`` contains architectures: ``'tc131', 'tc16', 'tc161', 'tc162', 'tc18'``
- ``CMakeToolchain`` defines ``CMAKE_SYSTEM_NAME=Generic-ELF`` and ``CMAKE_SYSTEM_PROCESSOR=tricore`` for these architectures
- The compiler flags ``-m<architecture>"`` are injected as compiler and linker flags in ``CMakeToolchain`` and ``AutotoolsToolchain``
czoido marked this conversation as resolved.
Show resolved Hide resolved

That means that it is possible to define a profile like:

.. code-block::
:caption: tricore.profile

[settings]
os=baremetal
arch=tc162
compiler=gcc
compiler.version=11
compiler.cppstd=20
compiler.libcxx=libstdc++11

[options]
*:fPIC=False
*:shared=False

[conf]
tools.build:compiler_executables={"c":"tricore-elf-gcc","cpp":"tricore-elf-g++"}


This assumes the compiler is installed in the system path, and its executables are called ``tricore-elf-gcc`` and ``tricore-elf-g++``.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An open source gcc toolchain is available on GitHub: https://github.com/EEESlab/tricore-gcc-toolchain-11.3.0

Is that helpful to mention here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessarily at this stage, but if we built a full working example (which is the final goal), then it would be perfect to use such open source toolchain

And then, cross-build and create a package for tricore using this profile, for example the default ``cmake_lib``:

.. code-block:: bash

$ conan new cmake_lib -d name=mypkg -d version=0.1
$ conan create . -pr=tricore.profile


.. note::

- This support is new and experimental. Please create a ticket in https://github.com/conan-io/conan/issues for any feedback or issues
- Linking applications (like if using ``conan new cmake_exe``) requires a specific linker script, definition of entry-points, etc.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some example linker scripts available on Github https://github.com/Infineon/AURIX_code_examples/blob/master/code_examples/iLLD_TC37x_ADS_SCR_Blinky_LED_LK_1/Lcf_Gnuc_Tricore_Tc.lsl

These scripts will setup gcc exception handling tables, but iLLD provides key entry points and startup code that are expected by these linker scripts.

You can see this in the included iLLD source in the same example:

Trying to build it as above will produce linking errors. We will try to add further examples for this case.