Skip to content

Commit

Permalink
Merge pull request #365 from shorepine/slowerram
Browse files Browse the repository at this point in the history
slower ram debug build + linux/macos TFB
  • Loading branch information
bwhitman authored Sep 8, 2024
2 parents 64d0c8f + da0a50a commit 79e5147
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 20 deletions.
18 changes: 18 additions & 0 deletions tulip/esp32s3/boards/TULIP4_R11_DEBUG/board.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"deploy": [
"../deploy_s3.md"
],
"docs": "",
"features": [
"BLE",
"WiFi"
],
"images": [
"generic_s3.jpg"
],
"mcu": "esp32s3",
"product": "Tulip CC (R10)",
"thumbnail": "",
"url": "https://www.espressif.com/en/products/modules",
"vendor": "Espressif"
}
20 changes: 20 additions & 0 deletions tulip/esp32s3/boards/TULIP4_R11_DEBUG/mpconfigboard.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
set(IDF_TARGET esp32s3)



set(BOARD_DEFINITION1 TULIP4_R11)
set(BOARD_DEFINITION2 MAKERFABS)

set(SDKCONFIG_DEFAULTS
../../micropython/ports/esp32/boards/sdkconfig.base
../../micropython/ports/esp32/boards/sdkconfig.usb
../../micropython/ports/esp32/boards/sdkconfig.240mhz
boards/sdkconfig.tulip
boards/TULIP4_R11_DEBUG/sdkconfig.board
)

list(APPEND MICROPY_SOURCE_PORT
gt911_touchscreen.c
esp32s3_display.c
usb_keyboard.c
)
12 changes: 12 additions & 0 deletions tulip/esp32s3/boards/TULIP4_R11_DEBUG/mpconfigboard.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "pins.h"
#define MICROPY_HW_BOARD_NAME "TulipCC"
#define MICROPY_HW_MCU_NAME "ESP32S3"

#define MICROPY_PY_MACHINE_DAC (0)

// Enable UART REPL for modules that have an external USB-UART and don't use native USB.
#define MICROPY_HW_ENABLE_UART_REPL (1)


#define MICROPY_HW_I2C0_SCL (I2C_SCL)
#define MICROPY_HW_I2C0_SDA (I2C_SDA)
24 changes: 24 additions & 0 deletions tulip/esp32s3/boards/TULIP4_R11_DEBUG/sdkconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
CONFIG_IDF_EXPERIMENTAL_FEATURES=y
CONFIG_ESPTOOLPY_FLASHSIZE_32MB=y
CONFIG_ESPTOOLPY_FLASHSIZE="32MB"
CONFIG_SPIRAM_MODE_OCT=y

#CONFIG_SPIRAM_SPEED_80M=y
#CONFIG_ESPTOOLPY_FLASHFREQ_120M=y
#CONFIG_ESPTOOLPY_FLASHFREQ="120m"
#CONFIG_ESPTOOLPY_FLASH_SAMPLE_MODE_DTR=y

CONFIG_SPIRAM_SPEED_80M=y
CONFIG_ESPTOOLPY_FLASHFREQ_80M=y
CONFIG_ESPTOOLPY_FLASHFREQ="80m"

CONFIG_ESPTOOLPY_OCT_FLASH=y
CONFIG_ESPTOOLPY_FLASHMODE_QIO=y

CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="boards/N32R8/tulip-partitions-32MB.csv"

CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=n




19 changes: 5 additions & 14 deletions tulip/linux/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,26 +92,17 @@ long heap_size = 4 * 1024 * 1024 * (sizeof(mp_uint_t) / 4);
extern int unix_display_draw();
extern void unix_display_init();


void display_print_strn(void *env, const char *str, size_t len) {
(void)env;
if(len) {
display_tfb_str((char*)str, len, 0, tfb_fg_pal_color, tfb_bg_pal_color);
}
}
extern void mp_uos_dupterm_tx_strn(const char *str, size_t len);

