Skip to content

Commit 75e62ad

Browse files
committed
fix build with pico sdk v2
update ci to use gcc 12
1 parent 0a14a34 commit 75e62ad

File tree

8 files changed

+41
-29
lines changed

8 files changed

+41
-29
lines changed

.github/workflows/build.yml

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,41 +11,23 @@ jobs:
1111
build:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Setup Python
15-
uses: actions/setup-python@v3
16-
1714
- name: Checkout
18-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
16+
17+
- name: Install ARM GCC
18+
uses: carlosperate/arm-none-eabi-gcc-action@v1
19+
with:
20+
release: '12.3.Rel1'
1921

2022
- name: Checkout pico-sdk
2123
run: |
2224
git clone --depth 1 -b develop https://github.com/raspberrypi/pico-sdk ~/pico-sdk
2325
echo >> $GITHUB_ENV PICO_SDK_PATH=~/pico-sdk
24-
# checkout tinyusb in pico-sdk and switch to PR branch
26+
# checkout tinyusb in pico-sdk and switch to master branch
2527
git -C ~/pico-sdk submodule update --init
2628
git -C ~/pico-sdk/lib/tinyusb fetch
2729
git -C ~/pico-sdk/lib/tinyusb checkout master
2830
29-
- name: Set Toolchain URL
30-
run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v10.2.1-1.1/xpack-arm-none-eabi-gcc-10.2.1-1.1-linux-x64.tar.gz
31-
32-
- name: Cache Toolchain
33-
uses: actions/cache@v3
34-
id: cache-toolchain
35-
with:
36-
path: ~/cache/
37-
key: ${{ runner.os }}-22-05-05-${{ env.TOOLCHAIN_URL }}
38-
39-
- name: Install Toolchain
40-
if: steps.cache-toolchain.outputs.cache-hit != 'true'
41-
run: |
42-
mkdir -p ~/cache/toolchain
43-
wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz
44-
tar -C ~/cache/toolchain -xaf toolchain.tar.gz
45-
46-
- name: Set Toolchain Path
47-
run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
48-
4931
- name: Build
5032
run: |
5133
cd examples

.github/workflows/build_arduino.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,8 @@ jobs:
1818

1919
runs-on: ubuntu-latest
2020
steps:
21-
- name: Setup Python
22-
uses: actions/setup-python@v3
23-
2421
- name: Checkout
25-
uses: actions/checkout@v3
22+
uses: actions/checkout@v4
2623

2724
- name: Install Arduino CLI
2825
run: |

examples/capture_hid_report/capture_hid_report.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#include <stdio.h>
33
#include <string.h>
44

5+
#include "hardware/clocks.h"
56
#include "pico/stdlib.h"
67
#include "pico/multicore.h"
78
#include "pico/bootrom.h"

examples/host_hid_to_device_cdc/host_hid_to_device_cdc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include <stdio.h>
3434
#include <string.h>
3535

36+
#include "hardware/clocks.h"
3637
#include "pico/stdlib.h"
3738
#include "pico/multicore.h"
3839
#include "pico/bootrom.h"

examples/test_ll/test_ll.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <string.h>
44
#include <strings.h>
55

6+
#include "hardware/clocks.h"
67
#include "hardware/gpio.h"
78
#include "hardware/sync.h"
89
#include "pico/stdlib.h"

examples/usb_device/usb_device.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <stdio.h>
44
#include <string.h>
55

6+
#include "hardware/clocks.h"
67
#include "pico/stdlib.h"
78
#include "pico/multicore.h"
89
#include "pico/bootrom.h"

