Skip to content

Commit 6f0d0fe

Browse files
committed
fixes build for custom boards
1 parent b52ced5 commit 6f0d0fe

File tree

4 files changed

+27
-28
lines changed

4 files changed

+27
-28
lines changed

builder/esp32.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,8 +1484,9 @@ def compile(*args): # NOQA
14841484

14851485
build_name = f'build-{board}'
14861486

1487-
if board_variant:
1488-
build_name += f'-{board_variant}'
1487+
if custom_board_path is None:
1488+
if board_variant:
1489+
build_name += f'-{board_variant}'
14891490

14901491
full_file_path = (
14911492
f'{SCRIPT_DIR}/lib/micropython/ports/esp32/{build_name}'
@@ -1504,9 +1505,12 @@ def compile(*args): # NOQA
15041505

15051506
scrub_build_folder()
15061507

1507-
build_bin_file = f'build/lvgl_micropy_{build_name[6:]}-{flash_size}'
1508-
if oct_flash:
1509-
build_bin_file += '_OCTFLASH'
1508+
if custom_board_path is None:
1509+
build_bin_file = f'build/lvgl_micropy_{build_name[6:]}-{flash_size}'
1510+
if oct_flash:
1511+
build_bin_file += '_OCTFLASH'
1512+
else:
1513+
build_bin_file = f'build/lvgl_micropy_{build_name[6:]}'
15101514

15111515
build_bin_file += '.bin'
15121516
build_bin_file = os.path.abspath(build_bin_file)

display_configs/LilyGo-TDeck/LilyGo-TDeck.toml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
11
[MCU.esp32]
2-
BOARD = "ESP32_GENERIC_S3"
3-
BOARD_VARIANT = "SPIRAM_OCT"
4-
flash_size = 16
5-
octal_flash = true
6-
enable_cdc_repl = "y"
7-
enable_jtag_repl = "n"
8-
enable_uart_repl = "n"
92
FROZEN_MANIFEST = "display_configs/LilyGo-TDeck/manifest.py"
103

114
[SPI.Bus.spi_bus]
@@ -50,11 +43,10 @@ reg_bits = 8
5043
data_bus = "display_bus"
5144
display_width = 320
5245
display_height = 240
53-
power_pin = 42
5446
backlight_pin = 42
5547
backlight_on_state = "st7789.STATE_PWM"
5648
color_space = "lv.COLOR_FORMAT.RGB565"
57-
color_byte_order = "ili9341.BYTE_ORDER_BGR"
49+
color_byte_order = "st7789.BYTE_ORDER_BGR"
5850
rgb565_byte_swap = true
5951

6052
[display.set_power]
@@ -69,7 +61,7 @@ device = "touch_device"
6961
[keyboard_s3.Keyboard.keyboard]
7062
device = "keyboard_device"
7163

72-
[trackball.TrackBall.trackball]
64+
[trackball.TrackBall.tball]
7365
up_pin = 3
7466
down_pin = 2
7567
left_pin = 15

display_configs/LilyGo-TDeck/power.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import time
55

66

7-
class PowerButton:
7+
class Button:
88

99
def __init__(self, pin):
1010
self._pin = machine.Pin(pin, machine.Pin.IN)

make.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -188,18 +188,6 @@
188188
raise RuntimeError('Frozen manifest does not exist.')
189189

190190

191-
if custom_board_path is not None:
192-
board_name = os.path.split(custom_board_path)[-1]
193-
dst_path = f'lib/micropython/ports/{target}/boards/{board_name}'
194-
if os.path.exists(dst_path):
195-
shutil.rmtree(dst_path)
196-
197-
shutil.copytree(custom_board_path, dst_path)
198-
199-
if board is None or board != board_name:
200-
board = board_name
201-
202-
203191
if lv_cflags is None:
204192
lv_cflags = ''
205193

@@ -217,10 +205,12 @@ def get_submodules():
217205
os.path.join(SCRIPT_DIR, 'lib/micropython/mpy-cross')
218206
):
219207
builder.get_micropython()
208+
220209
if not os.path.exists(
221210
os.path.join(SCRIPT_DIR, 'lib/lvgl/lvgl.h')
222211
):
223212
builder.get_lvgl()
213+
224214
if not os.path.exists(os.path.join(
225215
SCRIPT_DIR, 'lib/pycparser/pycparser')
226216
):
@@ -273,6 +263,19 @@ def create_lvgl_header():
273263

274264
get_submodules()
275265

266+
if custom_board_path is not None:
267+
board_name = os.path.split(custom_board_path)[-1]
268+
dst_path = f'lib/micropython/ports/{target}/boards/{board_name}'
269+
if os.path.exists(dst_path):
270+
shutil.rmtree(dst_path)
271+
272+
shutil.copytree(custom_board_path, dst_path)
273+
274+
if board is None or board != board_name:
275+
board = board_name
276+
277+
mod.custom_board_path = custom_board_path
278+
276279
extra_args, lv_cflags, board = mod.parse_args(extra_args, lv_cflags, board)
277280
extra_args = mod.build_commands(
278281
target, extra_args, SCRIPT_DIR, lv_cflags, board)

0 commit comments

Comments
 (0)