Skip to content

Commit

Permalink
Ensure we can continue to build for microbit/mdbt42/esp8266 after rec…
Browse files Browse the repository at this point in the history
…ent code size increases
  • Loading branch information
gfwilliams committed Nov 8, 2024
1 parent f6493d5 commit 9573bb3
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README_BuildProcess.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ This is a partial list of definitions that can be added in a `BOARD.py` file's `

There are some specifically that are useful for cutting a few bytes out of the build:

* `SAVE_ON_FLASH` - Remove some features (like any ES6 support) to target devices with ~128kB Flash
* `SAVE_ON_FLASH` - Remove some features (like any ES6 support) to target devices with ~128kB Flash (see next list)
* `SAVE_ON_FLASH_EXTREME` - Pull out as many features as possible to target devices with ~128kB Flash that also want things like Filesystem support
* `ESPR_PACKED_SYMPTR` - Packs string offsets of builtin symbols into their function pointers in JswSymPtr, saves 2 bytes per symbol
* `JSVAR_FORCE_NO_INLINE` - Opposite of `JSVAR_FORCE_INLINE`. Force getter/setter functions not to be inlined. Saves ~2% code size. Ideally just leave it up to the compiler
Expand Down
5 changes: 4 additions & 1 deletion boards/ESP8266_BOARD.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
'NEOPIXEL',
],
'makefile' : [
'DEFINES+=-DSAVE_ON_FLASH_MATH',
'DEFINES+=-DSAVE_ON_FLASH_MATH',
'DEFINES+=-DESPR_NO_LINE_NUMBERS',
'DEFINES+=-DESPR_LIMIT_DATE_RANGE',
'DEFINES+=-DNO_DUMP_HARDWARE_INITIALISATION',
'DEFINES+=-DESPR_NO_REGEX_OPTIMISE', # save some storage space
'BLACKLIST=boards/ESP8266.blocklist', # force some stuff to be removed to save space
'USE_DEBUGGER=0', # We can't use debugger as RTOS needs jsiIdle to keep exiting
Expand Down
2 changes: 2 additions & 0 deletions boards/MDBT42Q.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
'DEFINES+=-DBLUETOOTH_NAME_PREFIX=\'"MDBT42Q"\'',
'DEFINES+=-DNEOPIXEL_SCK_PIN=23 -DNEOPIXEL_LRCK_PIN=13', # see https://github.com/espruino/Espruino/issues/2071
'DEFINES += -DESPR_USE_STEPPER_TIMER=1', # Build in the code for stepping using the timer
'DEFINES+=-DESPR_PACKED_SYMPTR', # Pack builtin symbols' offset into pointer to save 2 bytes/symbol
'DEFINES+=-DESPR_NO_REGEX_OPTIMISE', # save some storage space
'DFU_PRIVATE_KEY=targets/nrf5x_dfu/dfu_private_key.pem',
'DFU_SETTINGS=--application-version 0xff --hw-version 52 --sd-req 0x8C,0x91'
]
Expand Down
2 changes: 2 additions & 0 deletions boards/MICROBIT1.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
'makefile' : [
'SAVE_ON_FLASH=1',
'DEFINES+=-DSAVE_ON_FLASH_EXTREME',
'DEFINES+=-DESPR_NO_LINE_NUMBERS',
'DEFINES+=-DESPR_LIMIT_DATE_RANGE',
'DEFINES+=-DESPR_PACKED_SYMPTR', # Pack builtin symbols' offset into pointer to save 2 bytes/symbol
'DEFINES+=-DESPR_NO_DAYLIGHT_SAVING',
'DEFINES+=-DJSVAR_FORCE_NO_INLINE=1',
Expand Down
4 changes: 2 additions & 2 deletions libs/bluetooth/jswrap_bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ NRF.requestDevice(...).then(function(device) {
"type" : "event",
"class" : "BluetoothRemoteGATTCharacteristic",
"name" : "characteristicvaluechanged",
"ifdef" : "BLUETOOTH"
"#if" : "defined(NRF52_SERIES) || defined(ESP32)"
}
Called when a characteristic's value changes, *after*
`BluetoothRemoteGATTCharacteristic.startNotifications` has been called.
Expand Down Expand Up @@ -4514,7 +4514,7 @@ JsVar *jswrap_ble_BluetoothRemoteGATTCharacteristic_readValue(JsVar *characteris
"generate" : "jswrap_ble_BluetoothRemoteGATTCharacteristic_startNotifications",
"return" : ["JsVar", "A `Promise` that is resolved (or rejected) with data when notifications have been added" ],
"return_object" : "Promise",
"ifdef" : "BLUETOOTH"
"#if" : "defined(NRF52_SERIES) || defined(ESP32)"
}
Starts notifications - whenever this characteristic's value changes, a
`characteristicvaluechanged` event is fired and `characteristic.value` will then
Expand Down
5 changes: 3 additions & 2 deletions src/jsutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,11 @@
#ifndef ESPR_NO_SOFTWARE_I2C
#define ESPR_NO_SOFTWARE_I2C 1
#endif
#endif
#define ESPR_NO_REGEX_OPTIMISE 1
#endif // SAVE_ON_FLASH
#ifdef SAVE_ON_FLASH_EXTREME
#define ESPR_NO_BLUETOOTH_MESSAGES 1
#endif
#endif // SAVE_ON_FLASH_EXTREME

#ifndef alloca
#define alloca(x) __builtin_alloca(x)
Expand Down

0 comments on commit 9573bb3

Please sign in to comment.