Skip to content

Commit 8348631

Browse files
committed
improve esp32 ci, build esp32 with -DDMAX3421_HOST=1 for max3421 testing
revert change in hcd.h
1 parent 6b8933c commit 8348631

File tree

4 files changed

+45
-50
lines changed

4 files changed

+45
-50
lines changed

.github/workflows/build_esp.yml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,10 @@ jobs:
2929
fail-fast: false
3030
matrix:
3131
board:
32-
# Alphabetical order
3332
# ESP32-S2
34-
- 'espressif_saola_1'
33+
- 'espressif_kaluga_1'
3534
# ESP32-S3
36-
#- 'espressif_s3_devkitm'
37-
# S3 compile error with "dangerous relocation: call8: call target out of range: memcpy"
35+
- 'espressif_s3_devkitm'
3836

3937
steps:
4038
- name: Setup Python
@@ -48,20 +46,5 @@ jobs:
4846
- name: Checkout TinyUSB
4947
uses: actions/checkout@v3
5048

51-
- name: Checkout hathach/linkermap
52-
uses: actions/checkout@v3
53-
with:
54-
repository: hathach/linkermap
55-
path: linkermap
56-
5749
- name: Build
5850
run: docker run --rm -v $PWD:/project -w /project espressif/idf:latest python3 tools/build_esp32.py ${{ matrix.board }}
59-
60-
- name: Linker Map
61-
run: |
62-
pip install linkermap/
63-
# find -quit to only print linkermap of 1 board per example
64-
for ex in `ls -d examples/device/*/`
65-
do
66-
find ${ex} -maxdepth 3 -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
67-
done

hw/bsp/espressif/boards/espressif_s3_devkitm/board.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
#define BUTTON_PIN 0
3737
#define BUTTON_STATE_ACTIVE 0
3838

39+
// SPI for USB host shield
40+
#define MAX3421_SPI_HOST SPI2_HOST
41+
#define MAX3421_SCK_PIN 36
42+
#define MAX3421_MOSI_PIN 35
43+
#define MAX3421_MISO_PIN 37
44+
#define MAX3421_CS_PIN 15
45+
#define MAX3421_INTR_PIN 14
46+
3947
#ifdef __cplusplus
4048
}
4149
#endif

src/host/hcd.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ bool hcd_init(uint8_t rhport);
133133
// Interrupt Handler
134134
void hcd_int_handler(uint8_t rhport, bool in_isr);
135135

136-
// Interrupt Hanndler (extended version)
137-
void hcd_int_handler_ext(uint8_t rhport, bool in_isr);
138-
139136
// Enable USB interrupt
140137
void hcd_int_enable (uint8_t rhport);
141138

tools/build_esp32.py

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,18 @@
1717

1818
total_time = time.monotonic()
1919

20-
build_format = '| {:23} | {:30} | {:18} | {:7} | {:6} | {:6} |'
21-
build_separator = '-' * 100
20+
build_format = '| {:30} | {:30} | {:18} | {:7} | {:6} | {:6} |'
21+
build_separator = '-' * 107
2222

2323
def filter_with_input(mylist):
2424
if len(sys.argv) > 1:
2525
input_args = list(set(mylist).intersection(sys.argv))
2626
if len(input_args) > 0:
2727
mylist[:] = input_args
2828

29+
2930
# Build all examples if not specified
30-
all_examples = []
31-
for entry in os.scandir("examples/device"):
32-
# Only includes example with CMakeLists.txt for esp32s, and skip board_test to speed up ci
33-
if entry.is_dir() and os.path.exists(entry.path + "/sdkconfig.defaults") and entry.name != 'board_test':
34-
all_examples.append(entry.name)
31+
all_examples = [entry.replace('examples/', '') for entry in glob.glob("examples/*/*_freertos")]
3532
filter_with_input(all_examples)
3633
all_examples.sort()
3734

@@ -46,32 +43,41 @@ def filter_with_input(mylist):
4643
def build_board(example, board):
4744
global success_count, fail_count, skip_count, exit_status
4845
start_time = time.monotonic()
46+
47+
# Check if board is skipped
48+
build_dir = f"cmake-build/cmake-build-{board}/{example}"
49+
50+
# Generate and build
51+
r = subprocess.run(f"cmake examples/{example} -B {build_dir} -G \"Ninja\" -DBOARD={board} -DMAX3421_HOST=1",
52+
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
53+
if r.returncode == 0:
54+
r = subprocess.run(f"cmake --build {build_dir}", shell=True, stdout=subprocess.PIPE,
55+
stderr=subprocess.STDOUT)
56+
build_duration = time.monotonic() - start_time
4957
flash_size = "-"
5058
sram_size = "-"
5159

52-
# Check if board is skipped
53-
if build_utils.skip_example(example, board):
54-
success = SKIPPED
55-
skip_count += 1
56-
print(build_format.format(example, board, success, '-', flash_size, sram_size))
60+
if r.returncode == 0:
61+
success = SUCCEEDED
62+
success_count += 1
63+
#(flash_size, sram_size) = build_size(example, board)
5764
else:
58-
subprocess.run("make -C examples/device/{} BOARD={} clean".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
59-
build_result = subprocess.run("make -j -C examples/device/{} BOARD={} all".format(example, board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
60-
61-
if build_result.returncode == 0:
62-
success = SUCCEEDED
63-
success_count += 1
64-
(flash_size, sram_size) = build_size(example, board)
65-
else:
66-
exit_status = build_result.returncode
67-
success = FAILED
68-
fail_count += 1
69-
70-
build_duration = time.monotonic() - start_time
71-
print(build_format.format(example, board, success, "{:.2f}s".format(build_duration), flash_size, sram_size))
65+
exit_status = r.returncode
66+
success = FAILED
67+
fail_count += 1
68+
69+
title = build_format.format(example, board, success, "{:.2f}s".format(build_duration), flash_size, sram_size)
70+
if os.getenv('CI'):
71+
# always print build output if in CI
72+
print(f"::group::{title}")
73+
print(r.stdout.decode("utf-8"))
74+
print(f"::endgroup::")
75+
else:
76+
# print build output if failed
77+
print(title)
78+
if r.returncode != 0:
79+
print(r.stdout.decode("utf-8"))
7280

73-
if build_result.returncode != 0:
74-
print(build_result.stdout.decode("utf-8"))
7581

7682
def build_size(example, board):
7783
#elf_file = 'examples/device/{}/_build/{}/{}-firmware.elf'.format(example, board, board)
@@ -82,6 +88,7 @@ def build_size(example, board):
8288
sram_size = int(size_list[1]) + int(size_list[2])
8389
return (flash_size, sram_size)
8490

91+
8592
print(build_separator)
8693
print(build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM'))
8794
print(build_separator)

0 commit comments

Comments
 (0)