Added capabilties memory allocation.

This commit is contained in:
Brad Nelson
2021-02-08 00:20:36 -08:00
parent 93a60aa188
commit da57c5b9e2
5 changed files with 32 additions and 11 deletions

View File

@ -128,7 +128,7 @@ $(GEN)/windows_boot.h: common/source_to_string.js $(WINDOWS_BOOT) | $(GEN)
ARDUINO_BOOT = common/boot.fs common/vocabulary.fs \
arduino/arduino.fs arduino/arduino_highlevel.fs \
arduino/hide_io.fs common/highlevel.fs \
arduino/bindings.fs common/highlevel.fs \
common/filetools.fs common/utils.fs \
common/tasks.fs common/streams.fs arduino/arduino_server.fs \
arduino/esp_camera.fs common/blocks.fs \

View File

@ -24,12 +24,6 @@ forth definitions
2 constant OUTPUT
2 constant LED
( WiFi Modes )
0 constant WIFI_MODE_NULL
1 constant WIFI_MODE_STA
2 constant WIFI_MODE_AP
3 constant WIFI_MODE_APSTA
( Startup Setup )
-1 echo !
115200 Serial.begin

View File

@ -42,10 +42,14 @@
#define PUSH(v) (DUP, tos = (cell_t) (v))
#define PLATFORM_OPCODE_LIST \
/* Allocation and Strings */ \
/* Memory Allocation */ \
X("MALLOC", MALLOC, tos = (cell_t) malloc(tos)) \
X("SYSFREE", FREE, free((void *) tos); DROP) \
X("REALLOC", REALLOC, tos = (cell_t) realloc((void *) *sp, tos); --sp) \
X("heap_caps_malloc", HEAP_CAPS_MALLOC, tos = (cell_t) heap_caps_malloc(*sp, tos); --sp) \
X("heap_caps_free", HEAP_CAPS_FREE, heap_caps_free((void *) tos); DROP) \
X("heap_caps_realloc", HEAP_CAPS_REALLOC, \
tos = (cell_t) heap_caps_realloc((void *) sp[-1], *sp, tos); sp -= 2) \
/* Serial */ \
X("Serial.begin", SERIAL_BEGIN, Serial.begin(tos); DROP) \
X("Serial.end", SERIAL_END, Serial.end()) \

View File

@ -102,7 +102,7 @@ window.onload = function() {
variable webserver
20000 constant out-size
200 stream input-stream
out-size dup stream output-stream
out-size stream output-stream
create out-string out-size 1+ allot align
: handle-index

View File

@ -1,4 +1,5 @@
( Migrate various words to separate vocabularies )
( Migrate various words to separate vocabularies, and constants )
vocabulary Wire Wire definitions
transfer{
Wire.begin Wire.setClock Wire.getClock
@ -25,6 +26,7 @@ transfer{
forth definitions
vocabulary WiFi WiFi definitions
transfer{
WiFi.config
WiFi.begin WiFi.disconnect
@ -32,8 +34,14 @@ transfer{
WiFi.macAddress WiFi.localIP
WiFi.mode
WiFi.setTxPower WiFi.getTxPower
WIFI_MODE_APSTA WIFI_MODE_AP WIFI_MODE_STA WIFI_MODE_NULL
}transfer
( WiFi Modes )
0 constant WIFI_MODE_NULL
1 constant WIFI_MODE_STA
2 constant WIFI_MODE_AP
3 constant WIFI_MODE_APSTA
forth definitions
vocabulary SD_MMC SD_MMC definitions
@ -92,6 +100,21 @@ forth definitions
internals definitions
transfer{
malloc sysfree realloc
heap_caps_malloc heap_caps_free heap_caps_realloc
}transfer
( Heap Capabilities )
binary
0001 constant MALLOC_CAP_EXEC
0010 constant MALLOC_CAP_32BIT
0100 constant MALLOC_CAP_8BIT
1000 constant MALLOC_CAP_DMA
: MALLOC_CAP_PID ( n -- ) 10000 over 11 ( 3 ) - for 2* next ;
000010000000000 constant MALLOC_CAP_SPIRAM
000100000000000 constant MALLOC_CAP_INTERNAL
001000000000000 constant MALLOC_CAP_DEFAULT
010000000000000 constant MALLOC_CAP_IRAM_8BIT
010000000000000 constant MALLOC_CAP_RETENTION
decimal
forth definitions