STATIC void stderr_print_strn(void *env, const char *str, size_t len) {
(void)env;
ssize_t ret;
MP_HAL_RETRY_SYSCALL(ret, write(STDERR_FILENO, str, len), {});
mp_uos_dupterm_tx_strn(str, len);
mp_os_dupterm_tx_strn(str, len);
if(len) {
display_tfb_str((unsigned char*)str, len, 0, tfb_fg_pal_color, tfb_bg_pal_color);
}
}

const mp_print_t mp_stderr_print = {NULL, display_print_strn};
const mp_print_t mp_stdout_print = {NULL, display_print_strn};
const mp_print_t mp_sys_stdout_print = {NULL, display_print_strn};
const mp_print_t mp_display_print = {NULL, display_print_strn};
const mp_print_t mp_stderr_print = {NULL, stderr_print_strn};


#define FORCED_EXIT (0x100)
Expand Down
21 changes: 18 additions & 3 deletions tulip/macos/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,28 +92,43 @@ extern int unix_display_draw();
extern void unix_display_init();



/*
extern void mp_uos_dupterm_tx_strn(const char *str, size_t len);
void display_print_strn(void *env, const char *str, size_t len) {
(void)env;
if(len) {
display_tfb_str((unsigned char*)str, len, 0, tfb_fg_pal_color, tfb_bg_pal_color);
}
}
extern void mp_uos_dupterm_tx_strn(const char *str, size_t len);
STATIC void stderr_print_strn(void *env, const char *str, size_t len) {
(void)env;
ssize_t ret;
MP_HAL_RETRY_SYSCALL(ret, write(STDERR_FILENO, str, len), {});
mp_uos_dupterm_tx_strn(str, len);
}
*/


STATIC void stderr_print_strn(void *env, const char *str, size_t len) {
(void)env;
ssize_t ret;
MP_HAL_RETRY_SYSCALL(ret, write(STDERR_FILENO, str, len), {});
mp_os_dupterm_tx_strn(str, len);
if(len) {
display_tfb_str((unsigned char*)str, len, 0, tfb_fg_pal_color, tfb_bg_pal_color);
}
}

const mp_print_t mp_stderr_print = {NULL, stderr_print_strn};

/*
const mp_print_t mp_stderr_print = {NULL, display_print_strn};
const mp_print_t mp_stdout_print = {NULL, display_print_strn};
const mp_print_t mp_sys_stdout_print = {NULL, display_print_strn};
const mp_print_t mp_display_print = {NULL, display_print_strn};

*/

#define FORCED_EXIT (0x100)
// If exc is SystemExit, return value where FORCED_EXIT bit set,
Expand Down
2 changes: 1 addition & 1 deletion tulip/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if [ "$TYPE" == "sys" ]; then
fi

# Otherwise, compile all boards. If upload set, upload them
declare -a boards=("TULIP4_R11" "N16R8" "N32R8" "TDECK")
declare -a boards=("TULIP4_R11" "N16R8" "N32R8" "TDECK", "TULIP4_R11_DEBUG")
for i in "${boards[@]}"
do
rm -rf build
Expand Down
7 changes: 5 additions & 2 deletions tulip/shared/desktop/unix_mphal.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,13 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) {
}
*/

//extern void mp_uos_dupterm_tx_strn(const char *str, size_t len);

void mp_hal_stdout_tx_strn(const char *str, size_t len) {
//MP_HAL_RETRY_SYSCALL(ret, write(STDOUT_FILENO, str, len), {});
//mp_uos_dupterm_tx_strn(str, len);
// TFB log
for(uint16_t i=0;i<len;i++) {
fprintf(stderr, "%c", str[i]);
}
if(len) {
display_tfb_str((unsigned char*)str, len, 0, tfb_fg_pal_color, tfb_bg_pal_color);
}
Expand Down

0 comments on commit 79e5147

Please sign in to comment.