Peel off assemblers into optional module.
Not sufficiently tested.
This commit is contained in:
20
esp32/README-optional.txt
Normal file
20
esp32/README-optional.txt
Normal file
@ -0,0 +1,20 @@
|
||||
+----------------------------------+
|
||||
| ESP32forth - Optional Packages |
|
||||
+----------------------------------+
|
||||
|
||||
ESPforth supports a number of optional packages, included in this directory.
|
||||
|
||||
By default ESPforth will only include core functionality.
|
||||
To include one or more of these modules, move them from this directory
|
||||
into the parent directory, next to the ESPforth.ino file.
|
||||
|
||||
These are the current optional modules:
|
||||
* assemblers.h - Assemblers for ESP32 Xtensa and ESP32 RISC-V
|
||||
|
||||
Initially ESP32forth focused on a minimal C kernel, with most functionality
|
||||
built in Forth code loaded at boot. Eventually, as support for more capabilities
|
||||
were added to ESPforth, this became unsustainable.
|
||||
|
||||
Optional modules demonstrate good patterns for use in your own extensions
|
||||
to ESP32forth. You can add you own modules by #including them from
|
||||
an optional userwords.h file placed next to ESPforth.ino
|
||||
20
esp32/README.txt
Normal file
20
esp32/README.txt
Normal file
@ -0,0 +1,20 @@
|
||||
+--------------+
|
||||
| ESP32forth |
|
||||
+--------------+
|
||||
|
||||
This is ESP32forth v{{VERSION}} (Revision {{REVISION}}).
|
||||
|
||||
ESP32forth is an indirect threaded Forth for the ESP32 family of microcontrollers.
|
||||
It uses a small C "kernel" that boots via inline Forth code.
|
||||
The use of C allows developers to leverage C/C++ ESP32 libraries with minimal effort.
|
||||
|
||||
To compile and flash with the Arduino tools, load ESP32forth.ino.
|
||||
|
||||
Documentation and the latest version of ESP32forth are available at:
|
||||
https://esp32forth.appspot.com/
|
||||
|
||||
Full unexpanded source code and an issue tracker are available at:
|
||||
https://github.com/flagxor/ueforth
|
||||
|
||||
There are several optional components that you can add into ESP32forth.
|
||||
See: optional/README-optional.txt
|
||||
26
esp32/assemblers.h
Normal file
26
esp32/assemblers.h
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright 2023 Bradley D. Nelson
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* ESP32forth Assemblers v{{VERSION}}
|
||||
* Revision: {{REVISION}}
|
||||
*/
|
||||
|
||||
{{assemblers}}
|
||||
|
||||
#define OPTIONAL_ASSEMBLERS_SUPPORT \
|
||||
XV(internals, "assemblers-source", ASSEMBLERS_SOURCE, \
|
||||
PUSH assemblers_source; PUSH sizeof(assemblers_source))
|
||||
@ -22,19 +22,27 @@
|
||||
# include <sys/stat.h>
|
||||
# include <sys/select.h>
|
||||
|
||||
// Optional hook to pull in words for userwords.h
|
||||
// Hook to pull in words from optional userwords.h
|
||||
# if __has_include("userwords.h")
|
||||
# include "userwords.h"
|
||||
# else
|
||||
# define USER_WORDS
|
||||
# endif
|
||||
|
||||
// Hook to pull in words from optional assemblers.h
|
||||
# if __has_include("assemblers.h")
|
||||
# include "assemblers.h"
|
||||
# else
|
||||
# define OPTIONAL_ASSEMBLERS_SUPPORT
|
||||
# endif
|
||||
|
||||
static cell_t ResizeFile(cell_t fd, cell_t size);
|
||||
|
||||
#endif
|
||||
|
||||
#define PLATFORM_OPCODE_LIST \
|
||||
USER_WORDS \
|
||||
OPTIONAL_ASSEMBLERS_SUPPORT \
|
||||
REQUIRED_PLATFORM_SUPPORT \
|
||||
REQUIRED_ESP_SUPPORT \
|
||||
REQUIRED_MEMORY_SUPPORT \
|
||||
|
||||
19
esp32/optionals.fs
Normal file
19
esp32/optionals.fs
Normal file
@ -0,0 +1,19 @@
|
||||
\ Copyright 2023 Bradley D. Nelson
|
||||
\
|
||||
\ Licensed under the Apache License, Version 2.0 (the "License");
|
||||
\ you may not use this file except in compliance with the License.
|
||||
\ You may obtain a copy of the License at
|
||||
\
|
||||
\ http://www.apache.org/licenses/LICENSE-2.0
|
||||
\
|
||||
\ Unless required by applicable law or agreed to in writing, software
|
||||
\ distributed under the License is distributed on an "AS IS" BASIS,
|
||||
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
\ See the License for the specific language governing permissions and
|
||||
\ limitations under the License.
|
||||
|
||||
internals
|
||||
|
||||
DEFINED? assemblers-source [IF] assemblers-source evaluate [THEN]
|
||||
|
||||
forth
|
||||
@ -23,6 +23,7 @@
|
||||
#define CALLING_OPCODE_LIST
|
||||
#define FLOATING_POINT_LIST
|
||||
#define USER_WORDS
|
||||
#define OPTIONAL_ASSEMBLERS_SUPPORT
|
||||
#include "builtins.h"
|
||||
|
||||
#define XV(flags, name, op, code) Z(flags, name, op, code)
|
||||
|
||||
Reference in New Issue
Block a user