Skip to content

Commit 60d28d6

Browse files
Add PIO.h header verification to CI (#2911)
* Add PIO.h header verification to CI Ensure all PIO .pio.h headers match the .pio sources in the tree * Install all tools for Style check * Clean up mismatched PIO headers No functional changes, but the PDM pdm.pio file did not init a data pin while the pdm.pio.h (the one actually used in the core) did. Correct to match. * No need for submodules in the style check
1 parent e8bd9da commit 60d28d6

File tree

6 files changed

+43
-10
lines changed

6 files changed

+43
-10
lines changed

.github/workflows/pull-request.yml

+10-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010

1111
# Consistent style, spelling
1212
astyle:
13-
name: Spelling, Style, Boards, Package
13+
name: Spelling, Style, Boards, Package, PIO
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
@@ -21,11 +21,6 @@ jobs:
2121
with:
2222
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
2323
ignore_words_list: ser,dout,shiftIn,acount,froms
24-
- name: Get submodules for following tests
25-
run: git submodule update --init
26-
- name: Check package references
27-
run: |
28-
./tests/ci/pkgrefs_test.sh
2924
- name: Check boards.txt was not edited after makeboards.py
3025
run: |
3126
./tools/makeboards.py
@@ -38,6 +33,15 @@ jobs:
3833
./tests/restyle.sh
3934
# If anything changed, GIT should return an error and fail the test
4035
git diff --exit-code
36+
- name: Check compiled PIO files
37+
run: |
38+
(cd ./tools && ./get.py)
39+
./tools/makepio.py
40+
# If anything changed, GIT should return an error and fail the test
41+
git diff -w --exit-code
42+
- name: Check package references
43+
run: |
44+
./tests/ci/pkgrefs_test.sh
4145
4246
# Build all examples on linux (core and Arduino IDE)
4347
build-linux:

cores/rp2040/tone2.pio.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@
1717
#define tone2_pio_version 0
1818

1919
static const uint16_t tone2_program_instructions[] = {
20-
// .wrap_target
20+
// .wrap_target
2121
0x8080, // 0: pull noblock
2222
0xb827, // 1: mov x, osr side 1
2323
0xa047, // 2: mov y, osr
2424
0x0083, // 3: jmp y--, 3
2525
0xb047, // 4: mov y, osr side 0
2626
0x0085, // 5: jmp y--, 5
27-
// .wrap
27+
// .wrap
2828
};
2929

3030
#if !PICO_NO_HARDWARE
3131
static const struct pio_program tone2_program = {
3232
.instructions = tone2_program_instructions,
3333
.length = 6,
3434
.origin = -1,
35-
.pio_version = tone2_pio_version,
35+
.pio_version = 0,
3636
#if PICO_PIO_VERSION > 0
3737
.used_gpio_ranges = 0x0
3838
#endif

libraries/I2S/src/pio_i2s.pio.h

+3
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ static inline pio_sm_config pio_tdm_out_swap_program_get_default_config(uint off
199199

200200
#define pio_tdm_inout_wrap_target 0
201201
#define pio_tdm_inout_wrap 5
202+
#define pio_tdm_inout_pio_version 0
202203

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

237238
#define pio_tdm_inout_swap_wrap_target 0
238239
#define pio_tdm_inout_swap_wrap 5
240+
#define pio_tdm_inout_swap_pio_version 0
239241

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

661663
#endif
664+

libraries/PDM/src/rp2040/pdm.pio

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static inline void pdm_pio_program_init(PIO pio, uint sm, uint offset, uint clkP
3131
pio_sm_set_consecutive_pindirs(pio, sm, dataPin, 1, false);
3232
pio_sm_set_consecutive_pindirs(pio, sm, clkPin, 1, true);
3333
pio_sm_set_pins_with_mask(pio, sm, 0, (1u << clkPin) );
34-
//pio_gpio_init(pio, dataPin);
34+
pio_gpio_init(pio, dataPin);
3535
pio_gpio_init(pio, clkPin);
3636

3737
pio_sm_init(pio, sm, offset, &c);

libraries/lwIP_w55rp20/src/wiznet_pio_spi.pio.h

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#define wiznet_pio_spi_write_read_wrap_target 0
1616
#define wiznet_pio_spi_write_read_wrap 8
17+
#define wiznet_pio_spi_write_read_pio_version 0
1718

1819
#define wiznet_pio_spi_write_read_offset_write_bits 0u
1920
#define wiznet_pio_spi_write_read_offset_write_end 3u
@@ -38,6 +39,10 @@ static const struct pio_program wiznet_pio_spi_write_read_program = {
3839
.instructions = wiznet_pio_spi_write_read_program_instructions,
3940
.length = 9,
4041
.origin = -1,
42+
.pio_version = 0,
43+
#if PICO_PIO_VERSION > 0
44+
.used_gpio_ranges = 0x0
45+
#endif
4146
};
4247

4348
static inline pio_sm_config wiznet_pio_spi_write_read_program_get_default_config(uint offset) {

tools/makepio.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env python3
2+
3+
import os
4+
import subprocess
5+
6+
PIOASM="system/pioasm/pioasm"
7+
8+
def recursivepioasm(path):
9+
for root, dirs, files in os.walk(path):
10+
for f in files:
11+
if f.endswith(".pio"):
12+
subprocess.run([PIOASM, "-o", "c-sdk", os.path.join(root, f), os.path.join(root, f) + ".h"])
13+
print(os.path.join(root, f))
14+
15+
16+
def main():
17+
recursivepioasm("cores")
18+
recursivepioasm("libraries")
19+
20+
if __name__ == "__main__":
21+
main()

0 commit comments

Comments
 (0)