chore: add support for dev containers #477
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pslab-firmware | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_call: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
target: [v6, v5, v6_esp01] | |
include: | |
- target: v6 | |
branch: main | |
cmake_flags: '-DCMAKE_BUILD_TYPE=RelWithDebInfo' | |
- target: v5 | |
branch: main | |
cmake_flags: '-DCMAKE_BUILD_TYPE=RelWithDebInfo -DLEGACY_HARDWARE=1' | |
- target: v6_esp01 | |
branch: esp-01 | |
cmake_flags: '-DCMAKE_BUILD_TYPE=RelWithDebInfo' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download project files | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ matrix.branch }} | |
path: ${{ matrix.branch }} | |
- name: Cache Compilers | |
id: cache-compiler | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/mplab-xc | |
key: xc16-v2.10-cache | |
- name: Download XC16 Compiler | |
if: steps.cache-compiler.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p ~/.cache/mplab-xc | |
cd ~/.cache/mplab-xc | |
wget https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc16-v2.10-full-install-linux64-installer.run | |
chmod +x xc16-v2.10-full-install-linux64-installer.run | |
- name: Install XC16 Compiler | |
run: | | |
cd ~/.cache/mplab-xc | |
sudo ./xc16-v2.10-full-install-linux64-installer.run --mode unattended --netservername dontknow | |
- name: Set up cmake-microchip submodules | |
run: | | |
cd ${{ matrix.branch }} | |
git submodule init | |
git submodule update | |
- name: Build firmware | |
run: | | |
cd ${{ matrix.branch }} | |
mkdir build_${{ matrix.target }} | |
cd build_${{ matrix.target }} | |
cmake .. ${{ matrix.cmake_flags}} | |
make | |
- name: Fetch bootloader | |
run: | | |
git clone https://github.com/fossasia/pslab-bootloader.git pslab-bootloader | |
cd pslab-bootloader | |
mkdir build | |
cd build | |
wget https://github.com/fossasia/pslab-bootloader/releases/latest/download/pslab-bootloader.hex | |
- name: Download XC8 Compiler | |
if: steps.cache-compiler.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p ~/.cache/mplab-xc | |
cd ~/.cache/mplab-xc | |
wget https://ww1.microchip.com/downloads/aemDocuments/documents/DEV/ProductDocuments/SoftwareTools/xc8-v3.00-full-install-linux-x64-installer.run | |
chmod +x xc8-v3.00-full-install-linux-x64-installer.run | |
- name: Install XC8 Compiler | |
run: | | |
cd ~/.cache/mplab-xc | |
sudo ./xc8-v3.00-full-install-linux-x64-installer.run --mode unattended --netservername dontknow | |
echo "/opt/microchip/xc8/v3.00/pic/bin" >> $GITHUB_PATH | |
- name: Combine hex files | |
run: | | |
mv ${{ matrix.branch }}/build_${{ matrix.target }}/pslab-firmware.hex pslab-bootloader/build/pslab-firmware.hex | |
cd pslab-bootloader | |
chmod +x combine_hex.sh | |
./combine_hex.sh | |
- name: Publish build files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pslab-firmware_${{ matrix.target}} | |
path: pslab-bootloader/build/combined.hex |