From 28b7cbfca624d3e6a59c7ec231ee6da6ebcf0d80 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 2 Aug 2019 07:44:02 -0500 Subject: [PATCH 1/2] nrf: Mark interrupt vectors as used --- ports/nrf/device/nrf52/startup_nrf52840.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/nrf/device/nrf52/startup_nrf52840.c b/ports/nrf/device/nrf52/startup_nrf52840.c index 30634a1b54..8e1c360128 100644 --- a/ports/nrf/device/nrf52/startup_nrf52840.c +++ b/ports/nrf/device/nrf52/startup_nrf52840.c @@ -116,7 +116,7 @@ void CRYPTOCELL_IRQHandler (void) __attribute__ ((weak, alias("Default_Han void SPIM3_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler"))); void PWM3_IRQHandler (void) __attribute__ ((weak, alias("Default_Handler"))); -const func __Vectors[] __attribute__ ((section(".isr_vector"))) = { +const func __Vectors[] __attribute__ ((used, section(".isr_vector"))) = { (func)&_estack, Reset_Handler, NMI_Handler, From 4bae29b9254416d192e498a9e9df049097cab660 Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Fri, 2 Aug 2019 07:48:12 -0500 Subject: [PATCH 2/2] nrf: enable link-time optimization Testing performed: installed freshly built .uf2 on a Particle Xenon. Checked that circuitpython still starts. Checked that the size of all .uf2 files for nrf builds are plausible. Aside from memory savings, the performance of Python code (pystone) increased by about +14%. However, this adds about 12-16 seconds to each nrf build. Timings & Sizes (build system: i5-3320M, -j5 parallelism on 4 threads): Before: $ make -j5 BOARD=particle_xenon 765004 bytes free in flash out of 1048576 bytes ( 1024.0 kb ). 232076 bytes free in ram for stack out of 245760 bytes ( 240.0 kb ). 68.54user 11.83system 0:34.34elapsed 234%CPU pystones before: 570 After: $ make -j5 BOARD=particle_xenon 804284 bytes free in flash out of 1048576 bytes ( 1024.0 kb ). 232072 bytes free in ram for stack out of 245760 bytes ( 240.0 kb ). 71.06user 11.77system 0:46.91elapsed 176%CPU pystones after: 650 Timings on travis: Before: Build feather_nrf52840_express for pl took 55.79s and succeeded Build feather_nrf52840_express for zh_Latn_pinyin took 3.18s and succeeded After: Build feather_nrf52840_express for pl took 62.72s and succeeded Build feather_nrf52840_express for zh_Latn_pinyin took 19.10s Closes: #1396 --- ports/nrf/Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 9da2c498d0..fad127514b 100755 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -95,8 +95,7 @@ ifeq ($(DEBUG), 1) CFLAGS += -fno-inline -fno-ipa-sra else CFLAGS += -Os -DNDEBUG - # TODO: Test with -flto - ### CFLAGS += -flto + CFLAGS += -flto -flto-partition=none endif