I think I saw somebody on a facebook group (Minimal Computing maybe) had ZeptoFORTH running on the PicoCalc, but my attempts to contact the author there failed.
Does anybody know of anything else that will work out of the box?
Thanks
-Dave
I think I saw somebody on a facebook group (Minimal Computing maybe) had ZeptoFORTH running on the PicoCalc, but my attempts to contact the author there failed.
Does anybody know of anything else that will work out of the box?
Thanks
-Dave
Someone posted on the forums here that they got Zeptoforth running, but didnāt share any release information, git repo, etc. except a link to a private Facebook group.
Maybe try contacting them and asking if they will share it with other PicoCalc owners?
Ah, thanks, thatās the person I saw on facebook, so I clearly had the wrong group. Obviously Iām a member of several different āprogramming in the previous milleniumā groups.
And yeah, I did try contacting them directly, but that was on Facebook so who knows if they ever saw the message.
Hello ā I just saw this thread, and I am the primary author of zeptoforth. I personally donāt have access to Jerryās source code, so I cannot show you the code that he demoed.
However, zeptoforth is on GitHub at GitHub - tabemann/zeptoforth: A not-so-small Forth for Cortex-M and furthermore has a development branch picocalc-devel at GitHub - tabemann/zeptoforth at picocalc-devel which includes drivers for the PicoCalcās keyboard and display and a terminal emulator for the PicoCalc. These compile and at least load without crashing but have not been fully tested (I have not received my PicoCalc yet).
If you are brave and want to try out zeptoforthās PicoCalc drivers and terminal emulator, first flash your RP2040 or RP2350 board with a UF2 file from the latest zeptoforth release (as the PicoCalc captures the UART0 TX and RX and exposes them via USB-C I recommend using a full rather than full_usb build, for the RP2040 I recommend the rp2040_big platform over the rp2040 platform unless you really care about having extra on-board space for blocks or FAT32 filesystems at the expense of flash dictionary space, and for the RP2350 if you are using a Pimoroni Pico Plus 2 or Pimoroni Pico Plus 2 W I recommend the rp2350_16mib platform over the rp2350 platform so as to take advantage of the full 16 MiB flash size). Then execute the following at the base of the zeptoforth directory tree (taking care to replace <your tty device>
with your tty device for your serial link):
utils/codeload3.sh -B 115200 -p <your tty device> serial extra/common/ili9488_spi_8_all.fs
utils/codeload3.sh -B 115200 -p <your tty device> serial extra/rp_common/picocalc_keys.fs
utils/codeload3.sh -B 115200 -p <your tty device> serial extra/rp_common/picocalc_term.fs
Note that utils/codeload3.sh
is a wrapper around a smallish Python program that requires Python 3 and which will use pip to pull pySerial into a local installation if it is not already installed on your system.
Then, if everything went okay (it should), connect to your tty device with your favorite serial terminal emulator (e.g. picocom, GNU Screen), and execute:
picocalc-term::term-console
If everything goes well, that should transfer control of the console to the PicoCalcās display and keyboard. Mind you, this has never been tried before to my knowledge, so it may just as well crash your PicoCalc.
Note that at this point the drivers and terminal emulator are only loaded into RAM, and will thus disappear next time you reboot. This is probably what you will want the first time you try this out, as most likely it simply wonāt work.
If everything does go well, then if you want to make this permanent, issue at the zeptoforth REPL:
reboot
and then again with your favorite serial terminal emulator issue:
compile-to-flash
and re-issue the commands to upload the code for the drivers and terminal emulator.
Afterwards, issue with your serial terminal emulator:
reboot
or if you want your PicoCalc to boot directly into the terminal emulator:
initializer picocalc-term::term-console
reboot
Then your PicoCalc will be persistently configured to support the keyboard and display under zeptoforth.
However, if you want to re-flash your PicoCalcās RP2040 or RP2350 board, there is now a more convenient means of doing so rather than sticking an object through the slits in the back to press the BOOTSEL button, which is simply to issue at the REPL:
bootsel
If you only want to return zeptoforth on the PicoCalc to the āfactory configurationā, you can instead issue:
restore-state
Oh and please, if you do try this out, I would much appreciate it if you provided feedback on the zeptoforth GitHub, especially if it doesnāt work, so I can work on making it work without having a PicoCalc in my own possession.
Hey, Iām not the guy who claimed to have zeptoforth working on PicoCalc, but Iāve tinkered with it. SPI is pretty straightforward. I wrote a few words that initialize the LCD and write pixels (slowly). I havenāt messed with I2C yet, but Iām pretty confident all the PicoCalc support could be done in pure forth without any asm.
Dude! I love zeptoforth! Thank you for making it. Iāve been playing with it on the Pico itself for sometime, and in fact zeptoforth (and the idea of a pocket forth machine) was one of the reasons I bought a PicoCalc.
I will try to make some time this weekend, check this out on the PicoCalc, and report back!
The main area in which I use asm for my drivers for the PicoCalc is in the graphics support, because while zeptoforth is fast as Forths go, hand-optimized assembly is faster, and provides a definite benefit in areas like blitting bitmaps and pixmaps and converting 8-bit pixmaps to 16-bit data for output.
Youāre welcome! And thank you in advance for trying this out! Let me know if you have any luck with it!
Iām testing everything on Windows 11/zeptocom.js and using 1.13.1 on the Pico.
When I send 1l19488_spi_8_all.fs, picocalc_keys.fs, and picocalc_term.fs the Pico 1 runs out of memory and hard-faults at line 1269 of picocalc_term.
I worked around that by compiling ili9488_spi_8_all to flash. With that out of the way, theres enough memory to work with the other two ā¦
In picocalc_term Iām getting an out of range branch at line 605 (the ārepeatā at the end of handle-input). I havenāt dug into it, but as a quick and dirty test I commented handle-input out, rebooted and resent.
It sent ok after that, but naturally, I get a āmethod not implementedā error and āblock timed outā shortly after, when it tries to initialize the terminal. That said, it does seem to start initializing the lcd. I get a white screen with a couple vertical lines and a black 6x8 square at the top left! Off to a good start!
If I investigate further, Iāll post anything I figure out.
I made some fixes, so please pull again and try again (note that you will not need to re-flash the ILI9488 driver, as that has not changed).
Note that I have been compiling this on a Pimoroni Pico Plus 2, and the RP2350 does not have the significant branch distance problems that plague the RP2040 as, being ARM Cortex-M33 rather than ARM Cortex-M0+, it has longer-distance branch instructions that zeptoforth takes advantage of.
Note that I just made a change to the repo to change the default foreground color to bright green (I personally am a partisan of green-on-black), but if you pulled before this will not fundamentally affect the functioning of the code.
Iām giving this a shot too. I did a git clone then git checkout picocalc-devel
which I think worked. I built everything ā lots of tty spam but it appeared to produce several uf2 files. I flashed the base rp2040 onto my picocalc and plugged in a usb c cable and did the first step of the code load.
I do seem to have python3 (this is on a recent M series MacBook Air) and the output I get is
TX: begin-module clip
error begin-module clip unable to parse: begin-module
Error file extra/common/ili9488_spi_8_all.fs line 21: could not upload file
>>> #include extra/common/clip.fs
Any idea what Iāve done wrong?
I also tried to upload clip.fs directly and got
TX: begin-module clip
error begin-module clip unable to parse: begin-module
so I feel like Iāve done something fundamentally wrong here.
I think itās installed on the picocalc because when I held down the power button the LED turned amber instead of going off, which I assume is some sort of sleep mode. I held the power button down for 20-30 seconds and that killed power completely (so I didnāt need to mess with pulling the batteries). Then I installed the rp2040_big uf2.
Next, I tried the upload immediately, and it complained that my TTY device was invalid, which was not unexpected because the power was still off. I turned the power back on, and repeated the upload, and got the same error as above.
So I think the zeptoforth image is getting downloaded and is working, and I think I am able to communicate over the TTY device (wow, built in USB serial is nice, havenāt messed with much of this stuff since there were real serial ports on PCās).
A bunch of poking around the internet and I got the direct terminal to work. On a Mac, edit/create ~/.screenrc with
term rxvt-256color
to get rid of an error about $TERM being too long, sorry. Then to actually connect, make sure USB C is connected to the picocalc, turn it on, and run (from a terminal window)
screen /dev/tty.usbserial-10 115200
You should see an āokā prompt and you can enter forth commands. You might need to change /dev/tty.usbserial-10 to something else on your machine, do an ls
in /dev/
to see what device is created once youāve turned on and connected your pico.
Thanks,
-Dave
I just realized, Iām trying to flash the uf2 I built myself, and maybe itās incomplete somehow. My zeptoforth-rp2040_big.uf2 file is 197,632 bytes long. The released āfullā version is substantially larger than that, so I probably built the wrong target somehow. (I just hoped/expected āmakeā to do what I needed)
Once I pulled the *.uf2 from an official release, the first download worked. But then I donāt have the picocalc forth files somehow, which means my git-fu is weak and I didnāt really switch to the picocalc-devel branch like Iād hoped.
Yeah, if you just flashed the output of make
it is not going to work, as make
only builds the zeptoforth kernel and nothing else. This is only really meant as a starting point for building more complete zeptoforth systems and lacks much of what one would expect from a useful Forth.
I normally recommend that users not try to build zeptoforth from scratch but rather use the prebuilt binaries under the bin/
directory in the latest release tarball. This will save you effort and headache getting zeptoforth built.
If you still want to build zeptoforth from scratch, after having flashed your RP2040 or RP2350 with the proper kernel binary, execute at your shell prompt:
utils/codeload3.sh -B 115200 -p <your tty device> serial src/<your platform>/forth/setup_full.fs
(replacing the strings in angle brackets).
Once that is all complete, connect to your PicoCalc with a terminal emulator and execute reboot
. Then you can follow the directions in a previous post.
Note that if you are targeting the original Pico (or another RP2040 board) as z900rs discovered you will need to compile the ILI9488 driver to flash. This can be accomplished by issuing:
compile-to-flash
prior to uploading it and then afterwards issuing:
reboot
before uploading extra/rp_common/picocalc_keys.fs
or extra/rp_common/picocalc_term.fs
.
I do have multiple picoās but itās a 2040 in my picocalc right now, so Iāll definitely do that.
Do you have any idea why even though Iām on the picocalc-devel branch, I canāt see those two picocalc forth files? Iāve searched on a bunch of git-related things but havenāt had any luck.
EDIT - ugh, just noticed I somehow copied an incorrect path the first time and was looking in the wrong subdirectory.
Thanks,
-Dave
Iām getting closer. Switching between screen
and codeload3
keeps tying up the serial port and I canāt figure out how to quit screen
cleanly without just unplugging the USB cable to kill the connection.
EDIT - Figured out how to exit screen
, itās the stunningly intuitive combination of hitting Ctrl+A, then Ctrl+\.
I added compile-to-flash
at the top of ili9488_spi_8_all.fs
and reboot
to the bottom, and then uploaded the two pico-specific files. When I ran
picocalc-term::term-console
though it locked up my terminal session and turned my screen white. If I cycle power the screen just comes back white again.
-Dave
Re-reading this thread, I think Iāve gotten as far as z900rs has.
I tried blind-typing reboot
on the keyboard and hitting enter but it didnāt seem to do anything.