Skip to content

Commit f7f3a99

Browse files
committed
Initial commit
0 parents  commit f7f3a99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2896
-0
lines changed

.gitignore

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Compiled Sources
2+
###################
3+
*.o
4+
*.a
5+
*.elf
6+
*.bin
7+
*.map
8+
*.hex
9+
*.dis
10+
*.exe
11+
12+
# Packages
13+
############
14+
15+
# Logs and Databases
16+
######################
17+
*.log
18+
19+
# VIM Swap Files
20+
######################
21+
*.swp
22+
23+
# Build directories
24+
######################
25+
build/
26+
build-*/
27+
28+
# Test failure outputs
29+
######################
30+
tests/results/*
31+
32+
# Python cache files
33+
######################
34+
__pycache__/
35+
*.pyc
36+
37+
# Customized Makefile/project overrides
38+
######################
39+
GNUmakefile
40+
user.props
41+
42+
# Generated rst files
43+
######################
44+
genrst/
45+
46+
# MacOS desktop metadata files
47+
######################
48+
.DS_Store
49+
50+
.vscode/

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "micropython"]
2+
path = micropython
3+
url = https://github.com/micropython/micropython

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# uiflow_micropython
2+
3+
## build
4+
5+
```shell
6+
git clone https://github.com/m5stack/uiflow_micropython --recursive
7+
cd uiflow_micropython/m5stack
8+
make submodules
9+
make mpy-cross
10+
make -j
11+
make deploy PORT=/dev/ttyUSBx BAUD=1500000
12+
```

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# uiflow-micropyton api docs

m5stack/CMakeLists.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Top-level cmake file for building MicroPython on ESP32.
2+
3+
cmake_minimum_required(VERSION 3.12)
4+
5+
# Set the location of this port's directory.
6+
set(MICROPY_PORT_DIR ${CMAKE_SOURCE_DIR}/../micropython/ports/esp32)
7+
8+
# Set the board if it's not already set.
9+
if(NOT MICROPY_BOARD)
10+
set(MICROPY_BOARD m5stack)
11+
endif()
12+
13+
# Set the board directory and check that it exists.
14+
if(NOT MICROPY_BOARD_DIR)
15+
set(MICROPY_BOARD_DIR ${CMAKE_SOURCE_DIR}/boards/${MICROPY_BOARD})
16+
endif()
17+
if(NOT EXISTS ${MICROPY_BOARD_DIR}/mpconfigboard.cmake)
18+
message(FATAL_ERROR "Invalid MICROPY_BOARD specified: ${MICROPY_BOARD}")
19+
endif()
20+
21+
# Define the output sdkconfig so it goes in the build directory.
22+
set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig)
23+
24+
# Include board config; this is expected to set SDKCONFIG_DEFAULTS (among other options).
25+
include(${MICROPY_BOARD_DIR}/mpconfigboard.cmake)
26+
27+
# Concatenate all sdkconfig files into a combined one for the IDF to use.
28+
file(WRITE ${CMAKE_BINARY_DIR}/sdkconfig.combined.in "")
29+
foreach(SDKCONFIG_DEFAULT ${SDKCONFIG_DEFAULTS})
30+
file(READ ${SDKCONFIG_DEFAULT} CONTENTS)
31+
file(APPEND ${CMAKE_BINARY_DIR}/sdkconfig.combined.in "${CONTENTS}")
32+
endforeach()
33+
configure_file(${CMAKE_BINARY_DIR}/sdkconfig.combined.in ${CMAKE_BINARY_DIR}/sdkconfig.combined COPYONLY)
34+
set(SDKCONFIG_DEFAULTS ${CMAKE_BINARY_DIR}/sdkconfig.combined)
35+
36+
# Include main IDF cmake file and define the project.
37+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
38+
project(micropython)

m5stack/Makefile

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Makefile for MicroPython on ESP32.
2+
#
3+
# This is a simple, convenience wrapper around idf.py (which uses cmake).
4+
5+
# Select the board to build for, defaulting to GENERIC.
6+
BOARD ?= m5stack
7+
8+
# If the build directory is not given, make it reflect the board name.
9+
BUILD ?= build-$(BOARD)
10+
11+
# Device serial settings.
12+
#PORT ?= /dev/ttyS8
13+
PORT ?= /dev/ttyUSB0
14+
BAUD ?= 1500000
15+
16+
PYTHON ?= python3
17+
18+
GIT_SUBMODULES = lib/berkeley-db-1.xx
19+
20+
.PHONY: all clean deploy erase submodules FORCE
21+
22+
MAKEFILE_DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
23+
24+
USER_C_MODULES = $(MAKEFILE_DIR)/cmodules/cmodules.cmake
25+
26+
CMAKE_ARGS =
27+
28+
ifdef USER_C_MODULES
29+
CMAKE_ARGS += -DUSER_C_MODULES=${USER_C_MODULES}
30+
endif
31+
32+
IDFPY_FLAGS += -D MICROPY_BOARD=$(BOARD) -B $(BUILD) $(CMAKE_ARGS)
33+
34+
ifdef FROZEN_MANIFEST
35+
IDFPY_FLAGS += -D MICROPY_FROZEN_MANIFEST=$(FROZEN_MANIFEST)
36+
endif
37+
38+
all:
39+
idf.py $(IDFPY_FLAGS) build
40+
@$(PYTHON) makeimg.py \
41+
$(BUILD)/sdkconfig \
42+
$(BUILD)/bootloader/bootloader.bin \
43+
$(BUILD)/partition_table/partition-table.bin \
44+
$(BUILD)/micropython.bin \
45+
$(BUILD)/firmware.bin
46+
47+
$(BUILD)/bootloader/bootloader.bin $(BUILD)/partition_table/partition-table.bin $(BUILD)/micropython.bin: FORCE
48+
49+
clean:
50+
idf.py $(IDFPY_FLAGS) fullclean
51+
52+
deploy:
53+
idf.py $(IDFPY_FLAGS) -p $(PORT) -b $(BAUD) flash
54+
55+
monitor:
56+
idf.py $(IDFPY_FLAGS) -p $(PORT) -b $(BAUD) monitor
57+
58+
erase:
59+
idf.py $(IDFPY_FLAGS) -p $(PORT) -b $(BAUD) erase_flash
60+
61+
mpy-cross:
62+
make -C ../micropython/mpy-cross
63+
64+
submodules:
65+
cd ./../micropython && git submodule update --init $(addprefix ./,$(GIT_SUBMODULES)) && cd -

m5stack/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# micropython m5stack port
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
set(SDKCONFIG_DEFAULTS
2+
./boards/sdkconfig.base
3+
./boards/sdkconfig.ble
4+
./boards/sdkconfig.spiram
5+
./boards/sdkconfig.240mhz
6+
./boards/sdkconfig.disable_iram
7+
)
8+
9+
if(NOT MICROPY_FROZEN_MANIFEST)
10+
set(MICROPY_FROZEN_MANIFEST ${CMAKE_SOURCE_DIR}/boards/manifest.py)
11+
endif()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#define MICROPY_HW_BOARD_NAME "M5STACK"
2+
#define MICROPY_HW_MCU_NAME "ESP32"

m5stack/boards/manifest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
freeze("$(MPY_DIR)/../m5stack/modules")
2+
freeze("$(MPY_DIR)/tools", ("upip.py", "upip_utarfile.py"))
3+
freeze("$(MPY_DIR)/ports/esp8266/modules", "ntptime.py")
4+
freeze("$(MPY_DIR)/drivers/dht", "dht.py")
5+
freeze("$(MPY_DIR)/drivers/onewire")
6+
include("$(MPY_DIR)/extmod/uasyncio/manifest.py")
7+
include("$(MPY_DIR)/extmod/webrepl/manifest.py")
8+
include("$(MPY_DIR)/drivers/neopixel/manifest.py")

0 commit comments

Comments
 (0)