Trouble to upload uLisp to a Raspberry Pico W


#1

Hi,
(I am no native speaker, sorry).

Using Linux/Arduino IDE 1.8.19 I followed the instructions given to upload µLisp to a Raspberry Pico W RP2040. On the board there is installed µPython currently.

With the boards manager I installed Raspberry Pi Pico/RP2040 by Earle F. Philhower v.: 2.7.2.
I loaded the ARM-version of µLisp into the IDE, selected the port (/dev/ttyACM0) and started the upload process.
It fails with:

Resetting /dev/ttyACM0
Converting to uf2, output size: 329728, start address: 0x2000
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
No drive to deploy.
An error occurred while uploading the sketch

Then I unplugged the board, and while I pressed the bootsel button, I connected it again to the
USB port.

Now /dev/ttyAMC0 does no longer show up and the Arduino IDE shows /dev/ttys0 instead, which I choose.
This time the upload attempt ended with:

Resetting /dev/ttyS0
Converting to uf2, output size: 329728, start address: 0x2000
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
Exception executing udisksctl. Exception: [Errno 2] No such file or directory: 'udisksctl'
No drive to deploy.
An error occurred while uploading the sketch

How can I successfully upload µLisp to my board?


#2

I don’t have experience of running the Arduino IDE on Linux - can anyone else help with this?


#3

This might have something to do with it:

Auto mount turn off in Linux, can’t flash - Fixed


#4

Has the OP tried using Arduino 2.0.x? I just compiled uLisp v4.3a with Philhower v2.7.1 (now upto v2.7.3) and the IDE reset the attached Pico W, the RPI-RP2 disk appeared, it copied the .uf2 file over, and reset the Pico again. Everything went just fine. Having MicroPython preinstalled on the Pico doesn’t affect the Arduino download process.

According to the error messages, the program ‘udisksctl’ is either not installed on the Linux host system or is not in a directory on the PATH variable. It should be located in ‘/usr/bin’. If not, verify that the Linux package ‘udisks2’ has been installed and install if it hasn’t been.


#5

The OP has used Arduino 1.8.19.
The installation of udisk and dependancy would involve:
Installing LVM2 (which the OP doesn’t have and want)
Installing systemd (which the OP definitely don’t want)
Reconfiguring, recompiling and installing the kernel (which the OP also don’t want).

Using ESP-IDF and platformio instead would make things a lot easier…and the USB-problem would also vanish.
Arduino only wraps the ESP-IDF.


#6

I think the first thing to try is: can you blink the builtin LED by running the Blink example.


#7

The first thing one should accomplish before running any program is to successfully flash ulisp onto
my Raspberry Pico W…isn’t it?
In the meanwhile I choose another method of flashing (not uf2) and didn’t need this silly udisk stuff.

I get a prompt saying
15871>
which is the available memory, if I interpret this correctly.
I choose the "Raspberry Pico " as board and enabled the following in the source:

// #define resetautorun
#define printfreespace
// #define printgcs
// #define sdcardsupport
// #define gfxsupport

//#define lisplibrary
#define assemblerlist
#define lineeditor
#define vt100

Question: Is the amount of free mem what is expected or did I flash the image right in the middle of
the available flash and waste a lot of space?
Is there a way to save some space without limiting the features?
The vt100 emulation seems not to work?
Suggestion: When giving the settings in the tutorial how to flash µLisp onto a board, saying “the rest can be left on its defaults” is a little confusing because from experiments with the same board for other experiments this may already differ from the defaults without notice. A full set of all settings with its correct values would be helpful especially when searching for a solution for problems like I had.
Instead of “uf2” I set “picotool” to flash µLisp.
Question remains, whether it results in a complete valid result…
Cheers!
mcc


#8

@mcc Glad to hear that you’ve got it working. Try running some of the demo programs!

I get a prompt saying
15871>
which is the available memory, if I interpret this correctly.

Yes, that’s correct: in fact it’s the number of 8-byte Lisp objects.

Question: Is the amount of free mem what is expected or did I flash the image right in the middle of the available flash and waste a lot of space?

Yes, that’s correct. It’s defined by the #define WORKSPACESIZE in the uLisp source.

The vt100 emulation seems not to work?

Try it without that option enabled; does the terminal emulation work as expected?

The vt100 emulation option adds parenthesis matching to the terminal emulation, and relies on particular features of vt100 terminals, such as an 80-character line width. Can you give specific examples of what doesn’t work?

Regards,
David


#9

