Skip to content

Commit

Permalink
[GS] Export UF2 file when calling uf2_loader.py script
Browse files Browse the repository at this point in the history
  • Loading branch information
stojadin2701 committed Aug 10, 2023
1 parent 5562c35 commit e9570bc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/merge-criteria.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ jobs:

- name: Build
run: platformio run -d ${{ matrix.project }}

- name: (Ground station) Generate UF2 file
if: ${{ matrix.project }} == 'ground_station'
run: ${{ matrix.project }}/uf2_loader.py ${{ matrix.project }}/.pio/build/esp32-s2-saola-1/firmware

- name: Generate compile_commands.json
run: platformio run -d ${{ matrix.project }} --target compiledb
Expand All @@ -118,6 +122,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
Expand Down
11 changes: 8 additions & 3 deletions ground_station/uf2_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

0 comments on commit e9570bc

Please sign in to comment.