Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
07eeba4
Fixed edge case that might lead to Serial beeing stuck in spinlook wait
Oct 7, 2024
893d92a
Refact: elagant way to return value in CAN.wakeup() and sleep()
LinjingZhang Oct 22, 2024
ea52721
test: CAN pingpong test v2, with loop
LinjingZhang Oct 22, 2024
064cb6c
Fix: add missing semicolon
LinjingZhang Oct 22, 2024
ba05ce7
Test: CAN unit test pingpong v2, add more assertion
LinjingZhang Oct 22, 2024
1527196
Merge pull request #307 from MaxMax-embedded/HardwareSerial-Fix
LinjingZhang Oct 25, 2024
bf4944d
Chore: clean comments of spinlock in HardwareSerial fix
LinjingZhang Oct 25, 2024
ae74cac
Chore: restruct unit test for CAN and delete redundant tests
LinjingZhang Oct 25, 2024
423631b
Merge pull request #308 from Infineon/bugfix/serial_stuck_in_spinlock
LinjingZhang Oct 28, 2024
21caf1a
Refact: Reorganized unit test folder structure
LinjingZhang Oct 28, 2024
b7c6bdd
Initial insert of unity check in new setup, will yet not work
OlafFilies Oct 29, 2024
ac193aa
Find new structure
OlafFilies Oct 29, 2024
3ddf3c5
test 6,Find new structure
OlafFilies Oct 29, 2024
bd8356f
test 6,Find new structure
OlafFilies Oct 29, 2024
c8c4d94
test 6,Find new structure
OlafFilies Oct 29, 2024
25a2afc
test 6,Find new structure
OlafFilies Oct 29, 2024
9b2dfd8
test 6,Find new structure
OlafFilies Oct 29, 2024
dc1f2e2
test 6,Find new structure
OlafFilies Oct 29, 2024
7ed3735
test 6,Find new structure
OlafFilies Oct 29, 2024
25be042
Test: rename test folder, format code and add readme
LinjingZhang Oct 29, 2024
2ecc32a
test 6,Find new structure
OlafFilies Oct 29, 2024
7f0d414
Chore: add pre-commig-config for .clangformat and format code for bui…
LinjingZhang Oct 29, 2024
02db4ad
test 6,Find new structure
OlafFilies Oct 29, 2024
405126a
test 6,Find new structure
OlafFilies Oct 29, 2024
0cfa5f5
test 6,Find new structure
OlafFilies Oct 29, 2024
009271d
test 6,Find new structure
OlafFilies Oct 29, 2024
1b8eaa5
test 6,Find new structure
OlafFilies Oct 29, 2024
628e5d4
test 6,Find new structure
OlafFilies Oct 29, 2024
57fee12
test 6,Find new structure
OlafFilies Oct 29, 2024
b1f5849
test 6,Find new structure
OlafFilies Oct 29, 2024
a12499e
test 6,Find new structure
OlafFilies Oct 29, 2024
853d69f
test 6,Find new structure
OlafFilies Oct 29, 2024
19b5917
test 6,Find new structure
OlafFilies Oct 29, 2024
f4e2f87
test 6,Find new structure
OlafFilies Oct 29, 2024
97ee172
test 6,Find new structure
OlafFilies Oct 29, 2024
44133bb
test 6,Find new structure
OlafFilies Oct 29, 2024
eb6773d
test 6,Find new structure
OlafFilies Oct 29, 2024
300bbad
Chore: - update pre-commit config to exlude xmc LLD only, so arduino…
LinjingZhang Oct 30, 2024
c60baba
Merge branch 'master' into feature/Unity_codecheck_setup
LinjingZhang Oct 30, 2024
242d437
test 7, change to device order
OlafFilies Oct 30, 2024
196f7ac
test 7, change to device order
OlafFilies Oct 30, 2024
2636de5
test 7, change to device order
OlafFilies Oct 30, 2024
195becb
test 7, change to device order
OlafFilies Oct 30, 2024
4453b8c
test 7, change to device order
OlafFilies Oct 30, 2024
68cc654
test 7, change to device order
OlafFilies Oct 30, 2024
dafc3ba
test 7, change to device order
OlafFilies Oct 30, 2024
66aeb19
test 7, change to device order
OlafFilies Oct 30, 2024
f9bc694
test 7, change to device order
OlafFilies Oct 30, 2024
1ca4143
test 7, change to device order
OlafFilies Oct 30, 2024
4e37fa4
test 7, change to device order
OlafFilies Oct 30, 2024
d91d286
test 7, change to device order
OlafFilies Oct 30, 2024
e923740
test 7, change to device order
OlafFilies Oct 30, 2024
9a2d0c0
test 7, change to device order
OlafFilies Oct 30, 2024
c20f6e2
test 7, change to device order
OlafFilies Oct 30, 2024
c3d4f9f
test 7, change to device order
OlafFilies Oct 30, 2024
dc8c3d4
test 7, change to device order
OlafFilies Oct 30, 2024
796ebf0
test 7, change to device order
OlafFilies Oct 30, 2024
2531382
test 7, change to device order
OlafFilies Oct 30, 2024
f86db5b
test 7, change to device order
OlafFilies Oct 30, 2024
f891836
test 7, change to device order
OlafFilies Oct 30, 2024
e67d056
test 7, change to device order
OlafFilies Oct 30, 2024
cf50588
test 7, change to device order
OlafFilies Oct 30, 2024
544243a
test 7, change to device order
OlafFilies Oct 30, 2024
2278cbc
test 7, change to device order
OlafFilies Oct 30, 2024
1ea47df
test 7, change to device order
OlafFilies Oct 30, 2024
aa9b1f3
test 7, change to device order
OlafFilies Oct 30, 2024
b36eb72
test 7, change to device order
OlafFilies Oct 30, 2024
e88da6c
test 7, change to device order
OlafFilies Oct 30, 2024
86072db
test 7, change to device order
OlafFilies Oct 30, 2024
2a21061
test 7, change to device order
OlafFilies Oct 30, 2024
57bd3fd
test 7, change to device order
OlafFilies Oct 30, 2024
b2a612f
test 7, change to device order
OlafFilies Oct 30, 2024
5430f03
test 7, change to device order
OlafFilies Oct 30, 2024
dbf1c0d
test 7, change to device order
OlafFilies Oct 30, 2024
de4be8b
test 7, change to device order
OlafFilies Oct 30, 2024
686c38b
test 7, change to device order
OlafFilies Oct 30, 2024
9b471a1
test 7, change to device order
OlafFilies Oct 30, 2024
a862fc9
test 7, change to device order
OlafFilies Oct 30, 2024
e478105
test 7, change to device order
OlafFilies Oct 30, 2024
af0eb1c
test 7, change to device order
OlafFilies Oct 30, 2024
d2ab0f0
test 7, change to device order
OlafFilies Oct 30, 2024
435d17e
test 7, change to device order
OlafFilies Oct 30, 2024
0ea7bdd
test 7, change to device order
OlafFilies Oct 30, 2024
54e3013
test 8, right unity dir
OlafFilies Oct 31, 2024
36d28f0
test 9, with flash and monitor
OlafFilies Oct 31, 2024
36b73ae
test 9, with flash and monitor
OlafFilies Oct 31, 2024
6096717
test 9, with flash and monitor
OlafFilies Oct 31, 2024
5037ba3
test 9, with flash and monitor
OlafFilies Oct 31, 2024
c476b44
test 9, with flash and monitor
OlafFilies Oct 31, 2024
bce2c32
test 9, with flash and monitor
OlafFilies Oct 31, 2024
2e86580
test 9, with flash and monitor
OlafFilies Oct 31, 2024
4ef5d8c
test 9, with flash and monitor
OlafFilies Oct 31, 2024
9ea3535
test 9, with flash and monitor
OlafFilies Oct 31, 2024
11c488a
test 9, with flash and monitor
OlafFilies Oct 31, 2024
ea8b044
test 10, generate artefacts
OlafFilies Oct 31, 2024
405b950
test 10, generate artefacts
OlafFilies Oct 31, 2024
fb3be1c
test 10, generate artefacts
OlafFilies Oct 31, 2024
ca7be64
test 10, generate artefacts
OlafFilies Oct 31, 2024
33c8cdc
test 10, generate artefacts
OlafFilies Oct 31, 2024
c8d7be4
test 10, generate artefacts
OlafFilies Oct 31, 2024
d362b9d
Merge pull request #309 from Infineon/DESMAKERS-3803-new-hil-setup
OlafFilies Nov 6, 2024
230c582
Chore: unity folder name lower case
LinjingZhang Nov 6, 2024
691e881
CI: change build test trigger condition, only when doc changes
LinjingZhang Nov 6, 2024
606ca07
CI: add pre-commit on workflow
LinjingZhang Nov 6, 2024
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
2 changes: 2 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Build docs

