It seems that very little of what’s available is being allocated, and I’m running into a stack overflow if I try to increase the size of my program data. Here is the result of a successful compilation with less data allocated:
Processing nrf52840_dk (platform: nordicnrf52; board: nrf52840_dk; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
PLATFORM: Nordic nRF52 > Nordic nRF52840-DK
HARDWARE: NRF52840 64MHz 256KB RAM (1MB Flash)
DEBUG: CURRENT(cmsis-dap) ON-BOARD(cmsis-dap, jlink) EXTERNAL(blackmagic, stlink)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 2 compatible libraries
Scanning dependencies...
No dependencies
MethodWrapper(["checkprogsize"], [".pioenvs\nrf52840_dk\firmware.elf"])
DATA: [ ] 0.4% (used 1072 bytes from 262144 bytes)
PROGRAM: [ ] 0.4% (used 4384 bytes from 1048576 bytes)
.pioenvs\nrf52840_dk\firmware.elf :
section size addr
.text 3948 0
.ARM.exidx 8 3948
.data 428 536870912
.bss 644 536871340
.heap 8192 536871984
.stack_dummy 8192 536871984
.ARM.attributes 46 0
.comment 126 0
.debug_frame 192 0
Total 21776
==================================================================================== [SUCCESS] Took 5.19 seconds ====================================================================================
but here is what I get if I increase the amount of data used by program by just a smidge:
Processing nrf52840_dk (platform: nordicnrf52; board: nrf52840_dk; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
PLATFORM: Nordic nRF52 > Nordic nRF52840-DK
HARDWARE: NRF52840 64MHz 256KB RAM (1MB Flash)
DEBUG: CURRENT(cmsis-dap) ON-BOARD(cmsis-dap, jlink) EXTERNAL(blackmagic, stlink)
Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF MODES: FINDER(chain) COMPATIBILITY(soft)
Collected 2 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Wire> 1.0
|-- <SPI> 1.0
Compiling .pioenvs\nrf52840_dk\src\main.cpp.o
Linking .pioenvs\nrf52840_dk\firmware.elf
c:/users/coolermaster/.platformio/packages/toolchain-gccarmnoneeabi/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/bin/ld.exe: region RAM overflowed with stack
collect2.exe: error: ld returned 1 exit status
*** [.pioenvs\nrf52840_dk\firmware.elf] Error 1
===================================================================================== [ERROR] Took 9.07 seconds =====================================================================================
Please advise.