Add watchdog timer to STM32 code #262 #240
This file contains 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: PlatformIO CI | |
on: | |
workflow_dispatch: | |
push: | |
paths-ignore: | |
- "**.md" | |
jobs: | |
job_build_modulecode: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache pip | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: ${{ runner.os }}-pip- | |
- name: Cache PlatformIO | |
uses: actions/cache@v3 | |
with: | |
path: ~/.platformio | |
key: ${{ runner.os }}-platformio-2022-${{ hashFiles('**/lockfiles') }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.local/share/virtualenvs | |
key: ${{ runner.os }}-pipenv-${{ hashFiles('Pipfile.lock') }} | |
restore-keys: ${{ runner.os }}-pipenv- | |
- name: Install PlatformIO | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade platformio | |
- name: Create folders | |
run: | | |
mkdir -p ./ESPController/data/avr | |
mkdir -p ~/OUTPUT | |
mkdir -p ~/OUTPUT/Controller | |
mkdir -p ~/OUTPUT/ControllerBoardTest | |
mkdir -p ~/OUTPUT/Modules/HEX | |
mkdir -p ~/OUTPUT/Modules/BIN | |
pwd | |
ls | |
- name: Build code for ATTINY modules | |
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ATTINYCellModule --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ATTINYCellModule/platformio.ini | |
- name: Copy output | |
run: | | |
cp ./ATTINYCellModule/.pio/build/V*/*.hex ~/OUTPUT/Modules/HEX/ | |
cp ./ATTINYCellModule/.pio/build/V*/*.bin ~/OUTPUT/Modules/BIN/ | |
- name: Build code for STM32 modules | |
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/STM32All-In-One --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/STM32All-In-One/platformio.ini | |
- name: Copy STM32 binary firmware output files | |
run: | | |
cp ./STM32All-In-One/.pio/build/V*/*.bin ~/OUTPUT/Modules/BIN/ | |
- name: Get latest esptool | |
run: | | |
git clone https://github.com/espressif/esptool.git | |
cd esptool | |
pip install --user -e . | |
cd ~ | |
python -m esptool version | |
- name: Build code for ESP32 controller | |
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESPController --environment esp32-devkitc --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESPController/platformio.ini | |
- name: Copy output | |
run: | | |
cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.bin ~/OUTPUT/Controller/ | |
cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.elf ~/OUTPUT/Controller/ | |
cp ./ESPController/.pio/build/esp32-devkitc/partitions.bin ~/OUTPUT/Controller/ | |
cp ./ESPController/.pio/build/esp32-devkitc/bootloader.bin ~/OUTPUT/Controller/ | |
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin ~/OUTPUT/Controller/ | |
cp ./ESPController/data/avr/manifest.json ~/OUTPUT/Modules/ | |
- name: Build File System Image for ESP32 | |
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESPController --target buildfs --environment esp32-devkitc | |
- name: Copy output | |
run: | | |
cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_filesystemimage_espressif32_esp32-devkitc.bin ~/OUTPUT/Controller/ | |
- name: Build single ESP32 image | |
run: | | |
python -m esptool --chip esp32 merge_bin -o ~/OUTPUT/Controller/esp32-controller-firmware-complete.bin --flash_mode=keep --flash_size 4MB 0x1000 ~/OUTPUT/Controller/bootloader.bin 0x8000 ~/OUTPUT/Controller/partitions.bin 0xe000 ~/OUTPUT/Controller/boot_app0.bin 0x10000 ~/OUTPUT/Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin 0x1C0000 ~/OUTPUT/Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin 0x370000 ~/OUTPUT/Controller/diybms_controller_filesystemimage_espressif32_esp32-devkitc.bin | |
- name: Board test code for ESP32 controller | |
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESP32BoardTest --environment esp32-devkitc --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESP32BoardTest/platformio.ini | |
- name: Copy board test output | |
run: | | |
cp ./ESP32BoardTest/.pio/build/esp32-devkitc/diybms_boardtest_espressif32_esp32-devkitc.bin ~/OUTPUT/ControllerBoardTest/ | |
- name: Publish Artifacts 1 | |
uses: actions/upload-artifact@v3 | |
with: | |
name: DIYBMS-Compiled | |
path: ~/OUTPUT | |
if-no-files-found: error | |
job_zip_code: | |
runs-on: ubuntu-latest | |
needs: [job_build_modulecode] | |
steps: | |
- name: Download artifact DIYBMS-Compiled | |
uses: actions/download-artifact@v3 | |
with: | |
name: DIYBMS-Compiled | |
- name: Rename over-the-air firmware | |
run: mv ./Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin ./Controller/esp32-controller-firmware-over-the-air.bin | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: ZIP output for release | |
run: | | |
zip release.zip ./Controller/esp32-controller-firmware-complete.bin | |
zip release.zip ./Controller/esp32-controller-firmware-over-the-air.bin | |
zip release.zip ./ControllerBoardTest/diybms_boardtest_espressif32_esp32-devkitc.bin | |
zip release.zip ./Modules/manifest.json | |
zip release.zip ./Modules/HEX/*.* | |
zip release.zip ./Modules/BIN/module_fw_V490*.* | |
- name: Get current date | |
id: date | |
run: echo "dt=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_ENV | |
- name: Rename ZIP | |
run: mv release.zip release_${{ env.dt }}.zip | |
- name: Publish Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: DIYBMS-Release-Artifact-${{ env.dt }} | |
path: | | |
./Controller/*.* | |
./Modules/manifest.json | |
./Modules/HEX/*.* | |
./Modules/BIN/module_fw_V490*.bin | |
if-no-files-found: error | |
- name: Create Release Files on MASTER branch only | |
id: create_release | |
uses: actions/create-release@v1 | |
if: github.ref == 'refs/heads/master' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | |
with: | |
tag_name: Tag-${{ env.dt }} | |
release_name: Release-${{ env.dt }} | |
body: | | |
Automatically generated release | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
if: github.ref == 'refs/heads/master' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./release_${{ env.dt }}.zip | |
asset_name: Compiled_Firmware_${{ env.dt }}.zip | |
asset_content_type: application/zip |