Skip to content

Commit

Permalink
Merge branch 'master' into bugfix/ch32-hs-dcd
Browse files Browse the repository at this point in the history
  • Loading branch information
HiFiPhile authored May 18, 2024
2 parents ddf329f + ccc7a36 commit 1a5eac8
Show file tree
Hide file tree
Showing 746 changed files with 38,534 additions and 11,645 deletions.
112 changes: 112 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
version: 2.1

commands:
setup-toolchain:
parameters:
toolchain:
type: string
toolchain_url:
type: string
steps:
- run:
name: Make toolchain cache key
command: echo "<< parameters.toolchain >>-<< parameters.toolchain_url>>" > toolchain_key
- restore_cache:
name: Restore Toolchain Cache
key: deps-{{ checksum "toolchain_key" }}
paths:
- ~/cache/<< parameters.toolchain >>
- run:
name: Install Toolchain
command: |
# Only download if folder does not exist (not cached)
if [ ! -d ~/cache/<< parameters.toolchain >> ]; then
mkdir -p ~/cache/<< parameters.toolchain >>
wget << parameters.toolchain_url>> -O toolchain.tar.gz
tar -C ~/cache/<< parameters.toolchain >> -xaf toolchain.tar.gz
fi
- save_cache:
name: Save Toolchain Cache
key: deps-{{ checksum "toolchain_key" }}
paths:
- ~/cache/<< parameters.toolchain >>
- run:
name: Setup build environment
command: |
echo "export PATH=$PATH:`echo ~/cache/<< parameters.toolchain >>/*/bin`" >> $BASH_ENV
# Install Ninja
NINJA_URL=https://github.com/ninja-build/ninja/releases/download/v1.12.1/ninja-linux.zip
wget $NINJA_URL -O ninja-linux.zip
unzip ninja-linux.zip -d ~/bin
get-deps:
parameters:
family:
type: string
steps:
- run:
name: Make deps cache key
command: |
python tools/get_deps.py --print > deps_key
- restore_cache:
name: Restore Dependencies Cache
key: deps-{{ checksum "deps_key" }}
paths:
- lib/CMSIS_5
- lib/FreeRTOS-Kernel
- lib/lwip
- tools/uf2
- run:
name: Get Dependencies
command: |
python tools/get_deps.py << parameters.family >>
- save_cache:
name: Save Dependencies Cache
key: deps-{{ checksum "deps_key" }}
paths:
- lib/CMSIS_5
- lib/FreeRTOS-Kernel
- lib/lwip
- tools/uf2

jobs:
arm-clang:
parameters:
family:
type: string
build-system:
type: string

docker:
- image: cimg/base:current
resource_class: medium
environment:
TOOLCHAIN_URL: https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/download/release-17.0.1/LLVMEmbeddedToolchainForArm-17.0.1-Linux-x86_64.tar.xz
steps:
- checkout
- setup-toolchain:
toolchain: clang
toolchain_url: $TOOLCHAIN_URL
- get-deps:
family: << parameters.family >>
- run:
name: Build
command: |
# Only build one board per family for non PRs i.e commit to master
ONE_PER_FAMILY=""
if [ -z "$CIRCLE_PULL_REQUEST" ]; then
ONE_PER_FAMILY="--one-per-family"
fi
python tools/build.py $ONE_PER_FAMILY -s << parameters.build-system >> --toolchain clang << parameters.family >>
workflows:
build:
jobs:
- arm-clang:
matrix:
parameters:
build-system:
- cmake
#family: ['stm32f1']
#family: ['stm32f1', 'stm32f2']
family: ['imxrt', 'kinetis_k kinetis_kl kinetis_k32l2', 'lpc11 lpc13 lpc15', 'lpc17 lpc18 lpc40 lpc43', 'lpc51 lpc54 lpc55', 'nrf', 'samd11 samd21 saml2x', 'samd5x_e5x samg', 'stm32f0 stm32f1 stm32f2 stm32f3', 'stm32f4', 'stm32f7', 'stm32g0 stm32g4 stm32h5', 'stm32h7', 'stm32l4 stm32u5 stm32wb']
66 changes: 66 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Generated from CLion C/C++ Code Style settings
BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: None
AlignOperands: Align
AllowAllArgumentsOnNextLine: false
AllowAllConstructorInitializersOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Always
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Always
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterReturnType: None
AlwaysBreakTemplateDeclarations: Yes
BreakBeforeBraces: Custom
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
ColumnLimit: 0
CompactNamespaces: false
ContinuationIndentWidth: 4
IndentCaseLabels: true
IndentPPDirectives: BeforeHash
IndentWidth: 2
KeepEmptyLinesAtTheStartOfBlocks: true
MaxEmptyLinesToKeep: 2
NamespaceIndentation: All
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PointerAlignment: Right
ReflowComments: false
SpaceAfterCStyleCast: true
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 0
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpacesInContainerLiterals: true
SpacesInParentheses: false
SpacesInSquareBrackets: false
TabWidth: 2
UseTab: Never
29 changes: 29 additions & 0 deletions .github/actions/get_deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Get dependencies

