How can I get uLisp to run on a Nordic nRF52840?


#23

This might be useful:

Since uLisp doesn’t use the heap you could set the heap size to zero, which should make more RAM available.


#24

As this was my first attempt at using PlatformIO, I can only relate my initial impression, which is that yes, it seems very similar to the Arduino IDE. I’ve tried other ide’s such as eclipse, Segger Embedded Systems, and MBED, and of those PlatformIO seems the most similar to arduino.

Thanks for the info. Every clue helps. I’ll see what I can ferret out and then report back.


#25

Hmm… Given that uLisp only uses the stack, what does setting the WORKSPACE size actually do? Does it set aside a large static block on the stack?


#26

Sorry, that statement was misleading. The uLisp workspace is allocated in the static RAM area, by the declaration:

object Workspace[WORKSPACESIZE] WORDALIGNED;

It doesn’t use the heap, and there isn’t a separate Lisp stack, separate from the processor stack.


#27

Reporting back. I got more info from a verbose compilation, and it seems to confirm that not much memory is being allocated for the stack or the heap, even though more is available. Likely it’s the same with the Sandeep Mistry build with the Arduino IDE. I’ll see what I can find out about improving that.

Processing nrf52840_dk (platform: nordicnrf52; board: nrf52840_dk; framework: arduino)

CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/nrf52840_dk.html
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"])
Memory Usage -> http://bit.ly/pio-memory-usage
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


#28

Problem solved: the solution is to modify the linker file named nrf52_xxaa.ld to allocate more RAM.

Doing that and expanding uLisp’s WORKSPACE size, I now get:

uLisp 2.4 
15999>

and

15999> (gc)
Space: 0 bytes, Time: 5981 us
nil

#29

As a giveback, here are the files and instructions for doing a uLisp build for a nRF52840-DK using PlatformIO: https://github.com/rabbithat/uLisp_nRF52840/blob/master/README.md

Enjoy!