Skip to content

Commit 143a68b

Browse files
WIP.
Signed-off-by: Ramya Subramanyam <[email protected]>
1 parent ae371fa commit 143a68b

23 files changed

+1116
-22
lines changed

.github/workflows/code_checks.yml

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Code check workflow with strategy
2+
3+
on:
4+
push:
5+
branches: [ '*' ]
6+
7+
defaults:
8+
run:
9+
shell: bash
10+
11+
jobs:
12+
setup:
13+
runs-on: ubuntu-24.04
14+
15+
# env:
16+
# GHCR_REGISTRY: ghcr.io
17+
# # issue : organization "Infineon" with capital "I" not allowed.
18+
# IMAGE_NAME: infineon/makers-docker
19+
20+
container:
21+
image: docker.io/ifxmakers/makers-docker:push
22+
# image: ghcr.io/infineon/makers-docker:latest
23+
# credentials:
24+
# # username: ${{ secrets.DOCKERHUB_USERNAME }}
25+
# # password: ${{ secrets.DOCKERHUB_PASSWORD }}
26+
# username: ${{ github.actor }}
27+
# password: ${{ secrets.github_token }}
28+
volumes:
29+
- .:/myLocalWorkingDir:rw
30+
options: --cpus 1
31+
32+
steps:
33+
34+
- name: Checkout actions
35+
uses: actions/checkout@v4
36+
with:
37+
submodules: true
38+
39+
- name: Set strategy matrix
40+
id: set-matrix
41+
run: |
42+
eval $(python3 tools/codeChecks.py --getAllChecks)
43+
44+
outputs:
45+
checks: ${{ steps.set-matrix.outputs.checks }}
46+
47+
48+
flowStep:
49+
runs-on: ubuntu-24.04
50+
needs: setup
51+
52+
container:
53+
image: docker.io/ifxmakers/makers-docker:push
54+
# image: ghcr.io/infineon/makers-docker:latest
55+
# credentials:
56+
# username: ${{ secrets.DOCKERHUB_USERNAME }}
57+
# password: ${{ secrets.DOCKERHUB_PASSWORD }}
58+
# username: ${{ github.actor }}
59+
# password: ${{ secrets.github_token }}
60+
volumes:
61+
- .:/myLocalWorkingDir:rw
62+
options: --cpus 1
63+
64+
strategy:
65+
66+
matrix:
67+
checks: ${{ fromJson(needs.setup.outputs.checks) }}
68+
69+
steps:
70+
71+
- name: Checkout actions
72+
uses: actions/checkout@v4
73+
with:
74+
submodules: recursive
75+
76+
77+
- name: Demo to show use of script to use matrix values
78+
id: run_build
79+
if: success() || failure()
80+
run: |
81+
echo "Workflow has these parameters :"
82+
echo "matrix.checks : " ${{ matrix.checks }}
83+
echo ""
84+
85+
python3 tools/codeChecks.py --runCheck ${{ matrix.checks }} --showLog
86+
87+
88+
- name: Archive tool reports
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: ${{ matrix.checks }}.log
92+
path: |
93+
results/${{ matrix.checks }}.log

.github/workflows/code_formatting.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

Makefile

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# include test make file
2+
#include tests/arduino-core-tests/Makefile
3+
4+
5+
6+
FQBN ?=
7+
TARGET ?=
8+
UNITY_PATH ?= Unity
9+
10+
11+
##############################################################################################################################################################
12+
13+
clean-results:
14+
-rm -rf results/cppcheck/* results/clang-tidy/* results/build/*
15+
- mkdir -p results/cppcheck results/clang-tidy results/build
16+
17+
18+
19+
##############################################################################################################################################################
20+
21+
run-build-target:
22+
(cd tests/arduino-core-tests ; make FQBN=$(FQBN) UNITY_PATH=Unity $(TARGET))
23+
24+
25+
##############################################################################################################################################################
26+
27+
28+
run-build-target-all:
29+
make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity TARGET=test_wire_connected1_pingpong run-build-target
30+
make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity TARGET=test_wire_connected2_slavepingpong run-build-target
31+
make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity TARGET=test_wire_connected2_masterpingpong run-build-target
32+
33+
34+
run-build-all:
35+
cd tests/arduino-core-tests ; make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity test_wire_connected1_pingpong
36+
cd tests/arduino-core-tests ; make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity test_wire_connected2_slavepingpong
37+
cd tests/arduino-core-tests ; make FQBN=Infineon:xmc:XMC4700_Relax_Kit UNITY_PATH=Unity test_wire_connected2_masterpingpong
38+
39+
40+
##############################################################################################################################################################
41+
42+
43+
TAG=push
44+
TAG=latest
45+
46+
DOCKER_REGISTRY=dockerregistry-v2.vih.infineon.com/ifxmakers/makers-docker:$(TAG)
47+
GHCR_REGISTRY=ghcr.io/infineon/makers-docker:$(TAG)
48+
49+
REGISTRY=$(DOCKER_REGISTRY)
50+
51+
DOCKER=docker run --rm -it -v $(PWD):/myLocalWorkingDir:rw $(REGISTRY)
52+
#DOCKER=
53+
54+
55+
### Setting DOCKER variable to empty string => containers not used
56+
### Setting DOCKER variable to "docker run ..." => containers used
57+
58+
59+
pull-container:
60+
docker pull $(REGISTRY)
61+
62+
63+
run-container-build-all: clean-results pull-container
64+
$(DOCKER) make run-build-target-all
65+
66+
67+
run-container-check-wire: clean-results pull-container
68+
$(DOCKER) tools/run_cppcheck.sh cores/psoc/* tests/arduino-core-tests/src/corelibs/wire
69+
firefox results/cppcheck/cppcheck-reports/index.html
70+
71+
72+
run-container-project-setup-script: clean-results pull-container
73+
$(DOCKER) python3 tools/codeChecks.py --getAllChecks
74+
$(DOCKER) python3 tools/codeChecks.py --runCheck check-clang-tidy
75+
$(DOCKER) python3 tools/codeChecks.py --runAllChecks
76+
# firefox results/cppcheck/cppcheck-reports/index.html
77+
78+
79+
run-container-project-setup-script-with-show-logs: clean-results pull-container
80+
$(DOCKER) python3 tools/codeChecks.py --getAllChecks
81+
$(DOCKER) python3 tools/codeChecks.py --runCheck check-clang-tidy --showLog
82+
$(DOCKER) python3 tools/codeChecks.py --runAllChecks --showLog
83+
# firefox results/cppcheck/cppcheck-reports/index.html
84+
85+
86+
run-container-cppcheck: clean-results pull-container
87+
$(DOCKER) python3 tools/codeChecks.py --runCheck check-cppcheck
88+
firefox results/cppcheck/cppcheck-reports/index.html
89+
90+
##############################################################################################################################################################
91+
92+
# check container content
93+
run-container-bash: pull-container
94+
$(DOCKER)
95+
96+
97+
# run stuff with container from docker hub
98+
run-container-build: clean-results pull-container
99+
$(DOCKER) make run-build-all
100+
101+
102+
103+

config/clang-format/.clang-format

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
# We'll use defaults from the LLVM style, but with 4 columns indentation.
3+
#BasedOnStyle: GNU
4+
BasedOnStyle: LLVM
5+
#BasedOnStyle: Google
6+
#BasedOnStyle: Mozilla
7+
#BasedOnStyle: Chromium
8+
IndentWidth: 4
9+
---
10+
Language: Cpp
11+
# BasedOnStyle: Google
12+
AccessModifierOffset: -4
13+
Standard: c++17
14+
TabWidth: 2
15+
UseTab: Never
16+
ColumnLimit: 100
17+
AlignAfterOpenBracket: Align
18+
BinPackParameters: false
19+
AlignEscapedNewlines: Left
20+
AlwaysBreakTemplateDeclarations: Yes
21+
PackConstructorInitializers: Never
22+
BreakConstructorInitializersBeforeComma: false
23+
IndentPPDirectives: BeforeHash
24+
SortIncludes: Never
25+
SeparateDefinitionBlocks: Always
26+
...

config/clang-tidy/.clang-tidy

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Checks: 'cppcoreguidelines-*,
2+
performance-*,
3+
modernize-*,
4+
google-*,
5+
misc-*
6+
cert-*,
7+
readability-*,
8+
clang-analyzer-*,
9+
-performance-unnecessary-value-param,
10+
-modernize-use-trailing-return-type,
11+
-google-runtime-references,
12+
-misc-non-private-member-variables-in-classes,
13+
-readability-braces-around-statements,
14+
-google-readability-braces-around-statements,
15+
-cppcoreguidelines-avoid-magic-numbers,
16+
-readability-magic-numbers,
17+
-readability-magic-numbers,
18+
-cppcoreguidelines-pro-type-vararg,
19+
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
20+
-cppcoreguidelines-avoid-c-arrays,
21+
-modernize-avoid-c-arrays,
22+
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
23+
-readability-named-parameter,
24+
-cert-env33-c
25+
'
26+
27+
28+
WarningsAsErrors: ''
29+
HeaderFilterRegex: '.*'
30+
#HeaderFilterRegex: '*spdlog/[^f].*'
31+
#AnalyzeTemporaryDtors: false
32+
FormatStyle: none
33+
34+
CheckOptions:
35+
- key: google-readability-braces-around-statements.ShortStatementLines
36+
value: '1'
37+
- key: google-readability-function-size.StatementThreshold
38+
value: '800'
39+
- key: google-readability-namespace-comments.ShortNamespaceLines
40+
value: '10'
41+
- key: google-readability-namespace-comments.SpacesBeforeComments
42+
value: '2'
43+
- key: modernize-loop-convert.MaxCopySize
44+
value: '16'
45+
- key: modernize-loop-convert.MinConfidence
46+
value: reasonable
47+
- key: modernize-loop-convert.NamingStyle
48+
value: CamelCase
49+
- key: modernize-pass-by-value.IncludeStyle
50+
value: llvm
51+
- key: modernize-replace-auto-ptr.IncludeStyle
52+
value: llvm
53+
- key: modernize-use-nullptr.NullMacros
54+
value: 'NULL'

config/cppcheck/misra.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"script": "misra.py",
3+
"args": [ "--rule-texts=config/cppcheck/misra.txt" ]
4+
}

config/cppcheck/misra.txt

Whitespace-only changes.

config/project.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
build:
2+
build-psoc-cy8ckit_062s2_ai:
3+
description: Compiling test_digitalio_single.cpp for PSOC6 platform
4+
target: test_digitalio_single
5+
fqbn: infineon:psoc:cy8ckit_062s2_ai
6+
7+
check:
8+
check-clang-tidy:
9+
description: clang-tidy check for wire sources
10+
tool: clang-tidy
11+
command: clang-tidy --config-file=config/clang-tidy/.clang-tidy -header-filter=. ./cores/psoc/*.cpp --
12+
13+
check-cppcheck:
14+
description: cppcheck check for wire sources
15+
tool: cppcheck
16+
command: tools/run_cppcheck.sh ./cores/psoc/*

config/user.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
check:
2+
- check-clang-tidy
3+
- check-cppcheck
4+
5+
build:
6+
- build-psoc-cy8ckit_062s2_ai
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
from schema import And, Or, Use, Optional
2+
3+
boardsFeaturesYAMLSchema = {
4+
str: {
5+
Optional("description"): str,
6+
"architecture": str,
7+
"subarchitecture": str,
8+
"arduino_related": Or(
9+
None,
10+
And(
11+
{
12+
Optional("fqbn"): str,
13+
Optional("iic"): int,
14+
Optional("spi"): int,
15+
Optional("uart"): int,
16+
Optional("analog_pins"): int,
17+
Optional("gpio_pins"): int,
18+
Optional("pwm_pins"): int,
19+
}
20+
),
21+
),
22+
"mtb_related": Or(
23+
None,
24+
And(
25+
{
26+
Optional("hw_ext"): str,
27+
Optional("iic"): int,
28+
Optional("spi"): int,
29+
Optional("uart"): int,
30+
Optional("analog_pins"): int,
31+
Optional("gpio_pins"): int,
32+
Optional("pwm_pins"): int,
33+
}
34+
),
35+
),
36+
"features": Or(
37+
None,
38+
And(
39+
{
40+
Optional("has_wifi"): bool,
41+
Optional("wifi_channels"): int,
42+
Optional("wifi_standards"): str,
43+
Optional("has_bt"): bool,
44+
Optional("bt_version"): Or(str, float),
45+
Optional("has_can"): bool,
46+
Optional("has_iic"): bool,
47+
Optional("has_spi"): bool,
48+
Optional("has_uart"): bool,
49+
Optional("has_analog_pins"): bool,
50+
Optional("has_gpio_pins"): bool,
51+
Optional("has_pwm_pins"): bool,
52+
}
53+
),
54+
),
55+
Optional("sensors"): Or(
56+
None,
57+
And(
58+
{
59+
str: int,
60+
}
61+
),
62+
),
63+
}
64+
}

0 commit comments

Comments
 (0)