Take more RAM, but cap it.

This commit is contained in:
Brad Nelson
2022-02-07 09:48:12 -08:00
parent a16cf640ce
commit 74125fc19e
6 changed files with 16 additions and 27 deletions

View File

@ -387,7 +387,6 @@ ESP32_PARTS = tools/replace.js \
common/calling.h \ common/calling.h \
common/core.h \ common/core.h \
common/interp.h \ common/interp.h \
esp32/config.h \
esp32/options.h \ esp32/options.h \
esp32/builtins.h \ esp32/builtins.h \
esp32/builtins.cpp \ esp32/builtins.cpp \
@ -398,7 +397,6 @@ $(ESP32)/ESP32forth/ESP32forth.ino: $(ESP32_PARTS) | $(ESP32)/ESP32forth
cat esp32/template.ino | tools/replace.js \ cat esp32/template.ino | tools/replace.js \
VERSION=$(VERSION) \ VERSION=$(VERSION) \
REVISION=$(REVISION) \ REVISION=$(REVISION) \
config=@esp32/config.h \
opcodes=@common/opcodes.h \ opcodes=@common/opcodes.h \
extra_opcodes=@common/extra_opcodes.h \ extra_opcodes=@common/extra_opcodes.h \
calling=@common/calling.h \ calling=@common/calling.h \

View File

@ -1,16 +0,0 @@
// Copyright 2022 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.
#define STACK_CELLS 512
#define INTERRUPT_STACK_CELLS 64

View File

@ -13,9 +13,13 @@
// limitations under the License. // limitations under the License.
void setup() { void setup() {
cell_t hs = heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL); cell_t fh = heap_caps_get_free_size(MALLOC_CAP_INTERNAL);
cell_t *heap = (cell_t *) malloc(hs); cell_t hc = heap_caps_get_largest_free_block(MALLOC_CAP_INTERNAL);
forth_init(0, 0, heap, hs, boot, sizeof(boot)); if (fh - hc < MINIMUM_FREE_SYSTEM_HEAP) {
hc = fh - MINIMUM_FREE_SYSTEM_HEAP;
}
cell_t *heap = (cell_t *) malloc(hc);
forth_init(0, 0, heap, hc, boot, sizeof(boot));
} }
void loop() { void loop() {

View File

@ -12,6 +12,10 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#define STACK_CELLS 512
#define INTERRUPT_STACK_CELLS 64
#define MINIMUM_FREE_SYSTEM_HEAP (64 * 1024)
// Default on several options. // Default on several options.
#define ENABLE_SPIFFS_SUPPORT #define ENABLE_SPIFFS_SUPPORT
#define ENABLE_WIFI_SUPPORT #define ENABLE_WIFI_SUPPORT

View File

@ -12,15 +12,14 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
#define SIM_HEAP_SIZE (100 * 1024 + 1024 * 1024)
#define STACK_CELLS 512
#include "esp32/options.h" #include "esp32/options.h"
#include "common/opcodes.h" #include "common/opcodes.h"
#include "common/extra_opcodes.h" #include "common/extra_opcodes.h"
#include "common/floats.h" #include "common/floats.h"
#include "common/calling.h" #include "common/calling.h"
#define SIM_HEAP_SIZE (100 * 1024 + 1024 * 1024)
static cell_t *simulated(cell_t *sp, const char *op); static cell_t *simulated(cell_t *sp, const char *op);
#define PLATFORM_OPCODE_LIST \ #define PLATFORM_OPCODE_LIST \
@ -33,8 +32,9 @@ static cell_t *simulated(cell_t *sp, const char *op);
PLATFORM_SIMULATED_OPCODE_LIST PLATFORM_SIMULATED_OPCODE_LIST
#undef XV #undef XV
#define MALLOC_CAP_INTERNAL SIM_HEAP_SIZE #define MALLOC_CAP_INTERNAL 0
#define heap_caps_get_largest_free_block(x) (x) #define heap_caps_get_largest_free_block(x) SIM_HEAP_SIZE
#define heap_caps_get_free_size(x) SIM_HEAP_SIZE
#include "common/core.h" #include "common/core.h"
#include "common/interp.h" #include "common/interp.h"

View File

@ -19,7 +19,6 @@
* Revision: {{REVISION}} * Revision: {{REVISION}}
*/ */
{{config}}
{{options}} {{options}}
{{opcodes}} {{opcodes}}
{{extra_opcodes}} {{extra_opcodes}}