mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Bangle.js1: dump() now doesn't write out interpreter state as JS (saves 1.5kB Flash)
This commit is contained in:
parent
9feb8de86f
commit
7940729a6e
@ -7,6 +7,7 @@
|
|||||||
Added ability to execute JS from an a timer with `require("timer").add({type:"EXEC",...)`
|
Added ability to execute JS from an a timer with `require("timer").add({type:"EXEC",...)`
|
||||||
Bangle.js: Add Bangle.setOptions({stepCounterDisabled:bool}) to disable the step counter
|
Bangle.js: Add Bangle.setOptions({stepCounterDisabled:bool}) to disable the step counter
|
||||||
Date: fix parsing of ISO8601 timezones (+HHMM worked, but +HH:MM and +HH added) (fix #2669)
|
Date: fix parsing of ISO8601 timezones (+HHMM worked, but +HH:MM and +HH added) (fix #2669)
|
||||||
|
Bangle.js1: dump() now doesn't write out interpreter state as JS (saves 1.5kB Flash)
|
||||||
|
|
||||||
2v28 : Add `E.internal` as a way to access the 'hidden root' containing Espruino internal variables that previously needed `global["\xff"]`
|
2v28 : Add `E.internal` as a way to access the 'hidden root' containing Espruino internal variables that previously needed `global["\xff"]`
|
||||||
Bangle.js: Fix back handler not removed when using E.setUI with a back button but without widgets (#2636)
|
Bangle.js: Fix back handler not removed when using E.setUI with a back button but without widgets (#2636)
|
||||||
|
|||||||
@ -173,6 +173,7 @@ There are some specifically that are useful for cutting a few bytes out of the b
|
|||||||
* `ESPR_LIMIT_DATE_RANGE` - limits the acceptable range for Date years (saves a few hundred bytes)
|
* `ESPR_LIMIT_DATE_RANGE` - limits the acceptable range for Date years (saves a few hundred bytes)
|
||||||
* `ESPR_NO_REGEX_OPTIMISE` - strips out some speed optimisations from the regex library
|
* `ESPR_NO_REGEX_OPTIMISE` - strips out some speed optimisations from the regex library
|
||||||
* On nRF52, `'LDFLAGS += -nostartfiles', 'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main',` can save ~300b by not including CRT startup code
|
* On nRF52, `'LDFLAGS += -nostartfiles', 'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main',` can save ~300b by not including CRT startup code
|
||||||
|
* `ESPR_NO_DUMP_STATE` - stops `dump()` from trying to reconstruct interpreter state as JS (saves almost 1.5kB)
|
||||||
|
|
||||||
|
|
||||||
These are set automatically when `SAVE_ON_FLASH` is set (see `jsutils.h`)
|
These are set automatically when `SAVE_ON_FLASH` is set (see `jsutils.h`)
|
||||||
|
|||||||
@ -49,6 +49,7 @@ info = {
|
|||||||
'DEFINES+=-DCUSTOM_GETBATTERY=jswrap_banglejs_getBattery',
|
'DEFINES+=-DCUSTOM_GETBATTERY=jswrap_banglejs_getBattery',
|
||||||
'DEFINES+=-DESPR_UNICODE_SUPPORT=1',
|
'DEFINES+=-DESPR_UNICODE_SUPPORT=1',
|
||||||
'DEFINES+=-DESPR_NO_SOFTWARE_SERIAL=1',
|
'DEFINES+=-DESPR_NO_SOFTWARE_SERIAL=1',
|
||||||
|
'DEFINES+=-DESPR_NO_DUMP_STATE=1', # don't let dump() output current state - saves a lot of flash
|
||||||
'DEFINES+=-DDUMP_IGNORE_VARIABLES=\'"g\\0"\'',
|
'DEFINES+=-DDUMP_IGNORE_VARIABLES=\'"g\\0"\'',
|
||||||
'DEFINES+=-DSAVE_ON_FLASH_MATH',
|
'DEFINES+=-DSAVE_ON_FLASH_MATH',
|
||||||
'DEFINES+=-DESPR_PACKED_SYMPTR', # Pack builtin symbols' offset into pointer to save 2 bytes/symbol
|
'DEFINES+=-DESPR_PACKED_SYMPTR', # Pack builtin symbols' offset into pointer to save 2 bytes/symbol
|
||||||
|
|||||||
@ -2699,8 +2699,10 @@ bool jsiLoop() {
|
|||||||
|
|
||||||
/** Output current interpreter state such that it can be copied to a new device */
|
/** Output current interpreter state such that it can be copied to a new device */
|
||||||
void jsiDumpState(vcbprintf_callback user_callback, void *user_data) {
|
void jsiDumpState(vcbprintf_callback user_callback, void *user_data) {
|
||||||
|
#if defined(ESPR_NO_DUMP_STATE)
|
||||||
|
cbprintf(user_callback, user_data, "// This build can't output RAM contants as JS (ESPR_NO_DUMP_STATE=1)\n");
|
||||||
|
#else
|
||||||
JsvObjectIterator it;
|
JsvObjectIterator it;
|
||||||
|
|
||||||
jsvObjectIteratorNew(&it, execInfo.root);
|
jsvObjectIteratorNew(&it, execInfo.root);
|
||||||
while (jsvObjectIteratorHasValue(&it)) {
|
while (jsvObjectIteratorHasValue(&it)) {
|
||||||
JsVar *child = jsvObjectIteratorGetKey(&it);
|
JsVar *child = jsvObjectIteratorGetKey(&it);
|
||||||
@ -2812,7 +2814,7 @@ void jsiDumpState(vcbprintf_callback user_callback, void *user_data) {
|
|||||||
|
|
||||||
// and now the actual hardware
|
// and now the actual hardware
|
||||||
jsiDumpHardwareInitialisation(user_callback, user_data, true/*human readable*/);
|
jsiDumpHardwareInitialisation(user_callback, user_data, true/*human readable*/);
|
||||||
|
#endif
|
||||||
JsVar *code = jsfGetBootCodeFromFlash(false);
|
JsVar *code = jsfGetBootCodeFromFlash(false);
|
||||||
if (code) {
|
if (code) {
|
||||||
cbprintf(user_callback, user_data, "// Code saved with E.setBootCode\n");
|
cbprintf(user_callback, user_data, "// Code saved with E.setBootCode\n");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user