Skip to content

fix(PeriphDrivers): MAX32657 Cache Access #5593

fix(PeriphDrivers): MAX32657 Cache Access

fix(PeriphDrivers): MAX32657 Cache Access #5593

###############################################################################
#
# Copyright (C) 2022-2023 Maxim Integrated Products, Inc. (now owned by
# Analog Devices, Inc.),
# Copyright (C) 2023-2024 Analog Devices, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
name: Build_Examples
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Build_Examples:
# The type of runner that the job will run on
runs-on:
- ubuntu-latest
env:
SOURCE_BRANCH: ${{github.ref_name}}
TARGET_BRANCH: ${{github.event.pull_request.base.ref}}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
# Update the submodules below, doing so here will convert ssh to https
submodules: false
fetch-depth: 0
ref: '${{ github.event.pull_request.head.ref }}'
repository: '${{ github.event.pull_request.head.repo.full_name }}'
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
**.c
**.h
**.S
**.s
**.a
**.cpp
**.mk
**/Makefile
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo ${ALL_CHANGED_FILES} > changed_files
cat changed_files
- name: Check watch files
id: check_watch
run: |
echo SOURCE_BRANCH = $SOURCE_BRANCH
echo TARGET_BRANCH = $TARGET_BRANCH
# Determine if we need to run the test
RUN_TEST=0
# Always run test if a workflow_dispatch
if [[ $GITHUB_EVENT_NAME == "workflow_dispatch" ]]; then
RUN_TEST=1
fi
if [[ $SOURCE_BRANCH == "main" ]]; then
echo "Pushed to main, running test"
RUN_TEST=1
fi
# Check for changes made to these files
WATCH_FILES="\
Build_Examples.yml \
.c \
.cpp \
.S \
.s \
.h \
.a \
.mk \
makefile \
Makefile"
if [[ -n $TARGET_BRANCH ]]; then
# We are in a PR. Need to check changes against the target branch.
echo "Comparing PR against target branch: $TARGET_BRANCH"
echo "Adding remote '$GITHUB_SERVER_URL/$GITHUB_REPOSITORY' as 'upstream'"
git remote add upstream $GITHUB_SERVER_URL/$GITHUB_REPOSITORY
echo "Fetching $TARGET_BRANCH"
git fetch upstream $TARGET_BRANCH
echo "diffing files"
CHANGE_FILES=$(git diff --ignore-submodules --name-only remotes/upstream/$TARGET_BRANCH)
fi
echo "Watching these locations and files"
echo $WATCH_FILES
echo "Checking the following changes"
echo $CHANGE_FILES
for watch_file in $WATCH_FILES; do
for change_file in $CHANGE_FILES; do
if [[ "${change_file,,}" == *"${watch_file,,}" ]]; then
echo "Match found. Watch type: $watch_file, File: $change_file"
RUN_TEST=1
fi
done
done
# End the test early if there wasn't a significant change
if [[ $RUN_TEST -eq 0 ]]; then
echo "Skipping Build"
else
echo "Running Build"
fi
echo "RUN_TEST=$RUN_TEST" >> $GITHUB_OUTPUT
- name: Install ARM GCC Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
id: arm-none-eabi-gcc-action
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
with:
release: '10.3-2021.10' # <-- The compiler release to use
- name: Install RISCV GCC Toolchain (riscv-none-embed-gcc)
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
run: |
# Install RISCV tools
npm install --global xpm@latest
TOOL_VER=10.2.0-1.2.1
xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@$TOOL_VER
cp -r /home/runner/.local/xPacks/@xpack-dev-tools/riscv-none-embed-gcc /home/runner/riscv-none-embed-gcc
# Add riscv tools to path
echo "/home/runner/riscv-none-embed-gcc/$TOOL_VER/.content/bin" >> $GITHUB_PATH
- name: Install RISCV GCC Toolchain (riscv-none-elf-gcc)
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
run: |
# Install RISCV tools (updated)
npm install --global xpm@latest
# https://www.npmjs.com/package/@xpack-dev-tools/riscv-none-elf-gcc
TOOL_VER=12.2.0-3.1
xpm install --global @xpack-dev-tools/riscv-none-elf-gcc@$TOOL_VER
cp -r /home/runner/.local/xPacks/@xpack-dev-tools/riscv-none-elf-gcc /home/runner/riscv-none-elf-gcc
# Add riscv tools to path
echo "/home/runner/riscv-none-elf-gcc/$TOOL_VER/.content/bin" >> $GITHUB_PATH
- name: Install ccache
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
run: |
# Install ccache
sudo apt install -y ccache
# Prepend ccache into the PATH
echo "/usr/bin" >> $GITHUB_PATH
echo "/usr/lib/ccache" >> $GITHUB_PATH
# Setup ccache links
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-addr2line
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-ar
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-as
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-c
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-c++filt
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-cpp
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-elfedit
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-g
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gcc
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gcc-10.2.1
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gcc-ar
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gcc-nm
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gcc-ranlib
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gcov
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gcov-dump
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gcov-tool
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gdb-add-index
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gdb-add-index-py
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gdb-py
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-gprof
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-ld
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-ld.bfd
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-lto-dump
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-nm
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-objcopy
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-objdump
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-ranlib
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-readelf
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-size
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-strings
sudo ln -s ../../bin/ccache /usr/bin/arm-none-eabi-strip
sudo ln -s ../../bin/ccache /usr/bin/riscv-none-embed-gcc
- name: Setup Python
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Install packages
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
run: pip install -r .github/workflows/scripts/requirements.txt
# Runs a set of commands using the runners shell
- name: Build All Examples
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
run: |
# This environment variable is required for the SBTs.
# It must be set to the absolute path inside the Github repo.
export MAXIM_SBT_DIR=$(pwd)/Tools/SBT
# Set MAXIM_PATH to limit warnings
export MAXIM_PATH=$(pwd)
python .github/workflows/scripts/build.py --change_file changed_files
Regression_Test_Make_3_81:
runs-on:
- ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# Update the submodules below, doing so here will convert ssh to https
submodules: false
fetch-depth: 0
ref: '${{ github.event.pull_request.head.ref }}'
repository: '${{ github.event.pull_request.head.repo.full_name }}'
- name: Install Make 3.81
run: |
# Build and install Make version 3.81.
cd $GITHUB_WORKSPACE
ls -la
wget https://ftp.gnu.org/gnu/make/make-3.81.tar.gz
tar -xvf make-3.81.tar.gz
cd make-3.81
# Note: This patch is necessary to get make to build on Ubuntu-22.04.
patch glob/glob.c $GITHUB_WORKSPACE/.github/workflows/patch/glob_patch.patch
./configure --prefix=$GITHUB_WORKSPACE/make-3.81
make
make install
# Pre-prend 3.81 to path
echo "$GITHUB_WORKSPACE/make-3.81/bin:$GITHUB_PATH" > $GITHUB_PATH
make --version
- name: Check Make Version
run: |
# If this fails, there is a setup issue with the workflow.
VERSION_CHECK=$(make --version | grep 3.81)
if [ ! "$VERSION_CHECK" ];then
exit 2
fi
- name: Check watch files
id: check_watch
run: |
echo SOURCE_BRANCH = $SOURCE_BRANCH
echo TARGET_BRANCH = $TARGET_BRANCH
# Determine if we need to run the test
RUN_TEST=0
# Always run test if a workflow_dispatch
if [[ $GITHUB_EVENT_NAME == "workflow_dispatch" ]]; then
RUN_TEST=1
fi
if [[ $SOURCE_BRANCH == "main" ]]; then
echo "Pushed to main, running test"
RUN_TEST=1
fi
# Check for changes made to these files
WATCH_FILES="\
Build_Examples.yml \
.c \
.cpp \
.S \
.s \
.h \
.a \
.mk \
makefile \
Makefile"
if [[ -n $TARGET_BRANCH ]]; then
# We are in a PR. Need to check changes against the target branch.
echo "Comparing PR against target branch: $TARGET_BRANCH"
echo "Adding remote '$GITHUB_SERVER_URL/$GITHUB_REPOSITORY' as 'upstream'"
git remote add upstream $GITHUB_SERVER_URL/$GITHUB_REPOSITORY
echo "Fetching $TARGET_BRANCH"
git fetch upstream $TARGET_BRANCH
echo "diffing files"
CHANGE_FILES=$(git diff --ignore-submodules --name-only remotes/upstream/$TARGET_BRANCH)
fi
echo "Watching these locations and files"
echo $WATCH_FILES
echo "Checking the following changes"
echo $CHANGE_FILES
for watch_file in $WATCH_FILES; do
for change_file in $CHANGE_FILES; do
if [[ "${change_file,,}" == *"${watch_file,,}" ]]; then
echo "Match found. Watch type: $watch_file, File: $change_file"
RUN_TEST=1
fi
done
done
# End the test early if there wasn't a significant change
if [[ $RUN_TEST -eq 0 ]]; then
echo "Skipping Build"
else
echo "Running Build"
fi
echo "RUN_TEST=$RUN_TEST" >> $GITHUB_OUTPUT
- name: Install ARM GCC Toolchain (arm-none-eabi-gcc)
uses: carlosperate/arm-none-eabi-gcc-action@v1
id: arm-none-eabi-gcc-action
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
with:
release: '10.3-2021.10' # <-- The compiler release to use
- name: Install RISCV GCC Toolchain (riscv-none-embed-gcc)
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
run: |
# Install RISCV tools
npm install --global xpm@latest
TOOL_VER=10.2.0-1.2.1
xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@$TOOL_VER
cp -r /home/runner/.local/xPacks/@xpack-dev-tools/riscv-none-embed-gcc /home/runner/riscv-none-embed-gcc
# Add riscv tools to path
echo "/home/runner/riscv-none-embed-gcc/$TOOL_VER/.content/bin" >> $GITHUB_PATH
- name: Install RISCV GCC Toolchain (riscv-none-elf-gcc)
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
run: |
# Install RISCV tools (updated)
npm install --global xpm@latest
# https://www.npmjs.com/package/@xpack-dev-tools/riscv-none-elf-gcc
TOOL_VER=12.2.0-3.1
xpm install --global @xpack-dev-tools/riscv-none-elf-gcc@$TOOL_VER
cp -r /home/runner/.local/xPacks/@xpack-dev-tools/riscv-none-elf-gcc /home/runner/riscv-none-elf-gcc
# Add riscv tools to path
echo "/home/runner/riscv-none-elf-gcc/$TOOL_VER/.content/bin" >> $GITHUB_PATH
- name: Setup Python
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
uses: actions/[email protected]
with:
python-version: '3.10'
- name: Install packages
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
run: pip install -r .github/workflows/scripts/requirements.txt
- name: Build PeriphDrivers and Hello_World
if: ${{ steps.check_watch.outputs.RUN_TEST == '1' }}
run: |
# This environment variable is required for the SBTs.
# It must be set to the absolute path inside the Github repo.
export MAXIM_SBT_DIR=$(pwd)/Tools/SBT
# Set MAXIM_PATH to limit warnings
export MAXIM_PATH=$(pwd)
python .github/workflows/scripts/build.py --projects Hello_World