Skip to content

Add PIO.h header verification to CI #2911

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

# Consistent style, spelling
astyle:
name: Spelling, Style, Boards, Package
name: Spelling, Style, Boards, Package, PIO
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -21,11 +21,6 @@ jobs:
with:
skip: ./ArduinoCore-API,./libraries/ESP8266SdFat,./libraries/Adafruit_TinyUSB_Arduino,./libraries/LittleFS/lib,./tools/pyserial,./pico-sdk,./.github,./docs/i2s.rst,./cores/rp2040/api,./libraries/FreeRTOS,./tools/libbearssl/bearssl,./include,./libraries/WiFi/examples/BearSSL_Server,./ota/uzlib,./libraries/http-parser/lib,./libraries/WebServer/examples/HelloServerBearSSL/HelloServerBearSSL.ino,./libraries/HTTPUpdateServer/examples/SecureBearSSLUpdater/SecureBearSSLUpdater.ino,./.git,./libraries/FatFS/lib/fatfs,./libraries/FatFS/src/diskio.h,./libraries/FatFS/src/ff.cpp,./libraries/FatFS/src/ffconf.h,./libraries/FatFS/src/ffsystem.cpp,./libraries/FatFS/src/ff.h,./libraries/lwIP_WINC1500/src/driver,./libraries/lwIP_WINC1500/src/common,./libraries/lwIP_WINC1500/src/bus_wrapper,./libraries/lwIP_WINC1500/src/spi_flash
ignore_words_list: ser,dout,shiftIn,acount,froms
- name: Get submodules for following tests
run: git submodule update --init
- name: Check package references
run: |
./tests/ci/pkgrefs_test.sh
- name: Check boards.txt was not edited after makeboards.py
run: |
./tools/makeboards.py
Expand All @@ -38,6 +33,15 @@ jobs:
./tests/restyle.sh
# If anything changed, GIT should return an error and fail the test
git diff --exit-code
- name: Check compiled PIO files
run: |
(cd ./tools && ./get.py)
./tools/makepio.py
# If anything changed, GIT should return an error and fail the test
git diff -w --exit-code
- name: Check package references
run: |
./tests/ci/pkgrefs_test.sh

# Build all examples on linux (core and Arduino IDE)
build-linux:
Expand Down
6 changes: 3 additions & 3 deletions cores/rp2040/tone2.pio.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
#define tone2_pio_version 0

static const uint16_t tone2_program_instructions[] = {
// .wrap_target
// .wrap_target
0x8080, // 0: pull noblock
0xb827, // 1: mov x, osr side 1
0xa047, // 2: mov y, osr
0x0083, // 3: jmp y--, 3
0xb047, // 4: mov y, osr side 0
0x0085, // 5: jmp y--, 5
// .wrap
// .wrap
};

#if !PICO_NO_HARDWARE
static const struct pio_program tone2_program = {
.instructions = tone2_program_instructions,
.length = 6,
.origin = -1,
.pio_version = tone2_pio_version,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
Expand Down
3 changes: 3 additions & 0 deletions libraries/I2S/src/pio_i2s.pio.h
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ static inline pio_sm_config pio_tdm_out_swap_program_get_default_config(uint off

#define pio_tdm_inout_wrap_target 0
#define pio_tdm_inout_wrap 5
#define pio_tdm_inout_pio_version 0

static const uint16_t pio_tdm_inout_program_instructions[] = {
// .wrap_target
Expand Down Expand Up @@ -236,6 +237,7 @@ static inline pio_sm_config pio_tdm_inout_program_get_default_config(uint offset

#define pio_tdm_inout_swap_wrap_target 0
#define pio_tdm_inout_swap_wrap 5
#define pio_tdm_inout_swap_pio_version 0

static const uint16_t pio_tdm_inout_swap_program_instructions[] = {
// .wrap_target
Expand Down Expand Up @@ -659,3 +661,4 @@ static inline void pio_i2s_inout_program_init(PIO pio, uint sm, uint offset, uin
}

#endif

2 changes: 1 addition & 1 deletion libraries/PDM/src/rp2040/pdm.pio
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static inline void pdm_pio_program_init(PIO pio, uint sm, uint offset, uint clkP
pio_sm_set_consecutive_pindirs(pio, sm, dataPin, 1, false);
pio_sm_set_consecutive_pindirs(pio, sm, clkPin, 1, true);
pio_sm_set_pins_with_mask(pio, sm, 0, (1u << clkPin) );
//pio_gpio_init(pio, dataPin);
pio_gpio_init(pio, dataPin);
pio_gpio_init(pio, clkPin);

pio_sm_init(pio, sm, offset, &c);
Expand Down
5 changes: 5 additions & 0 deletions libraries/lwIP_w55rp20/src/wiznet_pio_spi.pio.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#define wiznet_pio_spi_write_read_wrap_target 0
#define wiznet_pio_spi_write_read_wrap 8
#define wiznet_pio_spi_write_read_pio_version 0

#define wiznet_pio_spi_write_read_offset_write_bits 0u
#define wiznet_pio_spi_write_read_offset_write_end 3u
Expand All @@ -38,6 +39,10 @@ static const struct pio_program wiznet_pio_spi_write_read_program = {
.instructions = wiznet_pio_spi_write_read_program_instructions,
.length = 9,
.origin = -1,
.pio_version = 0,
#if PICO_PIO_VERSION > 0
.used_gpio_ranges = 0x0
#endif
};

static inline pio_sm_config wiznet_pio_spi_write_read_program_get_default_config(uint offset) {
Expand Down
21 changes: 21 additions & 0 deletions tools/makepio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env python3

import os
import subprocess

PIOASM="system/pioasm/pioasm"

def recursivepioasm(path):
for root, dirs, files in os.walk(path):
for f in files:
if f.endswith(".pio"):
subprocess.run([PIOASM, "-o", "c-sdk", os.path.join(root, f), os.path.join(root, f) + ".h"])
print(os.path.join(root, f))


def main():
recursivepioasm("cores")
recursivepioasm("libraries")

if __name__ == "__main__":
main()