inputs:
arg:
description: 'Arguments to get_deps.py'
required: true

runs:
using: "composite"
steps:
- name: Checkout pico-sdk for rp2040
if: contains(inputs.arg, 'rp2040') || contains(inputs.arg, 'raspberry_pi_pico')
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
ref: develop
path: pico-sdk

- name: Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt install -y ninja-build
shell: bash

- name: Get Dependencies
run: |
python3 tools/get_deps.py ${{ inputs.arg }}
echo "PICO_SDK_PATH=${{ github.workspace }}/pico-sdk" >> $GITHUB_ENV
shell: bash
53 changes: 53 additions & 0 deletions .github/actions/setup_toolchain/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Setup Toolchain

inputs:
toolchain:
description: 'Toolchain name'
required: true
toolchain_url:
description: 'Toolchain URL or version'
required: false

outputs:
build_option:
description: 'Build option for the toolchain e.g --toolchain clang'
value: ${{ steps.set-toolchain-option.outputs.build_option }}

runs:
using: "composite"
steps:
- name: Install ARM GCC
if: inputs.toolchain == 'arm-gcc'
uses: carlosperate/arm-none-eabi-gcc-action@v1
with:
release: '12.3.Rel1'

- name: Pull ESP-IDF docker
if: inputs.toolchain == 'esp-idf'
uses: ./.github/actions/setup_toolchain/espressif
with:
toolchain: ${{ inputs.toolchain }}
toolchain_url: ${{ inputs.toolchain_url }}

- name: Download Toolchain
if: >-
inputs.toolchain != 'arm-gcc' &&
inputs.toolchain != 'arm-iar' &&
inputs.toolchain != 'esp-idf'
uses: ./.github/actions/setup_toolchain/download
with:
toolchain: ${{ inputs.toolchain }}
toolchain_url: ${{ inputs.toolchain_url }}

- name: Set toolchain option
id: set-toolchain-option
run: |
BUILD_OPTION=""
if [[ "${{ inputs.toolchain }}" == *"clang"* ]]; then
BUILD_OPTION="--toolchain clang"
elif [[ "${{ inputs.toolchain }}" == "arm-iar" ]]; then
BUILD_OPTION="--toolchain iar"
fi
echo "build_option=$BUILD_OPTION"
echo "build_option=$BUILD_OPTION" >> $GITHUB_OUTPUT
shell: bash
32 changes: 32 additions & 0 deletions .github/actions/setup_toolchain/download/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Download Toolchain

inputs:
toolchain:
description: 'Toolchain name'
required: true
toolchain_url:
description: 'Toolchain URL'
required: true

runs:
using: "composite"
steps:
- name: Cache Toolchain
uses: actions/cache@v4
id: cache-toolchain-download
with:
path: ~/cache/${{ inputs.toolchain }}
key: ${{ runner.os }}-${{ inputs.toolchain }}-${{ inputs.toolchain_url }}

- name: Install Toolchain
if: steps.cache-toolchain-download.outputs.cache-hit != 'true'
run: |
mkdir -p ~/cache/${{ inputs.toolchain }}
wget --progress=dot:mega ${{ inputs.toolchain_url }} -O toolchain.tar.gz
tar -C ~/cache/${{ inputs.toolchain }} -xaf toolchain.tar.gz
shell: bash

- name: Set Toolchain Path
run: |
echo >> $GITHUB_PATH `echo ~/cache/${{ inputs.toolchain }}/*/bin`
shell: bash
42 changes: 42 additions & 0 deletions .github/actions/setup_toolchain/espressif/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Setup ESP-IDF Toolchain

inputs:
toolchain:
description: 'Toolchain name'
required: true
toolchain_url:
description: 'Toolchain URL or version'
required: true

runs:
using: "composite"
steps:
- id: set-docker-image
run: |
DOCKER_IMAGE=$HOME/cache/${{ inputs.toolchain }}/docker_image.tar
echo "DOCKER_IMAGE=$DOCKER_IMAGE" >> $GITHUB_ENV
echo "DOCKER_IMAGE=$DOCKER_IMAGE" >> $GITHUB_OUTPUT
shell: bash

- name: Cache Docker Image
uses: actions/cache@v4
id: cache-toolchain-espressif
with:
path: ${{ steps.set-docker-image.outputs.DOCKER_IMAGE }}
key: ${{ inputs.toolchain }}-${{ inputs.toolchain_url }}

- name: Pull and Save Docker Image
if: steps.cache-toolchain-espressif.outputs.cache-hit != 'true'
run: |
docker pull espressif/idf:${{ inputs.toolchain_url }}
mkdir -p ~/cache/${{ inputs.toolchain }}
docker save -o $DOCKER_IMAGE espressif/idf:${{ inputs.toolchain_url }}
du -sh $DOCKER_IMAGE
shell: bash

- name: Load Docker Image
if: steps.cache-toolchain-espressif.outputs.cache-hit == 'true'
run: |
du -sh $DOCKER_IMAGE
docker load --input $DOCKER_IMAGE
shell: bash
Loading

0 comments on commit 1a5eac8

Please sign in to comment.