diff --git a/.github/workflows/merge-criteria.yml b/.github/workflows/merge-criteria.yml index 7d60e46e..289bea3a 100644 --- a/.github/workflows/merge-criteria.yml +++ b/.github/workflows/merge-criteria.yml @@ -104,8 +104,13 @@ jobs: run: pio pkg install --global - name: Build - run: platformio run -d ${{ matrix.project }} - + shell: bash + run: | + platformio run -d ${{ matrix.project }} + if [[ "${{ matrix.project }}" == "ground_station" ]]; then + python ${{ matrix.project }}/uf2_loader.py ${{ matrix.project }}/.pio/build/esp32-s2-saola-1/firmware + fi + - name: Generate compile_commands.json run: platformio run -d ${{ matrix.project }} --target compiledb @@ -118,6 +123,7 @@ jobs: with: name: artifacts path: | + ./${{ matrix.project }}/.pio/build/**/firmware.UF2 ./${{ matrix.project }}/.pio/build/**/firmware.bin ./${{ matrix.project }}/.pio/build/**/firmware.elf ./${{ matrix.project }}/.pio/build/**/compile_commands.json diff --git a/ground_station/uf2_loader.py b/ground_station/uf2_loader.py index b33c75a8..c3952f79 100644 --- a/ground_station/uf2_loader.py +++ b/ground_station/uf2_loader.py @@ -291,9 +291,14 @@ def download(self, inputPath): os.remove(tempFilePath) return None - +# If this script is called directly, it converts the .bin binary into the .UF2 binary if __name__ == "__main__": loader = UF2Loader("ESP32S2", 0) - status = loader.download(".pio/build/esp32-s2-saola-1/firmware.bin") + binary_path = ".pio/build/esp32-s2-saola-1/firmware" + # if an argument is passed to the script, use it as the path to the binary + if len(sys.argv) > 1: + binary_path = sys.argv[1] + input = f"{binary_path}.bin" + output = f"{binary_path}.UF2" + status = loader.save(input, output) print(f"Status: {status}") - \ No newline at end of file