Skip to content

Commit 06e35ad

Browse files
committed
package tricore cli and fix dependencies accordingly
1 parent 41afba4 commit 06e35ad

File tree

9 files changed

+66
-5
lines changed

9 files changed

+66
-5
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
examples/
22
flash-tools/
33
project-template/
4+
tricore-cli/
45
venv/
56
__pycache__/

examples/Blinky_LED_1_KIT_TC397_TFT/manage.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/Blinky_LED_1_KIT_TC397_TFT/requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

project-template/requirements.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

tricore-cli/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.egg-info
2+
dist

tricore-cli/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) [year] [fullname]
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

tricore-cli/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# TriCore CLI
2+
A utility script for interacting with containerized TriCore development environment.
3+
4+
## Usage
5+
### Build
6+
Make sure to be in the top-level directory of a project (i.e. a folder with some source code, a CMakeLists.txt and the _tricore\_toolchain.cmake_ toolchain file provided in _project-template_ folder).
7+
8+
Then, run this to build the project:
9+
```bash
10+
tricorecli build .
11+
# OR
12+
python3 -m tricorecli build .
13+
```
14+
15+
If the build is successful, a file _.hex_ is generated inside the _build_ directory of the project.
16+
17+
### Flash
18+
> The flash tool is work in progress; at the moment, the preferred solution is to use Infineon MemTool, feeding it with the .hex binary image.

tricore-cli/pyproject.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[project]
2+
name = "tricore-cli"
3+
version = "1.0"
4+
authors = [{ name = "Francesco Mecatti" }]
5+
description = "A utility script for interacting with containerized TriCore development environment"
6+
readme = "README.md"
7+
requires-python = ">=3.9"
8+
dependencies = ["docker>=7.0.0"]
9+
10+
[project.urls]
11+
Homepage = "https://github.com/mc-cat-tty/tricore-dev-env"
12+
Issues = "https://github.com/mc-cat-tty/tricore-dev-env/issues"
13+
14+
[project.scripts]
15+
tricorecli = "tricorecli:main"
16+
17+
[build-system]
18+
requires = ["setuptools>=61.0"]
19+
build-backend = "setuptools.build_meta"

project-template/manage.py renamed to tricore-cli/src/tricorecli.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def build(client: DockerClient, args: Any) -> None:
5151
remove=True,
5252
mounts=[src_folder],
5353
entrypoint = '/bin/bash -c',
54-
command='"apt install -y cmake && cd /home/src/build && cmake --toolchain tricore_toolchain.cmake .. && make -j$(nproc)"'
54+
command='"cd /home/src/build && cmake --toolchain tricore_toolchain.cmake .. && make -j$(nproc)"'
5555
)
5656
print(out)
5757
print("Done!")
@@ -62,7 +62,7 @@ def flash(client: DockerClient, args: Any) -> None:
6262
raise NotImplementedError("Feature not implemented yet")
6363

6464

65-
if __name__ == '__main__':
65+
def main() -> None:
6666
parser = argparse.ArgumentParser(description='Utility script for managing the build of TriCore applications with ease.')
6767
subparsers = parser.add_subparsers(title='action', required=True)
6868

@@ -78,3 +78,6 @@ def flash(client: DockerClient, args: Any) -> None:
7878

7979
args = parser.parse_args()
8080
args.handler(args)
81+
82+
if __name__ == '__main__':
83+
main()

0 commit comments

Comments
 (0)