diff --git a/Sming/Makefile b/Sming/Makefile index 7ae4885dd2..9d34e46a49 100644 --- a/Sming/Makefile +++ b/Sming/Makefile @@ -181,6 +181,7 @@ EXTRA_INCDIR += third-party/ws_parser/ # => SDK ifneq (,$(findstring third-party/ESP8266_NONOS_SDK, $(SDK_BASE))) THIRD_PARTY_DATA += third-party/ESP8266_NONOS_SDK/Makefile + CFLAGS += -DSDK_INTERNAL endif # => esp-gdbstub @@ -233,7 +234,7 @@ endif MFORCE32 := $(shell $(CC) --help=target | grep mforce-l32) # compiler flags using during compilation of source files. Add '-pg' for debugging -CFLAGS = -Wpointer-arith -Wundef -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections \ +CFLAGS += -Wpointer-arith -Wundef -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections \ -D__ets__ -DICACHE_FLASH -DARDUINO=106 -DCOM_SPEED_SERIAL=$(COM_SPEED_SERIAL) -DENABLE_CMD_EXECUTOR=$(ENABLE_CMD_EXECUTOR) -DESP8266=1 ifeq ($(SMING_RELEASE),1) # See: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html diff --git a/Sming/Makefile-project.mk b/Sming/Makefile-project.mk index 52090080b9..1d373ed6c7 100644 --- a/Sming/Makefile-project.mk +++ b/Sming/Makefile-project.mk @@ -217,6 +217,10 @@ endif # compiler flags using during compilation of source files CFLAGS = -Wpointer-arith -Wundef -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections -D__ets__ -DICACHE_FLASH -DARDUINO=106 -DCOM_SPEED_SERIAL=$(COM_SPEED_SERIAL) $(USER_CFLAGS) -DENABLE_CMD_EXECUTOR=$(ENABLE_CMD_EXECUTOR) +# => SDK +ifneq (,$(findstring third-party/ESP8266_NONOS_SDK, $(SDK_BASE))) + CFLAGS += -DSDK_INTERNAL +endif ifeq ($(SMING_RELEASE),1) # See: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html # for full list of optimization options diff --git a/Sming/Makefile-rboot.mk b/Sming/Makefile-rboot.mk index 32ab0599c3..912bb2cd9d 100644 --- a/Sming/Makefile-rboot.mk +++ b/Sming/Makefile-rboot.mk @@ -195,6 +195,10 @@ USER_LIBDIR = $(SMING_HOME)/compiler/lib/ # compiler flags using during compilation of source files CFLAGS = -Wpointer-arith -Wundef -Werror -Wl,-EL -nostdlib -mlongcalls -mtext-section-literals -finline-functions -fdata-sections -ffunction-sections -D__ets__ -DICACHE_FLASH -DARDUINO=106 -DCOM_SPEED_SERIAL=$(COM_SPEED_SERIAL) $(USER_CFLAGS) -DENABLE_CMD_EXECUTOR=$(ENABLE_CMD_EXECUTOR) +# => SDK +ifneq (,$(findstring third-party/ESP8266_NONOS_SDK, $(SDK_BASE))) + CFLAGS += -DSDK_INTERNAL +endif ifeq ($(SMING_RELEASE),1) # See: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html # for full list of optimization options diff --git a/Sming/system/include/esp_systemapi.h b/Sming/system/include/esp_systemapi.h index 4c7a492160..4c964a2a54 100644 --- a/Sming/system/include/esp_systemapi.h +++ b/Sming/system/include/esp_systemapi.h @@ -3,7 +3,7 @@ #ifndef __ESP_SYSTEM_API_H__ #define __ESP_SYSTEM_API_H__ -#include "ets_sys.h" +#include #include #include #include @@ -43,6 +43,63 @@ #endif #define assert(condition) if (!(condition)) SYSTEM_ERROR("ASSERT: %s %d", __FUNCTION__, __LINE__) #define SYSTEM_ERROR(fmt, ...) m_printf("ERROR: " fmt "\r\n", ##__VA_ARGS__) + +#ifndef SDK_INTERNAL +extern void ets_timer_arm_new(ETSTimer *ptimer, uint32_t milliseconds, bool repeat_flag, int isMstimer); +extern void ets_timer_disarm(ETSTimer *a); +extern void ets_timer_setfn(ETSTimer *t, ETSTimerFunc *pfunction, void *parg); + +//extern void ets_wdt_init(uint32_t val); // signature? +extern void ets_wdt_enable(void); +extern void ets_wdt_disable(void); +extern void wdt_feed(void); +//extern void wd_reset_cnt(void); +extern void ets_delay_us(uint32_t us); + +extern void ets_isr_mask(unsigned intr); +extern void ets_isr_unmask(unsigned intr); + +typedef void (* ets_isr_t)(void *); + +//extern void ets_isr_attach(int intr, void *handler, void *arg); +extern void ets_isr_attach(int i, ets_isr_t func, void *arg); + +extern int ets_memcmp(const void *s1, const void *s2, size_t n); +extern void *ets_memcpy(void *dest, const void *src, size_t n); +extern void *ets_memset(void *s, int c, size_t n); + +//extern void ets_install_putc1(void *routine); +extern void ets_install_putc1(void (*p)(char c)); +extern int ets_sprintf(char *str, const char *format, ...) __attribute__ ((format (printf, 2, 3))); +extern int ets_str2macaddr(void *, void *); +extern int ets_strcmp(const char *s1, const char *s2); +extern char *ets_strcpy(char *dest, const char *src); +//extern int os_random(); +//extern char *ets_strdup(const char *str); // :( +const char * ets_strrchr(const char *str, int character); +extern int ets_strlen(const char *s); +extern int ets_strncmp(const char *s1, const char *s2, unsigned int len); +extern char *ets_strncpy(char *dest, const char *src, size_t n); +extern char *ets_strstr(const char *haystack, const char *needle); +extern int os_printf_plus(const char *format, ...) __attribute__ ((format (printf, 1, 2))); +extern int os_snprintf(char *str, size_t size, const char *format, ...) __attribute__ ((format (printf, 3, 4))); +extern int ets_vsnprintf(char * s, size_t n, const char * format, va_list arg) __attribute__ ((format (printf, 3, 0))); + +extern void *pvPortMalloc(size_t xWantedSize, const char *file, uint32 line); +extern void *pvPortZalloc(size_t xWantedSize, const char *file, uint32 line); +extern void pvPortFree(void *ptr); +extern void vPortFree(void *ptr, const char *file, uint32 line); +extern void *vPortMalloc(size_t xWantedSize); + +extern void uart_div_modify(uint8 uart_no, uint32 DivLatchValue); +extern int ets_uart_printf(const char *fmt, ...); +extern void uart_tx_one_char(char ch); + +extern void ets_intr_lock(); +extern void ets_intr_unlock(); + +#endif /* SDK_INTERNAL */ + // CPU Frequency extern void ets_update_cpu_frequency(uint32_t frq); extern uint32_t ets_get_cpu_frequency();