Fix ESP32-M5Core2 board build error (#56)

This commit is contained in:
Gabor Peresztegi 2022-07-14 08:00:32 +02:00 committed by GitHub
parent 2e880fb7eb
commit 60f57d2133
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 44 additions and 98 deletions

View File

@ -0,0 +1,25 @@
{
"deploy": [
"../deploy.md"
],
"docs": "https://docs.m5stack.com/en/core/core2",
"features": [
"BLE",
"WiFi",
"SPIRAM",
"IMU",
"RTC",
"PMU",
"SDCard",
"Microphone",
"USB-C"
],
"images": [
"m5core2.jpg"
],
"mcu": "esp32",
"product": "M5Stack Core2",
"thumbnail": "",
"url": "https://m5stack.com/",
"vendor": "M5 Stack"
}

View File

@ -1,2 +1,2 @@
freeze("modules")
include("$(PORT_DIR)/boards/manifest.py")
freeze("./modules")

View File

@ -1,88 +0,0 @@
import uos
from flashbdev import bdev
import lvgl as lv
def check_bootsec():
buf = bytearray(bdev.ioctl(5, 0)) # 5 is SEC_SIZE
bdev.readblocks(0, buf)
empty = True
for b in buf:
if b != 0xFF:
empty = False
break
if empty:
return True
fs_corrupted()
def fs_corrupted():
import time
while 1:
print(
"""\
The filesystem appears to be corrupted. If you had important data there, you
may want to make a flash snapshot to try to recover it. Otherwise, perform
factory reprogramming of MicroPython firmware (completely erase flash, followed
by firmware programming).
"""
)
time.sleep(3)
def setup():
check_bootsec()
print("Performing initial setup")
uos.VfsLfs2.mkfs(bdev)
vfs = uos.VfsLfs2(bdev)
uos.mount(vfs, "/")
with open("boot.py", "w") as f:
f.write(
"""\
# This file is executed on every boot (including wake-boot from deepsleep)
#import esp
#esp.osdebug(None)
#import webrepl
#webrepl.start()
# Init LVGL
import lvgl as lv
lv.init()
# Power Management
from m5core2_power import Power
power = Power()
# LCD screen
from ili9XXX import ili9341
lcd = ili9341(mosi=23, miso=38, clk=18, dc=15, cs=5, invert=True, rot=0x10, width=320, height=240, rst=-1, power=-1, backlight=-1)
# Touch sensor
from ft6x36 import ft6x36
touch = ft6x36(width=320, height=280)
"""
)
with open("board.py", "w") as f:
f.write(
"""\
name = "m5core2"
"""
)
with open("main.py", "w") as f:
f.write(
"""\
import lvgl as lv
scr = lv.obj()
btn = lv.btn(scr)
btn.align(lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text("Button")
lv.scr_load(scr)
"""
)
return vfs

View File

@ -0,0 +1,18 @@
name = "m5core2"
def init():
# Init LVGL
import lvgl as lv
lv.init()
# Power Management
from power import Power
Power()
# LCD screen
from ili9XXX import ili9341
ili9341(mosi=23, miso=38, clk=18, dc=15, cs=5, invert=True, rot=0x10, width=320, height=240, rst=-1, power=-1, backlight=-1)
# Touch sensor
from ft6x36 import ft6x36
ft6x36(width=320, height=280)

View File

@ -1,9 +0,0 @@
SDKCONFIG += boards/sdkconfig.base
SDKCONFIG += boards/sdkconfig.spiram
SDKCONFIG += boards/sdkconfig.240mhz
SDKCONFIG += boards/M5CORE2/sdkconfig.board
FROZEN_MANIFEST ?= $(BOARD_DIR)/manifest.py
PART_SRC = $(BOARD_DIR)/partitions.csv
LV_CFLAGS = -DLV_COLOR_DEPTH=16 -DLV_COLOR_16_SWAP=1