src/usb_rx.pio

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,13 @@ J2:
156156
% c-sdk {
157157
#include "hardware/clocks.h"
158158

159+
#if PICO_SDK_VERSION_MAJOR < 2
159160
static __always_inline void pio_sm_set_jmp_pin(PIO pio, uint sm, uint jmp_pin) {
160161
pio->sm[sm].execctrl =
161162
(pio->sm[sm].execctrl & ~PIO_SM0_EXECCTRL_JMP_PIN_BITS) |
162163
(jmp_pin << PIO_SM0_EXECCTRL_JMP_PIN_LSB);
163164
}
165+
#endif
164166

165167
static inline void usb_rx_fs_program_init(PIO pio, uint sm, uint offset, uint pin_dp, uint pin_dm, int pin_debug) {
166168
if (pin_dp < pin_dm) {

src/usb_rx.pio.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#define usb_edge_detector_wrap_target 3
2121
#define usb_edge_detector_wrap 9
22+
#define usb_edge_detector_pio_version 0
2223

2324
static const uint16_t usb_edge_detector_program_instructions[] = {
2425
0xc022, // 0: irq wait 2
@@ -47,6 +48,10 @@ static const struct pio_program usb_edge_detector_program = {
4748
.instructions = usb_edge_detector_program_instructions,
4849
.length = 17,
4950
.origin = -1,
51+
.pio_version = 0,
52+
#if PICO_PIO_VERSION > 0
53+
.used_gpio_ranges = 0x0
54+
#endif
5055
};
5156

5257
static inline pio_sm_config usb_edge_detector_program_get_default_config(uint offset) {
@@ -62,6 +67,7 @@ static inline pio_sm_config usb_edge_detector_program_get_default_config(uint of
6267

6368
#define usb_edge_detector_debug_wrap_target 3
6469
#define usb_edge_detector_debug_wrap 9
70+
#define usb_edge_detector_debug_pio_version 0
6571

6672
static const uint16_t usb_edge_detector_debug_program_instructions[] = {
6773
0xc022, // 0: irq wait 2 side 0
@@ -90,6 +96,10 @@ static const struct pio_program usb_edge_detector_debug_program = {
9096
.instructions = usb_edge_detector_debug_program_instructions,
9197
.length = 17,
9298
.origin = -1,
99+
.pio_version = 0,
100+
#if PICO_PIO_VERSION > 0
101+
.used_gpio_ranges = 0x0
102+
#endif
93103
};
94104

95105
static inline pio_sm_config usb_edge_detector_debug_program_get_default_config(uint offset) {
@@ -106,6 +116,7 @@ static inline pio_sm_config usb_edge_detector_debug_program_get_default_config(u
106116

107117
#define usb_nrzi_decoder_wrap_target 0
108118
#define usb_nrzi_decoder_wrap 6
119+
#define usb_nrzi_decoder_pio_version 0
109120

110121
static const uint16_t usb_nrzi_decoder_program_instructions[] = {
111122
// .wrap_target
@@ -127,6 +138,10 @@ static const struct pio_program usb_nrzi_decoder_program = {
127138
.instructions = usb_nrzi_decoder_program_instructions,
128139
.length = 10,
129140
.origin = -1,
141+
.pio_version = 0,
142+
#if PICO_PIO_VERSION > 0
143+
.used_gpio_ranges = 0x0
144+
#endif
130145
};
131146

132147
static inline pio_sm_config usb_nrzi_decoder_program_get_default_config(uint offset) {
@@ -142,6 +157,7 @@ static inline pio_sm_config usb_nrzi_decoder_program_get_default_config(uint off
142157

143158
#define usb_nrzi_decoder_debug_wrap_target 0
144159
#define usb_nrzi_decoder_debug_wrap 6
160+
#define usb_nrzi_decoder_debug_pio_version 0
145161

146162
static const uint16_t usb_nrzi_decoder_debug_program_instructions[] = {
147163
// .wrap_target
@@ -163,6 +179,10 @@ static const struct pio_program usb_nrzi_decoder_debug_program = {
163179
.instructions = usb_nrzi_decoder_debug_program_instructions,
164180
.length = 10,
165181
.origin = -1,
182+
.pio_version = 0,
183+
#if PICO_PIO_VERSION > 0
184+
.used_gpio_ranges = 0x0
185+
#endif
166186
};
167187

168188
static inline pio_sm_config usb_nrzi_decoder_debug_program_get_default_config(uint offset) {
@@ -173,6 +193,13 @@ static inline pio_sm_config usb_nrzi_decoder_debug_program_get_default_config(ui
173193
}
174194

175195
#include "hardware/clocks.h"
196+
#if PICO_SDK_VERSION_MAJOR < 2
197+
static __always_inline void pio_sm_set_jmp_pin(PIO pio, uint sm, uint jmp_pin) {
198+
pio->sm[sm].execctrl =
199+
(pio->sm[sm].execctrl & ~PIO_SM0_EXECCTRL_JMP_PIN_BITS) |
200+
(jmp_pin << PIO_SM0_EXECCTRL_JMP_PIN_LSB);
201+
}
202+
#endif
176203
static inline void usb_rx_fs_program_init(PIO pio, uint sm, uint offset, uint pin_dp, uint pin_dm, int pin_debug) {
177204
if (pin_dp < pin_dm) {
178205
pio_sm_set_consecutive_pindirs(pio, sm, pin_dp, 2, false);

0 commit comments

Comments
 (0)