Skip to content

Commit 07927b4

Browse files
committed
feature/T-CALL: Add T-PicoC3 board
Signed-off-by: liangyingy <[email protected]>
1 parent 9293d59 commit 07927b4

File tree

8 files changed

+204
-14
lines changed

8 files changed

+204
-14
lines changed

README.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,27 @@ $ cp config_T5-4.7 config
2626
$ make
2727
```
2828

29-
### T-T-CALL SIM800
29+
### T-CALL SIM800
3030

3131
```shell
3232
$ cp config_T-CALL config
3333
$ make
3434
```
3535

36+
### T-PicoC3
37+
38+
```shell
39+
$ cp config_T-PicoC3 config
40+
$ sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential
41+
$ make
42+
```
43+
3644
## Supported Boards
3745

38-
- TTGO T-SIM7000G
39-
- TTGO T5-4.7
40-
- TTGO T-T-CALL SIM800
46+
- LilyGo T-SIM7000G
47+
- LilyGo T5-4.7
48+
- LilyGo T-T-CALL SIM800
49+
- LilyGo T-PicoC3
4150

4251
## Modules
4352

config_T-PicoC3

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
CONFIG_TARGET=rp2
2+
CONFIG_BOARD=LILYGO_T_PicoC3

extmod/micropython.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,8 @@ endif()
99

1010
if(EXTMOD_GSM)
1111
include(${CMAKE_CURRENT_LIST_DIR}/network/gsm/src/micropython.cmake)
12+
endif()
13+
14+
if(EXTMOD_ST7789)
15+
include(${CMAKE_CURRENT_LIST_DIR}/display/st7789/src/micropython.cmake)
1216
endif()

include/package.mk

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@ endef
3434
##
3535
##
3636
define Package/patches
37+
cd $(1) ; \
38+
quilt import $(2)/* ; \
39+
quilt push -a ; \
40+
cd - ; \
3741
for patch in `ls $(2)` ; \
3842
do \
3943
if [ ! -e $(1)/prereq_$$patch ]; then \
40-
cd $(1) && \
41-
git apply --stat $(2)/$$patch && \
42-
git apply --check $(2)/$$patch && \
43-
git apply $(2)/$$patch && \
44-
cd - && \
4544
touch $(1)/prereq_$$patch ; \
4645
fi ; \
4746
done

micropython/micropython.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ endef
1212

1313
define micropython/prereq
1414
$(eval $(micropython/info))
15-
$(call Package/prereq,$(BUILD_DIR))
16-
$(call Package/patches,$(BUILD_DIR)/$(PKG_NAME),$(TOP_DIR)/$(PKG_NAME)/patches)
15+
$(call Package/prereq,$(TARGET_BUILD_DIR))
16+
$(call Package/patches,$(TARGET_BUILD_DIR)/$(PKG_NAME),$(TOP_DIR)/$(PKG_NAME)/patches)
1717
endef
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
Index: micropython/lib/pico-sdk/src/boards/include/boards/lilygo_t_picoc3.h
2+
===================================================================
3+
--- /dev/null
4+
+++ micropython/lib/pico-sdk/src/boards/include/boards/lilygo_t_picoc3.h
5+
@@ -0,0 +1,84 @@
6+
+/*
7+
+ * Copyright (c) 2020 Raspberry Pi (Trading) Ltd.
8+
+ *
9+
+ * SPDX-License-Identifier: BSD-3-Clause
10+
+ */
11+
+
12+
+// -----------------------------------------------------
13+
+// NOTE: THIS HEADER IS ALSO INCLUDED BY ASSEMBLER SO
14+
+// SHOULD ONLY CONSIST OF PREPROCESSOR DIRECTIVES
15+
+// -----------------------------------------------------
16+
+
17+
+// This header may be included by other board headers as "boards/pico.h"
18+
+
19+
+#ifndef _BOARDS_PICO_H
20+
+#define _BOARDS_PICO_H
21+
+
22+
+// For board detection
23+
+#define RASPBERRYPI_PICO
24+
+
25+
+// --- UART ---
26+
+#ifndef PICO_DEFAULT_UART
27+
+#define PICO_DEFAULT_UART 0
28+
+#endif
29+
+#ifndef PICO_DEFAULT_UART_TX_PIN
30+
+#define PICO_DEFAULT_UART_TX_PIN 0
31+
+#endif
32+
+#ifndef PICO_DEFAULT_UART_RX_PIN
33+
+#define PICO_DEFAULT_UART_RX_PIN 1
34+
+#endif
35+
+
36+
+// --- LED ---
37+
+#ifndef PICO_DEFAULT_LED_PIN
38+
+#define PICO_DEFAULT_LED_PIN 25
39+
+#endif
40+
+// no PICO_DEFAULT_WS2812_PIN
41+
+
42+
+// --- I2C ---
43+
+#ifndef PICO_DEFAULT_I2C
44+
+#define PICO_DEFAULT_I2C 0
45+
+#endif
46+
+#ifndef PICO_DEFAULT_I2C_SDA_PIN
47+
+#define PICO_DEFAULT_I2C_SDA_PIN 4
48+
+#endif
49+
+#ifndef PICO_DEFAULT_I2C_SCL_PIN
50+
+#define PICO_DEFAULT_I2C_SCL_PIN 5
51+
+#endif
52+
+
53+
+// --- SPI ---
54+
+#ifndef PICO_DEFAULT_SPI
55+
+#define PICO_DEFAULT_SPI 0
56+
+#endif
57+
+#ifndef PICO_DEFAULT_SPI_SCK_PIN
58+
+#define PICO_DEFAULT_SPI_SCK_PIN 18
59+
+#endif
60+
+#ifndef PICO_DEFAULT_SPI_TX_PIN
61+
+#define PICO_DEFAULT_SPI_TX_PIN 19
62+
+#endif
63+
+#ifndef PICO_DEFAULT_SPI_RX_PIN
64+
+#define PICO_DEFAULT_SPI_RX_PIN 16
65+
+#endif
66+
+#ifndef PICO_DEFAULT_SPI_CSN_PIN
67+
+#define PICO_DEFAULT_SPI_CSN_PIN 17
68+
+#endif
69+
+
70+
+// --- FLASH ---
71+
+
72+
+#define PICO_BOOT_STAGE2_CHOOSE_W25Q080 1
73+
+
74+
+#ifndef PICO_FLASH_SPI_CLKDIV
75+
+#define PICO_FLASH_SPI_CLKDIV 2
76+
+#endif
77+
+
78+
+#ifndef PICO_FLASH_SIZE_BYTES
79+
+#define PICO_FLASH_SIZE_BYTES (2 * 1024 * 1024)
80+
+#endif
81+
+
82+
+// Drive high to force power supply into PWM mode (lower ripple on 3V3 at light loads)
83+
+#define PICO_SMPS_MODE_PIN 23
84+
+
85+
+#ifndef PICO_RP2040_B0_SUPPORTED
86+
+#define PICO_RP2040_B0_SUPPORTED 1
87+
+#endif
88+
+
89+
+#endif
90+
Index: micropython/ports/rp2/boards/LILYGO_T_PicoC3/board.json
91+
===================================================================
92+
--- /dev/null
93+
+++ micropython/ports/rp2/boards/LILYGO_T_PicoC3/board.json
94+
@@ -0,0 +1,23 @@
95+
+{
96+
+ "deploy": [
97+
+ "../deploy.md"
98+
+ ],
99+
+ "docs": "",
100+
+ "features": [
101+
+ "WiFi ESP32-C3",
102+
+ "Bluetooth ESP32-C3",
103+
+ "LCD ST7789",
104+
+ "SPI Flash 4MB",
105+
+ "Battery",
106+
+ "USB TYPE-C"
107+
+ ],
108+
+ "id": "rp2-pico",
109+
+ "images": [
110+
+ "rp2-pico.jpg"
111+
+ ],
112+
+ "mcu": "rp2040",
113+
+ "product": "Pico",
114+
+ "thumbnail": "",
115+
+ "url": "https://www.raspberrypi.org/products/raspberry-pi-pico/",
116+
+ "vendor": "Raspberry Pi"
117+
+}
118+
Index: micropython/ports/rp2/boards/LILYGO_T_PicoC3/mpconfigboard.cmake
119+
===================================================================
120+
--- /dev/null
121+
+++ micropython/ports/rp2/boards/LILYGO_T_PicoC3/mpconfigboard.cmake
122+
@@ -0,0 +1,2 @@
123+
+# cmake file for Raspberry Pi Pico
124+
+set(EXTMOD_ST7789 1)
125+
\ No newline at end of file
126+
Index: micropython/ports/rp2/boards/LILYGO_T_PicoC3/mpconfigboard.h
127+
===================================================================
128+
--- /dev/null
129+
+++ micropython/ports/rp2/boards/LILYGO_T_PicoC3/mpconfigboard.h
130+
@@ -0,0 +1,3 @@
131+
+// Board and hardware specific configuration
132+
+#define MICROPY_HW_BOARD_NAME "Raspberry Pi Pico"
133+
+#define MICROPY_HW_FLASH_STORAGE_BYTES (1408 * 1024)

target/esp32.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ endef
2828
define esp32/compile
2929
$(TARGET_BUILD_DIR)/esp-idf/install.sh
3030
. $(TARGET_BUILD_DIR)/esp-idf/export.sh && \
31-
make -C $(BUILD_DIR)/micropython/ports/esp32 \
32-
BOARD=$(BOARD) BUILD=$(BUILD_DIR)/$(TARGET)/$(BOARD) \
31+
make -C $(TARGET_BUILD_DIR)/micropython/ports/esp32 \
32+
BOARD=$(BOARD) BUILD=$(TARGET_BUILD_DIR)/$(BOARD) \
3333
USER_C_MODULES=$(TOP_DIR)/extmod/micropython.cmake \
3434
EXTMOD_FROZEN_DIR=$(TOP_DIR)/extmod
3535
endef
@@ -38,7 +38,7 @@ endef
3838
define esp32/install
3939
[ -d $(BIN_DIR) ] && mkdir -p $(BIN_DIR)/esp32/$(BOARD)
4040
img_name=LilyGo-MicroPython_$(TARGET)_$(BOARD) && \
41-
cd $(BUILD_DIR)/micropython && \
41+
cd $(TARGET_BUILD_DIR)/micropython && \
4242
micropython_version=`git show -s --pretty=format:%h` && \
4343
img_name=$${img_name}_MPY-$${micropython_version} && \
4444
cd $(TARGET_BUILD_DIR)/$(PKG_NAME) && \

target/rp2.mk

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
2+
include $(INCLUDE_DIR)/download.mk
3+
include $(INCLUDE_DIR)/package.mk
4+
5+
define rp2/info
6+
PKG_NAME:=
7+
PKG_SOURCE_URL:=
8+
PKG_SOURCE_PROTO:=
9+
PKG_SOURCE_VERSION:=
10+
PKG_SOURCE_MD5:=
11+
endef
12+
13+
# $(call DownloadMethod/git,$(PKG_NAME),$(PKG_SOURCE_URL),$(PKG_SOURCE_VERSION)) ;
14+
define rp2/prereq
15+
# sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential
16+
@echo "Please pre-install gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential"
17+
endef
18+
19+
##
20+
## $(1) MODULES
21+
##
22+
define rp2/compile
23+
make -C $(TARGET_BUILD_DIR)/micropython/mpy-cross && \
24+
cd $(TARGET_BUILD_DIR)/micropython/ports/rp2 && \
25+
make BOARD=$(BOARD) BUILD=$(BUILD_DIR)/$(TARGET)/$(BOARD) \
26+
USER_C_MODULES=$(TOP_DIR)/extmod/micropython.cmake \
27+
EXTMOD_FROZEN_DIR=$(TOP_DIR)/extmod && \
28+
cd -
29+
endef
30+
31+
32+
define rp2/install
33+
[ -d $(BIN_DIR) ] && mkdir -p $(BIN_DIR)/rp2/$(BOARD)
34+
img_name=LilyGo-MicroPython_$(TARGET)_$(BOARD) && \
35+
cd $(TARGET_BUILD_DIR)/micropython && \
36+
micropython_version=`git show -s --pretty=format:%h` && \
37+
img_name=$${img_name}_MPY-$${micropython_version} && \
38+
time=`date +"%Y%m%d"` && \
39+
img_name=$${img_name}_B$${time} && \
40+
md5=`md5sum $(TARGET_BUILD_DIR)/$(BOARD)/firmware.bin | awk '{print $$1}'` && \
41+
img_name=$${img_name}_$${md5:0:10} && \
42+
cp $(TARGET_BUILD_DIR)/$(BOARD)/firmware.uf2 $(BIN_DIR)/rp2/$(BOARD)/$${img_name}.uf2
43+
endef

0 commit comments

Comments
 (0)