├── components ├── m5stickc-idf │ ├── backported │ │ ├── newlib │ │ │ ├── include │ │ │ │ ├── fcntl.h │ │ │ │ ├── machine │ │ │ │ │ ├── termios.h │ │ │ │ │ ├── ansi.h │ │ │ │ │ ├── param.h │ │ │ │ │ ├── _types.h │ │ │ │ │ ├── malloc.h │ │ │ │ │ ├── stdlib.h │ │ │ │ │ ├── endian.h │ │ │ │ │ ├── time.h │ │ │ │ │ ├── types.h │ │ │ │ │ ├── setjmp-dj.h │ │ │ │ │ ├── _default_types.h │ │ │ │ │ └── fastmath.h │ │ │ │ ├── sys │ │ │ │ │ ├── custom_file.h │ │ │ │ │ ├── fcntl.h │ │ │ │ │ ├── string.h │ │ │ │ │ ├── dir.h │ │ │ │ │ ├── resource.h │ │ │ │ │ ├── utime.h │ │ │ │ │ ├── _intsup.h │ │ │ │ │ ├── param.h │ │ │ │ │ ├── times.h │ │ │ │ │ ├── stdio.h │ │ │ │ │ ├── timeb.h │ │ │ │ │ ├── wait.h │ │ │ │ │ ├── file.h │ │ │ │ │ ├── lock.h │ │ │ │ │ ├── sched.h │ │ │ │ │ ├── _types.h │ │ │ │ │ ├── time.h │ │ │ │ │ ├── iconvnls.h │ │ │ │ │ └── syslimits.h │ │ │ │ ├── utmp.h │ │ │ │ ├── termios.h │ │ │ │ ├── errno.h │ │ │ │ ├── paths.h │ │ │ │ ├── utime.h │ │ │ │ ├── regdef.h │ │ │ │ ├── fastmath.h │ │ │ │ ├── dirent.h │ │ │ │ ├── unistd.h │ │ │ │ ├── libgen.h │ │ │ │ ├── envlock.h │ │ │ │ ├── alloca.h │ │ │ │ ├── setjmp.h │ │ │ │ ├── envz.h │ │ │ │ ├── signal.h │ │ │ │ ├── config.h │ │ │ │ ├── strings.h │ │ │ │ ├── wctype.h │ │ │ │ ├── _syslist.h │ │ │ │ ├── assert.h │ │ │ │ ├── argz.h │ │ │ │ ├── tar.h │ │ │ │ ├── locale.h │ │ │ │ ├── search.h │ │ │ │ ├── wordexp.h │ │ │ │ ├── stdio_ext.h │ │ │ │ ├── unctrl.h │ │ │ │ ├── iconv.h │ │ │ │ ├── fnmatch.h │ │ │ │ ├── sched.h │ │ │ │ ├── fenv.h │ │ │ │ ├── ar.h │ │ │ │ ├── pwd.h │ │ │ │ ├── grp.h │ │ │ │ ├── complex.h │ │ │ │ ├── regex.h │ │ │ │ └── glob.h │ │ │ ├── platform_include │ │ │ │ ├── sys │ │ │ │ │ ├── unistd.h │ │ │ │ │ └── select.h │ │ │ │ ├── assert.h │ │ │ │ └── esp_newlib.h │ │ │ ├── reent_init.c │ │ │ ├── select.c │ │ │ ├── syscalls.c │ │ │ └── syscall_table.c │ │ └── esp_event │ │ │ ├── esp_event_private.h │ │ │ ├── esp_event_base.h │ │ │ ├── esp_event_private.c │ │ │ └── default_event_loop.c │ ├── component.mk │ ├── Kconfig │ ├── .gitignore │ ├── CMakeLists.txt │ ├── include │ │ ├── m5event.h │ │ ├── m5stickc.h │ │ ├── m5rtc.h │ │ ├── m5led.h │ │ ├── m5power.h │ │ └── m5display.h │ ├── m5event.c │ ├── LICENSE │ ├── m5led.c │ ├── README.md │ ├── util │ │ └── stmpe610.h │ └── m5stickc.c └── ssd1306 │ ├── component.mk │ └── CMakeLists.txt ├── data ├── objectData ├── objectTable └── systemImage ├── objects └── objectData ├── smalltalkImage ├── lst3 ├── stje ├── source │ ├── m5StickSupport.h │ ├── process.h │ ├── esp32nvs.c │ ├── build.h │ ├── build_image.h │ ├── target.h │ ├── st.c │ ├── process.c │ └── initial.c ├── buildImage ├── imageBuilder ├── objectData ├── objectTable ├── systemImage ├── Makefile ├── date.st └── http.st ├── book ├── smalltalkje_documentation.pdf └── placeholder_image.tex ├── .vscode ├── extensions.json └── settings.json ├── src ├── CMakeLists.txt ├── component.mk └── tty.c ├── smalltalkje.xcodeproj ├── project.xcworkspace │ ├── xcuserdata │ │ └── abdul.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── xcuserdata │ └── abdul.xcuserdatad │ │ ├── xcschemes │ │ └── xcschememanagement.plist │ │ └── xcdebugger │ │ └── Breakpoints_v2.xcbkptlist └── xcshareddata │ └── xcschemes │ └── lst3.xcscheme ├── CMakeLists.txt ├── docs ├── feature ideas.txt ├── useful snippets.txt └── method ideas.txt ├── partitions_stje.csv ├── test └── README ├── Makefile ├── platformio.ini ├── lib └── README ├── .github └── workflows │ └── main.yml ├── LICENSE └── include ├── esp32wifi.h ├── primitive.h ├── tty.h ├── lex.h ├── target.h └── env.h /components/m5stickc-idf/backported/newlib/include/fcntl.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /data/objectData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/data/objectData -------------------------------------------------------------------------------- /data/objectTable: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/data/objectTable -------------------------------------------------------------------------------- /data/systemImage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/data/systemImage -------------------------------------------------------------------------------- /objects/objectData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/objects/objectData -------------------------------------------------------------------------------- /smalltalkImage/lst3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/smalltalkImage/lst3 -------------------------------------------------------------------------------- /smalltalkImage/stje: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/smalltalkImage/stje -------------------------------------------------------------------------------- /smalltalkImage/source/m5StickSupport.h: -------------------------------------------------------------------------------- 1 | typedef int object; 2 | extern void runButtonHandler(); 3 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/termios.h: -------------------------------------------------------------------------------- 1 | #define __MAX_BAUD B4000000 2 | -------------------------------------------------------------------------------- /smalltalkImage/buildImage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/smalltalkImage/buildImage -------------------------------------------------------------------------------- /smalltalkImage/imageBuilder: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/smalltalkImage/imageBuilder -------------------------------------------------------------------------------- /smalltalkImage/objectData: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/smalltalkImage/objectData -------------------------------------------------------------------------------- /smalltalkImage/objectTable: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/smalltalkImage/objectTable -------------------------------------------------------------------------------- /smalltalkImage/systemImage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/smalltalkImage/systemImage -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/ansi.h: -------------------------------------------------------------------------------- 1 | /* dummy header file to support BSD compiler */ 2 | -------------------------------------------------------------------------------- /book/smalltalkje_documentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/book/smalltalkje_documentation.pdf -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/param.h: -------------------------------------------------------------------------------- 1 | /* Place holder for machine-specific param.h. */ 2 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/custom_file.h: -------------------------------------------------------------------------------- 1 | #error System-specific custom_file.h is missing. 2 | 3 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/fcntl.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_FCNTL_H_ 2 | #define _SYS_FCNTL_H_ 3 | #include 4 | #endif 5 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/utmp.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | #include 5 | #ifdef __cplusplus 6 | } 7 | #endif 8 | 9 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/termios.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | #include 5 | #ifdef __cplusplus 6 | } 7 | #endif 8 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/string.h: -------------------------------------------------------------------------------- 1 | /* This is a dummy used as a placeholder for 2 | systems that need to have a special header file. */ 3 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | */ 4 | 5 | #ifndef _MACHINE__TYPES_H 6 | #define _MACHINE__TYPES_H 7 | #include 8 | #endif 9 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/malloc.h: -------------------------------------------------------------------------------- 1 | #ifndef _MACHMALLOC_H_ 2 | #define _MACHMALLOC_H_ 3 | 4 | /* place holder so platforms may add malloc.h extensions */ 5 | 6 | #endif /* _MACHMALLOC_H_ */ 7 | 8 | 9 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/stdlib.h: -------------------------------------------------------------------------------- 1 | #ifndef _MACHSTDLIB_H_ 2 | #define _MACHSTDLIB_H_ 3 | 4 | /* place holder so platforms may add stdlib.h extensions */ 5 | 6 | #endif /* _MACHSTDLIB_H_ */ 7 | 8 | 9 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=827846 3 | // for the documentation about the extensions.json format 4 | "recommendations": [ 5 | "platformio.platformio-ide" 6 | ] 7 | } 8 | -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file was automatically generated for projects 2 | # without default 'CMakeLists.txt' file. 3 | 4 | FILE(GLOB_RECURSE app_sources main.c ${CMAKE_SOURCE_DIR}/src/*.*) 5 | 6 | idf_component_register(SRCS ${app_sources}) 7 | -------------------------------------------------------------------------------- /components/ssd1306/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | COMPONENT_SRCDIRS := . 7 | COMPONENT_ADD_INCLUDEDIRS := . include 8 | -------------------------------------------------------------------------------- /smalltalkje.xcodeproj/project.xcworkspace/xcuserdata/abdul.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aknabi/smalltalkje/HEAD/smalltalkje.xcodeproj/project.xcworkspace/xcuserdata/abdul.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's CMakeLists 2 | # in this exact order for cmake to work correctly 3 | cmake_minimum_required(VERSION 3.5) 4 | 5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake) 6 | project(smalltalkje) 7 | -------------------------------------------------------------------------------- /book/placeholder_image.tex: -------------------------------------------------------------------------------- 1 | \documentclass[border=10pt]{standalone} 2 | \usepackage{tikz} 3 | 4 | \begin{document} 5 | \begin{tikzpicture} 6 | \draw[fill=gray!20] (0,0) rectangle (5,3); 7 | \node at (2.5,1.5) {\Large ESP32}; 8 | \end{tikzpicture} 9 | \end{document} 10 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/dir.h: -------------------------------------------------------------------------------- 1 | /* BSD predecessor of POSIX.1 and struct dirent */ 2 | 3 | #ifndef _SYS_DIR_H_ 4 | #define _SYS_DIR_H_ 5 | 6 | #include 7 | 8 | #define direct dirent 9 | 10 | #endif /*_SYS_DIR_H_*/ 11 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/errno.h: -------------------------------------------------------------------------------- 1 | #ifndef __ERRNO_H__ 2 | #define __ERRNO_H__ 3 | 4 | #ifndef __error_t_defined 5 | typedef int error_t; 6 | #define __error_t_defined 1 7 | #endif 8 | 9 | #include 10 | 11 | #endif /* !__ERRNO_H__ */ 12 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/paths.h: -------------------------------------------------------------------------------- 1 | #ifndef _PATHS_H_ 2 | #define _PATHS_H_ 3 | 4 | #define _PATH_DEV "/dev/" 5 | #define _PATH_DEVNULL "/dev/null" 6 | #define _PATH_DEVZERO "/dev/zero" 7 | #define _PATH_BSHELL "/bin/sh" 8 | 9 | #endif /* _PATHS_H_ */ 10 | -------------------------------------------------------------------------------- /smalltalkje.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/utime.h: -------------------------------------------------------------------------------- 1 | #ifdef __cplusplus 2 | extern "C" { 3 | #endif 4 | 5 | #include <_ansi.h> 6 | 7 | /* The utime function is defined in libc/sys//sys if it exists. */ 8 | #include 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/regdef.h: -------------------------------------------------------------------------------- 1 | /* regdef.h -- define register names. */ 2 | 3 | /* This is a standard include file for MIPS targets. Other target 4 | probably don't define it, and attempts to include this file will 5 | fail. */ 6 | 7 | #include 8 | -------------------------------------------------------------------------------- /docs/feature ideas.txt: -------------------------------------------------------------------------------- 1 | #defines for FREERTOS (beyond ESP32), MEM_MAP_FLASH 2 | 3 | more nils - nothing, undefined 4 | 5 | JSON filein format. 6 | 7 | JavaDoc comments 8 | 9 | aBlock forkNative: ifUnsupported: aBlock 10 | can add ifUnsupported to methods that call platform dep prims 11 | 12 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/fastmath.h: -------------------------------------------------------------------------------- 1 | #ifndef _FASTMATH_H_ 2 | #ifdef __cplusplus 3 | extern "C" { 4 | #endif 5 | #define _FASTMATH_H_ 6 | 7 | #include 8 | #include 9 | 10 | #ifdef __cplusplus 11 | } 12 | #endif 13 | #endif /* _FASTMATH_H_ */ 14 | -------------------------------------------------------------------------------- /components/m5stickc-idf/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Component Makefile 3 | # 4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) 5 | 6 | COMPONENT_SRCDIRS := . util util/font backported/esp_event backported/newlib 7 | COMPONENT_ADD_INCLUDEDIRS := . include util 8 | -------------------------------------------------------------------------------- /smalltalkImage/source/process.h: -------------------------------------------------------------------------------- 1 | #include "memory.h" 2 | 3 | void initVMBlockToRunQueue(); 4 | object getNextVMBlockToRun(); 5 | boolean queueVMBlockToRun(object block); 6 | boolean isVMBlockQueued(); 7 | 8 | void runBlockAfter(object block, object arg, int ticks); 9 | void runSmalltalkProcess(object processToRun); 10 | 11 | 12 | -------------------------------------------------------------------------------- /smalltalkje.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /components/m5stickc-idf/Kconfig: -------------------------------------------------------------------------------- 1 | menu "M5Stick-C" 2 | 3 | config ESP_IDF_VERSION_BEFORE_V3_3 4 | bool "Compatible with ESP-IDF older than v3.3" 5 | default n 6 | help 7 | Use backported libraries for versions of ESP-IDF older than v3.3. 8 | 9 | For ESP-IDF v3.3 or newer, this option should not be checked. 10 | 11 | endmenu -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/dirent.h: -------------------------------------------------------------------------------- 1 | #ifndef _DIRENT_H_ 2 | #define _DIRENT_H_ 3 | #ifdef __cplusplus 4 | extern "C" { 5 | #endif 6 | #include 7 | 8 | #if !defined(MAXNAMLEN) && !defined(_POSIX_SOURCE) 9 | #define MAXNAMLEN 1024 10 | #endif 11 | 12 | #ifdef __cplusplus 13 | } 14 | #endif 15 | #endif /*_DIRENT_H_*/ 16 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/unistd.h: -------------------------------------------------------------------------------- 1 | #ifndef _UNISTD_H_ 2 | #define _UNISTD_H_ 3 | 4 | # include 5 | 6 | #ifndef L_SET 7 | /* Old BSD names for the same constants; just for compatibility. */ 8 | #define L_SET SEEK_SET 9 | #define L_INCR SEEK_CUR 10 | #define L_XTND SEEK_END 11 | #endif 12 | 13 | #endif /* _UNISTD_H_ */ 14 | -------------------------------------------------------------------------------- /smalltalkImage/source/esp32nvs.c: -------------------------------------------------------------------------------- 1 | #include "nvs_flash.h" 2 | 3 | // Initialize NVS 4 | void nvs_init(void) 5 | { 6 | esp_err_t ret = nvs_flash_init(); 7 | if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { 8 | ESP_ERROR_CHECK(nvs_flash_erase()); 9 | ret = nvs_flash_init(); 10 | } 11 | ESP_ERROR_CHECK(ret); 12 | } -------------------------------------------------------------------------------- /partitions_stje.csv: -------------------------------------------------------------------------------- 1 | # Name, Type, SubType, Offset, Size, Flags 2 | # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap 3 | nvs, data, nvs, 0x9000, 0x6000, 4 | phy_init, data, phy, 0xf000, 0x1000, 5 | factory, app, factory, 0x10000, 1M, 6 | storage, data, spiffs, , 0xA0000, 7 | objects, data, 0x99, , 0x40000, 8 | -------------------------------------------------------------------------------- /src/component.mk: -------------------------------------------------------------------------------- 1 | # 2 | # Main component makefile. 3 | # 4 | # This Makefile can be left empty. By default, it will take the sources in the 5 | # src/ directory, compile them and link them into lib(subdirectory_name).a 6 | # in the build directory. This behaviour is entirely configurable, 7 | # please read the ESP-IDF documents if you need to do this. 8 | # 9 | 10 | COMPONENT_DIRS := ../components 11 | -------------------------------------------------------------------------------- /components/ssd1306/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | 4 | # include paths of this components. 5 | set(COMPONENT_ADD_INCLUDEDIRS include) 6 | 7 | # source files of this components. 8 | set(COMPONENT_SRCDIRS .) 9 | 10 | # add this components, this will define a CMake library target. 11 | register_component() 12 | -------------------------------------------------------------------------------- /components/m5stickc-idf/.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/libgen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * libgen.h - defined by XPG4 3 | */ 4 | 5 | #ifndef _LIBGEN_H_ 6 | #define _LIBGEN_H_ 7 | 8 | #include "_ansi.h" 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | char *_EXFUN(basename, (char *)); 16 | char *_EXFUN(dirname, (char *)); 17 | 18 | #ifdef __cplusplus 19 | } 20 | #endif 21 | 22 | #endif /* _LIBGEN_H_ */ 23 | 24 | -------------------------------------------------------------------------------- /components/m5stickc-idf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # The following lines of boilerplate have to be in your project's 2 | # CMakeLists in this exact order for cmake to work correctly 3 | 4 | # include paths of this components. 5 | set(COMPONENT_ADD_INCLUDEDIRS include util) 6 | 7 | # source files of this components. 8 | set(COMPONENT_SRCDIRS . util util/font backported/esp_event backported/newlib) 9 | 10 | # add this components, this will define a CMake library target. 11 | register_component() 12 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/envlock.h: -------------------------------------------------------------------------------- 1 | /* envlock.h -- header file for env routines. */ 2 | 3 | #ifndef _INCLUDE_ENVLOCK_H_ 4 | #define _INCLUDE_ENVLOCK_H_ 5 | 6 | #include <_ansi.h> 7 | #include 8 | 9 | #define ENV_LOCK __env_lock(reent_ptr) 10 | #define ENV_UNLOCK __env_unlock(reent_ptr) 11 | 12 | void _EXFUN(__env_lock,(struct _reent *reent)); 13 | void _EXFUN(__env_unlock,(struct _reent *reent)); 14 | 15 | #endif /* _INCLUDE_ENVLOCK_H_ */ 16 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/resource.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_RESOURCE_H_ 2 | #define _SYS_RESOURCE_H_ 3 | 4 | #include 5 | 6 | #define RUSAGE_SELF 0 /* calling process */ 7 | #define RUSAGE_CHILDREN -1 /* terminated child processes */ 8 | 9 | struct rusage { 10 | struct timeval ru_utime; /* user time used */ 11 | struct timeval ru_stime; /* system time used */ 12 | }; 13 | 14 | int _EXFUN(getrusage, (int, struct rusage*)); 15 | 16 | #endif 17 | 18 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/utime.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_UTIME_H 2 | #define _SYS_UTIME_H 3 | 4 | /* This is a dummy file, not customized for any 5 | particular system. If there is a utime.h in libc/sys/SYSDIR/sys, 6 | it will override this one. */ 7 | 8 | #ifdef __cplusplus 9 | extern "C" { 10 | #endif 11 | 12 | struct utimbuf 13 | { 14 | time_t actime; 15 | time_t modtime; 16 | }; 17 | 18 | #ifdef __cplusplus 19 | }; 20 | #endif 21 | 22 | #endif /* _SYS_UTIME_H */ 23 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/endian.h: -------------------------------------------------------------------------------- 1 | #ifndef __MACHINE_ENDIAN_H__ 2 | 3 | #include 4 | 5 | #ifndef BIG_ENDIAN 6 | #define BIG_ENDIAN 4321 7 | #endif 8 | #ifndef LITTLE_ENDIAN 9 | #define LITTLE_ENDIAN 1234 10 | #endif 11 | 12 | #ifndef BYTE_ORDER 13 | #if defined(__IEEE_LITTLE_ENDIAN) || defined(__IEEE_BYTES_LITTLE_ENDIAN) 14 | #define BYTE_ORDER LITTLE_ENDIAN 15 | #else 16 | #define BYTE_ORDER BIG_ENDIAN 17 | #endif 18 | #endif 19 | 20 | #endif /* __MACHINE_ENDIAN_H__ */ 21 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/time.h: -------------------------------------------------------------------------------- 1 | #ifndef _MACHTIME_H_ 2 | #define _MACHTIME_H_ 3 | 4 | #if defined(__rtems__) 5 | #define _CLOCKS_PER_SEC_ sysconf(_SC_CLK_TCK) 6 | #else /* !__rtems__ */ 7 | #if defined(__aarch64__) || defined(__arm__) || defined(__thumb__) 8 | #define _CLOCKS_PER_SEC_ 100 9 | #endif 10 | #endif /* !__rtems__ */ 11 | 12 | #ifdef __SPU__ 13 | #include 14 | int nanosleep (const struct timespec *, struct timespec *); 15 | #endif 16 | 17 | #endif /* _MACHTIME_H_ */ 18 | 19 | 20 | -------------------------------------------------------------------------------- /smalltalkImage/source/build.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Comment out the following to build image 3 | * (Goto smalltalkImage directory and run "make") 4 | * If uncommented will build for ESP32 5 | */ 6 | // #define TARGET_ESP32 7 | 8 | // For calls to support threading, file init, etc use POSIX calls 9 | #define TARGET_POSIX 10 | 11 | #define TARGET_BUILD_IMAGE 12 | 13 | /* 14 | * Uncomment out the following to build ESP32 image 15 | * that will simply write the object data file to a 16 | * data partition and stop 17 | */ 18 | // #define WRITE_OBJECT_PARTITION 19 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for PlatformIO Unit Testing and project tests. 3 | 4 | Unit Testing is a software testing method by which individual units of 5 | source code, sets of one or more MCU program modules together with associated 6 | control data, usage procedures, and operating procedures, are tested to 7 | determine whether they are fit for use. Unit testing finds problems early 8 | in the development cycle. 9 | 10 | More information about PlatformIO Unit Testing: 11 | - https://docs.platformio.org/page/plus/unit-testing.html 12 | -------------------------------------------------------------------------------- /smalltalkImage/source/build_image.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Comment out the following to build image 3 | * (Goto smalltalkImage directory and run "make") 4 | * If uncommented will build for ESP32 5 | */ 6 | // #define TARGET_ESP32 7 | 8 | // For calls to support threading, file init, etc use POSIX calls 9 | #define TARGET_POSIX 10 | 11 | #define TARGET_BUILD_IMAGE 12 | 13 | /* 14 | * Uncomment out the following to build ESP32 image 15 | * that will simply write the object data file to a 16 | * data partition and stop 17 | */ 18 | // #define WRITE_OBJECT_PARTITION 19 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/alloca.h: -------------------------------------------------------------------------------- 1 | /* libc/include/alloca.h - Allocate memory on stack */ 2 | 3 | /* Written 2000 by Werner Almesberger */ 4 | /* Rearranged for general inclusion by stdlib.h. 5 | 2001, Corinna Vinschen */ 6 | 7 | #ifndef _NEWLIB_ALLOCA_H 8 | #define _NEWLIB_ALLOCA_H 9 | 10 | #include "_ansi.h" 11 | #include 12 | 13 | #undef alloca 14 | 15 | #ifdef __GNUC__ 16 | #define alloca(size) __builtin_alloca(size) 17 | #else 18 | void * _EXFUN(alloca,(size_t)); 19 | #endif 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/setjmp.h: -------------------------------------------------------------------------------- 1 | /* 2 | setjmp.h 3 | stubs for future use. 4 | */ 5 | 6 | #ifndef _SETJMP_H_ 7 | #define _SETJMP_H_ 8 | 9 | #include "_ansi.h" 10 | #include 11 | 12 | _BEGIN_STD_C 13 | 14 | #ifdef __GNUC__ 15 | void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval)) 16 | __attribute__ ((__noreturn__)); 17 | #else 18 | void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval)); 19 | #endif 20 | int _EXFUN(setjmp,(jmp_buf __jmpb)); 21 | #define setjmp(env) setjmp(env) 22 | 23 | 24 | _END_STD_C 25 | 26 | #endif /* _SETJMP_H_ */ 27 | 28 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | # 3 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a 4 | # project subdirectory. 5 | # 6 | 7 | PROJECT_NAME := spiffsgen 8 | 9 | include $(IDF_PATH)/make/project.mk 10 | 11 | # Create a SPIFFS image from the contents of the 'spiffs_image' directory 12 | # that fits the partition named 'storage'. FLASH_IN_PROJECT indicates that 13 | # the generated image should be flashed when the entire project is flashed to 14 | # the target with 'make flash'. 15 | SPIFFS_IMAGE_FLASH_IN_PROJECT := 1 16 | $(eval $(call spiffs_create_partition_image,storage,spiffs_image)) -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/_intsup.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, 2005 by 3 | * Ralf Corsepius, Ulm/Germany. All rights reserved. 4 | * 5 | * Permission to use, copy, modify, and distribute this software 6 | * is freely granted, provided that this notice is preserved. 7 | * 8 | * Modified for xtensa arch & non-long int32_t, removes automatic setting of __have_long32. 9 | */ 10 | 11 | #ifndef _SYS__INTSUP_H 12 | #define _SYS__INTSUP_H 13 | 14 | #include 15 | 16 | #define __STDINT_EXP(x) __##x##__ 17 | 18 | #define __have_longlong64 1 19 | 20 | #endif /* _SYS__INTSUP_H */ 21 | -------------------------------------------------------------------------------- /components/m5stickc-idf/include/m5event.h: -------------------------------------------------------------------------------- 1 | /** 2 | * m5event.h 3 | * 4 | * (C) 2019 - Pablo Bacho 5 | * This code is licensed under the MIT License. 6 | */ 7 | 8 | #ifndef _M5EVENT_H_ 9 | #define _M5EVENT_H_ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include "esp_log.h" 16 | 17 | #ifdef CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 18 | #include "backported/esp_event/esp_event.h" 19 | #else 20 | #include "esp_event.h" 21 | #endif // CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 22 | 23 | extern esp_event_loop_handle_t m5_event_loop; /*!< Event loop for M5 device-specific events */ 24 | 25 | esp_err_t m5event_init(); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | 31 | #endif // _M5EVENT_H_ 32 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/param.h: -------------------------------------------------------------------------------- 1 | /* This is a dummy file, not customized for any 2 | particular system. If there is a param.h in libc/sys/SYSDIR/sys, 3 | it will override this one. */ 4 | 5 | #ifndef _SYS_PARAM_H 6 | # define _SYS_PARAM_H 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #ifndef HZ 14 | # define HZ (60) 15 | #endif 16 | #ifndef NOFILE 17 | # define NOFILE (60) 18 | #endif 19 | #ifndef PATHSIZE 20 | # define PATHSIZE (1024) 21 | #endif 22 | 23 | #define MAXPATHLEN PATH_MAX 24 | 25 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) 26 | #define MIN(a,b) ((a) < (b) ? (a) : (b)) 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/times.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_TIMES_H 2 | #ifdef __cplusplus 3 | extern "C" { 4 | #endif 5 | #define _SYS_TIMES_H 6 | 7 | #include <_ansi.h> 8 | #include 9 | 10 | #ifndef __clock_t_defined 11 | typedef _CLOCK_T_ clock_t; 12 | #define __clock_t_defined 13 | #endif 14 | 15 | /* Get Process Times, P1003.1b-1993, p. 92 */ 16 | struct tms { 17 | clock_t tms_utime; /* user time */ 18 | clock_t tms_stime; /* system time */ 19 | clock_t tms_cutime; /* user time, children */ 20 | clock_t tms_cstime; /* system time, children */ 21 | }; 22 | 23 | clock_t _EXFUN(times,(struct tms *)); 24 | #ifdef _COMPILING_NEWLIB 25 | clock_t _EXFUN(_times,(struct tms *)); 26 | #endif 27 | 28 | #ifdef __cplusplus 29 | } 30 | #endif 31 | #endif /* !_SYS_TIMES_H */ 32 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/types.h: -------------------------------------------------------------------------------- 1 | #ifndef _MACHTYPES_H_ 2 | #define _MACHTYPES_H_ 3 | 4 | /* 5 | * The following section is RTEMS specific and is needed to more 6 | * closely match the types defined in the BSD machine/types.h. 7 | * This is needed to let the RTEMS/BSD TCP/IP stack compile. 8 | */ 9 | #if defined(__rtems__) 10 | #include 11 | #endif 12 | 13 | #define _CLOCK_T_ unsigned long /* clock() */ 14 | #define _TIME_T_ long /* time() */ 15 | #define _CLOCKID_T_ unsigned long 16 | #define _TIMER_T_ unsigned long 17 | 18 | #ifndef _HAVE_SYSTYPES 19 | typedef long int __off_t; 20 | typedef int __pid_t; 21 | #ifdef __GNUC__ 22 | __extension__ typedef long long int __loff_t; 23 | #else 24 | typedef long int __loff_t; 25 | #endif 26 | #endif 27 | 28 | #endif /* _MACHTYPES_H_ */ 29 | 30 | 31 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/envz.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. 2 | * 3 | * Permission to use, copy, modify, and distribute this software 4 | * is freely granted, provided that this notice is preserved. 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | /* The newlib implementation of these functions assumes that sizeof(char) == 1. */ 11 | char * envz_entry (const char *envz, size_t envz_len, const char *name); 12 | char * envz_get (const char *envz, size_t envz_len, const char *name); 13 | error_t envz_add (char **envz, size_t *envz_len, const char *name, const char *value); 14 | error_t envz_merge (char **envz, size_t *envz_len, const char *envz2, size_t envz2_len, int override); 15 | void envz_remove(char **envz, size_t *envz_len, const char *name); 16 | void envz_strip (char **envz, size_t *envz_len); 17 | -------------------------------------------------------------------------------- /components/m5stickc-idf/m5event.c: -------------------------------------------------------------------------------- 1 | /** 2 | * m5event.c 3 | * 4 | * (C) 2019 - Pablo Bacho 5 | * This code is licensed under the MIT License. 6 | */ 7 | 8 | #include "m5event.h" 9 | 10 | static const char *TAG = "m5event"; 11 | 12 | esp_event_loop_handle_t m5_event_loop; 13 | 14 | esp_err_t m5event_init() 15 | { 16 | esp_event_loop_args_t loop_args = { 17 | .queue_size = 5, 18 | .task_name = "m5_event_loop", 19 | .task_priority = 10, 20 | .task_stack_size = 2048, 21 | .task_core_id = 0 22 | }; 23 | 24 | esp_err_t e = esp_event_loop_create(&loop_args, &m5_event_loop); 25 | if(e == ESP_OK) { 26 | ESP_LOGD(TAG, "Event loop created"); 27 | return ESP_OK; 28 | } else { 29 | ESP_LOGE(TAG, "Error creating event loop: %s", esp_err_to_name(e)); 30 | return ESP_FAIL; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /smalltalkje.xcodeproj/xcuserdata/abdul.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | M5StickC Image.xcscheme_^#shared#^_ 8 | 9 | orderHint 10 | 1 11 | 12 | lst3.xcscheme_^#shared#^_ 13 | 14 | orderHint 15 | 0 16 | 17 | stje copy.xcscheme_^#shared#^_ 18 | 19 | orderHint 20 | 1 21 | 22 | 23 | SuppressBuildableAutocreation 24 | 25 | 96D020AD25DFD2D100087CC6 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/stdio.h: -------------------------------------------------------------------------------- 1 | #ifndef _NEWLIB_STDIO_H 2 | #define _NEWLIB_STDIO_H 3 | 4 | #include 5 | #include 6 | 7 | /* Internal locking macros, used to protect stdio functions. In the 8 | general case, expand to nothing. Use __SSTR flag in FILE _flags to 9 | detect if FILE is private to sprintf/sscanf class of functions; if 10 | set then do nothing as lock is not initialised. */ 11 | #if !defined(_flockfile) 12 | #ifndef __SINGLE_THREAD__ 13 | # define _flockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_acquire_recursive((fp)->_lock)) 14 | #else 15 | # define _flockfile(fp) (_CAST_VOID 0) 16 | #endif 17 | #endif 18 | 19 | #if !defined(_funlockfile) 20 | #ifndef __SINGLE_THREAD__ 21 | # define _funlockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_release_recursive((fp)->_lock)) 22 | #else 23 | # define _funlockfile(fp) (_CAST_VOID 0) 24 | #endif 25 | #endif 26 | 27 | #endif /* _NEWLIB_STDIO_H */ 28 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/timeb.h: -------------------------------------------------------------------------------- 1 | /* timeb.h -- An implementation of the standard Unix file. 2 | Written by Ian Lance Taylor 3 | Public domain; no rights reserved. 4 | 5 | declares the structure used by the ftime function, as 6 | well as the ftime function itself. Newlib does not provide an 7 | implementation of ftime. */ 8 | 9 | #ifndef _SYS_TIMEB_H 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #define _SYS_TIMEB_H 16 | 17 | #include <_ansi.h> 18 | #include 19 | 20 | #ifndef __time_t_defined 21 | typedef _TIME_T_ time_t; 22 | #define __time_t_defined 23 | #endif 24 | 25 | struct timeb 26 | { 27 | time_t time; 28 | unsigned short millitm; 29 | short timezone; 30 | short dstflag; 31 | }; 32 | 33 | extern int ftime _PARAMS ((struct timeb *)); 34 | 35 | #ifdef __cplusplus 36 | } 37 | #endif 38 | 39 | #endif /* ! defined (_SYS_TIMEB_H) */ 40 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/signal.h: -------------------------------------------------------------------------------- 1 | #ifndef _SIGNAL_H_ 2 | #define _SIGNAL_H_ 3 | 4 | #include "_ansi.h" 5 | #include 6 | 7 | _BEGIN_STD_C 8 | 9 | typedef int sig_atomic_t; /* Atomic entity type (ANSI) */ 10 | #ifndef _POSIX_SOURCE 11 | typedef _sig_func_ptr sig_t; /* BSD naming */ 12 | typedef _sig_func_ptr sighandler_t; /* glibc naming */ 13 | #endif /* !_POSIX_SOURCE */ 14 | 15 | #define SIG_DFL ((_sig_func_ptr)0) /* Default action */ 16 | #define SIG_IGN ((_sig_func_ptr)1) /* Ignore action */ 17 | #define SIG_ERR ((_sig_func_ptr)-1) /* Error return */ 18 | 19 | struct _reent; 20 | 21 | _sig_func_ptr _EXFUN(_signal_r, (struct _reent *, int, _sig_func_ptr)); 22 | int _EXFUN(_raise_r, (struct _reent *, int)); 23 | 24 | #ifndef _REENT_ONLY 25 | _sig_func_ptr _EXFUN(signal, (int, _sig_func_ptr)); 26 | int _EXFUN(raise, (int)); 27 | void _EXFUN(psignal, (int, const char *)); 28 | #endif 29 | 30 | _END_STD_C 31 | 32 | #endif /* _SIGNAL_H_ */ 33 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/config.h: -------------------------------------------------------------------------------- 1 | #ifndef __SYS_CONFIG_H__ 2 | #define __SYS_CONFIG_H__ 3 | 4 | #include /* floating point macros */ 5 | #include /* POSIX defs */ 6 | 7 | #ifndef __EXPORT 8 | #define __EXPORT 9 | #endif 10 | 11 | #ifndef __IMPORT 12 | #define __IMPORT 13 | #endif 14 | 15 | /* Define return type of read/write routines. In POSIX, the return type 16 | for read()/write() is "ssize_t" but legacy newlib code has been using 17 | "int" for some time. If not specified, "int" is defaulted. */ 18 | #ifndef _READ_WRITE_RETURN_TYPE 19 | #define _READ_WRITE_RETURN_TYPE int 20 | #endif 21 | /* Define `count' parameter of read/write routines. In POSIX, the `count' 22 | parameter is "size_t" but legacy newlib code has been using "int" for some 23 | time. If not specified, "int" is defaulted. */ 24 | #ifndef _READ_WRITE_BUFSIZE_TYPE 25 | #define _READ_WRITE_BUFSIZE_TYPE int 26 | #endif 27 | 28 | #endif /* __SYS_CONFIG_H__ */ 29 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/platform_include/sys/unistd.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | 16 | #ifndef _ESP_SYS_UNISTD_H 17 | #define _ESP_SYS_UNISTD_H 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | #include_next 24 | 25 | int _EXFUN(truncate, (const char *, off_t __length)); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | #endif /* _SYS_UNISTD_H */ 31 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/strings.h: -------------------------------------------------------------------------------- 1 | /* 2 | * strings.h 3 | * 4 | * Definitions for string operations. 5 | */ 6 | 7 | #ifndef _STRINGS_H_ 8 | #define _STRINGS_H_ 9 | 10 | #include "_ansi.h" 11 | #include 12 | 13 | #include /* for size_t */ 14 | 15 | _BEGIN_STD_C 16 | 17 | #if !defined __STRICT_ANSI__ && _POSIX_VERSION < 200809L 18 | /* 19 | * Marked LEGACY in Open Group Base Specifications Issue 6/IEEE Std 1003.1-2004 20 | * Removed from Open Group Base Specifications Issue 7/IEEE Std 1003.1-2008 21 | */ 22 | int _EXFUN(bcmp,(const void *, const void *, size_t)); 23 | void _EXFUN(bcopy,(const void *, void *, size_t)); 24 | void _EXFUN(bzero,(void *, size_t)); 25 | char *_EXFUN(index,(const char *, int)); 26 | char *_EXFUN(rindex,(const char *, int)); 27 | #endif /* ! __STRICT_ANSI__ */ 28 | 29 | int _EXFUN(ffs,(int)); 30 | int _EXFUN(strcasecmp,(const char *, const char *)); 31 | int _EXFUN(strncasecmp,(const char *, const char *, size_t)); 32 | 33 | _END_STD_C 34 | 35 | #endif /* _STRINGS_H_ */ 36 | -------------------------------------------------------------------------------- /platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; https://docs.platformio.org/page/projectconf.html 10 | 11 | [env:m5stick-c] 12 | platform = espressif32 13 | 14 | board = m5stick-c 15 | ; board = m5stack-grey 16 | 17 | ; use this for T-Wristband, 18 | ; board = esp32dev 19 | 20 | framework = espidf 21 | 22 | ; M5StickC port 23 | upload_port = /dev/cu.usbserial-9952303F93 24 | 25 | ; M5StickC Plus port 26 | ; upload_port = /dev/cu.usbserial-95523FA295 27 | 28 | ; M5Stack Basic port 29 | ; upload_port = /dev/cu.usbserial-01EF05B8 30 | 31 | ; T-Wristband 32 | ; upload_port = /dev/cu.usbserial-01EAC869 33 | 34 | monitor_speed = 115200 35 | 36 | board_build.partitions = partitions_stje.csv 37 | board_build.f_cpu = 240000000L 38 | 39 | build_unflags = 40 | -Werror=all 41 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/platform_include/assert.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | 16 | /* This header file wraps newlib's own unmodified assert.h and adds 17 | support for silent assertion failure. 18 | */ 19 | #pragma once 20 | #include 21 | #include 22 | 23 | #include_next 24 | 25 | #if defined(CONFIG_OPTIMIZATION_ASSERTIONS_SILENT) && !defined(NDEBUG) 26 | #undef assert 27 | #define assert(__e) ((__e) ? (void)0 : abort()) 28 | #endif 29 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/platform_include/sys/select.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef __ESP_SYS_SELECT_H__ 16 | #define __ESP_SYS_SELECT_H__ 17 | 18 | #include 19 | #include 20 | 21 | #ifdef __cplusplus 22 | extern "C" { 23 | #endif 24 | 25 | int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout); 26 | 27 | #ifdef __cplusplus 28 | } // extern "C" 29 | #endif 30 | 31 | #endif //__ESP_SYS_SELECT_H__ 32 | -------------------------------------------------------------------------------- /components/m5stickc-idf/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Pablo Bacho 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /components/m5stickc-idf/include/m5stickc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * m5stickc.h - ESP-IDF component to work with M5StickC 3 | * 4 | * Include this header file to use the component. 5 | * 6 | * (C) 2019 - Pablo Bacho 7 | * This code is licensed under the MIT License. 8 | */ 9 | 10 | #ifndef _M5STICKC_H_ 11 | #define _M5STICKC_H_ 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | #include "esp_system.h" 18 | #include "esp_err.h" 19 | #include "esp_log.h" 20 | 21 | #include "m5power.h" 22 | #include "m5rtc.h" 23 | #include "m5button.h" 24 | #include "m5display.h" 25 | #include "m5event.h" 26 | #include "m5led.h" 27 | 28 | 29 | typedef struct { 30 | m5power_config_t power; 31 | } m5stickc_config_t; 32 | 33 | #define M5STICKC_CONFIG_DEFAULT() { \ 34 | .power = M5POWER_CONFIG_DEFAULT() \ 35 | }; 36 | 37 | /** 38 | * @brief Initialize M5StickC 39 | * 40 | * Initializes power management, display and buttons. 41 | * 42 | * @return ESP_OK success 43 | * ESP_FAIL errors found 44 | */ 45 | esp_err_t m5_init(m5stickc_config_t * config); 46 | 47 | #ifdef __cplusplus 48 | } 49 | #endif 50 | 51 | #endif // _M5STICKC_H_ 52 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/setjmp-dj.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 1991 DJ Delorie 3 | * All rights reserved. 4 | * 5 | * Redistribution, modification, and use in source and binary forms is permitted 6 | * provided that the above copyright notice and following paragraph are 7 | * duplicated in all such forms. 8 | * 9 | * This file is distributed WITHOUT ANY WARRANTY; without even the implied 10 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 11 | */ 12 | 13 | /* Modified to use SETJMP_DJ_H rather than SETJMP_H to avoid 14 | conflicting with setjmp.h. Ian Taylor, Cygnus support, April, 15 | 1993. */ 16 | 17 | #ifndef _SETJMP_DJ_H_ 18 | #define _SETJMP_DJ_H_ 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | typedef struct { 25 | unsigned long eax; 26 | unsigned long ebx; 27 | unsigned long ecx; 28 | unsigned long edx; 29 | unsigned long esi; 30 | unsigned long edi; 31 | unsigned long ebp; 32 | unsigned long esp; 33 | unsigned long eip; 34 | } jmp_buf[1]; 35 | 36 | extern int setjmp(jmp_buf); 37 | extern void longjmp(jmp_buf, int); 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/wait.h: -------------------------------------------------------------------------------- 1 | #ifndef _SYS_WAIT_H 2 | #define _SYS_WAIT_H 3 | 4 | #ifdef __cplusplus 5 | extern "C" { 6 | #endif 7 | 8 | #include 9 | 10 | #define WNOHANG 1 11 | #define WUNTRACED 2 12 | 13 | /* A status looks like: 14 | <2 bytes info> <2 bytes code> 15 | 16 | == 0, child has exited, info is the exit value 17 | == 1..7e, child has exited, info is the signal number. 18 | == 7f, child has stopped, info was the signal number. 19 | == 80, there was a core dump. 20 | */ 21 | 22 | #define WIFEXITED(w) (((w) & 0xff) == 0) 23 | #define WIFSIGNALED(w) (((w) & 0x7f) > 0 && (((w) & 0x7f) < 0x7f)) 24 | #define WIFSTOPPED(w) (((w) & 0xff) == 0x7f) 25 | #define WEXITSTATUS(w) (((w) >> 8) & 0xff) 26 | #define WTERMSIG(w) ((w) & 0x7f) 27 | #define WSTOPSIG WEXITSTATUS 28 | 29 | pid_t wait (int *); 30 | pid_t waitpid (pid_t, int *, int); 31 | 32 | #ifdef _COMPILING_NEWLIB 33 | pid_t _wait (int *); 34 | #endif 35 | 36 | /* Provide prototypes for most of the _ names that are 37 | provided in newlib for some compilers. */ 38 | pid_t _wait (int *); 39 | 40 | #ifdef __cplusplus 41 | }; 42 | #endif 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /lib/README: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link into executable file. 4 | 5 | The source code of each library should be placed in a an own separate directory 6 | ("lib/your_library_name/[here are source files]"). 7 | 8 | For example, see a structure of the following two libraries `Foo` and `Bar`: 9 | 10 | |--lib 11 | | | 12 | | |--Bar 13 | | | |--docs 14 | | | |--examples 15 | | | |--src 16 | | | |- Bar.c 17 | | | |- Bar.h 18 | | | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html 19 | | | 20 | | |--Foo 21 | | | |- Foo.c 22 | | | |- Foo.h 23 | | | 24 | | |- README --> THIS FILE 25 | | 26 | |- platformio.ini 27 | |--src 28 | |- main.c 29 | 30 | and a contents of `src/main.c`: 31 | ``` 32 | #include 33 | #include 34 | 35 | int main (void) 36 | { 37 | ... 38 | } 39 | 40 | ``` 41 | 42 | PlatformIO Library Dependency Finder will find automatically dependent 43 | libraries scanning project source files. 44 | 45 | More information about PlatformIO Library Dependency Finder 46 | - https://docs.platformio.org/page/librarymanager/ldf.html 47 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/wctype.h: -------------------------------------------------------------------------------- 1 | #ifndef _WCTYPE_H_ 2 | #define _WCTYPE_H_ 3 | 4 | #include <_ansi.h> 5 | #include 6 | 7 | #define __need_wint_t 8 | #include 9 | 10 | #ifndef WEOF 11 | # define WEOF ((wint_t)-1) 12 | #endif 13 | 14 | _BEGIN_STD_C 15 | 16 | #ifndef _WCTYPE_T 17 | #define _WCTYPE_T 18 | typedef int wctype_t; 19 | #endif 20 | 21 | #ifndef _WCTRANS_T 22 | #define _WCTRANS_T 23 | typedef int wctrans_t; 24 | #endif 25 | 26 | int _EXFUN(iswalpha, (wint_t)); 27 | int _EXFUN(iswalnum, (wint_t)); 28 | int _EXFUN(iswblank, (wint_t)); 29 | int _EXFUN(iswcntrl, (wint_t)); 30 | int _EXFUN(iswctype, (wint_t, wctype_t)); 31 | int _EXFUN(iswdigit, (wint_t)); 32 | int _EXFUN(iswgraph, (wint_t)); 33 | int _EXFUN(iswlower, (wint_t)); 34 | int _EXFUN(iswprint, (wint_t)); 35 | int _EXFUN(iswpunct, (wint_t)); 36 | int _EXFUN(iswspace, (wint_t)); 37 | int _EXFUN(iswupper, (wint_t)); 38 | int _EXFUN(iswxdigit, (wint_t)); 39 | wint_t _EXFUN(towctrans, (wint_t, wctrans_t)); 40 | wint_t _EXFUN(towupper, (wint_t)); 41 | wint_t _EXFUN(towlower, (wint_t)); 42 | wctrans_t _EXFUN(wctrans, (const char *)); 43 | wctype_t _EXFUN(wctype, (const char *)); 44 | 45 | _END_STD_C 46 | 47 | #endif /* _WCTYPE_H_ */ 48 | -------------------------------------------------------------------------------- /smalltalkImage/source/target.h: -------------------------------------------------------------------------------- 1 | #include "build.h" 2 | 3 | #ifdef TARGET_ESP32 4 | 5 | #include "esp_err.h" 6 | #include "esp_log.h" 7 | 8 | #include "freertos/FreeRTOS.h" 9 | #include "freertos/task.h" 10 | 11 | #define TT_LOG_ERROR(tag, format, ...) ESP_LOGE(tag, format, ##__VA_ARGS__) 12 | #define TT_LOG_WARN(tag, format, ...) ESP_LOGW(tag, format, ##__VA_ARGS__) 13 | #define TT_LOG_INFO(tag, format, ...) ESP_LOGI(tag, format, ##__VA_ARGS__) 14 | #define TT_LOG_DEBUG(tag, format, ...) ESP_LOGD(tag, format, ##__VA_ARGS__) 15 | #define TT_LOG_VERB(tag, format, ...) ESP_LOGV(tag, format, ##__VA_ARGS__) 16 | #define GET_FREE_HEAP_SIZE() esp_get_free_heap_size() 17 | 18 | #else 19 | #define TT_LOG_MSG(tag, level, format, ...) fprintf(stderr, format, ##__VA_ARGS__); 20 | #define TT_LOG_ERROR(tag, format, ...) TT_LOG_MSG(tag, "ERROR", format, ##__VA_ARGS__) 21 | #define TT_LOG_WARN(tag, format, ...) TT_LOG_MSG(tag, "WARN", format, ##__VA_ARGS__) 22 | #define TT_LOG_INFO(tag, format, ...) fprintf(stderr, format, ##__VA_ARGS__); 23 | #define TT_LOG_DEBUG(tag, format, ...) TT_LOG_MSG(tag, "DEBUG", format, ##__VA_ARGS__) 24 | #define TT_LOG_VERB(tag, format, ...) TT_LOG_MSG(tag, "VERB", format, ##__VA_ARGS__) 25 | #define GET_FREE_HEAP_SIZE() mallinfo().fordblks 26 | 27 | #endif -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "files.associations": { 3 | "m5led.h": "c", 4 | "esp_system.h": "c", 5 | "gpio.h": "c", 6 | "target.h": "c", 7 | "esp_spiffs.h": "c", 8 | "task.h": "c", 9 | "build.h": "c", 10 | "freertos.h": "c", 11 | "process.h": "c", 12 | "memory.h": "c", 13 | "env.h": "c", 14 | "queue.h": "c", 15 | "*.ipp": "c", 16 | "m5stickc.h": "c", 17 | "m5rtc.h": "c", 18 | "m5display.h": "c", 19 | "m5button.h": "c", 20 | "esp_err.h": "c", 21 | "nvs_flash.h": "c", 22 | "sys.h": "c", 23 | "err.h": "c", 24 | "sntp.h": "c", 25 | "esp_wifi.h": "c", 26 | "esp_event.h": "c", 27 | "esp_log.h": "c", 28 | "event_groups.h": "c", 29 | "esp_partition.h": "c", 30 | "nvs.h": "c", 31 | "names.h": "c", 32 | "esp32wifi.h": "c", 33 | "esp_sntp.h": "c", 34 | "esp_http_client.h": "c", 35 | "ssd1306_oled.h": "c", 36 | "time.h": "c", 37 | "tft.h": "c", 38 | "esp_spi_flash.h": "c", 39 | "tftspi.h": "c" 40 | }, 41 | "C_Cpp.errorSquiggles": "Disabled", 42 | "idf.pythonInstallPath": "/usr/local/bin/python" 43 | } -------------------------------------------------------------------------------- /components/m5stickc-idf/include/m5rtc.h: -------------------------------------------------------------------------------- 1 | /** 2 | * m5rtc.h 3 | * 4 | * (C) 2021 - Abdul Nabi 5 | * This code is licensed under the MIT License. 6 | */ 7 | 8 | #ifndef _M5RTC_H_ 9 | #define _M5RTC_H_ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include "esp_system.h" 16 | #include "esp_log.h" 17 | #include "esp_err.h" 18 | #include "freertos/FreeRTOS.h" 19 | #include "driver/i2c.h" 20 | 21 | #define BM8563_I2C_ADDR 0x51 22 | 23 | typedef struct 24 | { 25 | uint8_t hours; 26 | uint8_t minutes; 27 | uint8_t seconds; 28 | } RTC_TimeTypeDef; 29 | 30 | 31 | typedef struct 32 | { 33 | uint8_t WeekDay; 34 | uint8_t Month; 35 | uint8_t Date; 36 | uint16_t Year; 37 | } RTC_DateTypeDef; 38 | 39 | uint8_t rtc_data[7]; 40 | uint8_t asc[14]; 41 | 42 | /** 43 | * @brief Initialize RTC configuring BM8563 RTC IC 44 | * 45 | * @return ESP_OK success 46 | * ESP_FAIL failed 47 | */ 48 | esp_err_t m5rtc_init(void); 49 | 50 | esp_err_t getBM8563Time(void); 51 | 52 | esp_err_t setRTCTime(RTC_TimeTypeDef* RTC_TimeStruct); 53 | esp_err_t setRTCDate(RTC_DateTypeDef* RTC_DateStruct); 54 | 55 | esp_err_t getRTCTime(RTC_TimeTypeDef* RTC_TimeStruct); 56 | esp_err_t getRTCDate(RTC_DateTypeDef* RTC_DateStruct); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif // _M5RTC_H_ -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/_syslist.h: -------------------------------------------------------------------------------- 1 | /* internal use only -- mapping of "system calls" for libraries that lose 2 | and only provide C names, so that we end up in violation of ANSI */ 3 | #ifndef __SYSLIST_H 4 | #define __SYSLIST_H 5 | 6 | #ifdef MISSING_SYSCALL_NAMES 7 | #define _close close 8 | #define _execve execve 9 | #define _fcntl fcntl 10 | #define _fork fork 11 | #define _fstat fstat 12 | #define _getpid getpid 13 | #define _gettimeofday gettimeofday 14 | #define _isatty isatty 15 | #define _kill kill 16 | #define _link link 17 | #define _lseek lseek 18 | #define _mkdir mkdir 19 | #define _open open 20 | #define _read read 21 | #define _sbrk sbrk 22 | #define _stat stat 23 | #define _times times 24 | #define _unlink unlink 25 | #define _wait wait 26 | #define _write write 27 | #endif /* MISSING_SYSCALL_NAMES */ 28 | 29 | #if defined MISSING_SYSCALL_NAMES || !defined HAVE_OPENDIR 30 | /* If the system call interface is missing opendir, readdir, and 31 | closedir, there is an implementation of these functions in 32 | libc/posix that is implemented using open, getdents, and close. 33 | Note, these functions are currently not in the libc/syscalls 34 | directory. */ 35 | #define _opendir opendir 36 | #define _readdir readdir 37 | #define _closedir closedir 38 | #endif /* MISSING_SYSCALL_NAMES || !HAVE_OPENDIR */ 39 | 40 | #endif /* !__SYSLIST_H_ */ 41 | -------------------------------------------------------------------------------- /docs/useful snippets.txt: -------------------------------------------------------------------------------- 1 | oled <- Oled new 2 | 3 | oled initialize 4 | 5 | oled string: 'Hello world!' x: 16 y: 16 6 | 7 | oled transfer 8 | 9 | oled clear 10 | 11 | oled rectangleX: 16 y: 16 width: 80 height: 32 isFilled: true 12 | 13 | Rectangle new origin: 16 @ 16 extent: 64 @ 24; displayOn: oled 14 | 15 | rect <- Rectangle new origin: 16 @ 16 extent: 64 @ 24 16 | 17 | rect displayOn: oled 18 | 19 | rect corner y 20 | 21 | rect extent 22 | 23 | Circle new center: 64 @ 32 radius: 16; displayOn: oled 24 | 25 | circle <- Circle new center: 64 @ 32 radius: 16 26 | 27 | gizmo <- Gizmo new. gizmo setupButtonHandlers. gizmo setupWifiHandlers. 28 | 29 | gizmo afterDelay: 2000 do: [gizmo ledOn. gizmo afterDelay: 2000 do: [gizmo ledOff] ] 30 | 31 | gizmo when: #BigButtonClicked do: ['Big Button Pressed' print] 32 | 33 | gizmo <- Gizmo new. gizmo when: #BigButtonClicked do: buttonHandler 34 | 35 | aBlock <- [ 'Smalltalk says button pressed' print. buttonHandler <- aBlock newProcess ]. 36 | buttonHandler <- aBlock newProcess. 37 | 38 | BigButtonClicked <- ['no arg block' print] 39 | 40 | 'x [''Litte button has been held'' print] value' evalWith: 4 41 | 42 | gizmo when: #BigButtonClicked do: [ aBlock <- ['Big Button Pressed' print]. aBlock value. aProc <- aBlock newProcess. <181 1 eventNum aProc> ] 43 | 44 | ButtonEventHandlers at: 'BigButtonClicked' put: ['BigButtonClicked string event' print] -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | # This is a basic workflow to help you get started with Actions 2 | 3 | name: CI 4 | 5 | # Controls when the action will run. 6 | on: 7 | # Triggers the workflow on push or pull request events but only for the master branch 8 | push: 9 | branches: [ master ] 10 | pull_request: 11 | branches: [ master ] 12 | 13 | # Allows you to run this workflow manually from the Actions tab 14 | workflow_dispatch: 15 | 16 | # A workflow run is made up of one or more jobs that can run sequentially or in parallel 17 | jobs: 18 | # This workflow contains a single job called "build" 19 | build: 20 | # The type of runner that the job will run on 21 | runs-on: ubuntu-latest 22 | 23 | # Steps represent a sequence of tasks that will be executed as part of the job 24 | steps: 25 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 26 | - uses: actions/checkout@v2 27 | 28 | - name: Configure Git safe directory 29 | run: git config --global --add safe.directory /github/workspace 30 | 31 | # Runs a single command using the runners shell 32 | - name: esp-idf build 33 | uses: sebastianPsm/esp-idf-ci-action@1 34 | 35 | # Runs a set of commands using the runners shell 36 | - name: Run a multi-line script 37 | run: | 38 | echo Add other actions to build, 39 | echo test, and deploy your project. 40 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/assert.h: -------------------------------------------------------------------------------- 1 | /* 2 | assert.h 3 | */ 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include "_ansi.h" 10 | 11 | #undef assert 12 | 13 | #ifdef NDEBUG /* required by ANSI standard */ 14 | # define assert(__e) ((void) sizeof(__e)) 15 | #else 16 | # define assert(__e) ((__e) ? (void)0 : __assert_func (__FILE__, __LINE__, \ 17 | __ASSERT_FUNC, #__e)) 18 | 19 | # ifndef __ASSERT_FUNC 20 | /* Use g++'s demangled names in C++. */ 21 | # if defined __cplusplus && defined __GNUC__ 22 | # define __ASSERT_FUNC __PRETTY_FUNCTION__ 23 | 24 | /* C99 requires the use of __func__. */ 25 | # elif __STDC_VERSION__ >= 199901L 26 | # define __ASSERT_FUNC __func__ 27 | 28 | /* Older versions of gcc don't have __func__ but can use __FUNCTION__. */ 29 | # elif __GNUC__ >= 2 30 | # define __ASSERT_FUNC __FUNCTION__ 31 | 32 | /* failed to detect __func__ support. */ 33 | # else 34 | # define __ASSERT_FUNC ((char *) 0) 35 | # endif 36 | # endif /* !__ASSERT_FUNC */ 37 | #endif /* !NDEBUG */ 38 | 39 | void _EXFUN(__assert, (const char *, int, const char *) 40 | _ATTRIBUTE ((__noreturn__))); 41 | void _EXFUN(__assert_func, (const char *, int, const char *, const char *) 42 | _ATTRIBUTE ((__noreturn__))); 43 | 44 | #if __STDC_VERSION__ >= 201112L && !defined __cplusplus 45 | # define static_assert _Static_assert 46 | #endif 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/argz.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002 by Red Hat, Incorporated. All rights reserved. 2 | * 3 | * Permission to use, copy, modify, and distribute this software 4 | * is freely granted, provided that this notice is preserved. 5 | */ 6 | 7 | #ifndef _ARGZ_H_ 8 | #define _ARGZ_H_ 9 | 10 | #include 11 | #include 12 | 13 | #include "_ansi.h" 14 | 15 | _BEGIN_STD_C 16 | 17 | /* The newlib implementation of these functions assumes that sizeof(char) == 1. */ 18 | error_t argz_create (char *const argv[], char **argz, size_t *argz_len); 19 | error_t argz_create_sep (const char *string, int sep, char **argz, size_t *argz_len); 20 | size_t argz_count (const char *argz, size_t argz_len); 21 | void argz_extract (char *argz, size_t argz_len, char **argv); 22 | void argz_stringify (char *argz, size_t argz_len, int sep); 23 | error_t argz_add (char **argz, size_t *argz_len, const char *str); 24 | error_t argz_add_sep (char **argz, size_t *argz_len, const char *str, int sep); 25 | error_t argz_append (char **argz, size_t *argz_len, const char *buf, size_t buf_len); 26 | error_t argz_delete (char **argz, size_t *argz_len, char *entry); 27 | error_t argz_insert (char **argz, size_t *argz_len, char *before, const char *entry); 28 | char * argz_next (char *argz, size_t argz_len, const char *entry); 29 | error_t argz_replace (char **argz, size_t *argz_len, const char *str, const char *with, unsigned *replace_count); 30 | 31 | _END_STD_C 32 | 33 | #endif /* _ARGZ_H_ */ 34 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/tar.h: -------------------------------------------------------------------------------- 1 | /* 2 | * tar.h 3 | */ 4 | 5 | #ifndef _TAR_H 6 | #define _TAR_H 7 | 8 | /* General definitions */ 9 | #define TMAGIC "ustar" /* ustar plus null byte. */ 10 | #define TMAGLEN 6 /* Length of the above. */ 11 | #define TVERSION "00" /* 00 without a null byte. */ 12 | #define TVERSLEN 2 /* Length of the above. */ 13 | 14 | /* Typeflag field definitions */ 15 | #define REGTYPE '0' /* Regular file. */ 16 | #define AREGTYPE '\0' /* Regular file. */ 17 | #define LNKTYPE '1' /* Link. */ 18 | #define SYMTYPE '2' /* Symbolic link. */ 19 | #define CHRTYPE '3' /* Character special. */ 20 | #define BLKTYPE '4' /* Block special. */ 21 | #define DIRTYPE '5' /* Directory. */ 22 | #define FIFOTYPE '6' /* FIFO special. */ 23 | #define CONTTYPE '7' /* Reserved. */ 24 | 25 | /* Mode field bit definitions (octal) */ 26 | #define TSUID 04000 /* Set UID on execution. */ 27 | #define TSGID 02000 /* Set GID on execution. */ 28 | #define TSVTX 01000 /* On directories, restricted deletion flag. */ 29 | #define TUREAD 00400 /* Read by owner. */ 30 | #define TUWRITE 00200 /* Write by owner. */ 31 | #define TUEXEC 00100 /* Execute/search by owner. */ 32 | #define TGREAD 00040 /* Read by group. */ 33 | #define TGWRITE 00020 /* Write by group. */ 34 | #define TGEXEC 00010 /* Execute/search by group. */ 35 | #define TOREAD 00004 /* Read by other. */ 36 | #define TOWRITE 00002 /* Write by other. */ 37 | #define TOEXEC 00001 /* Execute/search by other. */ 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /smalltalkImage/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | LIBS = -lm 3 | 4 | 5 | default: 6 | make imageBuilder 7 | make image 8 | 9 | imageBuilder: 10 | @cp ../src/*.c source 11 | @cp ../include/*.h source 12 | @cp source/build_image.h source/build.h 13 | @rm source/main.c 14 | @rm source/esp32wifi.* 15 | @cd source && $(CC) -c memory.c names.c news.c interp.c process.c primitive.c sysprim.c filein.c lex.c parser.c unixio.c image.c st.c initial.c uart.c tty.c 16 | @cd source && $(CC) memory.o names.o news.o interp.o process.o primitive.o sysprim.o filein.o lex.o parser.o unixio.o image.o st.o uart.o tty.o -o ../stje $(LIBS) 17 | @cd source && $(CC) memory.o names.o news.o interp.o process.o primitive.o sysprim.o filein.o lex.o parser.o unixio.o image.o initial.o uart.o tty.o -o ../imageBuilder $(LIBS) 18 | 19 | image: 20 | ./buildImage basic.st mag.st collect.st file.st mult.st display.st gizmo.st http.st date.st tty.st 21 | @cp ./systemImage ../data/systemImage 22 | @cp ./objectTable ../data/objectTable 23 | @cp ./objectData ../data/objectData 24 | @cp ./objectData ../objects/objectData 25 | @echo Done. "Upload files in parent directory with: cd ..; pio run -t uploadfs" 26 | 27 | configImageFiles: 28 | 29 | ifndef $(TARGET_MAC) 30 | $(info TARGET_MAC not set) 31 | else 32 | $(info TARGET_MAC set) 33 | endif 34 | 35 | clean: 36 | rm -f source/*.o stje imageBuilder systemImage 37 | rm -f `find . | grep \~` 38 | 39 | install: 40 | @mkdir -p /usr/share/stje 41 | @cp systemImage /usr/share/stje 42 | @cp stje /usr/bin 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Creative Commons Attribution 4.0 International 2 | 3 | Copyright (c) 2025 Abdul Nabi 4 | 5 | This work is licensed under the Creative Commons Attribution 4.0 International License. 6 | To view a copy of this license, visit: 7 | 8 | https://creativecommons.org/licenses/by/4.0/ 9 | 10 | You are free to: 11 | 12 | - Share — copy and redistribute the material in any medium or format 13 | - Adapt — remix, transform, and build upon the material for any purpose, even commercially. 14 | 15 | Under the following terms: 16 | 17 | - Attribution — You must give appropriate credit, provide a link to the license, 18 | and indicate if changes were made. You may do so in any reasonable manner, 19 | but not in any way that suggests the licensor endorses you or your use. 20 | 21 | Notices: 22 | 23 | You do not have to comply with the license for elements of the material in the public domain 24 | or where your use is permitted by an applicable exception or limitation. 25 | 26 | No warranties are given. The license may not give you all of the permissions necessary 27 | for your intended use. For example, other rights such as publicity, privacy, or moral rights 28 | may limit how you use the material. 29 | 30 | --- 31 | 32 | Included Works: 33 | 34 | Any third-party code, libraries, images, or other assets included in this software 35 | are copyrighted by their respective owners and are subject to their own license agreements. 36 | Please refer to individual files or documentation for specific licensing terms. 37 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/_default_types.h: -------------------------------------------------------------------------------- 1 | /* 2 | * _default_types implementation for xtensa lx106 arch 3 | * 4 | * Simplified version of generic _default_types.h, ignores gcc 5 | * built-in standard types. 6 | */ 7 | 8 | #ifndef _MACHINE__DEFAULT_TYPES_H 9 | #define _MACHINE__DEFAULT_TYPES_H 10 | 11 | #include 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif 16 | 17 | typedef signed char __int8_t ; 18 | typedef unsigned char __uint8_t ; 19 | #define ___int8_t_defined 1 20 | 21 | typedef signed short __int16_t; 22 | typedef unsigned short __uint16_t; 23 | #define ___int16_t_defined 1 24 | 25 | typedef signed int __int32_t; 26 | typedef unsigned int __uint32_t; 27 | #define ___int32_t_defined 1 28 | 29 | typedef signed long long __int64_t; 30 | typedef unsigned long long __uint64_t; 31 | #define ___int64_t_defined 1 32 | 33 | typedef __int8_t __int_least8_t; 34 | typedef __uint8_t __uint_least8_t; 35 | #define ___int_least8_t_defined 36 | 37 | typedef __int16_t __int_least16_t; 38 | typedef __uint16_t __uint_least16_t; 39 | #define ___int_least16_t_defined 40 | 41 | typedef __int32_t __int_least32_t; 42 | typedef __uint32_t __uint_least32_t; 43 | #define ___int_least32_t_defined 44 | 45 | typedef __int64_t __int_least64_t; 46 | typedef __uint64_t __uint_least64_t; 47 | #define ___int_least64_t_defined 48 | 49 | typedef __INTPTR_TYPE__ __intptr_t; 50 | typedef __UINTPTR_TYPE__ __uintptr_t; 51 | 52 | #ifdef __cplusplus 53 | } 54 | #endif 55 | 56 | #endif /* _MACHINE__DEFAULT_TYPES_H */ 57 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/platform_include/esp_newlib.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef __ESP_NEWLIB_H__ 16 | #define __ESP_NEWLIB_H__ 17 | 18 | #include 19 | 20 | /** 21 | * Replacement for newlib's _REENT_INIT_PTR and __sinit. 22 | * 23 | * Called from startup code and FreeRTOS, not intended to be called from 24 | * application code. 25 | */ 26 | void esp_reent_init(struct _reent* r); 27 | 28 | /** 29 | * Function which sets up syscall table used by newlib functions in ROM. 30 | * 31 | * Called from the startup code, not intended to be called from application 32 | * code. 33 | */ 34 | void esp_setup_syscall_table(); 35 | 36 | /** 37 | * Update current microsecond time from RTC 38 | */ 39 | void esp_set_time_from_rtc(); 40 | 41 | /* 42 | * Sync counters RTC and FRC. Update boot_time. 43 | */ 44 | void esp_sync_counters_rtc_and_frc(); 45 | 46 | #endif //__ESP_NEWLIB_H__ 47 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/locale.h: -------------------------------------------------------------------------------- 1 | /* 2 | locale.h 3 | Values appropriate for the formatting of monetary and other 4 | numberic quantities. 5 | */ 6 | 7 | #ifndef _LOCALE_H_ 8 | #define _LOCALE_H_ 9 | 10 | #include "_ansi.h" 11 | 12 | #define __need_NULL 13 | #include 14 | 15 | #define LC_ALL 0 16 | #define LC_COLLATE 1 17 | #define LC_CTYPE 2 18 | #define LC_MONETARY 3 19 | #define LC_NUMERIC 4 20 | #define LC_TIME 5 21 | #define LC_MESSAGES 6 22 | 23 | _BEGIN_STD_C 24 | 25 | struct lconv 26 | { 27 | char *decimal_point; 28 | char *thousands_sep; 29 | char *grouping; 30 | char *int_curr_symbol; 31 | char *currency_symbol; 32 | char *mon_decimal_point; 33 | char *mon_thousands_sep; 34 | char *mon_grouping; 35 | char *positive_sign; 36 | char *negative_sign; 37 | char int_frac_digits; 38 | char frac_digits; 39 | char p_cs_precedes; 40 | char p_sep_by_space; 41 | char n_cs_precedes; 42 | char n_sep_by_space; 43 | char p_sign_posn; 44 | char n_sign_posn; 45 | char int_n_cs_precedes; 46 | char int_n_sep_by_space; 47 | char int_n_sign_posn; 48 | char int_p_cs_precedes; 49 | char int_p_sep_by_space; 50 | char int_p_sign_posn; 51 | }; 52 | 53 | #ifndef _REENT_ONLY 54 | char *_EXFUN(setlocale,(int category, const char *locale)); 55 | struct lconv *_EXFUN(localeconv,(void)); 56 | #endif 57 | 58 | struct _reent; 59 | char *_EXFUN(_setlocale_r,(struct _reent *, int category, const char *locale)); 60 | struct lconv *_EXFUN(_localeconv_r,(struct _reent *)); 61 | 62 | _END_STD_C 63 | 64 | #endif /* _LOCALE_H_ */ 65 | -------------------------------------------------------------------------------- /smalltalkje.xcodeproj/xcuserdata/abdul.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | 9 | 21 | 22 | 23 | 25 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /components/m5stickc-idf/include/m5led.h: -------------------------------------------------------------------------------- 1 | /** 2 | * m5led.h 3 | * 4 | * (C) 2019 - Timothee Cruse (teuteuguy) 5 | * This code is licensed under the MIT License. 6 | */ 7 | 8 | #ifndef _M5LED_H_ 9 | #define _M5LED_H_ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | #include "esp_system.h" 15 | #include "esp_log.h" 16 | #include "driver/gpio.h" 17 | 18 | // TODO: Either move build.h or figure out how to use in in components (though breaks component modularity) 19 | #include "../../../include/build.h" 20 | 21 | #define M5LED_ON 0 22 | #define M5LED_OFF 1 23 | 24 | #define M5LED_DEFAULT_STATE M5LED_OFF 25 | 26 | #if TARGET_DEVICE == DEVICE_M5STICKC 27 | 28 | #define M5LED_GPIO GPIO_NUM_10 29 | 30 | #elif TARGET_DEVICE == DEVICE_M5SATOM_LITE 31 | 32 | #define M5LED_GPIO GPIO_NUM_27 33 | 34 | #elif TARGET_DEVICE == DEVICE_T_WRISTBAND 35 | 36 | #define M5LED_GPIO GPIO_NUM_4 37 | 38 | #endif 39 | 40 | /** 41 | * @brief Initialize led 42 | * * 43 | * @return ESP_OK success 44 | * ESP_FAIL failed 45 | */ 46 | esp_err_t m5led_init(); 47 | 48 | /** 49 | * @brief Check if led is on 50 | * 51 | * @return false not on 52 | * true otherwise on 53 | */ 54 | bool m5led_is_on(void); 55 | 56 | /** 57 | * @brief Set led. 58 | * 59 | * @param state led state to set 60 | * @return ESP_OK success 61 | * ESP_FAIL failed 62 | */ 63 | esp_err_t m5led_set(bool state); 64 | 65 | /** 66 | * @brief Toggle led. 67 | * 68 | * @return ESP_OK success 69 | * ESP_FAIL failed 70 | */ 71 | esp_err_t m5led_toggle(void); 72 | 73 | #ifdef __cplusplus 74 | } 75 | #endif 76 | 77 | #endif // _M5BUTTON_H_ -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/search.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ */ 2 | /* $FreeBSD: src/include/search.h,v 1.4 2002/03/23 17:24:53 imp Exp $ */ 3 | 4 | /* 5 | * Written by J.T. Conklin 6 | * Public domain. 7 | */ 8 | 9 | #ifndef _SEARCH_H_ 10 | #define _SEARCH_H_ 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | typedef struct entry { 17 | char *key; 18 | void *data; 19 | } ENTRY; 20 | 21 | typedef enum { 22 | FIND, ENTER 23 | } ACTION; 24 | 25 | typedef enum { 26 | preorder, 27 | postorder, 28 | endorder, 29 | leaf 30 | } VISIT; 31 | 32 | #ifdef _SEARCH_PRIVATE 33 | typedef struct node { 34 | char *key; 35 | struct node *llink, *rlink; 36 | } node_t; 37 | #endif 38 | 39 | struct hsearch_data 40 | { 41 | struct internal_head *htable; 42 | size_t htablesize; 43 | }; 44 | 45 | #ifndef __compar_fn_t_defined 46 | #define __compar_fn_t_defined 47 | typedef int (*__compar_fn_t) (const void *, const void *); 48 | #endif 49 | 50 | __BEGIN_DECLS 51 | int hcreate(size_t); 52 | void hdestroy(void); 53 | ENTRY *hsearch(ENTRY, ACTION); 54 | int hcreate_r(size_t, struct hsearch_data *); 55 | void hdestroy_r(struct hsearch_data *); 56 | int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *); 57 | void *tdelete(const void *__restrict, void **__restrict, __compar_fn_t); 58 | void tdestroy (void *, void (*)(void *)); 59 | void *tfind(const void *, void **, __compar_fn_t); 60 | void *tsearch(const void *, void **, __compar_fn_t); 61 | void twalk(const void *, void (*)(const void *, VISIT, int)); 62 | __END_DECLS 63 | 64 | #endif /* !_SEARCH_H_ */ 65 | -------------------------------------------------------------------------------- /docs/method ideas.txt: -------------------------------------------------------------------------------- 1 | m5Stick when: #buttonOnePressed do: aBlock 2 | m5Stick when: #alarmGoesOff do: 3 | 4 | wifi connect: ssid password: password whenDone: aBlock 5 | 6 | esp32 whenGPIO: pin goes: (lowOrHigh) do: aBlock 7 | // Define globals low as true and high as false 8 | 9 | esp32 do: [aBlock] after: milliseconds 10 | 11 | Make M5StickC a subclass of ESP32 12 | 13 | 14 | smalltalk after: 10 seconds do: [gizmo ledOn] 15 | smalltalk every: 1 minute do: [gizmo blink] 16 | smalltalk at: 1 oClock do: [gizmo blink] 17 | 18 | 19 | aBlock runAfter: 10 seconds 20 | aBlock runEvery: 1 minute 21 | aBlock runAt: 1 oClock 22 | aBlock runAt: 16 : 45 23 | aBlock runEveryDayAt: 2 am 24 | 25 | 26 | smalltalk 27 | 28 | Methods ESP32 'event handling' 29 | 30 | Internally create a ESP32 prim 31 | <180 funcNum arg1 arg2> 32 | 33 | funcNum mappings: 34 | 35 | 1 - register GPIO event handler process in arg 2 for pin arg1 36 | 2 - call block in arg1 after delay of milliseconds in arg2 37 | 38 | 39 | and a M5StickC prim 40 | <181 funcNum arg1 arg2> 41 | 42 | funcNum mappings: 43 | 101 - register M5StickC event handler process in arg 2 for event num in arg1 44 | 45 | event num mappings: 46 | 0 - Button A Clicked 47 | 1 - Button A Hold 48 | 2 - Button B Clicked 49 | 3 - Button B Hold 50 | 51 | 52 | WiFi 53 | <201 bool> 54 | - turnOnOffWiFi 55 | 56 | <202 returnObj> 57 | - return SSIDs available (with info structs?) 58 | 59 | <203 ssid password doneProcess> 60 | - connect to ssid with password (callback process when success/fail) 61 | 62 | <203 host method arg responseObj doneProcess> 63 | - spawn task and call done proc on complete. 64 | 65 | 66 | globalSymbol() should be renamed globalAtSymbol() -------------------------------------------------------------------------------- /components/m5stickc-idf/m5led.c: -------------------------------------------------------------------------------- 1 | /** 2 | * m5led.c 3 | * 4 | * (C) 2019 - Timothee Cruse (teuteuguy) 5 | * This code is licensed under the MIT License. 6 | */ 7 | 8 | #include "include/m5led.h" 9 | 10 | static const char * TAG = "m5led"; 11 | 12 | static bool current_state = M5LED_DEFAULT_STATE; 13 | 14 | esp_err_t m5led_init() 15 | { 16 | esp_err_t e; 17 | 18 | gpio_config_t io_conf; 19 | // Setup the LED 20 | io_conf.intr_type = GPIO_PIN_INTR_DISABLE; //disable interrupt 21 | io_conf.mode = GPIO_MODE_OUTPUT; //set as output mode 22 | io_conf.pin_bit_mask = ((1ULL << M5LED_GPIO)); // bit mask of the pins that you want to set, e.g.GPIO10 23 | io_conf.pull_down_en = 0; //disable pull-down mode 24 | io_conf.pull_up_en = 0; //disable pull-up mode 25 | e = gpio_config(&io_conf); //configure GPIO with the given settings 26 | if (e != ESP_OK) 27 | { 28 | ESP_LOGE(TAG, "Error setting up LED: %u", e); 29 | return e; 30 | } 31 | 32 | e = gpio_set_level(M5LED_GPIO, M5LED_DEFAULT_STATE); 33 | if (e != ESP_OK) 34 | { 35 | return ESP_FAIL; 36 | } 37 | 38 | ESP_LOGD(TAG, "LED GP10 enabled"); 39 | return ESP_OK; 40 | } 41 | 42 | bool m5led_is_on(void) 43 | { 44 | return current_state; 45 | } 46 | 47 | esp_err_t m5led_set(bool state) 48 | { 49 | esp_err_t e; 50 | 51 | current_state = state; 52 | e = gpio_set_level(M5LED_GPIO, current_state); 53 | if (e != ESP_OK) 54 | { 55 | return ESP_FAIL; 56 | } 57 | 58 | return ESP_OK; 59 | } 60 | 61 | esp_err_t m5led_toggle(void) 62 | { 63 | esp_err_t e; 64 | 65 | e = m5led_set(1 - current_state); 66 | if (e != ESP_OK) 67 | { 68 | return ESP_FAIL; 69 | } 70 | 71 | return ESP_OK; 72 | } 73 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/wordexp.h: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2002, 2010 by Red Hat, Incorporated. All rights reserved. 2 | * 3 | * Permission to use, copy, modify, and distribute this software 4 | * is freely granted, provided that this notice is preserved. 5 | */ 6 | 7 | #ifndef _WORDEXP_H_ 8 | #define _WORDEXP_H_ 9 | 10 | #include 11 | 12 | #ifdef __cplusplus 13 | extern "C" { 14 | #endif 15 | 16 | struct _wordexp_t 17 | { 18 | size_t we_wordc; /* Count of words matched by words. */ 19 | char **we_wordv; /* Pointer to list of expanded words. */ 20 | size_t we_offs; /* Slots to reserve at the beginning of we_wordv. */ 21 | }; 22 | 23 | typedef struct _wordexp_t wordexp_t; 24 | 25 | #define WRDE_DOOFFS 0x0001 /* Use we_offs. */ 26 | #define WRDE_APPEND 0x0002 /* Append to output from previous call. */ 27 | #define WRDE_NOCMD 0x0004 /* Don't perform command substitution. */ 28 | #define WRDE_REUSE 0x0008 /* pwordexp points to a wordexp_t struct returned from 29 | a previous successful call to wordexp. */ 30 | #define WRDE_SHOWERR 0x0010 /* Print error messages to stderr. */ 31 | #define WRDE_UNDEF 0x0020 /* Report attempt to expand undefined shell variable. */ 32 | 33 | enum { 34 | WRDE_SUCCESS, 35 | WRDE_NOSPACE, 36 | WRDE_BADCHAR, 37 | WRDE_BADVAL, 38 | WRDE_CMDSUB, 39 | WRDE_SYNTAX, 40 | WRDE_NOSYS 41 | }; 42 | 43 | /* Note: This implementation of wordexp requires a version of bash 44 | that supports the --wordexp and --protected arguments to be present 45 | on the system. It does not support the WRDE_UNDEF flag. */ 46 | int wordexp(const char *__restrict, wordexp_t *__restrict, int); 47 | void wordfree(wordexp_t *); 48 | 49 | #ifdef __cplusplus 50 | } 51 | #endif 52 | 53 | #endif /* _WORDEXP_H_ */ 54 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/esp_event/esp_event_private.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ESP_EVENT_PRIVATE_H_ 16 | #define ESP_EVENT_PRIVATE_H_ 17 | 18 | #include "esp_event.h" 19 | 20 | #ifdef __cplusplus 21 | extern "C" { 22 | #endif 23 | 24 | /** 25 | * @brief Searches handlers registered with an event loop to see if it has been registered. 26 | * 27 | * @param[in] event_loop the loop to search 28 | * @param[in] event_base the event base to search 29 | * @param[in] event_id the event id to search 30 | * @param[in] event_handler the event handler to look for 31 | * 32 | * @return true handler registered 33 | * @return false handler not registered 34 | * 35 | * @return 36 | * - true: Handler registered 37 | * - false: Handler not registered 38 | */ 39 | bool esp_event_is_handler_registered(esp_event_loop_handle_t event_loop, esp_event_base_t event_base, int32_t event_id, esp_event_handler_t event_handler); 40 | 41 | /** 42 | * @brief Deinitializes the event loop library 43 | * 44 | * @return 45 | * - ESP_OK: Success 46 | * - Others: Fail 47 | */ 48 | esp_err_t esp_event_loop_deinit(); 49 | 50 | #ifdef __cplusplus 51 | } // extern "C" 52 | #endif 53 | 54 | #endif // #ifndef ESP_EVENT_PRIVATE_H_ -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/file.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2005-2006 Tensilica Inc. ALL RIGHTS RESERVED. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are met: 5 | 6 | 1. Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | 9 | 2. Redistributions in binary form must reproduce the above copyright 10 | notice, this list of conditions and the following disclaimer in the 11 | documentation and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 14 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 15 | TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 16 | PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL TENSILICA 17 | INCORPORATED BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 21 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 22 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 24 | 25 | #include 26 | 27 | /* Alternate names for values for the WHENCE argument to `lseek'. 28 | These are the same as SEEK_SET, SEEK_CUR, and SEEK_END, respectively. */ 29 | #ifndef L_SET 30 | #define L_SET 0 /* Seek from beginning of file. */ 31 | #define L_INCR 1 /* Seek from current position. */ 32 | #define L_XTND 2 /* Seek from end of file. */ 33 | #endif 34 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/esp_event/esp_event_base.h: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #ifndef ESP_EVENT_BASE_H_ 16 | #define ESP_EVENT_BASE_H_ 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | // Defines for declaring and defining event base 23 | #define ESP_EVENT_DECLARE_BASE(id) extern esp_event_base_t id; 24 | #define ESP_EVENT_DEFINE_BASE(id) esp_event_base_t id = #id; 25 | 26 | // Event loop library types 27 | typedef const char* esp_event_base_t; /**< unique pointer to a subsystem that exposes events */ 28 | typedef void* esp_event_loop_handle_t; /**< a number that identifies an event with respect to a base */ 29 | typedef void (*esp_event_handler_t)(void* event_handler_arg, 30 | esp_event_base_t event_base, 31 | int32_t event_id, 32 | void* event_data); /**< function called when an event is posted to the queue */ 33 | 34 | 35 | // Defines for registering/unregistering event handlers 36 | #define ESP_EVENT_ANY_BASE NULL /**< register handler for any event base */ 37 | #define ESP_EVENT_ANY_ID -1 /**< register handler for any event id */ 38 | 39 | #ifdef __cplusplus 40 | } 41 | #endif 42 | 43 | #endif // #ifndef ESP_EVENT_BASE_H_ 44 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/esp_event/esp_event_private.c: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "sdkconfig.h" 16 | 17 | #ifdef CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 18 | 19 | #include "esp_event_private.h" 20 | #include "esp_event_internal.h" 21 | 22 | #include "esp_log.h" 23 | 24 | bool esp_event_is_handler_registered(esp_event_loop_handle_t event_loop, esp_event_base_t event_base, int32_t event_id, esp_event_handler_t event_handler) 25 | { 26 | esp_event_loop_instance_t* loop = (esp_event_loop_instance_t*) event_loop; 27 | 28 | bool result = false; 29 | xSemaphoreTake(loop->mutex, portMAX_DELAY); 30 | 31 | esp_event_base_instance_t* base_it; 32 | SLIST_FOREACH(base_it, &(loop->event_bases), event_base_entry) { 33 | esp_event_id_instance_t* event_it; 34 | SLIST_FOREACH(event_it, &(base_it->event_ids), event_id_entry) { 35 | esp_event_handler_instance_t* handler_it; 36 | SLIST_FOREACH(handler_it, &(event_it->handlers), handler_entry) { 37 | if (base_it->base == event_base && event_it->id == event_id && handler_it->handler == event_handler) { 38 | result = true; 39 | goto out; 40 | } 41 | } 42 | } 43 | } 44 | 45 | out: 46 | xSemaphoreGive(loop->mutex); 47 | return result; 48 | } 49 | 50 | #endif // CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/reent_init.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "sdkconfig.h" 16 | 17 | #ifdef CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 18 | 19 | #include 20 | #include 21 | #include "esp_attr.h" 22 | 23 | /* This function is not part on newlib API, it is defined in libc/stdio/local.h 24 | * There is no nice way to get __cleanup member populated while avoiding __sinit, 25 | * so extern declaration is used here. 26 | */ 27 | extern void _cleanup_r(struct _reent* r); 28 | 29 | /** 30 | * This is the replacement for newlib's _REENT_INIT_PTR and __sinit. 31 | * The problem with __sinit is that it allocates three FILE structures 32 | * (stdin, stdout, stderr). Having individual standard streams for each task 33 | * is a bit too much on a small embedded system. So we point streams 34 | * to the streams of the global struct _reent, which are initialized in 35 | * startup code. 36 | */ 37 | void IRAM_ATTR esp_reent_init(struct _reent* r) 38 | { 39 | memset(r, 0, sizeof(*r)); 40 | r->_stdout = _GLOBAL_REENT->_stdout; 41 | r->_stderr = _GLOBAL_REENT->_stderr; 42 | r->_stdin = _GLOBAL_REENT->_stdin; 43 | r->__cleanup = &_cleanup_r; 44 | r->__sdidinit = 1; 45 | r->__sglue._next = NULL; 46 | r->__sglue._niobs = 0; 47 | r->__sglue._iobs = NULL; 48 | r->_current_locale = "C"; 49 | } 50 | 51 | #endif // CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/lock.h: -------------------------------------------------------------------------------- 1 | #ifndef _XTENSA_LOCK_H__ 2 | #define _XTENSA_LOCK_H__ 3 | 4 | /* generic lock implementation. 5 | 6 | Weak linked stub _lock functions in lock.c, can be 7 | replaced with a lock implementation at link time. 8 | 9 | */ 10 | 11 | typedef int _lock_t; 12 | typedef _lock_t _LOCK_RECURSIVE_T; 13 | typedef _lock_t _LOCK_T; 14 | 15 | #include <_ansi.h> 16 | 17 | /* NOTE: some parts of newlib statically initialise locks via 18 | __LOCK_INIT, some initialise at runtime via __lock_init. So need to 19 | support possibility that a _lock_t is null during first call to 20 | _lock_acquire or _lock_try_acquire. 21 | 22 | Lock functions all take a pointer to the _lock_t entry, so the 23 | value stored there can be manipulated. 24 | */ 25 | #define __LOCK_INIT(CLASS,NAME) CLASS _lock_t NAME = 0; 26 | #define __LOCK_INIT_RECURSIVE(CLASS,NAME) CLASS _lock_t NAME = 0; 27 | 28 | void _lock_init(_lock_t *lock); 29 | void _lock_init_recursive(_lock_t *lock); 30 | void _lock_close(_lock_t *lock); 31 | void _lock_close_recursive(_lock_t *lock); 32 | void _lock_acquire(_lock_t *lock); 33 | void _lock_acquire_recursive(_lock_t *lock); 34 | int _lock_try_acquire(_lock_t *lock); 35 | int _lock_try_acquire_recursive(_lock_t *lock); 36 | void _lock_release(_lock_t *lock); 37 | void _lock_release_recursive(_lock_t *lock); 38 | 39 | #define __lock_init(lock) _lock_init(&(lock)) 40 | #define __lock_init_recursive(lock) _lock_init_recursive(&(lock)) 41 | #define __lock_close(lock) _lock_close(&(lock)) 42 | #define __lock_close_recursive(lock) _lock_close_recursive(&(lock)) 43 | #define __lock_acquire(lock) _lock_acquire(&(lock)) 44 | #define __lock_acquire_recursive(lock) _lock_acquire_recursive(&(lock)) 45 | #define __lock_try_acquire(lock) _lock_try_acquire(&(lock)) 46 | #define __lock_try_acquire_recursive(lock) _lock_try_acquire_recursive(&(lock)) 47 | #define __lock_release(lock) _lock_release(&(lock)) 48 | #define __lock_release_recursive(lock) _lock_release_recursive(&(lock)) 49 | 50 | #endif /* _XTENSA_LOCK_H__ */ 51 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/sched.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Joel Sherrill . 3 | * 4 | * COPYRIGHT (c) 1989-2010. 5 | * On-Line Applications Research Corporation (OAR). 6 | * 7 | * Permission to use, copy, modify, and distribute this software for any 8 | * purpose without fee is hereby granted, provided that this entire notice 9 | * is included in all copies of any software which is or includes a copy 10 | * or modification of this software. 11 | * 12 | * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED 13 | * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION 14 | * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS 15 | * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. 16 | * 17 | * $Id$ 18 | */ 19 | 20 | 21 | #ifndef _SYS_SCHED_H_ 22 | #define _SYS_SCHED_H_ 23 | 24 | #ifdef __cplusplus 25 | extern "C" { 26 | #endif 27 | 28 | /* Scheduling Policies */ 29 | /* Open Group Specifications Issue 6 */ 30 | #if defined(__CYGWIN__) 31 | #define SCHED_OTHER 3 32 | #else 33 | #define SCHED_OTHER 0 34 | #endif 35 | 36 | #define SCHED_FIFO 1 37 | #define SCHED_RR 2 38 | 39 | #if defined(_POSIX_SPORADIC_SERVER) 40 | #define SCHED_SPORADIC 4 41 | #endif 42 | 43 | /* Scheduling Parameters */ 44 | /* Open Group Specifications Issue 6 */ 45 | 46 | struct sched_param { 47 | int sched_priority; /* Process execution scheduling priority */ 48 | 49 | #if defined(_POSIX_SPORADIC_SERVER) || defined(_POSIX_THREAD_SPORADIC_SERVER) 50 | int sched_ss_low_priority; /* Low scheduling priority for sporadic */ 51 | /* server */ 52 | struct timespec sched_ss_repl_period; 53 | /* Replenishment period for sporadic server */ 54 | struct timespec sched_ss_init_budget; 55 | /* Initial budget for sporadic server */ 56 | int sched_ss_max_repl; /* Maximum pending replenishments for */ 57 | /* sporadic server */ 58 | #endif 59 | }; 60 | 61 | int sched_yield( void ); 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif 68 | /* end of include file */ 69 | 70 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/stdio_ext.h: -------------------------------------------------------------------------------- 1 | /* 2 | * stdio_ext.h 3 | * 4 | * Definitions for I/O internal operations, originally from Solaris. 5 | */ 6 | 7 | #ifndef _STDIO_EXT_H_ 8 | #define _STDIO_EXT_H_ 9 | 10 | #ifdef __rtems__ 11 | #error " not supported" 12 | #endif 13 | 14 | #include 15 | 16 | #define FSETLOCKING_QUERY 0 17 | #define FSETLOCKING_INTERNAL 1 18 | #define FSETLOCKING_BYCALLER 2 19 | 20 | _BEGIN_STD_C 21 | 22 | void _EXFUN(__fpurge,(FILE *)); 23 | int _EXFUN(__fsetlocking,(FILE *, int)); 24 | 25 | /* TODO: 26 | 27 | void _flushlbf (void); 28 | */ 29 | 30 | #ifdef __GNUC__ 31 | 32 | _ELIDABLE_INLINE size_t 33 | __fbufsize (FILE *__fp) { return (size_t) __fp->_bf._size; } 34 | 35 | _ELIDABLE_INLINE int 36 | __freading (FILE *__fp) { return (__fp->_flags & __SRD) != 0; } 37 | 38 | _ELIDABLE_INLINE int 39 | __fwriting (FILE *__fp) { return (__fp->_flags & __SWR) != 0; } 40 | 41 | _ELIDABLE_INLINE int 42 | __freadable (FILE *__fp) { return (__fp->_flags & (__SRD | __SRW)) != 0; } 43 | 44 | _ELIDABLE_INLINE int 45 | __fwritable (FILE *__fp) { return (__fp->_flags & (__SWR | __SRW)) != 0; } 46 | 47 | _ELIDABLE_INLINE int 48 | __flbf (FILE *__fp) { return (__fp->_flags & __SLBF) != 0; } 49 | 50 | _ELIDABLE_INLINE size_t 51 | __fpending (FILE *__fp) { return __fp->_p - __fp->_bf._base; } 52 | 53 | #else 54 | 55 | size_t _EXFUN(__fbufsize,(FILE *)); 56 | int _EXFUN(__freading,(FILE *)); 57 | int _EXFUN(__fwriting,(FILE *)); 58 | int _EXFUN(__freadable,(FILE *)); 59 | int _EXFUN(__fwritable,(FILE *)); 60 | int _EXFUN(__flbf,(FILE *)); 61 | size_t _EXFUN(__fpending,(FILE *)); 62 | 63 | #ifndef __cplusplus 64 | 65 | #define __fbufsize(__fp) ((size_t) (__fp)->_bf._size) 66 | #define __freading(__fp) (((__fp)->_flags & __SRD) != 0) 67 | #define __fwriting(__fp) (((__fp)->_flags & __SWR) != 0) 68 | #define __freadable(__fp) (((__fp)->_flags & (__SRD | __SRW)) != 0) 69 | #define __fwritable(__fp) (((__fp)->_flags & (__SWR | __SRW)) != 0) 70 | #define __flbf(__fp) (((__fp)->_flags & __SLBF) != 0) 71 | #define __fpending(__fp) ((size_t) ((__fp)->_p - (__fp)->_bf._base)) 72 | 73 | #endif /* __cplusplus */ 74 | 75 | #endif /* __GNUC__ */ 76 | 77 | _END_STD_C 78 | 79 | #endif /* _STDIO_EXT_H_ */ 80 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/unctrl.h: -------------------------------------------------------------------------------- 1 | /* From curses.h. */ 2 | /* 3 | * Copyright (c) 1981, 1993 4 | * The Regents of the University of California. All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions 8 | * are met: 9 | * 1. Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * 3. All advertising materials mentioning features or use of this software 15 | * must display the following acknowledgement: 16 | * This product includes software developed by the University of 17 | * California, Berkeley and its contributors. 18 | * 4. Neither the name of the University nor the names of its contributors 19 | * may be used to endorse or promote products derived from this software 20 | * without specific prior written permission. 21 | * 22 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 | * SUCH DAMAGE. 33 | */ 34 | 35 | #ifndef _UNCTRL_H_ 36 | #define _UNCTRL_H_ 37 | 38 | #include <_ansi.h> 39 | 40 | #define unctrl(c) __unctrl[(c) & 0xff] 41 | #define unctrllen(ch) __unctrllen[(ch) & 0xff] 42 | 43 | extern __IMPORT _CONST char * _CONST __unctrl[256]; /* Control strings. */ 44 | extern __IMPORT _CONST char __unctrllen[256]; /* Control strings length. */ 45 | 46 | #endif /* _UNCTRL_H_ */ 47 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/_types.h: -------------------------------------------------------------------------------- 1 | /* ANSI C namespace clean utility typedefs */ 2 | 3 | /* This file defines various typedefs needed by the system calls that support 4 | the C library. Basically, they're just the POSIX versions with an '_' 5 | prepended. This file lives in the `sys' directory so targets can provide 6 | their own if desired (or they can put target dependant conditionals here). 7 | */ 8 | 9 | #ifndef _SYS__TYPES_H 10 | #define _SYS__TYPES_H 11 | 12 | #include 13 | #include 14 | 15 | #ifndef __off_t_defined 16 | typedef long _off_t; 17 | #endif 18 | 19 | #ifndef __dev_t_defined 20 | typedef short __dev_t; 21 | #endif 22 | 23 | #ifndef __uid_t_defined 24 | typedef unsigned short __uid_t; 25 | #endif 26 | #ifndef __gid_t_defined 27 | typedef unsigned short __gid_t; 28 | #endif 29 | 30 | #ifndef __off64_t_defined 31 | __extension__ typedef long long _off64_t; 32 | #endif 33 | 34 | /* 35 | * We need fpos_t for the following, but it doesn't have a leading "_", 36 | * so we use _fpos_t instead. 37 | */ 38 | #ifndef __fpos_t_defined 39 | typedef long _fpos_t; /* XXX must match off_t in */ 40 | /* (and must be `long' for now) */ 41 | #endif 42 | 43 | #ifdef __LARGE64_FILES 44 | #ifndef __fpos64_t_defined 45 | typedef _off64_t _fpos64_t; 46 | #endif 47 | #endif 48 | 49 | #ifndef __ssize_t_defined 50 | #ifdef __SIZE_TYPE__ 51 | /* If __SIZE_TYPE__ is defined (gcc) we define ssize_t based on size_t. 52 | We simply change "unsigned" to "signed" for this single definition 53 | to make sure ssize_t and size_t only differ by their signedness. */ 54 | #define unsigned signed 55 | typedef __SIZE_TYPE__ _ssize_t; 56 | #undef unsigned 57 | #else 58 | #if defined(__INT_MAX__) && __INT_MAX__ == 2147483647 59 | typedef int _ssize_t; 60 | #else 61 | typedef long _ssize_t; 62 | #endif 63 | #endif 64 | #endif 65 | 66 | #define __need_wint_t 67 | #include 68 | 69 | #ifndef __mbstate_t_defined 70 | /* Conversion state information. */ 71 | typedef struct 72 | { 73 | int __count; 74 | union 75 | { 76 | wint_t __wch; 77 | unsigned char __wchb[4]; 78 | } __value; /* Value so far. */ 79 | } _mbstate_t; 80 | #endif 81 | 82 | #ifndef __flock_t_defined 83 | typedef _LOCK_RECURSIVE_T _flock_t; 84 | #endif 85 | 86 | #ifndef __iconv_t_defined 87 | /* Iconv descriptor type */ 88 | typedef void *_iconv_t; 89 | #endif 90 | 91 | #endif /* _SYS__TYPES_H */ 92 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/select.c: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "sdkconfig.h" 16 | 17 | #ifdef CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 18 | 19 | #include 20 | #include "esp_vfs.h" 21 | #include "sdkconfig.h" 22 | 23 | #ifdef CONFIG_USE_ONLY_LWIP_SELECT 24 | #include "lwip/sockets.h" 25 | 26 | #ifdef CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT 27 | #define LOG_LOCAL_LEVEL ESP_LOG_NONE 28 | #endif //CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT 29 | #include "esp_log.h" 30 | 31 | static const char *TAG = "newlib_select"; 32 | 33 | static void log_fd_set(const char *fds_name, const fd_set *fds) 34 | { 35 | if (fds_name && fds) { 36 | ESP_LOGD(TAG, "FDs in %s =", fds_name); 37 | for (int i = 0; i < MAX_FDS; ++i) { 38 | if (FD_ISSET(i, fds)) { 39 | ESP_LOGD(TAG, "%d", i); 40 | } 41 | } 42 | } 43 | } 44 | #endif //CONFIG_USE_ONLY_LWIP_SELECT 45 | 46 | int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout) 47 | { 48 | #ifdef CONFIG_USE_ONLY_LWIP_SELECT 49 | ESP_LOGD(TAG, "lwip_select starts with nfds = %d", nfds); 50 | if (timeout) { 51 | ESP_LOGD(TAG, "timeout is %lds + %ldus", timeout->tv_sec, timeout->tv_usec); 52 | } 53 | log_fd_set("readfds", readfds); 54 | log_fd_set("writefds", writefds); 55 | log_fd_set("errorfds", errorfds); 56 | 57 | int ret = lwip_select(nfds, readfds, writefds, errorfds, timeout); 58 | 59 | ESP_LOGD(TAG, "lwip_select returns %d", ret); 60 | log_fd_set("readfds", readfds); 61 | log_fd_set("writefds", writefds); 62 | log_fd_set("errorfds", errorfds); 63 | 64 | return ret; 65 | #else 66 | return esp_vfs_select(nfds, readfds, writefds, errorfds, timeout); 67 | #endif 68 | } 69 | 70 | #endif // CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 -------------------------------------------------------------------------------- /components/m5stickc-idf/README.md: -------------------------------------------------------------------------------- 1 | # M5StickC-IDF 2 | 3 | ESP-IDF component to work with M5StickC. Works without including the Arduino framework. 4 | 5 | --- 6 | 7 | ## Current features: 8 | 9 | * Initializes power management IC AXP192 10 | * Provides easy function calls to read/write its registers 11 | * Initializes display ST7735 12 | * Initializes push buttons 13 | * "Click" & "hold" events available 14 | * Set display backlight level 15 | * Option to turn it completely off 16 | * Display API thanks to Loboris ESP32_TFT_library 17 | * Added support for custom fonts without modifying its code 18 | 19 | ## Usage 20 | 21 | Check out the [example project](https://github.com/pablobacho/m5stickc-idf-example). 22 | 23 | Clone repository in your `components` folder in your project and include `m5stickc.h` in your source code. 24 | 25 | Call `m5_init()` to initialize your M5StickC. This initializes the AXP192 power manager chip, the display and the push buttons. 26 | 27 | This component creates a custom event loop called `m5_event_loop` for device events. User program can subscribe to it and listen to events such as "button click" and "button hold". More actions coming. Check out .h files for specific module events. 28 | 29 | Use `m5display_set_backlight_level(uint8_t backlight_level)` to set the backlight level on the display. Backlight range between 0 and 7. To turn on or off the backlight, use `m5display_on()` and `m5display_off()`. 30 | 31 | ## Display driver based on Loboris ESP32_TFT_library 32 | 33 | Includes a modified version of [ESP32_TFT_library](https://github.com/loboris/ESP32_TFT_library) by Boris Lovosevic. Check his GitHub for help on how to use the display. 34 | 35 | One of the modifications enables support for custom embedded fonts. After converting the font file to an embedded array using the tools provided by Loboris, use: 36 | 37 | TFT_setFont(CUSTOM_EMBEDDED_FONT, (char *) opensans_semibold_12); // opensans_semibold_12 is my custom embedded font. 38 | 39 | ## Contributing 40 | 41 | If you find a bug, improve documentation, add a feature, or anything else, I encourage you to open an issue and/or make a pull request. 42 | 43 | When contributing, please follow [Espressif IoT Development Framework Style Guide](https://docs.espressif.com/projects/esp-idf/en/latest/contribute/style-guide.html) and their [Documenting Code Guide](https://docs.espressif.com/projects/esp-idf/en/latest/contribute/documenting-code.html) 44 | 45 | Licensed under the MIT License. -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/iconv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2004, Artem B. Bityuckiy, SoftMine Corporation. 3 | * Rights transferred to Franklin Electronic Publishers. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | */ 26 | #ifndef _ICONV_H_ 27 | #define _ICONV_H_ 28 | 29 | #include <_ansi.h> 30 | #include 31 | #include 32 | #include 33 | 34 | /* iconv_t: charset conversion descriptor type */ 35 | typedef _iconv_t iconv_t; 36 | 37 | _BEGIN_STD_C 38 | 39 | #ifndef _REENT_ONLY 40 | iconv_t 41 | _EXFUN(iconv_open, (_CONST char *, _CONST char *)); 42 | 43 | size_t 44 | _EXFUN(iconv, (iconv_t, char **__restrict, size_t *__restrict, 45 | char **__restrict, size_t *__restrict)); 46 | 47 | int 48 | _EXFUN(iconv_close, (iconv_t)); 49 | #endif 50 | 51 | iconv_t 52 | _EXFUN(_iconv_open_r, (struct _reent *, _CONST char *, _CONST char *)); 53 | 54 | size_t 55 | _EXFUN(_iconv_r, (struct _reent *, iconv_t, _CONST char **, 56 | size_t *, char **, size_t *)); 57 | 58 | int 59 | _EXFUN(_iconv_close_r, (struct _reent *, iconv_t)); 60 | 61 | _END_STD_C 62 | 63 | #endif /* #ifndef _ICONV_H_ */ 64 | -------------------------------------------------------------------------------- /smalltalkImage/source/st.c: -------------------------------------------------------------------------------- 1 | /* 2 | Little Smalltalk, version 3 3 | Main Driver 4 | written By Tim Budd, September 1988 5 | Oregon State University 6 | */ 7 | #include 8 | #include 9 | #include 10 | 11 | #include "env.h" 12 | #include "memory.h" 13 | #include "names.h" 14 | 15 | int initial = 0; /* not making initial image */ 16 | 17 | extern int objectCount(void); 18 | boolean execute(object aProcess, int maxsteps); 19 | 20 | void readImage() 21 | { 22 | FILE *fp; 23 | char *p, buffer[32]; 24 | 25 | strcpy(buffer, "systemImage"); 26 | p = buffer; 27 | 28 | fp = fopen(p, "r"); 29 | if (fp == NULL) 30 | { 31 | sysError("cannot open image", p); 32 | exit(1); 33 | } 34 | 35 | imageRead(fp); 36 | } 37 | 38 | void readImageObjects() 39 | { 40 | FILE *fpObjTable; 41 | FILE *fpObjData; 42 | char *pOT, buffer1[32]; 43 | char *pOD, buffer2[32]; 44 | 45 | strcpy(buffer1, "objectTable"); 46 | pOT = buffer1; 47 | 48 | fpObjTable = fopen(pOT, "r"); 49 | if (fpObjTable == NULL) 50 | { 51 | sysError("cannot open object table", pOT); 52 | exit(1); 53 | } 54 | 55 | strcpy(buffer2, "objectData"); 56 | pOD = buffer2; 57 | 58 | fpObjData = fopen(pOD, "r"); 59 | if (fpObjData == NULL) 60 | { 61 | sysError("cannot open object data", pOD); 62 | exit(1); 63 | } 64 | 65 | readObjectFiles(fpObjTable, fpObjData); 66 | } 67 | 68 | int main(int argc, char **argv) 69 | { 70 | // FILE *fp; 71 | object firstProcess; 72 | // char *p, buffer[120]; 73 | 74 | initMemoryManager(); 75 | 76 | // readImage(); 77 | readImageObjects(); 78 | 79 | initCommonSymbols(); 80 | 81 | firstProcess = globalSymbol("systemProcess"); 82 | if (firstProcess == nilobj) 83 | { 84 | sysError("no initial process", "in image"); 85 | exit(1); 86 | return 1; 87 | } 88 | 89 | printf("Little Smalltalk, Version 3.1\n"); 90 | printf("Written by Tim Budd, Oregon State University\n"); 91 | printf("Updated for modern systems by Charles Childers\n"); 92 | printf("Updated for embedded support by Abdul Nabi\n"); 93 | 94 | while (execute(firstProcess, 15000)) 95 | ; 96 | 97 | /* exit and return - belt and suspenders, but it keeps lint happy */ 98 | exit(0); 99 | return 0; 100 | } 101 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/fnmatch.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1992, 1993 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 4. Neither the name of the University nor the names of its contributors 14 | * may be used to endorse or promote products derived from this software 15 | * without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 | * SUCH DAMAGE. 28 | * 29 | * $FreeBSD: src/include/fnmatch.h,v 1.10 2002/03/23 17:24:53 imp Exp $ 30 | * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93 31 | */ 32 | 33 | #ifndef _FNMATCH_H_ 34 | #define _FNMATCH_H_ 35 | 36 | #define FNM_NOMATCH 1 /* Match failed. */ 37 | 38 | #define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */ 39 | #define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ 40 | #define FNM_PERIOD 0x04 /* Period must be matched by period. */ 41 | 42 | #if defined(_GNU_SOURCE) || !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) 43 | #define FNM_LEADING_DIR 0x08 /* Ignore / after Imatch. */ 44 | #define FNM_CASEFOLD 0x10 /* Case insensitive search. */ 45 | #define FNM_IGNORECASE FNM_CASEFOLD 46 | #define FNM_FILE_NAME FNM_PATHNAME 47 | #endif 48 | 49 | #include 50 | 51 | __BEGIN_DECLS 52 | int fnmatch(const char *, const char *, int); 53 | __END_DECLS 54 | 55 | #endif /* !_FNMATCH_H_ */ 56 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sched.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Written by Joel Sherrill . 3 | * 4 | * COPYRIGHT (c) 1989-2010. 5 | * On-Line Applications Research Corporation (OAR). 6 | * 7 | * Permission to use, copy, modify, and distribute this software for any 8 | * purpose without fee is hereby granted, provided that this entire notice 9 | * is included in all copies of any software which is or includes a copy 10 | * or modification of this software. 11 | * 12 | * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED 13 | * WARRANTY. IN PARTICULAR, THE AUTHOR MAKES NO REPRESENTATION 14 | * OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY OF THIS 15 | * SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. 16 | * 17 | * $Id$ 18 | */ 19 | 20 | #ifndef _SCHED_H_ 21 | #define _SCHED_H_ 22 | 23 | #include 24 | #include 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | #if defined(_POSIX_PRIORITY_SCHEDULING) 31 | /* 32 | * XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1803 33 | */ 34 | int sched_setparam( 35 | pid_t __pid, 36 | const struct sched_param *__param 37 | ); 38 | 39 | /* 40 | * XBD 13 - Set Scheduling Parameters, P1003.1b-2008, p. 1800 41 | */ 42 | int sched_getparam( 43 | pid_t __pid, 44 | struct sched_param *__param 45 | ); 46 | 47 | /* 48 | * XBD 13 - Set Scheduling Policy and Scheduling Parameters, 49 | * P1003.1b-2008, p. 1805 50 | */ 51 | int sched_setscheduler( 52 | pid_t __pid, 53 | int __policy, 54 | const struct sched_param *__param 55 | ); 56 | 57 | /* 58 | * XBD 13 - Get Scheduling Policy, P1003.1b-2008, p. 1801 59 | */ 60 | int sched_getscheduler( 61 | pid_t __pid 62 | ); 63 | 64 | /* 65 | * XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1799 66 | */ 67 | int sched_get_priority_max( 68 | int __policy 69 | ); 70 | 71 | int sched_get_priority_min( 72 | int __policy 73 | ); 74 | 75 | /* 76 | * XBD 13 - Get Scheduling Parameter Limits, P1003.1b-2008, p. 1802 77 | */ 78 | int sched_rr_get_interval( 79 | pid_t __pid, 80 | struct timespec *__interval 81 | ); 82 | #endif /* _POSIX_PRIORITY_SCHEDULING */ 83 | 84 | #if defined(_POSIX_THREADS) || defined(_POSIX_PRIORITY_SCHEDULING) 85 | 86 | /* 87 | * XBD 13 - Yield Processor, P1003.1b-2008, p. 1807 88 | */ 89 | int sched_yield( void ); 90 | 91 | #endif /* _POSIX_THREADS or _POSIX_PRIORITY_SCHEDULING */ 92 | 93 | #ifdef __cplusplus 94 | } 95 | #endif 96 | 97 | #endif /* _SCHED_H_ */ 98 | -------------------------------------------------------------------------------- /components/m5stickc-idf/util/stmpe610.h: -------------------------------------------------------------------------------- 1 | /* 2 | STMPE610 Touch controller constants 3 | */ 4 | 5 | #ifndef _STMPE610_H 6 | #define _STMPE610_H 7 | 8 | #include 9 | 10 | #define STMPE610_SPI_MODE 1 11 | 12 | // Identification registers 13 | #define STMPE610_REG_CHP_ID 0x00 // 16-bit 14 | #define STMPE610_REG_ID_VER 0x02 15 | 16 | // System registers 17 | #define STMPE610_REG_SYS_CTRL1 0x03 18 | #define STMPE610_REG_SYS_CTRL2 0x04 19 | #define STMPE610_REG_SPI_CFG 0x08 20 | 21 | // Interrupt control registers 22 | #define STMPE610_REG_INT_CTRL 0x09 23 | #define STMPE610_REG_INT_EN 0x0A 24 | #define STMPE610_REG_INT_STA 0x0B 25 | #define STMPE610_REG_GPIO_INT_EN 0x0C 26 | #define STMPE610_REG_GPIO_INT_STA 0x0D 27 | #define STMPE610_REG_ADC_INT_EN 0x0E 28 | #define STMPE610_REG_ADC_INT_STA 0x0F 29 | 30 | // GPIO registers 31 | #define STMPE610_REG_GPIO_SET_PIN 0x10 32 | #define STMPE610_REG_GPIO_CLR_PIN 0x11 33 | #define STMPE610_REG_GPIO_MP_STA 0x12 34 | #define STMPE610_REG_GPIO_DIR 0x13 35 | #define STMPE610_REG_GPIO_ED 0x14 36 | #define STMPE610_REG_GPIO_RE 0x15 37 | #define STMPE610_REG_GPIO_FE 0x16 38 | #define STMPE610_REG_GPIO_AF 0x17 39 | 40 | // ADC registers 41 | #define STMPE610_REG_ADC_CTRL1 0x20 42 | #define STMPE610_REG_ADC_CTRL2 0x21 43 | #define STMPE610_REG_ADC_CAPT 0x22 44 | #define STMPE610_REG_ADC_DATA_CH0 0x30 // 16-bit 45 | #define STMPE610_REG_ADC_DATA_CH1 0x32 // 16-bit 46 | #define STMPE610_REG_ADC_DATA_CH4 0x38 // 16-bit 47 | #define STMPE610_REG_ADC_DATA_CH5 0x3A // 16-bit 48 | #define STMPE610_REG_ADC_DATA_CH6 0x3C // 16-bit 49 | #define STMPE610_REG_ADC_DATA_CH7 0x3E // 16-bit 50 | 51 | // Touchscreen registers 52 | #define STMPE610_REG_TSC_CTRL 0x40 53 | #define STMPE610_REG_TSC_CFG 0x41 54 | #define STMPE610_REG_WDW_TR_X 0x42 // 16-bit 55 | #define STMPE610_REG_WDW_TR_Y 0x44 // 16-bit 56 | #define STMPE610_REG_WDW_BL_X 0x46 // 16-bit 57 | #define STMPE610_REG_WDW_BL_Y 0x48 // 16-bit 58 | #define STMPE610_REG_FIFO_TH 0x4A 59 | #define STMPE610_REG_FIFO_STA 0x4B 60 | #define STMPE610_REG_FIFO_SIZE 0x4C 61 | #define STMPE610_REG_TSC_DATA_X 0x4D // 16-bit 62 | #define STMPE610_REG_TSC_DATA_Y 0x4F // 16-bit 63 | #define STMPE610_REG_TSC_DATA_Z 0x51 64 | #define STMPE610_REG_TSC_DATA_XYZ 0x52 // 32-bit 65 | #define STMPE610_REG_TSC_FRACT_XYZ 0x56 66 | #define STMPE610_REG_TSC_DATA 0x57 67 | #define STMPE610_REG_TSC_I_DRIVE 0x58 68 | #define STMPE610_REG_TSC_SHIELD 0x59 69 | 70 | 71 | #endif /* _STMPE610_H */ 72 | -------------------------------------------------------------------------------- /include/esp32wifi.h: -------------------------------------------------------------------------------- 1 | /* 2 | Smalltalkje, version 1 3 | Written by Abdul Nabi, code krafters, March 2021 4 | 5 | ESP32 WiFi Support Header 6 | 7 | This header defines the interface for WiFi connectivity functions specific to 8 | the ESP32 platform. It provides a bridge between the Smalltalk environment 9 | and the ESP32's WiFi capabilities, enabling Smalltalk applications to connect 10 | to wireless networks, scan for available networks, and configure connection 11 | parameters. 12 | 13 | The functions defined here are typically called by Smalltalk primitives to 14 | implement networking functionality, allowing Smalltalk applications to 15 | interact with WiFi networks and Internet services without having to deal 16 | with the low-level details of the ESP32 WiFi stack. 17 | */ 18 | 19 | /** 20 | * Initialize the WiFi subsystem 21 | * 22 | * This function initializes the ESP32's WiFi stack and prepares it for use. 23 | * It must be called before any other WiFi operations can be performed. 24 | * The function configures the WiFi system in station mode (client mode) 25 | * and registers the necessary event handlers. 26 | */ 27 | void wifi_start(void); 28 | 29 | /** 30 | * Connect to a WiFi network 31 | * 32 | * Initiates a connection to the WiFi network using the SSID and password 33 | * that were previously set using wifi_set_ssid() and wifi_set_password(). 34 | * The function works asynchronously - it returns immediately and the 35 | * connection process continues in the background. 36 | * 37 | * Connection status can be monitored through ESP32 event handlers that 38 | * are set up during wifi_start(). 39 | */ 40 | void wifi_connect(void); 41 | 42 | /** 43 | * Scan for available WiFi networks 44 | * 45 | * Performs a scan for nearby WiFi networks and returns the results as 46 | * a Smalltalk object (typically an Array of Dictionaries). Each entry 47 | * contains information about a discovered network including SSID, 48 | * signal strength, channel, and security type. 49 | * 50 | * @return A Smalltalk object containing the scan results 51 | */ 52 | object wifi_scan(void); 53 | 54 | /** 55 | * Set the SSID for WiFi connection 56 | * 57 | * Configures the SSID (network name) to use for subsequent calls to 58 | * wifi_connect(). This must be called before attempting to connect 59 | * to a WiFi network. 60 | * 61 | * @param ssid The name of the WiFi network to connect to 62 | */ 63 | void wifi_set_ssid(char *ssid); 64 | 65 | /** 66 | * Set the password for WiFi connection 67 | * 68 | * Configures the password to use for subsequent calls to wifi_connect(). 69 | * This must be called before attempting to connect to a password-protected 70 | * WiFi network. 71 | * 72 | * @param password The password for the WiFi network 73 | */ 74 | void wifi_set_password(char *password); 75 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/syscalls.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "sdkconfig.h" 16 | 17 | #ifdef CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include "esp_attr.h" 27 | #include "freertos/FreeRTOS.h" 28 | #include "esp_heap_caps.h" 29 | 30 | 31 | /* 32 | These contain the business logic for the malloc() and realloc() implementation. Because of heap tracing 33 | wrapping reasons, we do not want these to be a public api, however, so they're not defined publicly. 34 | */ 35 | extern void *heap_caps_malloc_default( size_t size ); 36 | extern void *heap_caps_realloc_default( void *ptr, size_t size ); 37 | 38 | 39 | void* IRAM_ATTR _malloc_r(struct _reent *r, size_t size) 40 | { 41 | return heap_caps_malloc_default( size ); 42 | } 43 | 44 | void IRAM_ATTR _free_r(struct _reent *r, void* ptr) 45 | { 46 | heap_caps_free( ptr ); 47 | } 48 | 49 | void* IRAM_ATTR _realloc_r(struct _reent *r, void* ptr, size_t size) 50 | { 51 | return heap_caps_realloc_default( ptr, size ); 52 | } 53 | 54 | void* IRAM_ATTR _calloc_r(struct _reent *r, size_t nmemb, size_t size) 55 | { 56 | void *result; 57 | size_t size_bytes; 58 | if (__builtin_mul_overflow(nmemb, size, &size_bytes)) { 59 | return NULL; 60 | } 61 | 62 | result = malloc(size_bytes); 63 | if (result != NULL) { 64 | bzero(result, size_bytes); 65 | } 66 | return result; 67 | } 68 | 69 | int _system_r(struct _reent *r, const char *str) 70 | { 71 | __errno_r(r) = ENOSYS; 72 | return -1; 73 | } 74 | 75 | void _raise_r(struct _reent *r) 76 | { 77 | abort(); 78 | } 79 | 80 | void* _sbrk_r(struct _reent *r, ptrdiff_t sz) 81 | { 82 | abort(); 83 | } 84 | 85 | int _getpid_r(struct _reent *r) 86 | { 87 | __errno_r(r) = ENOSYS; 88 | return -1; 89 | } 90 | 91 | int _kill_r(struct _reent *r, int pid, int sig) 92 | { 93 | __errno_r(r) = ENOSYS; 94 | return -1; 95 | } 96 | 97 | void _exit(int __status) 98 | { 99 | abort(); 100 | } 101 | 102 | #endif // CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 -------------------------------------------------------------------------------- /smalltalkImage/date.st: -------------------------------------------------------------------------------- 1 | * 2 | * Date.st 3 | * 4 | * Smalltalkje, version 1 - Date and Time Support 5 | * Written by Abdul Nabi, code crafters, March 2021 6 | Class Date Object epochSeconds 7 | * 8 | Methods Date 'all' 9 | new 10 | ^super new now 11 | | 12 | now 13 | epochSeconds <- <170 55> 14 | | 15 | epochSeconds 16 | ^ epochSeconds 17 | | 18 | epochSeconds: aNumber 19 | epochSeconds <- aNumber asFloat 20 | | 21 | day: day month: month year: year 22 | "Set new values for the receiver day, month, year" 23 | epochSeconds <- <170 58 epochSeconds day month year> 24 | | 25 | hour: hour minutes: minutes seconds: seconds 26 | "Set new values for the receiver day, month, year" 27 | epochSeconds <- <170 59 epochSeconds hour minutes seconds> 28 | | 29 | seconds 30 | ^ <170 56 epochSeconds 1> 31 | | 32 | minutes 33 | ^ <170 56 epochSeconds 2> 34 | | 35 | hour 36 | ^ <170 56 epochSeconds 3> 37 | | 38 | day 39 | ^ <170 56 epochSeconds 4> 40 | | 41 | month 42 | ^ <170 56 epochSeconds 5> 43 | | 44 | year 45 | ^ <170 56 epochSeconds 6> + 1900 46 | | 47 | asString: format 48 | ^ <170 57 epochSeconds format> 49 | | 50 | printString 51 | ^ self asString 52 | | 53 | asString 54 | ^ self asString: '%FT%TZ' 55 | | 56 | initSNTP 57 | ^ <170 50> 58 | | 59 | getSNTPTime 60 | ^ <170 51> 61 | | 62 | getESP32Time 63 | ^ <170 52> 64 | | 65 | getTimeString: format 66 | "Return time as string based on linux strftime() format string" 67 | "see linux.die.net/man/3/strftime" 68 | ^ <170 53 format> 69 | | 70 | setTimeZone: tzString 71 | "Set the timezone based on POSIX TZ string and save in flash" 72 | "see www.gnu.org/software/libc/manual/html_node/TZ-Variable.html" 73 | ^ <170 54 tzString> 74 | ] 75 | * 76 | Methods Gizmo 'Date' 77 | setupDate | tz | 78 | self initSNTP. 79 | self getSNTPTime. 80 | tz <- self nvsStringAtKey: 'TZ'. 81 | tz ifNil: [tz <- 'UTC-1']. 82 | self setTimeZone: tz. 83 | "clockUpdateBlock <- [self clockUpdateLoop]." 84 | "clockUpdateBlock value" 85 | | 86 | updateDisplayTime 87 | display set7Seg: 8 width: 1 outline: 1. 88 | display string: (self getTimeString: '%R') x: -9003 y: 4. 89 | display setFont: Font new default 90 | | 91 | setTimeZone: tzString 92 | "Set the timezone based on POSIX TZ string and save in flash" 93 | "see www.gnu.org/software/libc/manual/html_node/TZ-Variable.html" 94 | ^ <170 54 tzString> 95 | | 96 | clockUpdateLoop 97 | self updateDisplayTime. 98 | clockUpdateBlock runAfter: 500 99 | | 100 | initSNTP 101 | ^ <170 50> 102 | | 103 | getSNTPTime 104 | ^ <170 51> 105 | | 106 | getESP32Time 107 | ^ <170 52> 108 | | 109 | getTimeString: format 110 | "Return time as string based on linux strftime() format string" 111 | "see linux.die.net/man/3/strftime" 112 | ^ <170 53 format> 113 | | 114 | getEpochSeconds 115 | ^ <170 55> 116 | ] -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/time.h: -------------------------------------------------------------------------------- 1 | /* time.h -- An implementation of the standard Unix file. 2 | Written by Geoffrey Noer 3 | Public domain; no rights reserved. */ 4 | 5 | #ifndef _SYS_TIME_H_ 6 | #define _SYS_TIME_H_ 7 | 8 | #include <_ansi.h> 9 | #include 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #ifndef _TIMEVAL_DEFINED 16 | #define _TIMEVAL_DEFINED 17 | struct timeval { 18 | time_t tv_sec; 19 | suseconds_t tv_usec; 20 | }; 21 | 22 | /* BSD time macros used by RTEMS code */ 23 | #if defined (__rtems__) || defined (__CYGWIN__) || defined(__XTENSA__) 24 | 25 | /* Convenience macros for operations on timevals. 26 | NOTE: `timercmp' does not work for >= or <=. */ 27 | #define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) 28 | #define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0) 29 | #define timercmp(a, b, CMP) \ 30 | (((a)->tv_sec == (b)->tv_sec) ? \ 31 | ((a)->tv_usec CMP (b)->tv_usec) : \ 32 | ((a)->tv_sec CMP (b)->tv_sec)) 33 | #define timeradd(a, b, result) \ 34 | do { \ 35 | (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ 36 | (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ 37 | if ((result)->tv_usec >= 1000000) \ 38 | { \ 39 | ++(result)->tv_sec; \ 40 | (result)->tv_usec -= 1000000; \ 41 | } \ 42 | } while (0) 43 | #define timersub(a, b, result) \ 44 | do { \ 45 | (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ 46 | (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ 47 | if ((result)->tv_usec < 0) { \ 48 | --(result)->tv_sec; \ 49 | (result)->tv_usec += 1000000; \ 50 | } \ 51 | } while (0) 52 | #endif /* defined (__rtems__) || defined (__CYGWIN__) */ 53 | #endif /* !_TIMEVAL_DEFINED */ 54 | 55 | struct timezone { 56 | int tz_minuteswest; 57 | int tz_dsttime; 58 | }; 59 | 60 | #ifdef __CYGWIN__ 61 | #include 62 | #endif /* __CYGWIN__ */ 63 | 64 | #define ITIMER_REAL 0 65 | #define ITIMER_VIRTUAL 1 66 | #define ITIMER_PROF 2 67 | 68 | struct itimerval { 69 | struct timeval it_interval; 70 | struct timeval it_value; 71 | }; 72 | 73 | #ifdef _COMPILING_NEWLIB 74 | int _EXFUN(_gettimeofday, (struct timeval *__p, void *__tz)); 75 | #endif 76 | 77 | int _EXFUN(gettimeofday, (struct timeval *__restrict __p, 78 | void *__restrict __tz)); 79 | #if __BSD_VISIBLE 80 | int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *)); 81 | int _EXFUN(adjtime, (const struct timeval *, struct timeval *)); 82 | #endif 83 | int _EXFUN(utimes, (const char *__path, const struct timeval *__tvp)); 84 | int _EXFUN(getitimer, (int __which, struct itimerval *__value)); 85 | int _EXFUN(setitimer, (int __which, const struct itimerval *__restrict __value, 86 | struct itimerval *__restrict __ovalue)); 87 | 88 | #ifdef __cplusplus 89 | } 90 | #endif 91 | #endif /* _SYS_TIME_H_ */ 92 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/iconvnls.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003-2004, Artem B. Bityuckiy. 3 | * Rights transferred to Franklin Electronic Publishers. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | */ 26 | 27 | /* 28 | * Funtions, macros, etc implimented in iconv library but used by other 29 | * NLS-related subsystems too. 30 | */ 31 | #ifndef __SYS_ICONVNLS_H__ 32 | #define __SYS_ICONVNLS_H__ 33 | 34 | #include <_ansi.h> 35 | #include 36 | #include 37 | #include 38 | 39 | /* Iconv data path environment variable name */ 40 | #define NLS_ENVVAR_NAME "NLSPATH" 41 | /* Default NLSPATH value */ 42 | #define ICONV_DEFAULT_NLSPATH "/usr/locale" 43 | /* Direction markers */ 44 | #define ICONV_NLS_FROM 0 45 | #define ICONV_NLS_TO 1 46 | 47 | _VOID 48 | _EXFUN(_iconv_nls_get_state, (iconv_t cd, mbstate_t *ps, int direction)); 49 | 50 | int 51 | _EXFUN(_iconv_nls_set_state, (iconv_t cd, mbstate_t *ps, int direction)); 52 | 53 | int 54 | _EXFUN(_iconv_nls_is_stateful, (iconv_t cd, int direction)); 55 | 56 | int 57 | _EXFUN(_iconv_nls_get_mb_cur_max, (iconv_t cd, int direction)); 58 | 59 | size_t 60 | _EXFUN(_iconv_nls_conv, (struct _reent *rptr, iconv_t cd, 61 | _CONST char **inbuf, size_t *inbytesleft, 62 | char **outbuf, size_t *outbytesleft)); 63 | 64 | _CONST char * 65 | _EXFUN(_iconv_nls_construct_filename, (struct _reent *rptr, _CONST char *file, 66 | _CONST char *dir, _CONST char *ext)); 67 | 68 | 69 | int 70 | _EXFUN(_iconv_nls_open, (struct _reent *rptr, _CONST char *encoding, 71 | iconv_t *towc, iconv_t *fromwc, int flag)); 72 | 73 | char * 74 | _EXFUN(_iconv_resolve_encoding_name, (struct _reent *rptr, _CONST char *ca)); 75 | 76 | #endif /* __SYS_ICONVNLS_H__ */ 77 | 78 | -------------------------------------------------------------------------------- /smalltalkje.xcodeproj/xcshareddata/xcschemes/lst3.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 43 | 45 | 51 | 52 | 53 | 54 | 60 | 62 | 68 | 69 | 70 | 71 | 73 | 74 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /include/primitive.h: -------------------------------------------------------------------------------- 1 | /* 2 | Smalltalkje, version 1 3 | Written by Abdul Nabi, code krafters, March 2021 4 | 5 | Primitive Support Header 6 | 7 | This header provides macros and utilities for implementing primitive methods in the 8 | Smalltalk system. Primitives are operations implemented directly in C code rather 9 | than Smalltalk, typically for performance reasons or to access system-level functionality. 10 | 11 | The macros defined here provide consistent argument checking and value extraction 12 | for primitive implementations, ensuring type safety and proper error handling. 13 | They are used extensively in the primitive.c and sysprim.c files. 14 | */ 15 | 16 | /** 17 | * Integer Argument Extraction 18 | * 19 | * Extracts the integer value from a Smalltalk integer object. 20 | * This macro is used to convert from Smalltalk's tagged integer representation 21 | * to a native C integer value that can be used in primitive operations. 22 | * 23 | * @param i Index of the argument in the arguments array 24 | * @return The C integer value of the argument 25 | */ 26 | #define getIntArg(i) intValue(arguments[i]) 27 | 28 | /** 29 | * Integer Argument Validation 30 | * 31 | * Checks if the specified argument is a Smalltalk integer. 32 | * This is a shorthand for checking an argument from the arguments array. 33 | * 34 | * @param i Index of the argument in the arguments array 35 | */ 36 | #define checkIntArg(i) checkInteger(arguments[i]) 37 | 38 | /** 39 | * Integer Object Validation 40 | * 41 | * Verifies that an object is a valid Smalltalk integer. 42 | * If the object is not an integer, raises a system error. 43 | * This is used to ensure type safety before operations that 44 | * require integer values. 45 | * 46 | * @param i The Smalltalk object to check 47 | */ 48 | #define checkInteger(i) \ 49 | if (!isInteger(i)) \ 50 | { \ 51 | sysError("non integer index", "x"); \ 52 | } 53 | 54 | /** 55 | * Class Type Validation 56 | * 57 | * Verifies that an argument is an instance of the expected class. 58 | * If the argument is not of the specified class, raises a system error. 59 | * This is used to ensure type safety before operations that require 60 | * specific object types. 61 | * 62 | * @param i Index of the argument in the arguments array 63 | * @param classStr String name of the expected class 64 | */ 65 | #define checkArgClass(i, classStr) \ 66 | if (classField(arguments[i]) != findClass(classStr)) \ 67 | { \ 68 | sysError("Argument is not the expected class", classStr); \ 69 | } 70 | 71 | /** 72 | * Combined Integer Validation and Extraction 73 | * 74 | * This macro combines checking if an argument is an integer and 75 | * extracting its value. It's a convenience for the common pattern 76 | * of validating and then using an integer argument. 77 | * 78 | * @param i Index of the argument in the arguments array 79 | * @return The C integer value of the argument 80 | */ 81 | #define checkAndGetIntArg(i) \ 82 | checkIntArg(i) \ 83 | getIntArg(i) 84 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/fenv.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2011 Tensilica Inc. ALL RIGHTS RESERVED. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions 5 | are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above 11 | copyright notice, this list of conditions and the following 12 | disclaimer in the documentation and/or other materials provided 13 | with the distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 19 | TENSILICA INCORPORATED BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 26 | OF THE POSSIBILITY OF SUCH DAMAGE. */ 27 | 28 | 29 | #ifndef _FENV_H 30 | #define _FENV_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | typedef unsigned long fenv_t; 37 | typedef unsigned long fexcept_t; 38 | 39 | #define FE_DIVBYZERO 0x08 40 | #define FE_INEXACT 0x01 41 | #define FE_INVALID 0x10 42 | #define FE_OVERFLOW 0x04 43 | #define FE_UNDERFLOW 0x02 44 | 45 | #define FE_ALL_EXCEPT \ 46 | (FE_DIVBYZERO | \ 47 | FE_INEXACT | \ 48 | FE_INVALID | \ 49 | FE_OVERFLOW | \ 50 | FE_UNDERFLOW) 51 | 52 | #define FE_DOWNWARD 0x3 53 | #define FE_TONEAREST 0x0 54 | #define FE_TOWARDZERO 0x1 55 | #define FE_UPWARD 0x2 56 | 57 | #define FE_DFL_ENV ((const fenv_t *) 0) 58 | 59 | int feclearexcept(int); 60 | int fegetexceptflag(fexcept_t *, int); 61 | int feraiseexcept(int); 62 | int fesetexceptflag(const fexcept_t *, int); 63 | int fetestexcept(int); 64 | int fegetround(void); 65 | int fesetround(int); 66 | int fegetenv(fenv_t *); 67 | int feholdexcept(fenv_t *); 68 | int fesetenv(const fenv_t *); 69 | int feupdateenv(const fenv_t *); 70 | 71 | /* glibc extensions */ 72 | int feenableexcept(int excepts); 73 | int fedisableexcept(int excepts); 74 | int fegetexcept(void); 75 | 76 | #define _FE_EXCEPTION_FLAGS_OFFSET 7 77 | #define _FE_EXCEPTION_FLAG_MASK (FE_ALL_EXCEPT << _FE_EXCEPTION_FLAGS_OFFSET) 78 | #define _FE_EXCEPTION_ENABLE_OFFSET 2 79 | #define _FE_EXCEPTION_ENABLE_MASK (FE_ALL_EXCEPT << _FE_EXCEPTION_ENABLE_OFFSET) 80 | #define _FE_ROUND_MODE_OFFSET 0 81 | #define _FE_ROUND_MODE_MASK (0x3 << _FE_ROUND_MODE_OFFSET) 82 | #define _FE_FLOATING_ENV_MASK (_FE_EXCEPTION_FLAG_MASK | _FE_EXCEPTION_ENABLE_MASK | _FE_ROUND_MODE_MASK) 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/ar.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: ar.h,v 1.4 1994/10/26 00:55:43 cgd Exp $ */ 2 | 3 | /*- 4 | * Copyright (c) 1991, 1993 5 | * The Regents of the University of California. All rights reserved. 6 | * (c) UNIX System Laboratories, Inc. 7 | * All or some portions of this file are derived from material licensed 8 | * to the University of California by American Telephone and Telegraph 9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with 10 | * the permission of UNIX System Laboratories, Inc. 11 | * 12 | * This code is derived from software contributed to Berkeley by 13 | * Hugh Smith at The University of Guelph. 14 | * 15 | * Redistribution and use in source and binary forms, with or without 16 | * modification, are permitted provided that the following conditions 17 | * are met: 18 | * 1. Redistributions of source code must retain the above copyright 19 | * notice, this list of conditions and the following disclaimer. 20 | * 2. Redistributions in binary form must reproduce the above copyright 21 | * notice, this list of conditions and the following disclaimer in the 22 | * documentation and/or other materials provided with the distribution. 23 | * 3. All advertising materials mentioning features or use of this software 24 | * must display the following acknowledgement: 25 | * This product includes software developed by the University of 26 | * California, Berkeley and its contributors. 27 | * 4. Neither the name of the University nor the names of its contributors 28 | * may be used to endorse or promote products derived from this software 29 | * without specific prior written permission. 30 | * 31 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 32 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 33 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 34 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 35 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 39 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 40 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 41 | * SUCH DAMAGE. 42 | * 43 | * @(#)ar.h 8.2 (Berkeley) 1/21/94 44 | */ 45 | 46 | #ifndef _AR_H_ 47 | #define _AR_H_ 48 | 49 | /* Pre-4BSD archives had these magic numbers in them. */ 50 | #define OARMAG1 0177555 51 | #define OARMAG2 0177545 52 | 53 | #define ARMAG "!\n" /* ar "magic number" */ 54 | #define SARMAG 8 /* strlen(ARMAG); */ 55 | 56 | #define AR_EFMT1 "#1/" /* extended format #1 */ 57 | 58 | struct ar_hdr { 59 | char ar_name[16]; /* name */ 60 | char ar_date[12]; /* modification time */ 61 | char ar_uid[6]; /* user id */ 62 | char ar_gid[6]; /* group id */ 63 | char ar_mode[8]; /* octal file permissions */ 64 | char ar_size[10]; /* size in bytes */ 65 | #define ARFMAG "`\n" 66 | char ar_fmag[2]; /* consistency check */ 67 | }; 68 | 69 | #endif /* !_AR_H_ */ 70 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/pwd.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1989 The Regents of the University of California. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the University of 16 | * California, Berkeley and its contributors. 17 | * 4. Neither the name of the University nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * 33 | * @(#)pwd.h 5.13 (Berkeley) 5/28/91 34 | */ 35 | 36 | #ifndef _PWD_H_ 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif 40 | #define _PWD_H_ 41 | 42 | #include 43 | #include 44 | 45 | #if __BSD_VISIBLE 46 | #define _PATH_PASSWD "/etc/passwd" 47 | 48 | #define _PASSWORD_LEN 128 /* max length, not counting NULL */ 49 | #endif 50 | 51 | struct passwd { 52 | char *pw_name; /* user name */ 53 | char *pw_passwd; /* encrypted password */ 54 | uid_t pw_uid; /* user uid */ 55 | gid_t pw_gid; /* user gid */ 56 | char *pw_comment; /* comment */ 57 | char *pw_gecos; /* Honeywell login info */ 58 | char *pw_dir; /* home directory */ 59 | char *pw_shell; /* default shell */ 60 | }; 61 | 62 | #ifndef __INSIDE_CYGWIN__ 63 | struct passwd *getpwuid (uid_t); 64 | struct passwd *getpwnam (const char *); 65 | 66 | #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 67 | int getpwnam_r (const char *, struct passwd *, 68 | char *, size_t , struct passwd **); 69 | int getpwuid_r (uid_t, struct passwd *, char *, 70 | size_t, struct passwd **); 71 | #endif 72 | 73 | #if __XSI_VISIBLE >= 500 74 | struct passwd *getpwent (void); 75 | void setpwent (void); 76 | void endpwent (void); 77 | #endif 78 | 79 | #if __BSD_VISIBLE 80 | int setpassent (int); 81 | #endif 82 | #endif /*!__INSIDE_CYGWIN__*/ 83 | 84 | #ifdef __cplusplus 85 | } 86 | #endif 87 | #endif /* _PWD_H_ */ 88 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/machine/fastmath.h: -------------------------------------------------------------------------------- 1 | #ifdef __sysvnecv70_target 2 | double EXFUN(fast_sin,(double)); 3 | double EXFUN(fast_cos,(double)); 4 | double EXFUN(fast_tan,(double)); 5 | 6 | double EXFUN(fast_asin,(double)); 7 | double EXFUN(fast_acos,(double)); 8 | double EXFUN(fast_atan,(double)); 9 | 10 | double EXFUN(fast_sinh,(double)); 11 | double EXFUN(fast_cosh,(double)); 12 | double EXFUN(fast_tanh,(double)); 13 | 14 | double EXFUN(fast_asinh,(double)); 15 | double EXFUN(fast_acosh,(double)); 16 | double EXFUN(fast_atanh,(double)); 17 | 18 | double EXFUN(fast_abs,(double)); 19 | double EXFUN(fast_sqrt,(double)); 20 | double EXFUN(fast_exp2,(double)); 21 | double EXFUN(fast_exp10,(double)); 22 | double EXFUN(fast_expe,(double)); 23 | double EXFUN(fast_log10,(double)); 24 | double EXFUN(fast_log2,(double)); 25 | double EXFUN(fast_loge,(double)); 26 | 27 | 28 | #define sin(x) fast_sin(x) 29 | #define cos(x) fast_cos(x) 30 | #define tan(x) fast_tan(x) 31 | #define asin(x) fast_asin(x) 32 | #define acos(x) fast_acos(x) 33 | #define atan(x) fast_atan(x) 34 | #define sinh(x) fast_sinh(x) 35 | #define cosh(x) fast_cosh(x) 36 | #define tanh(x) fast_tanh(x) 37 | #define asinh(x) fast_asinh(x) 38 | #define acosh(x) fast_acosh(x) 39 | #define atanh(x) fast_atanh(x) 40 | #define abs(x) fast_abs(x) 41 | #define sqrt(x) fast_sqrt(x) 42 | #define exp2(x) fast_exp2(x) 43 | #define exp10(x) fast_exp10(x) 44 | #define expe(x) fast_expe(x) 45 | #define log10(x) fast_log10(x) 46 | #define log2(x) fast_log2(x) 47 | #define loge(x) fast_loge(x) 48 | 49 | #ifdef _HAVE_STDC 50 | /* These functions are in assembler, they really do take floats. This 51 | can only be used with a real ANSI compiler */ 52 | 53 | float EXFUN(fast_sinf,(float)); 54 | float EXFUN(fast_cosf,(float)); 55 | float EXFUN(fast_tanf,(float)); 56 | 57 | float EXFUN(fast_asinf,(float)); 58 | float EXFUN(fast_acosf,(float)); 59 | float EXFUN(fast_atanf,(float)); 60 | 61 | float EXFUN(fast_sinhf,(float)); 62 | float EXFUN(fast_coshf,(float)); 63 | float EXFUN(fast_tanhf,(float)); 64 | 65 | float EXFUN(fast_asinhf,(float)); 66 | float EXFUN(fast_acoshf,(float)); 67 | float EXFUN(fast_atanhf,(float)); 68 | 69 | float EXFUN(fast_absf,(float)); 70 | float EXFUN(fast_sqrtf,(float)); 71 | float EXFUN(fast_exp2f,(float)); 72 | float EXFUN(fast_exp10f,(float)); 73 | float EXFUN(fast_expef,(float)); 74 | float EXFUN(fast_log10f,(float)); 75 | float EXFUN(fast_log2f,(float)); 76 | float EXFUN(fast_logef,(float)); 77 | #define sinf(x) fast_sinf(x) 78 | #define cosf(x) fast_cosf(x) 79 | #define tanf(x) fast_tanf(x) 80 | #define asinf(x) fast_asinf(x) 81 | #define acosf(x) fast_acosf(x) 82 | #define atanf(x) fast_atanf(x) 83 | #define sinhf(x) fast_sinhf(x) 84 | #define coshf(x) fast_coshf(x) 85 | #define tanhf(x) fast_tanhf(x) 86 | #define asinhf(x) fast_asinhf(x) 87 | #define acoshf(x) fast_acoshf(x) 88 | #define atanhf(x) fast_atanhf(x) 89 | #define absf(x) fast_absf(x) 90 | #define sqrtf(x) fast_sqrtf(x) 91 | #define exp2f(x) fast_exp2f(x) 92 | #define exp10f(x) fast_exp10f(x) 93 | #define expef(x) fast_expef(x) 94 | #define log10f(x) fast_log10f(x) 95 | #define log2f(x) fast_log2f(x) 96 | #define logef(x) fast_logef(x) 97 | #endif 98 | /* Override the functions defined in math.h */ 99 | #endif /* __sysvnecv70_target */ 100 | 101 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/esp_event/default_event_loop.c: -------------------------------------------------------------------------------- 1 | // Copyright 2018 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "sdkconfig.h" 16 | 17 | #ifdef CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 18 | 19 | #include "esp_event.h" 20 | #include "esp_event_internal.h" 21 | 22 | /* ------------------------- Static Variables ------------------------------- */ 23 | 24 | static esp_event_loop_handle_t s_default_loop = NULL; 25 | 26 | /* ---------------------------- Public API ---------------------------------- */ 27 | 28 | esp_err_t esp_event_handler_register(esp_event_base_t event_base, int32_t event_id, 29 | esp_event_handler_t event_handler, void* event_handler_arg) 30 | { 31 | if (s_default_loop == NULL) { 32 | return ESP_ERR_INVALID_STATE; 33 | } 34 | 35 | return esp_event_handler_register_with(s_default_loop, event_base, event_id, 36 | event_handler, event_handler_arg); 37 | } 38 | 39 | esp_err_t esp_event_handler_unregister(esp_event_base_t event_base, int32_t event_id, 40 | esp_event_handler_t event_handler) 41 | { 42 | if (s_default_loop == NULL) { 43 | return ESP_ERR_INVALID_STATE; 44 | } 45 | 46 | return esp_event_handler_unregister_with(s_default_loop, event_base, event_id, 47 | event_handler); 48 | } 49 | 50 | esp_err_t esp_event_post(esp_event_base_t event_base, int32_t event_id, 51 | void* event_data, size_t event_data_size, TickType_t ticks_to_wait) 52 | { 53 | if (s_default_loop == NULL) { 54 | return ESP_ERR_INVALID_STATE; 55 | } 56 | 57 | return esp_event_post_to(s_default_loop, event_base, event_id, 58 | event_data, event_data_size, ticks_to_wait); 59 | } 60 | 61 | 62 | esp_err_t esp_event_loop_create_default() 63 | { 64 | if (s_default_loop) { 65 | return ESP_ERR_INVALID_STATE; 66 | } 67 | 68 | esp_event_loop_args_t loop_args = { 69 | .queue_size = CONFIG_SYSTEM_EVENT_QUEUE_SIZE, 70 | .task_name = "sys_evt", 71 | .task_stack_size = 2048, 72 | .task_priority = 10, 73 | .task_core_id = 0 74 | }; 75 | 76 | esp_err_t err; 77 | 78 | err = esp_event_loop_create(&loop_args, &s_default_loop); 79 | if (err != ESP_OK) { 80 | return err; 81 | } 82 | 83 | return ESP_OK; 84 | } 85 | 86 | esp_err_t esp_event_loop_delete_default() 87 | { 88 | if (!s_default_loop) { 89 | return ESP_ERR_INVALID_STATE; 90 | } 91 | 92 | esp_err_t err; 93 | 94 | err = esp_event_loop_delete(s_default_loop); 95 | 96 | if (err != ESP_OK) { 97 | return err; 98 | } 99 | 100 | s_default_loop = NULL; 101 | 102 | return ESP_OK; 103 | } 104 | 105 | #endif // CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/sys/syslimits.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1988, 1993 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 3. All advertising materials mentioning features or use of this software 14 | * must display the following acknowledgement: 15 | * This product includes software developed by the University of 16 | * California, Berkeley and its contributors. 17 | * 4. Neither the name of the University nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * 33 | * @(#)syslimits.h 8.1 (Berkeley) 6/2/93 34 | * $FreeBSD: src/sys/sys/syslimits.h,v 1.10 2001/06/18 20:24:54 wollman Exp $ 35 | */ 36 | 37 | #ifndef _SYS_SYSLIMITS_H_ 38 | #define _SYS_SYSLIMITS_H_ 39 | 40 | #define ARG_MAX 4096 /* max bytes for an exec function */ 41 | #ifndef CHILD_MAX 42 | #define CHILD_MAX 40 /* max simultaneous processes */ 43 | #endif 44 | #define LINK_MAX 32767 /* max file link count */ 45 | #define MAX_CANON 255 /* max bytes in term canon input line */ 46 | #define MAX_INPUT 255 /* max bytes in terminal input */ 47 | #define NAME_MAX 255 /* max bytes in a file name */ 48 | #define NGROUPS_MAX 16 /* max supplemental group id's */ 49 | #ifndef OPEN_MAX 50 | #define OPEN_MAX 64 /* max open files per process */ 51 | #endif 52 | #define PATH_MAX 1024 /* max bytes in pathname */ 53 | #define PIPE_BUF 512 /* max bytes for atomic pipe writes */ 54 | #define IOV_MAX 1024 /* max elements in i/o vector */ 55 | 56 | #define BC_BASE_MAX 99 /* max ibase/obase values in bc(1) */ 57 | #define BC_DIM_MAX 2048 /* max array elements in bc(1) */ 58 | #define BC_SCALE_MAX 99 /* max scale value in bc(1) */ 59 | #define BC_STRING_MAX 1000 /* max const string length in bc(1) */ 60 | #define COLL_WEIGHTS_MAX 0 /* max weights for order keyword */ 61 | #define EXPR_NEST_MAX 32 /* max expressions nested in expr(1) */ 62 | #define LINE_MAX 2048 /* max bytes in an input line */ 63 | #define RE_DUP_MAX 255 /* max RE's in interval notation */ 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /include/tty.h: -------------------------------------------------------------------------------- 1 | /* 2 | Smalltalkje, version 1 based on: 3 | Little Smalltalk, version 3 4 | Written by Tim Budd, January 1989 5 | 6 | Terminal Interface Header 7 | 8 | This header defines the interface for terminal I/O and error reporting 9 | in the Smalltalkje system. It provides functions for displaying error 10 | and warning messages, reporting compilation issues, and interacting 11 | with the user through a text-based terminal. 12 | 13 | The functions declared here form the primary interface between the 14 | Smalltalk system and the user for error reporting and debugging 15 | output. On embedded platforms like the ESP32, these functions may 16 | output to a serial console, while on desktop platforms they typically 17 | output to stdout/stderr. 18 | 19 | These functions can be replaced with platform-specific implementations 20 | when using alternative interfaces (e.g., graphical interfaces or 21 | custom display systems). 22 | */ 23 | 24 | /** 25 | * Report a system error and terminate execution 26 | * 27 | * This function displays a critical error message to the user and 28 | * terminates the execution of the system. It's used for reporting 29 | * unrecoverable errors that prevent further execution. 30 | * 31 | * @param s1 First part of the error message 32 | * @param s2 Second part of the error message (may be empty) 33 | */ 34 | noreturn sysError(char *s1, char *s2); 35 | 36 | /** 37 | * Report a system warning without terminating 38 | * 39 | * This function displays a warning message to the user but allows 40 | * execution to continue. It's used for reporting non-critical issues 41 | * that don't prevent the system from functioning. 42 | * 43 | * @param s1 First part of the warning message 44 | * @param s2 Second part of the warning message (may be empty) 45 | */ 46 | noreturn sysWarn(char *s1, char *s2); 47 | 48 | /** 49 | * Report a compilation warning 50 | * 51 | * This function displays a warning message related to the compilation 52 | * of Smalltalk code. It includes information about the selector (method name) 53 | * where the warning occurred. 54 | * 55 | * @param selector The method selector where the warning occurred 56 | * @param str1 First part of the warning message 57 | * @param str2 Second part of the warning message (may be empty) 58 | */ 59 | void compilWarn(char *selector, char *str1, char *str2); 60 | 61 | /** 62 | * Report a compilation error 63 | * 64 | * This function displays an error message related to the compilation 65 | * of Smalltalk code. It includes information about the selector (method name) 66 | * where the error occurred. 67 | * 68 | * @param selector The method selector where the error occurred 69 | * @param str1 First part of the error message 70 | * @param str2 Second part of the error message (may be empty) 71 | */ 72 | void compilError(char *selector, char *str1, char *str2); 73 | 74 | /** 75 | * Display method information 76 | * 77 | * This function displays information about a method, typically for 78 | * debugging or tracing purposes. It shows the class and method name. 79 | * 80 | * @param cp The class name (as a string) 81 | * @param mp The method name (as a string) 82 | */ 83 | noreturn dspMethod(char *cp, char *mp); 84 | 85 | /** 86 | * Pause execution and wait for user input 87 | * 88 | * This function pauses the execution of the system and waits for 89 | * the user to press a key before continuing. It's used for debugging 90 | * or to give the user time to read messages before proceeding. 91 | */ 92 | void givepause(); 93 | -------------------------------------------------------------------------------- /components/m5stickc-idf/include/m5power.h: -------------------------------------------------------------------------------- 1 | /** 2 | * m5power.h 3 | * 4 | * (C) 2019 - Pablo Bacho 5 | * This code is licensed under the MIT License. 6 | */ 7 | 8 | #ifndef _M5POWER_H_ 9 | #define _M5POWER_H_ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include "esp_system.h" 16 | #include "esp_log.h" 17 | #include "esp_err.h" 18 | #include "freertos/FreeRTOS.h" 19 | #include "driver/i2c.h" 20 | 21 | #include "../util/axp192_reg.h" 22 | 23 | #define AXP192_I2C_ADDR 0x34 24 | #define I2C_SDA_GPIO ((gpio_num_t) 21) /*!< SDA pin of I²C bus */ 25 | #define I2C_SCL_GPIO ((gpio_num_t) 22) /*!< SCL pin of I²C bus */ 26 | 27 | typedef struct { 28 | bool enable_lcd_backlight; 29 | uint8_t lcd_backlight_level; 30 | } m5power_config_t; 31 | 32 | #define M5POWER_CONFIG_DEFAULT() { \ 33 | .enable_lcd_backlight = true, \ 34 | .lcd_backlight_level = 7 \ 35 | } 36 | 37 | /** 38 | * @brief Initialize power configuring AXP192 IC 39 | * 40 | * @return ESP_OK success 41 | * ESP_FAIL failed 42 | */ 43 | esp_err_t m5power_init(m5power_config_t * config); 44 | 45 | /** 46 | * @brief Read content of register 47 | * 48 | * @param register_address 49 | * @param register_content The content of the register gets stored in this variable 50 | * 51 | * @return ESP_OK success 52 | * ESP_FAIL failed 53 | * ESP_ERR_NO_MEM out of memory 54 | */ 55 | esp_err_t m5power_register_read(uint8_t register_address, uint8_t * register_content); 56 | 57 | /** 58 | * @brief Write content of register. Will overwrite any previous content. 59 | * 60 | * @param register_address 61 | * @param register_content New register content 62 | * 63 | * @return ESP_OK success 64 | * ESP_FAIL failed 65 | * ESP_ERR_NO_MEM out of memory 66 | */ 67 | esp_err_t m5power_register_write(uint8_t register_address, uint8_t register_content); 68 | 69 | /** 70 | * @brief Set to 1 a selection of bits in a register. Will not change other bits. 71 | * 72 | * @param register_address 73 | * @param bits_to_set bits to be set 74 | * 75 | * @return ESP_OK success 76 | * ESP_FAIL failed 77 | * ESP_ERR_NO_MEM out of memory 78 | */ 79 | esp_err_t m5power_register_set_bits(uint8_t register_address, uint8_t bits_to_set); 80 | 81 | /** 82 | * @brief Clear a selection of bits in a register. Will not change other bits. 83 | * 84 | * @param register_address 85 | * @param bits_to_clear bits to clear (pass them as 1s) 86 | * 87 | * @return ESP_OK success 88 | * ESP_FAIL failed 89 | * ESP_ERR_NO_MEM out of memory 90 | */ 91 | esp_err_t m5power_register_clear_bits(uint8_t register_address, uint8_t bits_to_clear); 92 | 93 | /** 94 | * @brief Get VBat in V. 95 | * 96 | * @param vbat The content of the vbat read gets stored in this variable 97 | * 98 | * @return ESP_OK success 99 | * ESP_FAIL failed 100 | */ 101 | esp_err_t m5power_get_vbat(uint16_t *vbat); 102 | 103 | /** 104 | * @brief Get VAps in V. 105 | * 106 | * @param vaps The content of the vaps read gets stored in this variable 107 | * 108 | * @return ESP_OK success 109 | * ESP_FAIL failed 110 | */ 111 | esp_err_t m5power_get_vaps(uint16_t *vbat); 112 | 113 | /** 114 | * @brief Set Sleep. 115 | * 116 | * @return ESP_OK success 117 | * ESP_FAIL failed 118 | */ 119 | esp_err_t m5power_set_sleep(void); 120 | 121 | #ifdef __cplusplus 122 | } 123 | #endif 124 | 125 | #endif // _M5POWER_H_ -------------------------------------------------------------------------------- /include/lex.h: -------------------------------------------------------------------------------- 1 | /* 2 | Smalltalkje, version 1 based on: 3 | 4 | Little Smalltalk, version 2 5 | Written by Tim Budd, Oregon State University, July 1987 6 | 7 | Lexical Analyzer Header 8 | 9 | This header defines the interface for the lexical analyzer component of 10 | the Smalltalk parser. The lexical analyzer (or lexer) is responsible for 11 | breaking input text into tokens - the basic syntactic units of the Smalltalk 12 | language like identifiers, numbers, symbols, etc. 13 | 14 | The lexer reads characters from the input stream and groups them into 15 | tokens, providing these tokens to the parser for syntactic analysis. 16 | This process is the first phase in compiling Smalltalk code. 17 | */ 18 | 19 | /** 20 | * Token Types 21 | * 22 | * This enumeration defines all the possible token types that can be 23 | * returned by the lexical analyzer. Each type represents a distinct 24 | * syntactic element in the Smalltalk language. 25 | * 26 | * The lexer classifies each sequence of characters it reads into one 27 | * of these token types, which the parser then uses to understand the 28 | * structure of the program. 29 | */ 30 | typedef enum tokensyms 31 | { 32 | nothing, /* No token recognized or initialization state */ 33 | nameconst, /* Identifier (variable/message name without colon) */ 34 | namecolon, /* Identifier followed by a colon (keyword message part) */ 35 | intconst, /* Integer literal (e.g., 42) */ 36 | floatconst, /* Floating-point literal (e.g., 3.14) */ 37 | charconst, /* Character literal (e.g., $a) */ 38 | symconst, /* Symbol literal (e.g., #symbol) */ 39 | arraybegin, /* Beginning of a literal array (e.g., #( ) */ 40 | strconst, /* String literal (e.g., 'hello') */ 41 | binary, /* Binary message selector (e.g., +, -, *, /) */ 42 | closing, /* Closing delimiter (e.g., ), }, ]) */ 43 | inputend /* End of input marker */ 44 | } tokentype; 45 | 46 | /** 47 | * Get the next token from the input stream 48 | * 49 | * This function reads characters from the input stream and returns 50 | * the next token found. It updates the global token-related variables 51 | * (token, tokenString, etc.) with information about the token. 52 | * 53 | * @return The type of the token that was found 54 | */ 55 | extern tokentype nextToken(NOARGS); 56 | 57 | /** 58 | * Global Token Information 59 | * 60 | * These variables hold information about the most recently recognized token. 61 | * They are updated by the nextToken() function each time it's called and 62 | * provide access to details about the current token being processed. 63 | */ 64 | extern tokentype token; /* The type of the current token */ 65 | extern char tokenString[]; /* The string representation of the current token */ 66 | extern int tokenInteger; /* The integer value if the token is an integer or character constant */ 67 | extern double tokenFloat; /* The floating-point value if the token is a float constant */ 68 | 69 | /** 70 | * Initialize the lexical analyzer 71 | * 72 | * This function prepares the lexical analyzer for use by setting up 73 | * internal state, initializing buffers, and preparing to read from 74 | * the input stream. It must be called before the first call to nextToken(). 75 | */ 76 | extern noreturn lexinit(); 77 | 78 | /** 79 | * Read all characters to the end of the current line 80 | * 81 | * This function consumes and returns all remaining characters on the 82 | * current line of input. It's useful for skipping over comments or 83 | * handling special line-oriented syntax. 84 | * 85 | * @return A pointer to a string containing the rest of the line 86 | */ 87 | extern char* toEndOfLine(); 88 | -------------------------------------------------------------------------------- /smalltalkImage/source/process.c: -------------------------------------------------------------------------------- 1 | /* 2 | ESP-32 Little Smalltalk interrupt driven execution support 3 | Written by Abdul Nabi, Feb. 2021 4 | 5 | process (blocks, etc) handling functions 6 | this has been added for supporting device events/interrupts 7 | and running smalltalk handler block by interrupting the 8 | interpreter loop. 9 | 10 | It uses message queues. FreeRTOS provides support for these. 11 | POSIX does as well, but since the Mac doesn't support it, for 12 | non FreeRTOS platforms we will need to roll a simple version 13 | that supports the methods in process.h 14 | */ 15 | 16 | #include "build.h" 17 | #include "process.h" 18 | 19 | #define BLOCK_RUN_QUEUE_DEPTH 16 20 | 21 | // Note this does not use the interruptInterpreter mechanism. 22 | extern void runBlock(object block, object arg); 23 | extern boolean execute(object aProcess, int maxsteps); 24 | 25 | void runSmalltalkProcess(object processToRun) 26 | { 27 | if (processToRun != nilobj) 28 | { 29 | while (execute(processToRun, 15000)); 30 | } 31 | else 32 | { 33 | fprintf(stderr, "<%s>: %s\n", "runSmalltalkProcess", "trying to run nil process"); 34 | } 35 | } 36 | 37 | #ifdef TARGET_ESP32 38 | 39 | #include "freertos/FreeRTOS.h" 40 | #include "freertos/queue.h" 41 | #include "freertos/task.h" 42 | 43 | typedef struct 44 | { 45 | object block; // block to run 46 | object arg; // and block argument 47 | int ticks; // ticks to delay before running 48 | } task_block_arg; 49 | 50 | static QueueHandle_t vmBlockToRunQueue; 51 | 52 | static void taskRunBlockAfter(task_block_arg *taskBlockArg) 53 | { 54 | object block = taskBlockArg->block; 55 | object arg = taskBlockArg->arg; 56 | int ticks = taskBlockArg->ticks; 57 | vTaskDelay(ticks); 58 | while (!interruptInterpreter()) 59 | { 60 | vTaskDelay(20 / portTICK_PERIOD_MS); 61 | } 62 | queueVMBlockToRun(block); 63 | vTaskDelete(xTaskGetCurrentTaskHandle()); 64 | } 65 | 66 | // prim 152 calls this 67 | void runBlockAfter(object block, object arg, int ticks) 68 | { 69 | // Since VM has a reference to the block 70 | task_block_arg taskBlockArg; 71 | 72 | incr(block); 73 | 74 | taskBlockArg.block = block; 75 | taskBlockArg.arg = arg; 76 | taskBlockArg.ticks = ticks; 77 | 78 | xTaskCreate( 79 | taskRunBlockAfter, /* Task function. */ 80 | "taskRunBlockAfter", /* name of task. */ 81 | 8096, /* Stack size of task */ 82 | &taskBlockArg, // parameter of the task (block, arg and delay until run) 83 | 1, /* priority of the task */ 84 | NULL); /* Task handle to keep track of created task */ 85 | } 86 | 87 | void initVMBlockToRunQueue() 88 | { 89 | vmBlockToRunQueue = xQueueCreate( BLOCK_RUN_QUEUE_DEPTH, sizeof(object) ); 90 | } 91 | 92 | boolean queueVMBlockToRun(object block) 93 | { 94 | incr(block); 95 | BaseType_t result = xQueueSend( vmBlockToRunQueue, &block, portMAX_DELAY); 96 | return result == pdPASS; 97 | } 98 | 99 | 100 | boolean isVMBlockQueued() 101 | { 102 | return uxQueueMessagesWaiting( vmBlockToRunQueue ) > 0; 103 | } 104 | 105 | object getNextVMBlockToRun() 106 | { 107 | object nextToRun; 108 | if (isVMBlockQueued()) { 109 | BaseType_t result = xQueueReceive(vmBlockToRunQueue, &nextToRun, portMAX_DELAY); 110 | return (result == pdPASS) ? nextToRun : nilobj; 111 | } 112 | return nilobj; 113 | } 114 | 115 | #else 116 | 117 | static int runBlockQueueIndex = 0; 118 | 119 | void initVMBlockToRunQueue() {} 120 | object getNextVMBlockToRun() { return nilobj; } 121 | boolean queueVMBlockToRun(object block) { return true; } 122 | boolean isVMBlockQueued() { return false; } 123 | 124 | #endif 125 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/syscall_table.c: -------------------------------------------------------------------------------- 1 | // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #include "sdkconfig.h" 16 | 17 | #ifdef CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include "rom/libc_stubs.h" 30 | #include "esp_vfs.h" 31 | #include "esp_newlib.h" 32 | #include "sdkconfig.h" 33 | 34 | static struct _reent s_reent; 35 | 36 | extern int _printf_float(struct _reent *rptr, 37 | void *pdata, 38 | FILE * fp, 39 | int (*pfunc) (struct _reent *, FILE *, _CONST char *, size_t len), 40 | va_list * ap); 41 | 42 | 43 | extern int _scanf_float(struct _reent *rptr, 44 | void *pdata, 45 | FILE *fp, 46 | va_list *ap); 47 | 48 | 49 | static struct syscall_stub_table s_stub_table = { 50 | .__getreent = &__getreent, 51 | ._malloc_r = &_malloc_r, 52 | ._free_r = &_free_r, 53 | ._realloc_r = &_realloc_r, 54 | ._calloc_r = &_calloc_r, 55 | ._abort = &abort, 56 | ._system_r = &_system_r, 57 | ._rename_r = &esp_vfs_rename, 58 | ._times_r = &_times_r, 59 | ._gettimeofday_r = &_gettimeofday_r, 60 | ._raise_r = (void (*)(struct _reent *r)) &_raise_r, 61 | ._unlink_r = &esp_vfs_unlink, 62 | ._link_r = &esp_vfs_link, 63 | ._stat_r = &esp_vfs_stat, 64 | ._fstat_r = &esp_vfs_fstat, 65 | ._sbrk_r = &_sbrk_r, 66 | ._getpid_r = &_getpid_r, 67 | ._kill_r = &_kill_r, 68 | ._exit_r = NULL, // never called in ROM 69 | ._close_r = &esp_vfs_close, 70 | ._open_r = &esp_vfs_open, 71 | ._write_r = (int (*)(struct _reent *r, int, const void *, int)) &esp_vfs_write, 72 | ._lseek_r = (int (*)(struct _reent *r, int, int, int)) &esp_vfs_lseek, 73 | ._read_r = (int (*)(struct _reent *r, int, void *, int)) &esp_vfs_read, 74 | ._lock_init = &_lock_init, 75 | ._lock_init_recursive = &_lock_init_recursive, 76 | ._lock_close = &_lock_close, 77 | ._lock_close_recursive = &_lock_close_recursive, 78 | ._lock_acquire = &_lock_acquire, 79 | ._lock_acquire_recursive = &_lock_acquire_recursive, 80 | ._lock_try_acquire = &_lock_try_acquire, 81 | ._lock_try_acquire_recursive = &_lock_try_acquire_recursive, 82 | ._lock_release = &_lock_release, 83 | ._lock_release_recursive = &_lock_release_recursive, 84 | #ifdef CONFIG_NEWLIB_NANO_FORMAT 85 | ._printf_float = &_printf_float, 86 | ._scanf_float = &_scanf_float, 87 | #else 88 | ._printf_float = NULL, 89 | ._scanf_float = NULL, 90 | #endif 91 | }; 92 | 93 | void esp_setup_syscall_table() 94 | { 95 | syscall_table_ptr_pro = &s_stub_table; 96 | syscall_table_ptr_app = &s_stub_table; 97 | _GLOBAL_REENT = &s_reent; 98 | environ = malloc(sizeof(char*)); 99 | environ[0] = NULL; 100 | } 101 | 102 | #endif // CONFIG_ESP_IDF_VERSION_BEFORE_V3_3 -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/grp.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: grp.h,v 1.7 1995/04/29 05:30:40 cgd Exp $ */ 2 | 3 | /*- 4 | * Copyright (c) 1989, 1993 5 | * The Regents of the University of California. All rights reserved. 6 | * (c) UNIX System Laboratories, Inc. 7 | * All or some portions of this file are derived from material licensed 8 | * to the University of California by American Telephone and Telegraph 9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with 10 | * the permission of UNIX System Laboratories, Inc. 11 | * 12 | * Redistribution and use in source and binary forms, with or without 13 | * modification, are permitted provided that the following conditions 14 | * are met: 15 | * 1. Redistributions of source code must retain the above copyright 16 | * notice, this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright 18 | * notice, this list of conditions and the following disclaimer in the 19 | * documentation and/or other materials provided with the distribution. 20 | * 3. All advertising materials mentioning features or use of this software 21 | * must display the following acknowledgement: 22 | * This product includes software developed by the University of 23 | * California, Berkeley and its contributors. 24 | * 4. Neither the name of the University nor the names of its contributors 25 | * may be used to endorse or promote products derived from this software 26 | * without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 29 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 32 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 37 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 38 | * SUCH DAMAGE. 39 | * 40 | * @(#)grp.h 8.2 (Berkeley) 1/21/94 41 | */ 42 | 43 | #ifndef _GRP_H_ 44 | #define _GRP_H_ 45 | 46 | #include 47 | #include 48 | #ifdef __CYGWIN__ 49 | #include 50 | #endif 51 | 52 | #if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) 53 | #define _PATH_GROUP "/etc/group" 54 | #endif 55 | 56 | struct group { 57 | char *gr_name; /* group name */ 58 | char *gr_passwd; /* group password */ 59 | gid_t gr_gid; /* group id */ 60 | char **gr_mem; /* group members */ 61 | }; 62 | 63 | #ifdef __cplusplus 64 | extern "C" { 65 | #endif 66 | 67 | #ifndef __INSIDE_CYGWIN__ 68 | struct group *getgrgid (gid_t); 69 | struct group *getgrnam (const char *); 70 | int getgrnam_r (const char *, struct group *, 71 | char *, size_t, struct group **); 72 | int getgrgid_r (gid_t, struct group *, 73 | char *, size_t, struct group **); 74 | #ifndef _POSIX_SOURCE 75 | struct group *getgrent (void); 76 | void setgrent (void); 77 | void endgrent (void); 78 | #ifndef __CYGWIN__ 79 | void setgrfile (const char *); 80 | #endif /* !__CYGWIN__ */ 81 | #ifndef _XOPEN_SOURCE 82 | #ifndef __CYGWIN__ 83 | char *group_from_gid (gid_t, int); 84 | int setgroupent (int); 85 | #endif /* !__CYGWIN__ */ 86 | int initgroups (const char *, gid_t); 87 | #endif /* !_XOPEN_SOURCE */ 88 | #endif /* !_POSIX_SOURCE */ 89 | #endif /* !__INSIDE_CYGWIN__ */ 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /* !_GRP_H_ */ 96 | -------------------------------------------------------------------------------- /components/m5stickc-idf/include/m5display.h: -------------------------------------------------------------------------------- 1 | /** 2 | * m5display.h 3 | * 4 | * (C) 2019 - Pablo Bacho 5 | * This code is licensed under the MIT License. 6 | */ 7 | 8 | #ifndef _M5DISPLAY_H_ 9 | #define _M5DISPLAY_H_ 10 | 11 | #ifdef __cplusplus 12 | extern "C" { 13 | #endif 14 | 15 | #include "esp_system.h" 16 | #include "esp_log.h" 17 | #include "../util/spi_master_lobo.h" 18 | #include "../util/tftspi.h" 19 | #include "../util/tft.h" 20 | #include "m5power.h" 21 | #include "m5button.h" 22 | #include "m5event.h" 23 | 24 | // TODO: Either move build.h or figure out how to use in in components (though breaks component modularity) 25 | #include "../../../include/build.h" 26 | 27 | #if TARGET_DEVICE == DEVICE_M5STICKC 28 | 29 | #define M5DISPLAY_TYPE DISP_TYPE_ST7735S /*!< Display type for display driver */ 30 | #define M5DISPLAY_WIDTH 160 /*!< Display width in pixels after rotation */ 31 | #define M5DISPLAY_HEIGHT 80 /*!< Display height in pixels after rotation */ 32 | 33 | #elif TARGET_DEVICE == DEVICE_T_WRISTBAND 34 | 35 | #define M5DISPLAY_TYPE DISP_TYPE_ST7735S /*!< Display type for display driver */ 36 | #define M5DISPLAY_WIDTH 160 /*!< Display width in pixels after rotation */ 37 | #define M5DISPLAY_HEIGHT 80 /*!< Display height in pixels after rotation */ 38 | 39 | #elif TARGET_DEVICE == DEVICE_M5STACK 40 | 41 | #define M5DISPLAY_TYPE DISP_TYPE_ILI9341 /*!< Display type for display driver */ 42 | #define M5DISPLAY_WIDTH 320 /*!< Display width in pixels after rotation */ 43 | #define M5DISPLAY_HEIGHT 240 /*!< Display height in pixels after rotation */ 44 | 45 | #endif 46 | 47 | // Defines for global variables of the TFT Library 48 | #define TFT_ORIENTATION orientation 49 | #define TFT_FONT_ROTATE font_rotate 50 | #define TFT_TEXT_WRAP text_wrap 51 | #define TFT_FONT_TRANSPARENT font_transparent 52 | #define TFT_FONT_FORCEFIXED font_forceFixed 53 | #define TFT_GRAY_SCALE gray_scale 54 | #define TFT_FONT_BACKGROUND _bg 55 | #define TFT_FONT_FOREGROUND _fg 56 | 57 | extern spi_lobo_device_handle_t m5display_spi; /*!< SPI device handle */ 58 | 59 | /** 60 | * @brief Initialize display 61 | * 62 | * @return ESP_OK success 63 | * ESP_FAIL failed 64 | */ 65 | esp_err_t m5display_init(); 66 | 67 | /** 68 | * @brief Set display backlight level 69 | * 70 | * @param backlight_level Backlight level from 0 (lowest) to 7 (brightest) 71 | * 72 | * @return ESP_OK success 73 | * ESP_FAIL failed 74 | */ 75 | esp_err_t m5display_set_backlight_level(uint8_t backlight_level); 76 | 77 | /** 78 | * @brief Turn display off 79 | * 80 | * @return ESP_OK success 81 | * ESP_FAIL failed 82 | */ 83 | esp_err_t m5display_off(); 84 | 85 | /** 86 | * @brief Turn display on 87 | * 88 | * @return ESP_OK success 89 | * ESP_FAIL failed 90 | */ 91 | esp_err_t m5display_on(); 92 | 93 | /** 94 | * @brief Sets a timeout to turn display off 95 | * 96 | * Display turns back on with button events or m5display_wakeup() function call. 97 | * 98 | * @param timeout timeout in seconds 99 | * @return ESP_OK success 100 | * ESP_FAIL failed 101 | */ 102 | esp_err_t m5display_timeout(uint32_t timeout); 103 | 104 | /** 105 | * @brief Turns display on and resets timeout timer 106 | */ 107 | void m5display_wakeup(); 108 | 109 | /** 110 | * @brief Callback for timeout to turn display off 111 | */ 112 | void m5display_sleep(); 113 | 114 | /** 115 | * @brief Event handler for display. Not meant to be used by user program. 116 | */ 117 | void m5display_event_handler(void * handler_arg, esp_event_base_t base, int32_t id, void * event_data); 118 | 119 | #ifdef __cplusplus 120 | } 121 | #endif 122 | 123 | #endif // _M5DISPLAY_H_ -------------------------------------------------------------------------------- /include/target.h: -------------------------------------------------------------------------------- 1 | /* 2 | Smalltalkje, version 1 3 | Written by Abdul Nabi, code krafters, March 2021 4 | 5 | Platform Target Configuration Header 6 | 7 | This header defines platform-specific configurations, macros, and includes 8 | for different target environments. It provides a uniform interface for 9 | platform-dependent functionality like logging, memory management, and 10 | system services. 11 | 12 | The file uses conditional compilation to select the appropriate implementation 13 | based on the target platform, currently supporting: 14 | 1. ESP32 - Using FreeRTOS and ESP-IDF libraries 15 | 2. Other platforms (desktop environments) - Using standard C libraries 16 | 17 | This abstraction layer allows the Smalltalkje codebase to be portable while 18 | still leveraging platform-specific optimizations and features. 19 | */ 20 | #include "build.h" 21 | 22 | /** 23 | * ESP32 Platform Configuration 24 | * 25 | * When targeting the ESP32 platform, we include ESP-IDF and FreeRTOS headers 26 | * and define macros that use the ESP32's native logging and memory management 27 | * facilities. The ESP32 is an embedded platform with specific requirements 28 | * and capabilities that differ from desktop environments. 29 | */ 30 | #ifdef TARGET_ESP32 31 | 32 | #include "esp_err.h" /* ESP32 error handling */ 33 | #include "esp_log.h" /* ESP32 logging system */ 34 | 35 | #include "freertos/FreeRTOS.h" /* FreeRTOS core */ 36 | #include "freertos/task.h" /* FreeRTOS task management */ 37 | 38 | /** 39 | * ESP32 Logging Macros 40 | * 41 | * These macros provide a consistent interface for logging at different levels 42 | * while using the ESP-IDF's native logging system. The ESP-IDF logger supports 43 | * features like log filtering by tag and level, timestamps, and colored output. 44 | */ 45 | #define TT_LOG_ERROR(tag, format, ...) ESP_LOGE(tag, format, ##__VA_ARGS__) /* Error level logging */ 46 | #define TT_LOG_WARN(tag, format, ...) ESP_LOGW(tag, format, ##__VA_ARGS__) /* Warning level logging */ 47 | #define TT_LOG_INFO(tag, format, ...) ESP_LOGI(tag, format, ##__VA_ARGS__) /* Info level logging */ 48 | #define TT_LOG_DEBUG(tag, format, ...) ESP_LOGD(tag, format, ##__VA_ARGS__) /* Debug level logging */ 49 | #define TT_LOG_VERB(tag, format, ...) ESP_LOGV(tag, format, ##__VA_ARGS__) /* Verbose level logging */ 50 | 51 | /** 52 | * ESP32 Memory Management 53 | * 54 | * Provides a platform-independent way to check available memory. 55 | * On ESP32, this uses the ESP-IDF's heap size function. 56 | */ 57 | #define GET_FREE_HEAP_SIZE() esp_get_free_heap_size() /* Get available heap size in bytes */ 58 | 59 | /** 60 | * Non-ESP32 Platform Configuration 61 | * 62 | * For desktop and other non-ESP32 platforms, we define simpler implementations 63 | * of the same macros using standard C libraries. This allows the same code to 64 | * run on both embedded devices and development machines. 65 | */ 66 | #else 67 | /** 68 | * Generic Logging Macros 69 | * 70 | * These provide simplified logging implementations for non-ESP32 platforms, 71 | * typically outputting to stderr. They maintain the same interface as the 72 | * ESP32 versions for compatibility. 73 | */ 74 | #define TT_LOG_MSG(tag, level, format, ...) fprintf(stderr, format, ##__VA_ARGS__); 75 | #define TT_LOG_ERROR(tag, format, ...) TT_LOG_MSG(tag, "ERROR", format, ##__VA_ARGS__) 76 | #define TT_LOG_WARN(tag, format, ...) TT_LOG_MSG(tag, "WARN", format, ##__VA_ARGS__) 77 | #define TT_LOG_INFO(tag, format, ...) fprintf(stderr, format, ##__VA_ARGS__); 78 | #define TT_LOG_DEBUG(tag, format, ...) TT_LOG_MSG(tag, "DEBUG", format, ##__VA_ARGS__) 79 | #define TT_LOG_VERB(tag, format, ...) TT_LOG_MSG(tag, "VERB", format, ##__VA_ARGS__) 80 | 81 | /** 82 | * Generic Memory Management 83 | * 84 | * On non-ESP32 platforms, uses the standard C library's mallinfo function 85 | * to report available heap memory. 86 | */ 87 | #define GET_FREE_HEAP_SIZE() mallinfo().fordblks 88 | 89 | #endif /* TARGET_ESP32 */ 90 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/complex.h: -------------------------------------------------------------------------------- 1 | /* $NetBSD: complex.h,v 1.3 2010/09/15 16:11:30 christos Exp $ */ 2 | 3 | /* 4 | * Written by Matthias Drochner. 5 | * Public domain. 6 | */ 7 | 8 | #ifndef _COMPLEX_H 9 | #define _COMPLEX_H 10 | 11 | #define complex _Complex 12 | #define _Complex_I 1.0fi 13 | #define I _Complex_I 14 | 15 | #include 16 | 17 | __BEGIN_DECLS 18 | 19 | /* 7.3.5 Trigonometric functions */ 20 | /* 7.3.5.1 The cacos functions */ 21 | double complex cacos(double complex); 22 | float complex cacosf(float complex); 23 | 24 | /* 7.3.5.2 The casin functions */ 25 | double complex casin(double complex); 26 | float complex casinf(float complex); 27 | 28 | /* 7.3.5.1 The catan functions */ 29 | double complex catan(double complex); 30 | float complex catanf(float complex); 31 | 32 | /* 7.3.5.1 The ccos functions */ 33 | double complex ccos(double complex); 34 | float complex ccosf(float complex); 35 | 36 | /* 7.3.5.1 The csin functions */ 37 | double complex csin(double complex); 38 | float complex csinf(float complex); 39 | 40 | /* 7.3.5.1 The ctan functions */ 41 | double complex ctan(double complex); 42 | float complex ctanf(float complex); 43 | 44 | /* 7.3.6 Hyperbolic functions */ 45 | /* 7.3.6.1 The cacosh functions */ 46 | double complex cacosh(double complex); 47 | float complex cacoshf(float complex); 48 | 49 | /* 7.3.6.2 The casinh functions */ 50 | double complex casinh(double complex); 51 | float complex casinhf(float complex); 52 | 53 | /* 7.3.6.3 The catanh functions */ 54 | double complex catanh(double complex); 55 | float complex catanhf(float complex); 56 | 57 | /* 7.3.6.4 The ccosh functions */ 58 | double complex ccosh(double complex); 59 | float complex ccoshf(float complex); 60 | 61 | /* 7.3.6.5 The csinh functions */ 62 | double complex csinh(double complex); 63 | float complex csinhf(float complex); 64 | 65 | /* 7.3.6.6 The ctanh functions */ 66 | double complex ctanh(double complex); 67 | float complex ctanhf(float complex); 68 | 69 | /* 7.3.7 Exponential and logarithmic functions */ 70 | /* 7.3.7.1 The cexp functions */ 71 | double complex cexp(double complex); 72 | float complex cexpf(float complex); 73 | 74 | /* 7.3.7.2 The clog functions */ 75 | double complex clog(double complex); 76 | float complex clogf(float complex); 77 | 78 | /* 7.3.8 Power and absolute-value functions */ 79 | /* 7.3.8.1 The cabs functions */ 80 | /*#ifndef __LIBM0_SOURCE__ */ 81 | /* avoid conflict with historical cabs(struct complex) */ 82 | /* double cabs(double complex) __RENAME(__c99_cabs); 83 | float cabsf(float complex) __RENAME(__c99_cabsf); 84 | #endif 85 | */ 86 | double cabs(double complex) ; 87 | float cabsf(float complex) ; 88 | 89 | /* 7.3.8.2 The cpow functions */ 90 | double complex cpow(double complex, double complex); 91 | float complex cpowf(float complex, float complex); 92 | 93 | /* 7.3.8.3 The csqrt functions */ 94 | double complex csqrt(double complex); 95 | float complex csqrtf(float complex); 96 | 97 | /* 7.3.9 Manipulation functions */ 98 | /* 7.3.9.1 The carg functions */ 99 | double carg(double complex); 100 | float cargf(float complex); 101 | 102 | /* 7.3.9.2 The cimag functions */ 103 | double cimag(double complex); 104 | float cimagf(float complex); 105 | /*long double cimagl(long double complex); */ 106 | 107 | /* 7.3.9.3 The conj functions */ 108 | double complex conj(double complex); 109 | float complex conjf(float complex); 110 | /*long double complex conjl(long double complex); */ 111 | 112 | /* 7.3.9.4 The cproj functions */ 113 | double complex cproj(double complex); 114 | float complex cprojf(float complex); 115 | /*long double complex cprojl(long double complex); */ 116 | 117 | /* 7.3.9.5 The creal functions */ 118 | double creal(double complex); 119 | float crealf(float complex); 120 | /*long double creall(long double complex); */ 121 | 122 | __END_DECLS 123 | 124 | #endif /* ! _COMPLEX_H */ 125 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/regex.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * Copyright (c) 1992 Henry Spencer. 3 | * Copyright (c) 1992, 1993 4 | * The Regents of the University of California. All rights reserved. 5 | * 6 | * This code is derived from software contributed to Berkeley by 7 | * Henry Spencer of the University of Toronto. 8 | * 9 | * Redistribution and use in source and binary forms, with or without 10 | * modification, are permitted provided that the following conditions 11 | * are met: 12 | * 1. Redistributions of source code must retain the above copyright 13 | * notice, this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright 15 | * notice, this list of conditions and the following disclaimer in the 16 | * documentation and/or other materials provided with the distribution. 17 | * 4. Neither the name of the University nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 | * SUCH DAMAGE. 32 | * 33 | * @(#)regex.h 8.2 (Berkeley) 1/3/94 34 | * $FreeBSD: src/include/regex.h,v 1.4 2002/03/23 17:24:53 imp Exp $ 35 | */ 36 | 37 | #ifndef _REGEX_H_ 38 | #define _REGEX_H_ 39 | 40 | #include 41 | 42 | /* types */ 43 | typedef off_t regoff_t; 44 | 45 | typedef struct { 46 | int re_magic; 47 | size_t re_nsub; /* number of parenthesized subexpressions */ 48 | __const char *re_endp; /* end pointer for REG_PEND */ 49 | struct re_guts *re_g; /* none of your business :-) */ 50 | } regex_t; 51 | 52 | typedef struct { 53 | regoff_t rm_so; /* start of match */ 54 | regoff_t rm_eo; /* end of match */ 55 | } regmatch_t; 56 | 57 | /* regcomp() flags */ 58 | #define REG_BASIC 0000 59 | #define REG_EXTENDED 0001 60 | #define REG_ICASE 0002 61 | #define REG_NOSUB 0004 62 | #define REG_NEWLINE 0010 63 | #define REG_NOSPEC 0020 64 | #define REG_PEND 0040 65 | #define REG_DUMP 0200 66 | 67 | /* regerror() flags */ 68 | #define REG_NOMATCH 1 69 | #define REG_BADPAT 2 70 | #define REG_ECOLLATE 3 71 | #define REG_ECTYPE 4 72 | #define REG_EESCAPE 5 73 | #define REG_ESUBREG 6 74 | #define REG_EBRACK 7 75 | #define REG_EPAREN 8 76 | #define REG_EBRACE 9 77 | #define REG_BADBR 10 78 | #define REG_ERANGE 11 79 | #define REG_ESPACE 12 80 | #define REG_BADRPT 13 81 | #define REG_EMPTY 14 82 | #define REG_ASSERT 15 83 | #define REG_INVARG 16 84 | #define REG_ATOI 255 /* convert name to number (!) */ 85 | #define REG_ITOA 0400 /* convert number to name (!) */ 86 | 87 | /* regexec() flags */ 88 | #define REG_NOTBOL 00001 89 | #define REG_NOTEOL 00002 90 | #define REG_STARTEND 00004 91 | #define REG_TRACE 00400 /* tracing of execution */ 92 | #define REG_LARGE 01000 /* force large representation */ 93 | #define REG_BACKR 02000 /* force use of backref code */ 94 | 95 | __BEGIN_DECLS 96 | int regcomp(regex_t *__restrict, const char *__restrict, int); 97 | size_t regerror(int, const regex_t *__restrict, char *__restrict, size_t); 98 | int regexec(const regex_t *__restrict, const char *__restrict, 99 | size_t, regmatch_t [__restrict], int); 100 | void regfree(regex_t *); 101 | __END_DECLS 102 | 103 | #endif /* !_REGEX_H_ */ 104 | -------------------------------------------------------------------------------- /smalltalkImage/source/initial.c: -------------------------------------------------------------------------------- 1 | /* 2 | Little Smalltalk, version 3 3 | Written by Tim Budd, June 1988 4 | 5 | initial image maker 6 | */ 7 | #include 8 | #include 9 | #include 10 | #include "env.h" 11 | #include "memory.h" 12 | #include "names.h" 13 | 14 | int initial = 1; /* making initial image */ 15 | 16 | // void goDoIt(char *text); 17 | void makeInitialImage(); 18 | boolean parse(object method, char *text, boolean savetext); 19 | boolean execute(object aProcess, int maxsteps); 20 | void setInstanceVariables(object aClass); 21 | 22 | int main(int argc, char **argv) 23 | { 24 | char methbuf[100]; 25 | int i; 26 | 27 | initMemoryManager(); 28 | makeInitialImage(); 29 | initCommonSymbols(); 30 | 31 | for (i = 1; i < argc; i++) { 32 | fprintf(stderr, "%s:\n", argv[i]); 33 | ignore sprintf(methbuf, 34 | "x <120 1 '%s' 'r'>. <123 1>. <121 1>", argv[i]); 35 | justDoIt(methbuf); 36 | } 37 | 38 | /* when we are all done looking at the arguments, do initialization */ 39 | fprintf(stderr, "initialization\n"); 40 | /*debugging = true; */ 41 | justDoIt("x nil initialize\n"); 42 | fprintf(stderr, "finished\n"); 43 | 44 | /* exit and return - belt and suspenders, but it keeps lint happy */ 45 | exit(0); 46 | return 0; 47 | } 48 | 49 | // void goDoIt(text) 50 | // char *text; 51 | // { 52 | // object process, stack, method; 53 | 54 | // method = newMethod(); 55 | // incr(method); 56 | // setInstanceVariables(nilobj); 57 | // ignore parse(method, text, false); 58 | 59 | // process = allocObject(processSize); 60 | // incr(process); 61 | // stack = newArray(50); 62 | // incr(stack); 63 | 64 | // /* make a process */ 65 | // basicAtPut(process, stackInProcess, stack); 66 | // basicAtPut(process, stackTopInProcess, newInteger(10)); 67 | // basicAtPut(process, linkPtrInProcess, newInteger(2)); 68 | 69 | // /* put argument on stack */ 70 | // basicAtPut(stack, 1, nilobj); /* argument */ 71 | // /* now make a linkage area in stack */ 72 | // basicAtPut(stack, 2, nilobj); /* previous link */ 73 | // basicAtPut(stack, 3, nilobj); /* context object (nil = stack) */ 74 | // basicAtPut(stack, 4, newInteger(1)); /* return point */ 75 | // basicAtPut(stack, 5, method); /* method */ 76 | // basicAtPut(stack, 6, newInteger(1)); /* byte offset */ 77 | 78 | // /* now go execute it */ 79 | // while (execute(process, 15000)) 80 | // fprintf(stderr, ".."); 81 | // } 82 | 83 | /* 84 | there is a sort of chicken and egg problem with regards to making 85 | the initial image 86 | */ 87 | void makeInitialImage() 88 | { 89 | object hashTable; 90 | object symbolObj, symbolClass, classClass; 91 | 92 | /* first create the table, without class links */ 93 | symbols = allocObject(1); 94 | incr(symbols); 95 | hashTable = allocObject(3 * 53); 96 | basicAtPut(symbols, 1, hashTable); 97 | 98 | /* next create #Symbol, Symbol and Class */ 99 | symbolObj = newSymbol("Symbol"); 100 | symbolClass = newClass("Symbol"); 101 | setClass(symbolObj, symbolClass); 102 | classClass = newClass("Class"); 103 | setClass(symbolClass, classClass); 104 | setClass(classClass, classClass); 105 | 106 | /* now fix up classes for symbol table */ 107 | /* and make a couple common classes, just to hold their places */ 108 | ignore newClass("Link"); 109 | ignore newClass("ByteArray"); 110 | setClass(hashTable, newClass("Array")); 111 | setClass(symbols, newClass("Dictionary")); 112 | setClass(nilobj, newClass("UndefinedObject")); 113 | ignore newClass("String"); 114 | nameTableInsert(symbols, strHash("symbols"), newSymbol("symbols"), 115 | symbols); 116 | 117 | /* finally at least make true and false to be distinct */ 118 | trueobj = newSymbol("true"); 119 | nameTableInsert(symbols, strHash("true"), trueobj, trueobj); 120 | falseobj = newSymbol("false"); 121 | nameTableInsert(symbols, strHash("false"), falseobj, falseobj); 122 | } 123 | -------------------------------------------------------------------------------- /components/m5stickc-idf/backported/newlib/include/glob.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1989, 1993 3 | * The Regents of the University of California. All rights reserved. 4 | * 5 | * This code is derived from software contributed to Berkeley by 6 | * Guido van Rossum. 7 | * 8 | * Redistribution and use in source and binary forms, with or without 9 | * modification, are permitted provided that the following conditions 10 | * are met: 11 | * 1. Redistributions of source code must retain the above copyright 12 | * notice, this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 4. Neither the name of the University nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 | * SUCH DAMAGE. 31 | * 32 | * @(#)glob.h 8.1 (Berkeley) 6/2/93 33 | * $FreeBSD: src/include/glob.h,v 1.6 2002/03/23 17:24:53 imp Exp $ 34 | */ 35 | 36 | #ifndef _GLOB_H_ 37 | #define _GLOB_H_ 38 | 39 | #include 40 | 41 | struct stat; 42 | typedef struct { 43 | int gl_pathc; /* Count of total paths so far. */ 44 | int gl_matchc; /* Count of paths matching pattern. */ 45 | int gl_offs; /* Reserved at beginning of gl_pathv. */ 46 | int gl_flags; /* Copy of flags parameter to glob. */ 47 | char **gl_pathv; /* List of paths matching pattern. */ 48 | /* Copy of errfunc parameter to glob. */ 49 | int (*gl_errfunc)(const char *, int); 50 | 51 | /* 52 | * Alternate filesystem access methods for glob; replacement 53 | * versions of closedir(3), readdir(3), opendir(3), stat(2) 54 | * and lstat(2). 55 | */ 56 | void (*gl_closedir)(void *); 57 | struct dirent *(*gl_readdir)(void *); 58 | void *(*gl_opendir)(const char *); 59 | int (*gl_lstat)(const char *, struct stat *); 60 | int (*gl_stat)(const char *, struct stat *); 61 | } glob_t; 62 | 63 | #define GLOB_APPEND 0x0001 /* Append to output from previous call. */ 64 | #define GLOB_DOOFFS 0x0002 /* Use gl_offs. */ 65 | #define GLOB_ERR 0x0004 /* Return on error. */ 66 | #define GLOB_MARK 0x0008 /* Append / to matching directories. */ 67 | #define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */ 68 | #define GLOB_NOSORT 0x0020 /* Don't sort. */ 69 | 70 | #define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */ 71 | #define GLOB_BRACE 0x0080 /* Expand braces ala csh. */ 72 | #define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */ 73 | #define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */ 74 | #define GLOB_QUOTE 0x0400 /* Quote special chars with \. */ 75 | #define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */ 76 | #define GLOB_LIMIT 0x1000 /* limit number of returned paths */ 77 | 78 | /* backwards compatibility, this is the old name for this option */ 79 | #define GLOB_MAXPATH GLOB_LIMIT 80 | 81 | #define GLOB_NOSPACE (-1) /* Malloc call failed. */ 82 | #define GLOB_ABEND (-2) /* Unignored error. */ 83 | 84 | __BEGIN_DECLS 85 | int glob(const char *__restrict, int, int (*)(const char *, int), 86 | glob_t *__restrict); 87 | void globfree(glob_t *); 88 | __END_DECLS 89 | 90 | #endif /* !_GLOB_H_ */ 91 | -------------------------------------------------------------------------------- /include/env.h: -------------------------------------------------------------------------------- 1 | /* 2 | Smalltalkje, version 1 based on: 3 | 4 | Little Smalltalk, version two 5 | Written by Tim Budd, Oregon State University, July 1987 6 | 7 | Environment and Cross-Platform Compatibility Header 8 | 9 | This header defines fundamental types, macros, and constants that ensure 10 | consistent behavior across different C compilers and operating systems. 11 | It serves as the foundation for the Smalltalkje system by isolating 12 | platform-specific and compiler-specific details. 13 | 14 | The definitions in this file address issues such as: 15 | - Basic type definitions that may vary between compilers 16 | - Convenience macros for common operations 17 | - Boolean constants and types 18 | - Numeric range checks for internal representations 19 | - Function parameter type abbreviations for better readability 20 | 21 | Most of Smalltalkje's source files include this header to ensure 22 | consistent behavior regardless of the underlying platform. 23 | 24 | (This file has remained largely unchanged from the original Little Smalltalk) 25 | */ 26 | 27 | #include 28 | 29 | /** 30 | * Basic Type Definitions 31 | * 32 | * These define fundamental types used throughout the Smalltalkje system. 33 | */ 34 | typedef unsigned char byte; /* 8-bit unsigned value, used for bytecodes and byte objects */ 35 | 36 | /** 37 | * Byte Conversion Macros 38 | * 39 | * These provide consistent handling of byte values across platforms. 40 | */ 41 | #define byteToInt(b) (b) /* Convert a byte value to an integer */ 42 | 43 | /** 44 | * Numeric Range Checks 45 | * 46 | * These macros determine if numeric values fit within Smalltalk's 47 | * internal representation limits. Smalltalk uses tagged integers 48 | * with a limited range to avoid allocating separate objects. 49 | */ 50 | /* Range check for Smalltalk integer representation (limited to 15 bits) */ 51 | #define longCanBeInt(l) ((l >= -16383) && (l <= 16383)) 52 | 53 | /** 54 | * Utility Macros 55 | * 56 | * These provide common operations used throughout the codebase. 57 | */ 58 | // #pragma GCC diagnostic ignored "-Werror=nonnull" /* Compiler warning suppression */ 59 | 60 | /* String equality comparison shorthand */ 61 | #define streq(a, b) (strcmp(a, b) == 0) 62 | 63 | /** 64 | * Boolean Constants and Type 65 | * 66 | * Standard boolean values and type definition for consistency. 67 | */ 68 | #define true 1 /* Boolean true value */ 69 | #define false 0 /* Boolean false value */ 70 | typedef int boolean; /* Boolean type (values true/false) */ 71 | 72 | /** 73 | * Code Style and Lint Helpers 74 | * 75 | * These macros help with code style and suppressing compiler warnings. 76 | */ 77 | /* Explicitly ignore a function return value */ 78 | #define ignore (void) /* Indicates intentional ignoring of return value */ 79 | #define noreturn void /* Indicates function returns nothing */ 80 | 81 | /** 82 | * Function Prototype Type Abbreviations 83 | * 84 | * These abbreviations make function prototypes more readable by 85 | * providing shorter names for common parameter types. They're used 86 | * extensively in header files throughout the system. 87 | * 88 | * For example, a function like: 89 | * extern object someFunction(object x, int y, char *z); 90 | * 91 | * Can be written as: 92 | * extern object someFunction(OBJ X INT X STR); 93 | */ 94 | #define X , /* Parameter separator */ 95 | #define OBJ object /* Smalltalk object parameter */ 96 | #define OBJP object * /* Pointer to object parameter */ 97 | #define INT int /* Integer parameter */ 98 | #define BOOL boolean /* Boolean parameter */ 99 | #define STR char * /* String parameter */ 100 | #define FLOAT double /* Floating point parameter */ 101 | #define NOARGS void /* No parameters */ 102 | #define FILEP FILE * /* File pointer parameter */ 103 | #define FUNC () /* Function with no special declaration */ 104 | -------------------------------------------------------------------------------- /components/m5stickc-idf/m5stickc.c: -------------------------------------------------------------------------------- 1 | /** 2 | * m5stickc.c - ESP-IDF component to work with M5 3 | * 4 | * (C) 2019 - Pablo Bacho 5 | * This code is licensed under the MIT License. 6 | * 7 | * Modified for Smalltalkje by Abdul Nabi power); 43 | if(e == ESP_OK) { 44 | ESP_LOGD(TAG, "Power manager initialized"); 45 | } else { 46 | ESP_LOGE(TAG, "Error initializing power manager"); 47 | ++error_count; 48 | } 49 | } else { 50 | ESP_LOGE(TAG, "Error during I2C driver installation: %s", esp_err_to_name(e)); 51 | ++error_count; 52 | } 53 | } else { 54 | ESP_LOGE(TAG, "Error setting up I2C: %s", esp_err_to_name(e)); 55 | ++error_count; 56 | } 57 | 58 | // Config I2C_NUM_1 begin(sda=-0, int scl=-26), the M5StickC 8-pin connector GPIO PINS 59 | conf.sda_io_num = I2C_PORT_1_SDA_GPIO_PIN; 60 | conf.scl_io_num = I2C_PORT_1_SCL_GPIO_PIN; 61 | conf.master.clk_speed = I2C_PORT_1_CLK_SPEED; 62 | e = i2c_param_config(I2C_NUM_1, &conf); 63 | if(e == ESP_OK) { 64 | e = i2c_driver_install(I2C_NUM_1, I2C_MODE_MASTER, 0, 0, 0); 65 | if(e != ESP_OK) { 66 | ESP_LOGE(TAG, "Error during I2C 1 driver install: %s", esp_err_to_name(e)); 67 | } 68 | } else { 69 | ESP_LOGE(TAG, "Error during I2C 1 param config installation: %s", esp_err_to_name(e)); 70 | } 71 | 72 | 73 | // Init led 74 | e = m5led_init(); 75 | if(e == ESP_OK) { 76 | ESP_LOGD(TAG, "Led initialized"); 77 | } else { 78 | ESP_LOGE(TAG, "Error initializing led"); 79 | ++error_count; 80 | } 81 | 82 | // Init button 83 | e = m5button_init(); 84 | if(e == ESP_OK) { 85 | ESP_LOGD(TAG, "Button initialized"); 86 | } else { 87 | ESP_LOGE(TAG, "Error initializing button"); 88 | ++error_count; 89 | } 90 | 91 | // Init display 92 | e = m5display_init(); 93 | if(e == ESP_OK) { 94 | ESP_LOGD(TAG, "Display initialized"); 95 | } else { 96 | ESP_LOGE(TAG, "Error initializing display"); 97 | ++error_count; 98 | } 99 | 100 | // Init RTC 101 | // e = m5rtc_init(); 102 | // if(e == ESP_OK) { 103 | // ESP_LOGD(TAG, "RTC initialized"); 104 | // } else { 105 | // ESP_LOGE(TAG, "Error initializing RTC"); 106 | // ++error_count; 107 | // } 108 | 109 | if(error_count == 0) { 110 | ESP_LOGD(TAG, "M5StickC initialized successfully"); 111 | return ESP_OK; 112 | } else { 113 | ESP_LOGE(TAG, "%d errors found while initializing M5StickC", error_count); 114 | return ESP_FAIL; 115 | } 116 | } -------------------------------------------------------------------------------- /smalltalkImage/http.st: -------------------------------------------------------------------------------- 1 | * 2 | * http.st 3 | * 4 | * Smalltalkje, version 1 - HTTP Support 5 | * Written by Abdul Nabi, code crafters, March 2021 6 | * 7 | Class HttpRequest Object url method contentType body 8 | Class HttpResponse Object statusCode contentLength content 9 | Class Weather Object city temp feelsLike minTemp maxTemp wind desc 10 | Class Cloud Object 11 | * 12 | Methods HttpRequest 'all' 13 | getUrl: urlString 14 | url <- urlString. 15 | method <- 0 16 | | 17 | postUrl: urlString contentType: typeString data: postData 18 | "If contentType is nil, then type will be assumed JSON" 19 | url <- urlString. 20 | method <- 1. 21 | contentType <- typeString. 22 | body <- postData 23 | | 24 | send 25 | "Send the request and wait for the HttpResponse which will be returned" 26 | ^ <183 0 self> 27 | | 28 | sendWhenDone: aBlock 29 | "Do the request on a seperate thread and call aBlock when done with the HttpResponse" 30 | ^ <183 1 self aBlock> 31 | | 32 | demoGet 33 | "After this is set up 'H sendWhenDone: B' will run a get and save response in global R" 34 | url <- 'http://httpbin.org/get'. 35 | method <- 0. 36 | B <- [:r | R <- r. '=== HTTP GET DEMO DONE ===' print ]. 37 | H <- self 38 | | 39 | getWeather: urlEncodedCity 40 | (url <- self getWeatherUrl) ifNil: [^ nil]. 41 | method <- 0. 42 | B <- [:r | R <- r. '=== HTTP POST DEMO DONE content size: ', r contentLength print ]. 43 | H <- self 44 | | 45 | getWeatherUrl | appId | 46 | appId <- gizmo nvsStringAtKey: 'weatherAppId'. 47 | appId ifNil: [^ nil]. 48 | ^ 'http://api.openweathermap.org/data/2.5/weather?units=metric&q=', city, '&appid=', appId 49 | | 50 | demoPost 51 | "After this is set up 'H sendWhenDone: B' will run a get and save response in global R" 52 | url <- 'http://httpbin.org/post'. 53 | method <- 1. 54 | contentType <- nil. 55 | body <- '{ "firstName" : "Abdul", "lastName" : "Nabi" }'. 56 | B <- [:r | R <- r. '=== HTTP POST DEMO DONE ===' print ]. 57 | H <- self 58 | ] 59 | Methods HttpResponse 'all' 60 | statusCode 61 | ^ statusCode 62 | | 63 | contentLength 64 | ^ contentLength 65 | | 66 | content 67 | ^ content 68 | ] 69 | Methods Weather 'all' 70 | city 71 | ^ city 72 | | 73 | city: aString 74 | city <- aString 75 | | 76 | temp 77 | ^ temp 78 | | 79 | feelsLike 80 | ^ feelsLike 81 | | 82 | minTemp 83 | ^ minTemp 84 | | 85 | maxTemp 86 | ^ maxTemp 87 | | 88 | wind 89 | ^ wind 90 | | 91 | desc 92 | ^ desc 93 | | 94 | getRequest 95 | ^ HttpRequest new getUrl: 'http://thenabi.com/smalltalkje/weather/current.php?secret=stjerules!&city=', city 96 | | 97 | update 98 | self updateSync 99 | | 100 | updateBackground | req a | 101 | "TODO: sendWhenDone crashes right now" 102 | req <- self getRequest. 103 | req sendWhenDone: [:r | (r isNil or: [(r statusCode = 200) not]) ifFalse: [ 104 | a <- r content asWords: $,. 105 | self loadArray: a ] ] 106 | | 107 | updateSync | req r a | 108 | req <- self getRequest. 109 | r <- req send. 110 | (r isNil or: [(r statusCode = 200) not]) ifFalse: [ 111 | a <- r content asWords: $,. 112 | self loadArray: a ] 113 | | 114 | loadArray: anArray 115 | temp <- anArray at: 1. 116 | feelsLike <- anArray at: 2. 117 | minTemp <- anArray at: 3. 118 | maxTemp <- anArray at: 4. 119 | wind <- anArray at: 5. 120 | desc <- anArray at: 6 121 | ] 122 | Methods Cloud 'all' 123 | getStringAt: url | req resp | 124 | req <- HttpRequest new getUrl: url. 125 | ^ (resp <- req send) isNil 126 | ifTrue: [nil] 127 | ifFalse: [resp statusCode = 200 ifTrue: [resp content] ifFalse: [nil] ] 128 | | 129 | download: url filename: filename | f s | 130 | " get response content from url and save to filename. Return boolean with success " 131 | f <- File new; name: '/spiffs/', filename; open: 'w'. 132 | ^ (s <- self getStringAt: url) notNil 133 | ifTrue: [ f printNoReturn: s. f close. true] 134 | ifFalse: [Error new] 135 | | 136 | fileIn: url | e | 137 | fileInEvalStr <- nil. 138 | ^ (e <- self download: url filename: 'download.st') notError 139 | ifTrue: [ File new fileIn: '/spiffs/download.st'. fileInEvalStr value ] 140 | ifFalse: [ e ] 141 | ] 142 | -------------------------------------------------------------------------------- /src/tty.c: -------------------------------------------------------------------------------- 1 | /* 2 | Smalltalkje, version 1 based on: 3 | Little Smalltalk, version 3 4 | Written by Tim Budd, January 1989 5 | 6 | Terminal Interface Routines 7 | 8 | This module provides terminal interface routines for the Smalltalkje system. 9 | It handles error reporting, warnings, and user interaction through a text-based 10 | terminal interface. These routines are used by systems with a bare TTY interface. 11 | 12 | The implementation provides: 13 | - Error and warning message display functions 14 | - Compiler error and warning reporting 15 | - Method display for debugging 16 | - Simple user interaction for pausing execution 17 | 18 | Systems using another interface (e.g., a graphical interface) would replace 19 | this file with their own implementation. 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include "memory.h" 26 | 27 | /** Flag indicating if parsing was successful */ 28 | extern boolean parseok; 29 | 30 | /** 31 | * Report a fatal system error and terminate execution 32 | * 33 | * This function displays an error message to the user and terminates 34 | * the execution of the system. It's used for reporting unrecoverable 35 | * errors that prevent further execution. 36 | * 37 | * @param s1 First part of the error message 38 | * @param s2 Second part of the error message 39 | */ 40 | noreturn sysError(char *s1, char *s2) 41 | { 42 | ignore fprintf(stderr, "Error <%s>: %s\n", s1, s2); 43 | ignore abort(); 44 | } 45 | 46 | /** 47 | * Report a non-fatal system warning 48 | * 49 | * This function displays a warning message to the user but allows 50 | * execution to continue. It's used for reporting non-critical issues 51 | * that don't prevent the system from functioning. 52 | * 53 | * @param s1 First part of the warning message 54 | * @param s2 Second part of the warning message 55 | */ 56 | noreturn sysWarn(char *s1, char *s2) 57 | { 58 | ignore fprintf(stderr, "Warning <%s>: %s\n", s1, s2); 59 | } 60 | 61 | /** 62 | * Report a compiler warning 63 | * 64 | * This function displays a warning message related to the compilation 65 | * of Smalltalk code. It includes information about the method selector 66 | * where the warning occurred. 67 | * 68 | * @param selector The method selector where the warning occurred 69 | * @param str1 First part of the warning message 70 | * @param str2 Second part of the warning message 71 | */ 72 | void compilWarn(char *selector, char *str1, char *str2) 73 | { 74 | ignore fprintf(stderr, "compiler warning: Method %s : %s %s\n", 75 | selector, str1, str2); 76 | } 77 | 78 | /** 79 | * Report a compiler error 80 | * 81 | * This function displays an error message related to the compilation 82 | * of Smalltalk code. It includes information about the method selector 83 | * where the error occurred and sets the parseok flag to false to indicate 84 | * that parsing failed. 85 | * 86 | * @param selector The method selector where the error occurred 87 | * @param str1 First part of the error message 88 | * @param str2 Second part of the error message 89 | */ 90 | void compilError(char *selector, char *str1, char *str2) 91 | { 92 | ignore fprintf(stderr, "compiler error: Method %s : %s %s\n", 93 | selector, str1, str2); 94 | parseok = false; 95 | } 96 | 97 | /** 98 | * Display method information 99 | * 100 | * This function would typically display information about a method for 101 | * debugging or tracing purposes. In this implementation, it's disabled 102 | * (commented out) but could be enabled to show the class and method names. 103 | * 104 | * @param cp The class name 105 | * @param mp The method name 106 | */ 107 | noreturn dspMethod(char *cp, char *mp) 108 | { 109 | /*ignore fprintf(stderr,"%s %s\n", cp, mp); */ 110 | } 111 | 112 | /** 113 | * Pause execution and wait for user input 114 | * 115 | * This function pauses the execution of the system and waits for 116 | * the user to press Enter before continuing. It's used for debugging 117 | * or to give the user time to read messages before proceeding. 118 | */ 119 | void givepause() 120 | { 121 | char buffer[80]; 122 | 123 | ignore fprintf(stderr, "push return to continue\n"); 124 | ignore fgets(buffer, 80, stdin); 125 | } 126 | --------------------------------------------------------------------------------