I was too fast: It is not working…kind of.
First things first:
When flashing with 1MB/1MB the Raspberry becomes non responding at all.
With 2MB/0MB I can cannot (save-image): There is no room for it.
I disabled the assembler…and vt100 emulation works (again no LittleFs … not even a tiny nano FS).

uLisp (or something in it) is not compatible to rlwrap, which works fine with sbcl or ccl.

I am a little frustrated here. Either I have a kind of working uLisp and cannot save my work or I have the theoretical space to save my work but can’t work.

Cheers!
mcc


#10

@mcc I’m glad the vt100 emulation is working!

When flashing with 1MB/1MB the Raspberry becomes non responding at all.
With 2MB/0MB I can cannot (save-image): There is no room for it.

LittleFs should work OK with less memory. To save the uLisp workspace you need 15872x8 bytes, or 126Kbytes, so try the option:

Flash Size: 2MB (Sketch: 1792KB, FS: 256KB)

It may be that on Linux the Raspberry Pi Pico needs more memory for the sketch.

I disabled the assembler

Do you mean that you commented out #define assemblerlist? That only affects the assembler listing, and doesn’t disable the assembler. Anyway, I doubt the assembler is the problem. It doesn’t really affect anything unless you actually use it.

Let me know how you get on!


#11

IT WORKS! (or at least…what I have tried as newbie so far… ;)

I tried a ultra simple function, a (save-image), reboot, (load-image) and it was there again.
The I run the blinking-primes, which also works.
Q: In general: How can I interrupt an endless-looping program in Lisp on a Raspi Pico W without losing
what I have entered just before?

Another newbie question: With a rough estimation: How long can be a lisp program, which can be stored via
(save-image) and restored via (load-image).
Is there a parameter, with which I can optimize (if even possible) the space available or LittleFS?

To summarize for others, which may have troubles to get µLisp running on a Raspi Pico W:

Under Linux I used this settings:
ulisp

Before flashing I pressed the BOOTSEL botton reconnected the USB plug, waited a moment, releases BOOTSEL and flashed the Raspi Pico with µLisp.

I did not make any extended tests though…I only checked, whether I will encounter the problems again, which I had before and I didn’t. Currently it looks fine.

I defined the following in the source of µLisp:
// Compile options

// #define resetautorun
#define printfreespace
// #define printgcs
// #define sdcardsupport
// #define gfxsupport

//#define lisplibrary
//#define assemblerlist
#define lineeditor
#define vt100

The prompt of µLisp shows:

uLisp 4.3a
15871>

I used picocom to connect to µLisp, which works fine so far.

HTH!
Cheers!


#12

Q: In general: How can I interrupt an endless-looping program in Lisp on a Raspi Pico W without losing what I have entered just before?

Enter a tilde character ‘~’ at the terminal, followed by Return. That should stop a running program.

Another newbie question: With a rough estimation: How long can be a lisp program, which can be stored via (save-image) and restored via (load-image). Is there a parameter, with which I can optimize (if even possible) the space available or LittleFS?

You have 15871 Lisp objects, and each Lisp object is 8 bytes, so that makes about 127Kbytes. So with your setting of 256Kbytes of FS space there should be plenty of room to save the entire workspace with save-image.

Good to hear that picocom works fine!


#13

I tried the ‘~’…but it did not stop the running (blink) function (the “primes” one).
Could be the terminal program (picocom in my case) the reason?

Further successes: I fed all benchmark programs into my image, saved it, rebooted, (load-image) and could run them and got reasonable times as result.
But would have never guessed, that the Raspi W is faster with µLisp as on the ESP32-family of chips…
But as the ESP32* does not have a working USB but the Raspi has, it is jsut fine.

PS: Is there a introspection way to list the source of any function defined in µLisp in textform?

Cheers!


#14

I tried the ‘~’…but it did not stop the running (blink) function (the “primes” one).

Try the Esc key. I think that may work with a terminal.

PS: Is there a introspection way to list the source of any function defined in µLisp in textform?

See:

http://www.ulisp.com/show?3L#pprint

and:

http://www.ulisp.com/show?3L#pprintall


#15

Just wanted to add re rlwrap: It surely cannot be expected to run easily, and it wouldn’t be uLisp’s fault, but the terminal program’s. BUT …

I found the following to work perfectly with rlwrap, and it’s a real joy to use (and who would have thought that UUCP would be helpful in 2023!):

rlwrap -a -N cu -l /dev/ttyACM0 -s 9600

While having the line editor and vt100 enabled. There’s just a overlap of ~ commands, since cu also uses ~. for disconnecting. To send ~. to uLisp, one has to use ~~. and press enter.