on:
push:
paths:
- docs/**
pull_request:
paths:
- docs/**
Expand Down
229 changes: 229 additions & 0 deletions .github/workflows/hil-unity-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
name: Hil unity library checks

# on which event should we start push, pull request or schedule dispatches
on:
- push
- pull_request

env:
TEST_VERSION: 1.0.0

# This template runes multiple workflows
jobs:


#############################################################################
# This action sets common variables for the flow and
# identifies the libs to compile
setup:

# we run this on self hosted runner, use labels to be more specific
# add specific names if there are some, otherwise self-hosted, X64, Linux are the default ones
runs-on:
- self-hosted
- X64
- Linux

steps:
# checkout the latest github action code
- name: Checkout actions
uses: actions/checkout@v4

# checkout the latest arduino-cli compiler
- name: Setup Arduino CLI
uses: arduino/setup-arduino-cli@master

# Update the arduino code. Attention this does not setup XMC packages as this are set inside the self hosted runner
# the arduino board support packages can be updated automatically
# the XMC board support package is only linked inside the self hosted runner, which allows
# to use none official and beta versions
# arduino-cli core install "infineon:xmc"
- name: Install/Update Arduino Platform
run: |
arduino-cli core update-index
arduino-cli core install "arduino:avr"

# Fetch variables and move them to the GITHUB_OUTPUT and fetch HIL information
- id: startup
run: |
# switch on the HIL
cd /opt/runner_support/
REPO="$(basename "$GITHUB_REPOSITORY")"
./py_checkusb.py --switch repo --namelist $REPO --onoff on

# set the hil-unity-checks
hil=$(./py_checkusb.py --readyaml $GITHUB_WORKSPACE/tests/Unity/hil-unity-checklist.yaml --json)
echo "hil=${hil}" >> $GITHUB_OUTPUT

# fetch unity libraries
readarray -t data < <(echo $hil | jq -r '.|keys[]')
export dev=$(jq --compact-output --null-input '$ARGS.positional' --args -- "${data[@]}")
echo "devices=${dev}" >> $GITHUB_OUTPUT
echo "devices=${dev}"

# Connect the GITHUB_OUTPUT to the variables and the workflow output mechanism
outputs:
hil: ${{ steps.startup.outputs.hil }}
devices: ${{ steps.startup.outputs.devices }}


#############################################################################
# This step allows HIL (Hardware in the loop), therefore
# is searches for the given board/sensor combination and tries to find the actual port
# on the self hosted runner. (see documentation for the board2port finder)
flash:

# We need a successful build before we can run the deploy
needs: [setup]

# we run this on self hosted runner, use labels to be more specific
# add specific names if there are some, otherwise self-hosted, X64, Linux are the default ones
runs-on:
- self-hosted
- X64
- Linux

# do not stop if a single job fails
continue-on-error: true

strategy:

# the code to flash
matrix:
# the serials of the hardware boards
device: ${{ fromJson(needs.setup.outputs.devices) }}

# These are the steps which should run for each combination of fqbn and lib code
steps:
# checkout the latest github action code
- name: Checkout actions
uses: actions/checkout@v4

# setup environment
- name: Environment
run: |
cd $HOME
rm -rf ~/.arduino15/packages/Infineon/hardware/xmc/*
ln -s $GITHUB_WORKSPACE ~/.arduino15/packages/Infineon/hardware/xmc/$TEST_VERSION

hil=${{ toJson(needs.setup.outputs.hil) }}
REPO="$(basename "$GITHUB_REPOSITORY")"
DEVICE="$(basename ${{ matrix.device }} )"
LIBRARY=$(echo $hil | jq ".\"${DEVICE}\"" -r --compact-output)
FQBN=`tr '.' ':' <<<"${DEVICE}"`

echo "repo=$REPO" >> $GITHUB_ENV
echo "device=$DEVICE" >> $GITHUB_ENV
echo "version=$TEST_VERSION" >> $GITHUB_ENV
echo "library=$LIBRARY" >> $GITHUB_ENV
echo "fqbn=$FQBN" >> $GITHUB_ENV

echo "Repo " $REPO
echo "Device " $DEVICE
echo "Library " $LIBRARY
echo "FQBN " $FQBN
echo "Version " ${TEST_VERSION}

# Build the test code with make and flash it to the board
# runs via nested loops:
# - first loop over the libraries mentioned for a device in the yaml file
# - selects the serial ids and ports for all devices connected with this device and library
# - second loop over the examples mentioned below the selected device for a library in the yaml file
# - third loop over the tests mentioned below the selected example for a device and library in the yaml file
# - fourth loop over the make commands mentioned below the selected test for a device, example and library in the yaml file

- name: Build
run: |
export TMPDIR=$HOME/tmp
mkdir -p $TMPDIR
rm -rf $HOME/artefact
mkdir -p $HOME/artefact

lib=${{ toJson(env.library) }}
readarray -t LIBS < <(echo ${lib} | jq ".|keys[]" -r --compact-output)

# loop over all libs in the unity test yaml
for LIB in "${LIBS[@]}"; do
cd /opt/runner_support/
readarray -t SERIALS < <(echo $(./py_checkusb.py --type ${LIB} --json) | jq ".\"${LIB}\".\"${{ env.device }}\"|keys[]" -r)

# check if we have one or more serial numbers for this lib or stop here
if [[ -z $SERIALS ]]; then
echo "No serial or library information found"
exit 0
fi

# loop over all serials and fetch the ports
declare -a PORTS
for SERIAL in "${SERIALS[@]}"; do
PORTS+=($(/opt/runner_support/find_usb.sh $SERIAL))
done

# loop over all examples for one library
readarray -t EXAMPLES < <(echo $lib | jq ".\"${LIB}\"|keys[]" -r --compact-output)
for EXAMPLE in "${EXAMPLES[@]}"; do
echo "=============================================================================================================="
echo "Run for EXAMPLE: ${EXAMPLE} under LIB: ${LIB}"
echo "=============================================================================================================="

# loop over all tests for one example and compile7flash the devices
readarray -t TESTS < <(echo $lib | jq ".\"${LIB}\".\"${EXAMPLE}\"[]" -r --compact-output)
for ((idx=0; idx<${#TESTS[@]}; ++idx)); do
cd $GITHUB_WORKSPACE/tests/Unity/
echo "=============================================================================================================="
echo "Run on index $idx for TEST: ${TESTS[idx]} under EXAMPLE: ${EXAMPLE} and LIB: ${LIB}"
echo "=============================================================================================================="
make FQBN=${{ env.fqbn }} PORT=${PORTS[idx]} UNITY_PATH=/opt/runner_support/Unity_github ${TESTS[idx]}
mkdir -p ~/artefact/${LIB}/${EXAMPLE}/${TESTS[idx]}/
mv ./build/build/* ~/artefact/${LIB}/${EXAMPLE}/${TESTS[idx]}/.
echo "=============================================================================================================="
done # end of TEST loop flash

# loop over all tests for one example and monitor the serial output
for ((idx=0; idx<${#TESTS[@]}; ++idx)); do
echo "=============================================================================================================="
echo "Monitor on index $idx for TEST: ${TESTS[idx]} under EXAMPLE: ${EXAMPLE} and LIB: ${LIB}"
timeout 1m \
/opt/runner_support/py_console.py \
--port ${PORTS[idx]} \
--baud 115200 \
--report ~/artefact/${LIB}/${EXAMPLE}/${TESTS[idx]}/${{ env.device }}/report.json

echo "=============================================================================================================="
done # end of TEST loop monitor

done # end of EXAMPLE loop
done # end of LIB loop

# Upload the compiled HEX files to the GitHub server
- name: Artefact
uses: actions/upload-artifact@v4
with:
name: ${{ env.device }}
path: ~/artefact/*
if-no-files-found: ignore


#############################################################################
# Switch off the HIL after all tests are done
post:

# we run this no matter if before fails
if: always()
# wait on first setup run before starting main function
needs: [setup, flash]

# we run this on self hosted runner, use labels to be more specific
# add specific names if there are some, otherwise self-hosted, X64, Linux are the default ones
runs-on:
- self-hosted
- X64
- Linux

steps:
- name: Switch off HIL
run: |
cd /opt/runner_support/
REPO="$(basename "$GITHUB_REPOSITORY")"
./py_checkusb.py --switch repo --namelist $REPO --onoff off

28 changes: 28 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Pre-commit checks

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
pre-commit:
runs-on: ubuntu-latest

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Install pre-commit
run: pip install pre-commit

- name: Run pre-commit
run: pre-commit run --all-files
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
.history
.vscode

# build folder
pkg_build
build

# python
**/__pycache__/
venv/

# Code-check reports
# code-check reports
clang-tidy-report.txt

scan-build-reports/
Expand Down
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: "v18.1.3"
hooks:
- id: clang-format
args: ["-style=file:config/clang-format/.clang-format"]
exclude: ^cores/(avr|usblib|xmc_lib)/
files: \.(c|cpp|h|hpp)$
26 changes: 0 additions & 26 deletions IFX_CONTRIBUTING.md

This file was deleted.

Loading
Loading