Open davidvfx07 opened 3 months ago
I made an issue on the official pocketlang repo in case somebody there can help out, ThakeeNathees/pocketlang#300.
UPDATE. Moved to RP2040 for convenience. I think I'm going to stay here and manually implement the libraries I want from within Nim. The std_lib
isn't very important to the project anyway. I am still doing a lot of testing around memory...
I've been interested in creating a language that can be interpreted on embedded systems (esp32) with platformio for use in a larger project, which would provide an api to the user which calls precompiled procs that talk to the hardware. I came across
nimpk
which compiles great and works well on PC, but there are some weird memory issues on esp32, causingGuru Meditation
errors when registering libs (backtrace attached bellow).Is there some solvable problem that would be causing a memory leak or something that would cause the esp not to boot?
Ultimately this may be impossible given the minuscule power of the esp32 to interpret nimpk on its own, and there may be other unforeseen reasons this won't work, but it would be a great tool for embedded programming and super helpful for the community.
PS. Since importing
nimpk/src
requires an os, and is necessary to include pocketlang libs into the compile, it has to be reimplemented in platformio for the platformio compiler. By default,pocketlang.h
is not included in the compile withoutnimpk/src
, so adding{importc, header: "pocketlang.h"}
innimpk/includes.nim
includes it. It will then throw errors likeerror: use of enum 'PkVarType' without previous declaration
, which can be circumvented by reorderingpocketlang.h
. Also be sure to use an environment with botharduino
andesp-idf
together. This is because it seems as though pocketlang requires lower level functionality from the esp-idf that's hidden by using just arduino, which is then resurfaced with esp-idf.Full backtrace: