Skip to content

Commit 4615130

Browse files
authored
Merge pull request #433 from shorepine/ulab
ulab included in tulip (only macos desktop for now)
2 parents 83328ae + 41c132a commit 4615130

File tree

301 files changed

+61678
-1577
lines changed

Some content is hidden

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

301 files changed

+61678
-1577
lines changed

tulip/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# Tulip folder structure
22

33
```
4+
amyboard - Tulip (headless) for the AMYboard
5+
amyrepl - micropython build for AMY-included python with no display or tulip stuff
46
esp32s3 - all TulipCC hardware specific files for the supported boards
57
fs - the filesystem that gets flashed as /sys on first run -- examples, images, etc
68
linux - all Tulip Desktop for Linux specific files
79
macos - all Tulip Desktop for macOS specific files
810
shared - code shared between all Tulip ports (hardware & Desktop)
911
shared/py - Python modules that get loaded into Tulip
1012
shared/desktop - code shared between Tulip Desktop ports (macOS, iOS, Linux)
13+
shared/ulab - our fork of ulab, a numpy/scipy wrapper for micropython
1114
web - all Tulip Desktop for Web specific files
1215
```
1316

tulip/amyboard/CMakeLists.txt

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Top-level cmake file for building MicroPython on ESP32.
2+
3+
cmake_minimum_required(VERSION 3.12)
4+
5+
execute_process(COMMAND bash -c "../shared/grab_submodules.sh"
6+
WORKING_DIRECTORY ".."
7+
OUTPUT_VARIABLE GIT_SUBMOD_RESULT)
8+
9+
# We have to do some nasty stuff to get the LVGL MP submodule compiled
10+
# We generate a lvgl.pp.c file, which is just the compiler preprocessor running in this env
11+
execute_process(COMMAND bash -c "xtensa-esp32s3-elf-gcc -E -DLVGL_PREPROCESS -I ../../../lv_binding_micropython_tulip/pycparser/utils/fake_libc_include -I../../../lv_binding_micropython_tulip -I. -I../../../lv_binding_micropython_tulip/lvgl/src ../../../lv_binding_micropython_tulip/lvgl/lvgl.h > ../build/lvgl.pp.c"
12+
WORKING_DIRECTORY "."
13+
)
14+
15+
# Then we run a python script which generates a MP module for LVGL based on the source files (and your conf and stuff)
16+
# This gets compiled into Tulip
17+
execute_process(COMMAND bash -c "python3 ../../../lv_binding_micropython_tulip/gen/gen_mpy.py -M lvgl -MP lv -MD ../build/lv_mpy.json -E ../build/lvgl.pp.c ../../../lv_binding_micropython_tulip/lvgl/lvgl.h > ../build/lv_mpy.c"
18+
WORKING_DIRECTORY "."
19+
)
20+
21+
# We also have to copy over mpconfigport.h
22+
execute_process(COMMAND bash -c "cp ../mpconfigport.h ../../../micropython/ports/esp32/mpconfigport.h" WORKING_DIRECTORY ".")
23+
24+
# Turn this on for debugging submodules
25+
#file(WRITE "submod" "${GIT_SUBMOD_RESULT}")
26+
27+
28+
# Set the board if it's not already set.
29+
if(NOT MICROPY_BOARD)
30+
set(MICROPY_BOARD TULIP4_R11)
31+
endif()
32+
33+
# Set the board directory and check that it exists.
34+
if(NOT MICROPY_BOARD_DIR)
35+
set(MICROPY_BOARD_DIR ${CMAKE_CURRENT_LIST_DIR}/boards/${MICROPY_BOARD})
36+
endif()
37+
if(NOT EXISTS ${MICROPY_BOARD_DIR}/mpconfigboard.cmake)
38+
message(FATAL_ERROR "Invalid MICROPY_BOARD specified: ${MICROPY_BOARD}")
39+
endif()
40+
41+
# Define the output sdkconfig so it goes in the build directory.
42+
set(SDKCONFIG ${CMAKE_BINARY_DIR}/sdkconfig)
43+
44+
# Save the manifest file set from the cmake command line.
45+
set(MICROPY_USER_FROZEN_MANIFEST ${MICROPY_FROZEN_MANIFEST})
46+
47+
# Include board config; this is expected to set (among other options):
48+
# - SDKCONFIG_DEFAULTS
49+
# - IDF_TARGET
50+
include(${MICROPY_BOARD_DIR}/mpconfigboard.cmake)
51+
52+
# Set the frozen manifest file. Note if MICROPY_FROZEN_MANIFEST is set from the cmake
53+
# command line, then it will override the default and any manifest set by the board.
54+
if (MICROPY_USER_FROZEN_MANIFEST)
55+
set(MICROPY_FROZEN_MANIFEST ${MICROPY_USER_FROZEN_MANIFEST})
56+
elseif (NOT MICROPY_FROZEN_MANIFEST)
57+
set(MICROPY_FROZEN_MANIFEST ${CMAKE_CURRENT_LIST_DIR}/boards/manifest.py)
58+
endif()
59+
60+
# Concatenate all sdkconfig files into a combined one for the IDF to use.
61+
file(WRITE ${CMAKE_BINARY_DIR}/sdkconfig.combined.in "")
62+
foreach(SDKCONFIG_DEFAULT ${SDKCONFIG_DEFAULTS})
63+
file(READ ${SDKCONFIG_DEFAULT} CONTENTS)
64+
file(APPEND ${CMAKE_BINARY_DIR}/sdkconfig.combined.in "${CONTENTS}")
65+
endforeach()
66+
configure_file(${CMAKE_BINARY_DIR}/sdkconfig.combined.in ${CMAKE_BINARY_DIR}/sdkconfig.combined COPYONLY)
67+
set(SDKCONFIG_DEFAULTS ${CMAKE_BINARY_DIR}/sdkconfig.combined)
68+
69+
# Include main IDF cmake file.
70+
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
71+
72+
# Set the location of the main component for the project (one per target).
73+
#set(EXTRA_COMPONENT_DIRS main components)
74+
75+
# Define the project.
76+
project(micropython)
77+
idf_build_set_property(COMPILE_OPTIONS "-fdiagnostics-color=always" APPEND)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"deploy": [
3+
"../deploy_s3.md"
4+
],
5+
"docs": "",
6+
"features": [
7+
"BLE",
8+
"WiFi"
9+
],
10+
"images": [
11+
"generic_s3.jpg"
12+
],
13+
"mcu": "esp32s3",
14+
"product": "Tulip CC (R10)",
15+
"thumbnail": "",
16+
"url": "https://www.espressif.com/en/products/modules",
17+
"vendor": "Espressif"
18+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
set(IDF_TARGET esp32s3)
2+
3+
set(MICROPY_PY_TINYUSB ON)
4+
5+
6+
set(BOARD_DEFINITION1 TULIP4_R11)
7+
set(BOARD_DEFINITION2 MAKERFABS)
8+
9+
set(SDKCONFIG_DEFAULTS
10+
../../micropython/ports/esp32/boards/sdkconfig.base
11+
../../micropython/ports/esp32/boards/sdkconfig.usb
12+
../../micropython/ports/esp32/boards/sdkconfig.240mhz
13+
boards/sdkconfig.tulip
14+
boards/N32R8/sdkconfig.board
15+
boards/TULIP4_R11/sdkconfig.board
16+
)
17+
18+
list(APPEND MICROPY_SOURCE_BOARD
19+
gt911_touchscreen.c
20+
esp_lcd_touch_gt911.c
21+
esp32s3_display.c
22+
usb_host.c
23+
)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#include "pins.h"
2+
#define MICROPY_HW_BOARD_NAME "TulipCC"
3+
#define MICROPY_HW_MCU_NAME "ESP32S3"
4+
5+
#define MICROPY_PY_MACHINE_DAC (0)
6+
7+
// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
8+
#define MICROPY_HW_ENABLE_UART_REPL (1)
9+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
I2C_SCL,GPIO9
2+
I2C_SDA,GPIO8
3+
FG_INT,GPIO21
4+
UART0_TX,GPIO43
5+
UART0_RX,GPIO44
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Nothing added to the N32 defaults
2+
3+
4+

tulip/amyboard/boards/manifest.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Just not _boot, we have our own
2+
freeze("$(PORT_DIR)/modules", "apa106.py")
3+
freeze("$(PORT_DIR)/modules", "inisetup.py")
4+
freeze("$(PORT_DIR)/modules", "espnow.py")
5+
freeze("$(PORT_DIR)/modules", "flashbdev.py")
6+
7+
include("$(MPY_DIR)/extmod/asyncio")
8+
9+
# Useful networking-related packages.
10+
#require("mip")
11+
require("ntptime")
12+
#require("webrepl")
13+
14+
# Require some micropython-lib modules.
15+
# require("aioespnow")
16+
require("dht")
17+
require("ds18x20")
18+
require("onewire")
19+
require("umqtt.robust")
20+
require("umqtt.simple")
21+
22+
freeze("$(PORT_DIR)/../shared/py")
23+
freeze("$(MPY_DIR)/../amy", "amy.py")
24+
freeze("$(MPY_DIR)/../amy", "juno.py")
25+
freeze("$(MPY_DIR)/../amy", "amy_wave.py")
26+
freeze("$(MPY_DIR)/../amy/experiments", "tulip_piano.py")
27+
freeze("$(MPY_DIR)/../amy/experiments", "piano_params.py")
28+
29+
#freeze("$(MPY_DIR)/lib/micropython-lib/micropython/utarfile", "utarfile.py")
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
CONFIG_SPIRAM=y
2+
CONFIG_SPIRAM_CACHE_WORKAROUND=y
3+
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
4+
#CONFIG_COMPILER_OPTIMIZATION_SIZE=y
5+
CONFIG_COMPILER_OPTIMIZATION_PERF=y
6+
#CONFIG_COMPILER_OPTIMIZATION_NONE=y
7+
CONFIG_USB_HOST_HUBS_SUPPORTED=y
8+
CONFIG_USB_HOST_HUB_MULTI_LEVEL=y
9+
CONFIG_USB_HOST_EXT_PORT_SUPPORT_LS=y
10+
#CONFIG_FREERTOS_PLACE_FUNCTIONS_INTO_FLASH=n
11+
CONFIG_FREERTOS_HZ=1000
12+
13+
CONFIG_SPIRAM_TYPE_AUTO=y
14+
CONFIG_SPIRAM_CLK_IO=30
15+
CONFIG_SPIRAM_CS_IO=26
16+
CONFIG_SPIRAM_BOOT_INIT=y
17+
CONFIG_SPIRAM_IGNORE_NOTFOUND=y
18+
CONFIG_SPIRAM_USE_CAPS_ALLOC=y
19+
CONFIG_MBEDTLS_EXTERNAL_MEM_ALLOC=y
20+
21+
CONFIG_FREERTOS_USE_TRACE_FACILITY=n
22+
CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS=y
23+
CONFIG_SPIRAM_TRY_ALLOCATE_WIFI_LWIP=y
24+
25+
26+
CONFIG_SPIRAM_FETCH_INSTRUCTIONS=y
27+
CONFIG_SPIRAM_RODATA=y
28+
CONFIG_LCD_RGB_ISR_IRAM_SAFE=n
29+
CONFIG_LCD_RGB_RESTART_IN_VSYNC=y
30+
31+
CONFIG_LWIP_PPP_SUPPORT=n
32+
33+
CONFIG_ESP_TIMER_TASK_STACK_SIZE=8192

0 commit comments

Comments
 (0)