Skip to content

Commit

Permalink
Enable nostartfiles optimisation for Pixl,MDBT42 and nRF52DK
Browse files Browse the repository at this point in the history
  • Loading branch information
gfwilliams committed Nov 18, 2024
1 parent 9cbae63 commit 4c50893
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 39 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
nRF52: Add E.setComparator to enable interrupts from LPCOMP
Add Serial.isConnected to check if Bluetooth/USB/etc actually connected
Pixl.js: Remove Wiznet W5100 support from default build (there's now a espruino_#v##_pixljs_wiznet.zip without JIT enabled) to ensure we have enough flash to continue builds
Enable nostartfiles optimisation for Pixl,MDBT42 and nRF52DK

2v24 : Bangle.js2: Add 'Bangle.touchRd()', 'Bangle.touchWr()'
Bangle.js2: After Bangle.showTestScreen, put Bangle.js into a hard off state (not soft off)
Expand Down
1 change: 1 addition & 0 deletions README_BuildProcess.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ There are some specifically that are useful for cutting a few bytes out of the b
* `ESPR_NO_BLUETOOTH_MESSAGES` - don't include text versions of Bluetooth error messages (just the error number)
* `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
* On nRF52, `'LDFLAGS += -nostartfiles', 'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main',` can save ~300b by not including CRT startup code

These are set automatically when `SAVE_ON_FLASH` is set (see `jsutils.h`)

Expand Down
17 changes: 9 additions & 8 deletions boards/MDBT42Q.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
info = {
'name' : "MDBT42Q Module",
'link' : [ "https://espruino.com/MDBT42Q" ],
'espruino_page_link' : 'MDBT42Q',
'espruino_page_link' : 'MDBT42Q',
'default_console' : "EV_SERIAL1",
'default_console_tx' : "D6",
'default_console_rx' : "D8",
Expand All @@ -37,19 +37,20 @@
'NFC',
'NEOPIXEL',
'FILESYSTEM',
'JIT'
'JIT'
#'TLS'
],
'makefile' : [
'DEFINES+=-DHAL_NFC_ENGINEERING_BC_FTPAN_WORKAROUND=1', # Looks like proper production nRF52s had this issue
'DEFINES+=-DCONFIG_GPIO_AS_PINRESET', # Allow the reset pin to work
'DEFINES += -DNRF_BLE_GATT_MAX_MTU_SIZE=53 -DNRF_BLE_MAX_MTU_SIZE=53', # increase MTU from default of 23
'DEFINES += -DCENTRAL_LINK_COUNT=2 -DNRF_SDH_BLE_CENTRAL_LINK_COUNT=2', # allow two outgoing connections at once
'DEFINES += -DCENTRAL_LINK_COUNT=2 -DNRF_SDH_BLE_CENTRAL_LINK_COUNT=2', # allow two outgoing connections at once
'LDFLAGS += -Xlinker --defsym=LD_APP_RAM_BASE=0x3290', # set RAM base to match MTU=53 + CENTRAL_LINK_COUNT=2
'LDFLAGS += -nostartfiles', 'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main', # Save ~300b by not including CRT startup code
'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_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 Expand Up @@ -91,7 +92,7 @@
'right2' : [ 'D24', '', 'D23'],
'right' : [ 'GND','D22','SWDIO','SWDCLK','D21','D20','D19','D18','D17','D16','D15','D14','D13','D12','D11' ],
'bottom' : [ 'GND','D0','D1','D2','D3','D4','D5','D6','D7','D8','D9','D10','GND' ],
'_title' : "MDBT42Q module",
'_title' : "MDBT42Q module",
'_notes' : {
'D21' : "Also NRST if configured",
'D13' : "This is used as LRCK when driving Neopixels, and will output a signal when 'require('neopixel').write' is called",
Expand Down Expand Up @@ -136,13 +137,13 @@
'left' : [ 'D25','D26','D27','D28','D29','D30','D31','D3','D4','D5','D11' ],
'right' : [ 'D22','D20','D19','D18','D17','D16','D15','D14','3.3','Vin','GND'],
'bottom' : [ 'D6','D8','D7','Vin','GND' ],
'top' : [ 'D9','D10' ],
'top' : [ 'D9','D10' ],
'_hide_not_on_connectors' : True,
'_title' : "MDBT42Q breakout board",
'_title' : "MDBT42Q breakout board",
'_class' : "board_breakout",
'_notes' : {
'D8' : "Serial Console RX when Bluetooth disconnected",
'D6' : "Serial Console TX when Bluetooth disconnected",
'D6' : "Serial Console TX when Bluetooth disconnected",
},
'_css' : """
#board {
Expand Down
5 changes: 2 additions & 3 deletions boards/MICROBIT1.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@
'DEFINES+=-DESPR_NO_DAYLIGHT_SAVING',
'DEFINES+=-DJSVAR_FORCE_NO_INLINE=1',
'CFLAGS += -ffreestanding', # needed for SAVE_ON_FLASH_EXTREME (jswrap_math, __aeabi_dsub)
'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main',
'LDFLAGS += -nostartfiles',
'LDFLAGS += -nostartfiles', 'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main', # Save ~300b by not including CRT startup code
'BLACKLIST=boards/MICROBIT1.blocklist', # force some stuff to be removed to save space
'DEFINES+=-DCONFIG_GPIO_AS_PINRESET', # Allow the reset pin to work
'DEFINES += -DMICROBIT', # enable microbit-specific stuff
Expand All @@ -50,7 +49,7 @@
'USE_DEBUGGER=0', # Removed due to firmware size issues
'INCLUDE += -I$(ROOT)/libs/microbit',
'WRAPPERSOURCES += libs/microbit/jswrap_microbit.c',

]
}
};
Expand Down
5 changes: 3 additions & 2 deletions boards/NRF52832DK.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@
#'DEFINES += -DI2C_SLAVE -DTWIS_ENABLED=1 -DTWIS1_ENABLED=1', # enable I2C slave support
# I2C slave can then be used with I2C1.setup({sda,scl,addr:42})
'DEFINES += -DNRF_BLE_GATT_MAX_MTU_SIZE=53 -DNRF_BLE_MAX_MTU_SIZE=53', # increase MTU from default of 23
'DEFINES += -DCENTRAL_LINK_COUNT=2 -DNRF_SDH_BLE_CENTRAL_LINK_COUNT=2', # allow two outgoing connections at once
'LDFLAGS += -Xlinker --defsym=LD_APP_RAM_BASE=0x3290', # set RAM base to match MTU=53 + CENTRAL_LINK_COUNT=2
'DEFINES += -DCENTRAL_LINK_COUNT=2 -DNRF_SDH_BLE_CENTRAL_LINK_COUNT=2', # allow two outgoing connections at once
'LDFLAGS += -Xlinker --defsym=LD_APP_RAM_BASE=0x3290', # set RAM base to match MTU=53 + CENTRAL_LINK_COUNT=2
'LDFLAGS += -nostartfiles', 'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main', # Save ~300b by not including CRT startup code
]
}
};
Expand Down
3 changes: 2 additions & 1 deletion boards/PIXLJS.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@
'DEFINES+=-DBLUETOOTH_NAME_PREFIX=\'"Pixl.js"\'',
'DEFINES+=-DCUSTOM_GETBATTERY=jswrap_pixljs_getBattery',
'DEFINES+=-DNFC_DEFAULT_URL=\'"https://www.espruino.com/ide"\'',
'LDFLAGS += -nostartfiles', 'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main', # Save ~300b by not including CRT startup code
'DEFINES+=-DDUMP_IGNORE_VARIABLES=\'"g\\0"\'',
'DEFINES+=-DNEOPIXEL_SCK_PIN=14 -DNEOPIXEL_LRCK_PIN=15', # see https://github.com/espruino/Espruino/issues/2071
'DEFINES += -DESPR_USE_STEPPER_TIMER=1', # Build in the code for stepping using the timer
'DEFINES+=-DSAVE_ON_FLASH_MATH',
'DFU_PRIVATE_KEY=targets/nrf5x_dfu/dfu_private_key.pem',
'DFU_SETTINGS=--application-version 0xff --hw-version 52 --sd-req 0x8C,0x91',
'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
'DEFINES+=-DESPR_LIMIT_DATE_RANGE', # limits the acceptable range for Date years (saves a few hundred bytes)
'DEFINES+=-DESPR_NO_BLUETOOTH_MESSAGES', # don't include text versions of Bluetooth error messages (just the error number)
'DEFINES+=-DESPR_NO_REGEX_OPTIMISE', # save some storage space
Expand Down
3 changes: 2 additions & 1 deletion boards/PIXLJS_WIZ.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@
'DEFINES+=-DBLUETOOTH_NAME_PREFIX=\'"Pixl.js"\'',
'DEFINES+=-DCUSTOM_GETBATTERY=jswrap_pixljs_getBattery',
'DEFINES+=-DNFC_DEFAULT_URL=\'"https://www.espruino.com/ide"\'',
'LDFLAGS += -nostartfiles', 'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main', # Save ~300b by not including CRT startup code
'DEFINES+=-DDUMP_IGNORE_VARIABLES=\'"g\\0"\'',
'DEFINES+=-DNEOPIXEL_SCK_PIN=14 -DNEOPIXEL_LRCK_PIN=15', # see https://github.com/espruino/Espruino/issues/2071
'DEFINES += -DESPR_USE_STEPPER_TIMER=1', # Build in the code for stepping using the timer
'DEFINES+=-DSAVE_ON_FLASH_MATH',
'DFU_PRIVATE_KEY=targets/nrf5x_dfu/dfu_private_key.pem',
'DFU_SETTINGS=--application-version 0xff --hw-version 52 --sd-req 0x8C,0x91',
'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
'DEFINES+=-DESPR_LIMIT_DATE_RANGE', # limits the acceptable range for Date years (saves a few hundred bytes)
'DEFINES+=-DESPR_NO_BLUETOOTH_MESSAGES', # don't include text versions of Bluetooth error messages (just the error number)
'DEFINES+=-DESPR_NO_REGEX_OPTIMISE', # save some storage space
Expand Down
23 changes: 11 additions & 12 deletions boards/PUCKJS_MINIMAL.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,13 @@
'DEFINES+=-DESPR_DCDC_ENABLE', # Ensure DCDC converter is enabled
'DEFINES += -DNEOPIXEL_SCK_PIN=22 -DNEOPIXEL_LRCK_PIN=16', # SCK pin needs defining as something unused for neopixel (HW errata means they can't be disabled) see https://github.com/espruino/Espruino/issues/2071
'DEFINES += -DNRF_BLE_GATT_MAX_MTU_SIZE=53 -DNRF_BLE_MAX_MTU_SIZE=53', # increase MTU from default of 23
'DEFINES += -DCENTRAL_LINK_COUNT=2 -DNRF_SDH_BLE_CENTRAL_LINK_COUNT=2', # allow two outgoing connections at once
'DEFINES += -DCENTRAL_LINK_COUNT=2 -DNRF_SDH_BLE_CENTRAL_LINK_COUNT=2', # allow two outgoing connections at once
'LDFLAGS += -Xlinker --defsym=LD_APP_RAM_BASE=0x3290', # set RAM base to match MTU=53 + CENTRAL_LINK_COUNT=2
'DEFINES+=-DBLUETOOTH_NAME_PREFIX=\'"Puck.js"\'',
'DEFINES+=-DCUSTOM_GETBATTERY=jswrap_puck_getBattery',
'DEFINES+=-DNFC_DEFAULT_URL=\'"https://puck-js.com/go"\'',
'DEFINES+=-DAPP_TIMER_OP_QUEUE_SIZE=3', # Puck.js magnetometer poll
'LDFLAGS += -nostartfiles',
'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main',
'LDFLAGS += -nostartfiles', 'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main', # Save ~300b by not including CRT startup code
'DFU_PRIVATE_KEY=targets/nrf5x_dfu/dfu_private_key.pem',
'DFU_SETTINGS=--application-version 0xff --hw-version 52 --sd-req 0x8C,0x91',
'DEFINES+=-DESPR_PACKED_SYMPTR', # Pack builtin symbols' offset into pointer to save 2 bytes/symbol
Expand Down Expand Up @@ -122,9 +121,9 @@
'right' : [ 'GND', '3V', 'D2', 'D1' ],
'left2' : [ 'D6','D7','D8','D11','D13','D14','D16','D23','D24','D27' ],
'right2' : [ 'D15' ],
'_title' : "Puck.js 1",
'_class' : "board_v1",
'_hide_not_on_connectors' : True,
'_title' : "Puck.js 1",
'_class' : "board_v1",
'_hide_not_on_connectors' : True,
'_notes' : {
'D11' : "Capacitive sense. D12 is connected to this pin via a 1 MOhm resistor",
'D28' : "If pulled up to 1 on startup, D28 and D29 become Serial1",
Expand Down Expand Up @@ -176,8 +175,8 @@
'bottom' : [ 'D28', 'D29', 'D30', 'D31'],
'right' : [ 'GND', '3V', 'D2', 'D1' ],
'left2' : [ 'D11','D23','D24','D26' ],
'_title' : "Puck.js 2",
'_class' : "board_v2",
'_title' : "Puck.js 2",
'_class' : "board_v2",
'_notes' : {
'D11' : "Capacitive sense. D12 is connected to this pin via a 1 MOhm resistor",
'D26' : "This is connected via a FET. If D26=1, this pin is shorted to GND, if D26=0 the pin is floating",
Expand Down Expand Up @@ -216,11 +215,11 @@
board_lite = {
'bottom' : [ 'D28', 'D29', 'D30', 'D31'],
'right' : [ 'GND', '3V', 'D2', 'D1' ],
'_title' : "Puck.js Lite",
'_class' : "board_lite",
'_hide_not_on_connectors' : True,
'_title' : "Puck.js Lite",
'_class' : "board_lite",
'_hide_not_on_connectors' : True,
'_notes' : {
'D21' : "Marked RST. This is usable IO by default, but is also the nRF52 reset pin.",
'D21' : "Marked RST. This is usable IO by default, but is also the nRF52 reset pin.",
'D28' : "If pulled up to 1 on startup, D28 and D29 become Serial1",
},
"_css" : """
Expand Down
23 changes: 11 additions & 12 deletions boards/PUCKJS_NETWORK.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@
'DEFINES+=-DESPR_DCDC_ENABLE', # Ensure DCDC converter is enabled
'DEFINES += -DNEOPIXEL_SCK_PIN=22 -DNEOPIXEL_LRCK_PIN=16', # SCK pin needs defining as something unused for neopixel (HW errata means they can't be disabled) see https://github.com/espruino/Espruino/issues/2071
'DEFINES += -DNRF_BLE_GATT_MAX_MTU_SIZE=53 -DNRF_BLE_MAX_MTU_SIZE=53', # increase MTU from default of 23
'DEFINES += -DCENTRAL_LINK_COUNT=2 -DNRF_SDH_BLE_CENTRAL_LINK_COUNT=2', # allow two outgoing connections at once
'DEFINES += -DCENTRAL_LINK_COUNT=2 -DNRF_SDH_BLE_CENTRAL_LINK_COUNT=2', # allow two outgoing connections at once
'LDFLAGS += -Xlinker --defsym=LD_APP_RAM_BASE=0x3290', # set RAM base to match MTU=53 + CENTRAL_LINK_COUNT=2
'DEFINES+=-DBLUETOOTH_NAME_PREFIX=\'"Puck.js"\'',
'DEFINES+=-DCUSTOM_GETBATTERY=jswrap_puck_getBattery',
'DEFINES+=-DNFC_DEFAULT_URL=\'"https://puck-js.com/go"\'',
'DEFINES+=-DAPP_TIMER_OP_QUEUE_SIZE=3', # Puck.js magnetometer poll
'LDFLAGS += -nostartfiles',
'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main',
'LDFLAGS += -nostartfiles', 'ASFLAGS += -D__STARTUP_CLEAR_BSS -D__START=main', # Save ~300b by not including CRT startup code
'DFU_PRIVATE_KEY=targets/nrf5x_dfu/dfu_private_key.pem',
'DFU_SETTINGS=--application-version 0xff --hw-version 52 --sd-req 0x8C,0x91',
'DEFINES+=-DESPR_PACKED_SYMPTR', # Pack builtin symbols' offset into pointer to save 2 bytes/symbol
Expand Down Expand Up @@ -129,9 +128,9 @@
'right' : [ 'GND', '3V', 'D2', 'D1' ],
'left2' : [ 'D6','D7','D8','D11','D13','D14','D16','D23','D24','D27' ],
'right2' : [ 'D15' ],
'_title' : "Puck.js 1",
'_class' : "board_v1",
'_hide_not_on_connectors' : True,
'_title' : "Puck.js 1",
'_class' : "board_v1",
'_hide_not_on_connectors' : True,
'_notes' : {
'D11' : "Capacitive sense. D12 is connected to this pin via a 1 MOhm resistor",
'D28' : "If pulled up to 1 on startup, D28 and D29 become Serial1",
Expand Down Expand Up @@ -183,8 +182,8 @@
'bottom' : [ 'D28', 'D29', 'D30', 'D31'],
'right' : [ 'GND', '3V', 'D2', 'D1' ],
'left2' : [ 'D11','D23','D24','D26' ],
'_title' : "Puck.js 2",
'_class' : "board_v2",
'_title' : "Puck.js 2",
'_class' : "board_v2",
'_notes' : {
'D11' : "Capacitive sense. D12 is connected to this pin via a 1 MOhm resistor",
'D26' : "This is connected via a FET. If D26=1, this pin is shorted to GND, if D26=0 the pin is floating",
Expand Down Expand Up @@ -223,11 +222,11 @@
board_lite = {
'bottom' : [ 'D28', 'D29', 'D30', 'D31'],
'right' : [ 'GND', '3V', 'D2', 'D1' ],
'_title' : "Puck.js Lite",
'_class' : "board_lite",
'_hide_not_on_connectors' : True,
'_title' : "Puck.js Lite",
'_class' : "board_lite",
'_hide_not_on_connectors' : True,
'_notes' : {
'D21' : "Marked RST. This is usable IO by default, but is also the nRF52 reset pin.",
'D21' : "Marked RST. This is usable IO by default, but is also the nRF52 reset pin.",
'D28' : "If pulled up to 1 on startup, D28 and D29 become Serial1",
},
"_css" : """
Expand Down

0 comments on commit 4c50893

Please sign in to comment.