Builds and sort of runs. Some modules not yet supported

This commit is contained in:
Philip Gladstone 2024-12-09 02:03:07 +00:00
parent 7c5bb15154
commit 83cfea9d08
8 changed files with 26 additions and 16 deletions

View File

@ -2,6 +2,6 @@ idf_component_register(
SRCS "ip_fmt.c" "user_main.c"
INCLUDE_DIRS "include"
REQUIRES "lua"
PRIV_REQUIRES "nvs_flash" "spiffs" "esp_netif" "driver" "vfs"
PRIV_REQUIRES "nvs_flash" "spiffs" "esp_netif" "driver" "vfs" "esp_vfs_console"
LDFRAGMENTS "nodemcu.lf"
)

View File

@ -23,6 +23,7 @@
#include "esp_vfs_cdcacm.h"
#include "esp_vfs_usb_serial_jtag.h"
#include "driver/usb_serial_jtag.h"
#include "driver/uart_vfs.h"
#include "nvs_flash.h"
#include "task/task.h"
@ -230,10 +231,9 @@ static void console_init(void)
#if CONFIG_ESP_CONSOLE_UART_DEFAULT || CONFIG_ESP_CONSOLE_UART_CUSTOM
/* Based on console/advanced example */
esp_vfs_dev_uart_port_set_rx_line_endings(
uart_vfs_dev_port_set_rx_line_endings(
CONFIG_ESP_CONSOLE_UART_NUM, RX_LINE_ENDINGS_CFG);
esp_vfs_dev_uart_port_set_tx_line_endings(
uart_vfs_dev_port_set_tx_line_endings(
CONFIG_ESP_CONSOLE_UART_NUM, TX_LINE_ENDINGS_CFG);
/* Configure UART. Note that REF_TICK is used so that the baud rate remains
@ -255,7 +255,7 @@ static void console_init(void)
uart_param_config(CONFIG_ESP_CONSOLE_UART_NUM, &uart_config);
/* Tell VFS to use UART driver */
esp_vfs_dev_uart_use_driver(CONFIG_ESP_CONSOLE_UART_NUM);
uart_vfs_dev_use_driver(CONFIG_ESP_CONSOLE_UART_NUM);
#elif CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG
/* Based on @pjsg's work */

View File

@ -79,6 +79,14 @@ elseif(IDF_TARGET STREQUAL "esp32c3")
list(APPEND module_srcs
${wifi_modules}
)
elseif(IDF_TARGET STREQUAL "esp32c5")
list(APPEND module_srcs
# "can.c"
# "i2s.c"
# "pulsecnt.c"
# "sdmmc.c"
${wifi_modules}
)
elseif(IDF_TARGET STREQUAL "esp32c6")
list(APPEND module_srcs
"dac.c"
@ -97,7 +105,6 @@ idf_component_register(
"app_update"
"base_nodemcu"
"bt"
"driver_can"
"esp_eth"
"esp_http_client"
"esp_http_server"

View File

@ -16,7 +16,7 @@ static int lht_init(lua_State *L)
heap_trace_stop();
free(buffer);
buffer = calloc(sizeof(heap_trace_record_t), records);
buffer = calloc(records, sizeof(heap_trace_record_t));
if (!buffer)
return luaL_error(L, "out of memory");

View File

@ -116,13 +116,13 @@ static int node_bootreason( lua_State *L)
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32H2)
case GLITCH_RTC_RESET:
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
#if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C5)
case EFUSE_RESET:
#endif
#if defined(CONFIG_IDF_TARGET_ESP32C6)
#if defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32C5)
case JTAG_RESET:
#endif
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2)
#if defined(CONFIG_IDF_TARGET_ESP32S3) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32C6) || defined(CONFIG_IDF_TARGET_ESP32H2) || defined(CONFIG_IDF_TARGET_ESP32C5)
case USB_UART_CHIP_RESET:
case USB_JTAG_CHIP_RESET:
#endif
@ -131,7 +131,7 @@ static int node_bootreason( lua_State *L)
#endif
case TG0WDT_SYS_RESET:
case TG1WDT_SYS_RESET:
#if !defined(CONFIG_IDF_TARGET_ESP32C6)
#if !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32C5)
case INTRUSION_RESET:
#endif
case RTCWDT_BROWN_OUT_RESET:
@ -281,7 +281,7 @@ static int node_sleep (lua_State *L)
esp_sleep_enable_timer_wakeup(usecs);
}
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2)
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32C5)
// touch option: boolean
if (opt_checkbool(L, "touch", false)) {
int err = esp_sleep_enable_touchpad_wakeup();
@ -354,7 +354,7 @@ static int node_dsleep (lua_State *L)
}
}
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2)
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32C5)
bool pull = opt_checkbool(L, "pull", false);
if (opt_get(L, "isolate", LUA_TTABLE)) {
for (int i = 1; ; i++) {

View File

@ -72,6 +72,7 @@ menu "NodeMCU platform config"
default y if IDF_TARGET_ESP32S2
default y if IDF_TARGET_ESP32S3
default y if IDF_TARGET_ESP32C3
default y if IDF_TARGET_ESP32C5
default y if IDF_TARGET_ESP32C6
default y if IDF_TARGET_ESP32H2
@ -79,6 +80,7 @@ menu "NodeMCU platform config"
bool
default y if IDF_TARGET_ESP32
default y if IDF_TARGET_ESP32S3
default y if IDF_TARGET_ESP32C5
config NODEMCU_UART_DRIVER_BUF_SIZE_RX0
int "RX buffer size for UART0"

View File

@ -65,6 +65,7 @@ sample code bearing this copyright.
#include "driver/gpio.h"
#include "rom/gpio.h" // for gpio_matrix_out()
#include "soc/gpio_periph.h"
#include "hal/gpio_ll.h"
#include "esp_log.h"
#define TRUE (1==1)
@ -197,7 +198,7 @@ static int onewire_rmt_attach_pin( uint8_t gpio_num )
return PLATFORM_ERR;
if (gpio_num != ow_rmt.gpio) {
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2)
#if !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32C6) && !defined(CONFIG_IDF_TARGET_ESP32H2) && !defined(CONFIG_IDF_TARGET_ESP32C5)
// attach GPIO to previous pin
if (gpio_num < 32) {
GPIO.enable_w1ts = (0x1 << gpio_num);
@ -217,7 +218,7 @@ static int onewire_rmt_attach_pin( uint8_t gpio_num )
rmt_set_gpio( ow_rmt.rx, RMT_MODE_RX, gpio_num, false );
rmt_set_gpio( ow_rmt.tx, RMT_MODE_TX, gpio_num, false );
// force pin direction to input to enable path to RX channel
PIN_INPUT_ENABLE(GPIO_PIN_MUX_REG[gpio_num]);
gpio_ll_input_enable(&GPIO, gpio_num);
ow_rmt.gpio = gpio_num;
}

@ -1 +1 @@
Subproject commit e7771c75bd1dbbfb7b3c5381be7e063b197c9734
Subproject commit a2f420a36ecf8cd19b443adde1d75e5eaecc6309