{"id":16265002,"url":"https://github.com/mc-cat-tty/tricore-dev-env","last_synced_at":"2025-03-19T23:30:32.386Z","repository":{"id":228252418,"uuid":"773500768","full_name":"mc-cat-tty/tricore-dev-env","owner":"mc-cat-tty","description":"WIP. Containerized environment for HighTec Tricore GCC + ERIKA Enterprise. Running on Linux and MacOS.","archived":false,"fork":false,"pushed_at":"2025-02-21T10:31:24.000Z","size":551474,"stargazers_count":8,"open_issues_count":3,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-17T11:55:03.137Z","etag":null,"topics":["docker","docker-container","erika-enterprise","gcc","rtos","tricore","tricore-development"],"latest_commit_sha":null,"homepage":"https://hub.docker.com/repository/docker/francescomecatti/tricore-dev-env","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mc-cat-tty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-17T20:33:16.000Z","updated_at":"2025-02-21T10:31:28.000Z","dependencies_parsed_at":"2024-03-17T21:49:17.256Z","dependency_job_id":"a1e6aab8-ee0f-4205-ad70-970838a7f036","html_url":"https://github.com/mc-cat-tty/tricore-dev-env","commit_stats":{"total_commits":46,"total_committers":1,"mean_commits":46.0,"dds":0.0,"last_synced_commit":"9376a12d5d405e75bfa75bccfa3b1efb9bd820af"},"previous_names":["mc-cat-tty/tricore-erika-dev-env"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc-cat-tty%2Ftricore-dev-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc-cat-tty%2Ftricore-dev-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc-cat-tty%2Ftricore-dev-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mc-cat-tty%2Ftricore-dev-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mc-cat-tty","download_url":"https://codeload.github.com/mc-cat-tty/tricore-dev-env/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244524418,"owners_count":20466417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","docker-container","erika-enterprise","gcc","rtos","tricore","tricore-development"],"created_at":"2024-10-10T17:05:16.304Z","updated_at":"2025-03-19T23:30:31.385Z","avatar_url":"https://github.com/mc-cat-tty.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Development Environment for Tricore GCC + ERIKA Enterprise\n\n## Setup\nThis repository serves as an aggregator for 3 conceptually different projects, but tightly bound to each other:\n 1. A containerized cross-compiler for TriCore architecture\n 2. A flasher for AURIX development boards (WIP)\n 3. A utility Python package for interacting with both of them (mimicking the Platform IO workflow: build, flash, monitor)\n\n### The easy way\nBoth the cross-compiler container and the Python package are published \"pre-coocked\" on an online repository:\n - [tricore-dev-env on Docker Hub](https://hub.docker.com/repository/docker/francescomecatti/tricore-dev-env)\n - [tricore-cli on PyPI](https://pypi.org/project/tricore-cli/)\n\nMake sure that Python3 and a Docker Engine are installed on your system and run:\n```bash\ndocker pull francescomecatti/tricore-dev-env:1.0\npip3 install tricore-cli\n```\n\nYou shold now be able to run:\n```bash\ndocker run -it CONTAINER_TAG\n```\n\nAnd, in case it exits:\n```bash\ndocker start -ai CONTAINER_ID\n```\nto restore it.\n\nThis is exactly what `tricorecli SUBCMD DIR` runs under the hood (through the Docker SDK for Python). To mount a **host**'s directory into the container, a **bind mount** is used by the script.\n\nThat's all! Move to [Examples - Containerized installation](#containerized-installation) for the build process.\n\n### Manual system-wide installation\nFirst of all, clone this repository:\n```bash\ngit clone --recurse-submodules --shallow-submodules https://github.com/mc-cat-tty/tricore-dev-env\n```\n\nIn order to install the toolchain on your system, the following steps are required:\n 1. Build _binutils_ for TC target\n 2. Build GCC for TC traget\n 3. Build, at least, _libgcc_ for TC target\n 4. Build _newlib_ for TC target\n\nApart from the third point, this sequence must be kept in order, since _bintuils_ (`as`, `ar`, `ld`, etc.) are needed by `gcc`; and, in turn, `newlib` requires a fully-functional `gcc` to be bult (plus the linker and the assembler).\n\nThe build procedure is automated by _build-toolchain/install.sh_ script. Feel free to tinker around with the build script.\nThe proposed set of flags make the compilation successfull on both _Darwin/arm64_ and _Linux/amd64_ platforms.\n\nThe install directory of the script can be customized with `INSTALL_PATH` environment variable:\n```bash\nINSTALL_PATH=/home/foo bash build-toolchain/install.sh\n```\n\nIn case of missing `nproc` in your system, replace `JOBS` variable with a reasonable value; typically 1.5 times the number of cores on your machine.\n\n### Manual containerized installation\nFirst of all, clone this repository:\n```bash\ngit clone --recurse-submodules --shallow-submodules https://github.com/mc-cat-tty/tricore-dev-env\n```\n\nMake sure that a Docker Engine is installed and running on your system:\n```bash\ncd tricore-dev-env\ndocker build -t CONTAINER_TAG .\n```\n\nThe `build` subcommand requires a _Dockerfile_ to be present in the build directory. This file instructs the docker client about the building steps.\n\nYou might want to avoid the copy of some source files during the build process - for instance, because they are not ready to be embedded into the container; _.dockerignore_ serves exactly this purpose.\n\nBoth the aforementioned files are located in the top-directory of this project, so that you can build up your own on top of them.\n\nYou shold now be able to run:\n```bash\ndocker run -it CONTAINER_TAG\n```\n\nAnd, in case it exits:\n```bash\ndocker start -ai CONTAINER_ID\n```\nto restore it.\n\n## Examples\nPlease, note that the linker script _.lsl_ file is not the default one provided by [Infineon Code Examples](https://github.com/Infineon/AURIX_code_examples). It has been downloaded from this [URL](https://nextcloud.hightec-rt.com/index.php/s/BG72PCMP7jrEcki), as suggested by [AURIX Development Studio - Guide for HighTec Toolchains](https://free-entry-toolchain.hightec-rt.com/aurix_dev_studio_with_hightec_gcc.pdf).\n\n### How to build and example?\n#### Containerized Installation\nMake sure that the dependencies described [here](#the-easy-way) are installed - and running, in the case of the Docker Engine - on your system.\n\nPick and example, for instance _Blinky_LED\\_1\\_KIT\\_TC397\\_TFT_:\n```bash\ncd examples/Blinky_LED_1_KIT_TC397_TFT\ntricorecli build .\n```\n\nIf the build process is successful, a new _build_ directory should appear in the project's top folder. Inside _build_ you can find two **compilation artifacts**:\n - _Blinky_\n - _Blinky.hex_\n\n_Blinky.hex_ is the format expected by Infineon MemTool.\n\n#### System-wide installation\nIf you have not already exported binutils and gcc paths into PATH env var, do the following:\n```bash\nexport PATH=/your/path/binutils-tc/install/bin/:$PATH\nexport PATH=your/path/gcc-tc/install/bin/:$PATH\n```\n\nBe aware that your path may be different. It depends on the configuration of your environment.\n\n```bash\ncd examples/Blinky_LED_1_KIT_TC397_TFT\nmkdir build\ncd build\ncmake --toolchain tricore_toolchain.cmake .. \u0026\u0026 make -j12\n```\n\n_12_ is the number of jobs I decided to pass to `make`; find your own tuning. Usually `1.5 * $(nproc)`.\n\nYou should now see the result of the compilation, namely _Blinky_ - for this specific project -, in the _build_ folder: `file Blinky`. If `file` spits out something like `ELF 32-bit [...] Siemens Tricore Embedded Processor`, everything should be ok.\n\nNow let's convert the ELF to the HEX format (already done by the build system, in the latest version of the project): `tricore-elf-objcopy -j .text -j .data -O ihex Blinky Blinky.hex`.\n\n### Internals\nThe _CMakeLists.txt_ and _tricore\\_toolchain.cmake_ do the trick. Noteworthy directives are:\n - `set(CMAKE_C_COMPILER tricore-elf-gcc)` chooses the right cross-compiler. Omitting this leads to the use of the system's compiler, which is not - almost for sure - a compier that supports TriCore architecture as a target.\n - `set(CMAKE_SYSROOT /tricore-build-tools/tricore-elf)` sets the compiler _sysroot_, namely the path where libraries (both heaers, under _/include_ and static/dynamic libraries, under _/lib_) like `libc`, `libm`, `crt` (C RunTime), etc. are searched. Read more about it on the [GCC manual](https://gcc.gnu.org/onlinedocs/gcc/Directory-Options.html).\n - `project(... LANGUAGES C)` disables C++ language. Enabling C++ raises some errors at the moment.\n - `add_compile_definitions(__HIGHTEC__)` defines a macro required by iLLD libraires.\n - `add_compiler_options(...) and add_link_options(...)` are described [here](https://free-entry-toolchain.hightec-rt.com/aurix_dev_studio_with_hightec_gcc.pdf). `-mcpu=XXXX` must be coherent with the CPU of your board. Run `tricore-elf-gcc --target-help` to get the complete list of supported CPUs and architectures.\n - `include_directories(... /tricore-build-tools/tricore-elf/include)` includes the header files of _newlib_. \n\nNote that `set(CMAKE_SYSROOT /tricore-build-tools/tricore-elf)` and `include_directories(... /tricore-build-tools/tricore-elf/include)` are probably useless in the context of a single installation path for GCC, binutils and newlib; but, they are necessary if the installation paths of these tools differ. \nIn particular, they should point to the install directory of _newlib_.\n\n## Create a new project\nAt the moment, projects have to be created by hand.\n\nSome useful resources are:\n - [iLLD drivers](https://www.infineon.com/cms/en/tools/aurix-embedded-sw/aurix-illd-drivers/)\n - [Linker scripts](https://nextcloud.hightec-rt.com/index.php/s/BG72PCMP7jrEcki)\n - [CMakeLists.txt template](project-template/CMakeLists.txt)\n - [tricore_toolchain.cmake](project-template/tricore_toolchain.cmake)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmc-cat-tty%2Ftricore-dev-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmc-cat-tty%2Ftricore-dev-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmc-cat-tty%2Ftricore-dev-env/lists"}