Hi Travis,
Any chance you (or others) can supply some UF2 files for the standard PicoCalc 2040? I am not familiar with the tool chain yet but would like to try some things out.
Thanks,
Paul
Hi Travis,
Any chance you (or others) can supply some UF2 files for the standard PicoCalc 2040? I am not familiar with the tool chain yet but would like to try some things out.
Thanks,
Paul
There are two problems with that at the moment. The first is that Iām on vacation, and I didnāt bring along an RP2040 board (and an actual RP2040 needed to build a UF2 for it). The second is the number of possible configurations ā there is both a graphical and a text-only terminal emulator, and there are three different fonts supported, 5x8, 6x8, and 7x8 pixels. That by itself makes six different configurations.
And that is not including all the desired software (e.g. you may want a bare configuration or you may want FAT32 support for block storage and the SD card, zeptoed, tools to transfer files to and from your computer without removing the SD card, the tool to copy files between filesystems, the appropriate screenshot tool, and, if you are to use the graphical terminal emulator, turtle graphics).
If you are using a Pico 1 W (or Pico 2 W or Pimoroni Pico Plus 2 W) you may also want to have zeptoIP with the CYW43439 driver, which requires using non-free firmware and thus I do not make UF2 files including it. (Note that on the Pico 1 W you will have to use the text-only terminal emulator if you are using zeptoIP or even just the CYW43439 driver, e.g. to blink the LED, because of restrictions on available RAM.)
This is why I do not supply premade UF2 files for zeptoforth on the PicoCalc. Rather, the suggested approach is to use a premade full UF2 file from the latest release, which is currently 1.13.2, and then either use utils/codeload3.sh or zeptocom.js to load the source files per the instructions in USING_THE_PICOCALC.md. If you are not comfortable with the toolchain, I would recommend using Chrome or Chromium on your computer (note that mobile Chrome will not work) with zeptocom.js.
You need to download
zeptoforth-1.13.2.tar.gz
in the git repository
(GitHub - tabemann/zeptoforth: A not-so-small Forth for Cortex-M)
on the top right find the GREEN drop down labeled
<> CODE
This is NOT the one you want, as it gives us
zeptoforth-master.zip
Go down further on the right to find RELEASES
Patch-level release 1.13.2Latest
2 weeks ago
(Release Patch-level release 1.13.2 Ā· tabemann/zeptoforth Ā· GitHub)
CLICK ON LATEST
The window that opens shows
zeptoforth-1.13.2.tar.gz
This is the download archive the contains the /BIN folder with the compiled binaries.
Hi Travis,
Ok. I understand completely. I did not realize that it was that complicated. I imagine it is not. So used to being pampered with prebuilt.
I will attempt to build myself.
Thanks,
Paul
Let me know if you need any help with it at all.
I made a fix to the Attention s screenshot combo (it would previously not use a lock when flashing the display when taking a screenshot), so if you use screenshots please update to the latest.
Note that some applications such as my snow/wind example (test/rp_common/picocalc_snow_wind.fs) do not screenshot properly, as they repeatedly draw and erase the screen such that the terminal emulator is unlocked between erasing and drawing, such that the screenshot is taken when the display has been erased.
Edit:
The snow/wind example has been updated so it does screenshot correctly, as shown below:
Another update:
I have changed all references to ili9488 to st7365p, so be mindful of that next time you load the display drivers for the PicoCalc terminal emulators.
I am the one who posted that. Zeptoforth runs great on the PicoCalc as I showed in the demo I mentioned. There is a lengthy discussion here on another thread with the author of Zeptoforth and others about it as well.
Some more changes ā I fixed the read-battery, read-backlight, set-backlight, read-kbd-backlight, and set-kbd-backlight words in the picocalc-term module, which were previously broken. I have also renamed the extra/common/st7365p_spi_*x8_font_all.fs files extra/common/st7365p_spi_8_*x8_font_all.fs, as I accidentally broke the wordsā naming convention (and contradicted my own doc).
Edit: It turned out that I had more fixing to do, so if you updated, update again⦠![]()
Here are a few demos on the PicoCalc that I implemented:
Note that the Mandelbrot set and the Barnsley fern require an RP2350 as they use hardware single-precision floating point. Also note that the Barnsley fern implementation is based off a program written in MMBasic that was posted on this forum.
I just set up Zeptoforth on my pico 2 w. However, after setting up the fat32 support, I canāt get zeptocom to communicate with the serial console anymore.
serial::serial-console on the PicoCalc disables the keyboard inputābut Iām not seeing the āokā message in zeptocom, and it doesnāt respond to any inputs from zeptocom.
Rebooting, and the PCalc keyboard and screen still work as expected.
This is an issue I have run into that I havenāt yet identified the root cause of. The way out of it is to, when connected to the serial console with zeptocom.js, press the Attention button (equivalent to typing Control-T if using a terminal emulator such as picocom) followed by pressing z (must be lowercase). This will display a main task interrupted message and gain you access to the ok prompt.
Are you perchance using the line editor? Just for the record, the line editor does not work with zeptocom.js except in mass upload mode, because the terminal emulator xterm.js used by zeptocom.js does not properly handle all of the ANSI codes used by the line editor. Also, the line editor should not be necessary with zeptocom.js because it has its own line editor built in.
However, I have seen this behavior when switching from the PicoCalc terminal emulator to the serial console using picocom, but I have always been using the line editor when I have done this, and I wonder whether the switch is messing with the logic of the line editor, where it is hanging waiting forever for a response to reading the current cursor coordinate.
Edit:
I confirmed that the line editor is at fault. There are two workarounds to the general issue of the console hanging when switching to the serial console, though. You only need to do one of these two things. The first is to press F1 at the start of a line to put the line editor into mass upload mode (effectively temporarily disabling it) prior to issuing serial::with-serial-console, and then at the start of the next line of input (without inputting anything before it, even if you delete it) press F2 to take the line editor out of mass upload mode. The second is to have your terminal emulator hooked up to the serial console open before you issue serial::with-serial-console.
However, because you are using zeptocom.js, there is a different issue, which is that zeptocom.js simply does not support the line editor unless it is in mass upload mode prior to connecting zeptocom.js to the serial console, and remains in mass upload mode for the duration of zeptocom.js being connected. Therefore, before issuing serial::with-serial-console press F1 at the start of a line on the keyboard of your PicoCalc and do not press F2 afterwards but instead keep the line editor in mass upload mode until you return control of the console to the PicoCalc terminal emulator.
Iāve got Conwayās Game of Life working on the PicoCalc. The source for the Life engine is at zeptoforth/test/rp_common/picocalc_life.fs at picocalc-devel Ā· tabemann/zeptoforth Ā· GitHub and the source for a small bit of code that instantiates it is at zeptoforth/test/rp_common/picocalc_life_demo.fs at picocalc-devel Ā· tabemann/zeptoforth Ā· GitHub.
Here is a screenshot of it in action:
Note that once the two source files are loaded, in that order, one should execute:
life import life-demo import
and then one can execute things such as:
lrtb 160 160 my-life r-pentomino
to instantiate an R-pentomino with its upper lefthand corner at (160, 160) and:
my-life run-life
to run the life world (which will be exited by pressing a key on the PicoCalcās keyboard).
zeptoforth 1.14.0, which includes optional support for the PicoCalc, is out!
As a result, the picocalc-devel branch has been merged into the devel and master branches and is now considered deprecated.
Also, there is a new build script for building zeptoforth on the PicoCalc from sources, with included support for FAT32 on SDHC cards, zeptoed, transferring files between your board and your PC, and taking screenshots. The script is at zeptoforth/utils/build_picocalc.sh at master Ā· tabemann/zeptoforth Ā· GitHub and the directions for its use are included in USING_THE_PICOCALC.md.
Note that this script requires a bare kernel image to be installed on your board, because it builds a full build on top of it from sources. If you already have an up-to-date kernel installed and you want to return your system to having a bare kernel image, execute erase-all at the console.
After you have executed this script, your PicoCalc will be ready for immediate use!
However, you may want to customize your installation after the fact, e.g. I normally compile to flash code to enable the line editor, import fat32-tools and picocalc-term, enable the audible and visual bells (note that you may not want these enabled, per your taste), select the SDHC card FAT32 filesystem as the default filesystem with sd-fs:, and change the current directory to /TOOLS where I store assorted programs on boot.
I do this with:
compile-to-flash
begin-module init-stuff
fat32-tools import
picocalc-term import
: do-init ( -- )
enable-line
picocalc-term import
fat32-tools import
true audible-bell-enabled!
true visual-bell-enabled!
sd-fs:
s" /tools" change-dir
;
initializer do-init
end-module
reboot
Warning, though, if you use the above code verbatim you will need to disable the line editor before switching from the PicoCalc terminal emulator to the serial console to avoid hangs (even though you can get out of these hangs with Break z on the PicoCalc or Control-T z on the serial console).
I might be seen at as a nut, butā¦
How could I get a absolute minimal zeptoforth running on the picocalc and build from there, instead of the other way aroundā¦
I would like to have a system that comes up with a prompt on the picocalc but not much more⦠Speed is not really a issue, I just want to teach myself forth.
I fell in love with forth and itās simplicity(and complexity), 30 years or so ago. But I am not able to write the system myselfā¦
The problem is that a lot of functionality is needed just to get a prompt on the PicoCalc. For instance, not only does zeptoforth on the PicoCalc practically require multitasking*, it also requires a display driver, graphics and font routines, an I2C driver, byte streams, and console redirection to function.
While zeptoforth could definitely be pared down to eliminate all functionality that is not needed just to display a prompt on the PicoCalc, such as removing FAT32 and block device support, which would be a good amount of work with little gain, while at the same time breaking compatibility with much code that runs on top of zeptoforth such as zeptoed.
* A completely new terminal emulator could be written that does not use multitasking or byte streams might be possible, but it would have poor performance characteristics in practice due to each console input or output being a truly blocking operation, and it would rely upon the STM32 to buffer input characters.
I suspected that, guess I just have to learn with what I haveā¦
Hopefully my rp2350 board arrives soon⦠then the constraint will be less, I guessā¦
Thank you for zeptoforth, btw. And all the effort you have put into make it run @ picocalc.
You can use zeptoforth on the PicoCalc with the RP2040 just fine ā the only thing is that I recommend using the text-only PicoCalc terminal emulator rather than the graphical one with the RP2040 because the graphical PicoCalc terminal emulator eats up a lot of SRAM with its 320x320 RGB332 framebuffer. The primary downside to this is that you really cannot play with pretty graphics this way. (Note that if you use the graphical PicoCalc terminal emulator with zeptoed on the RP2040 you have to reconfigure zeptoed prior to use to significantly cut down on its heap size.)
However, I should note, that cutting down zeptoforth would not actually save that much SRAM, as most of zeptoforth lives in on-board flash without being copied into SRAM and executes in Execute-In-Place (XIP) mode (the only parts that are copied into SRAM are the kernel and the flash dictionary index, a.k.a. the āmini-dictionaryā).
I have tried loading zeptoed a couple of times now, and it hangs every time⦠I even nuked the flash and tried again⦠same, just freeze and have to restart, having a broken zeptoed that have to be erasedā¦
Anywayz, I do not need fancy. I need something to play with, and blocks works. the default block editor does not (on the picocalc, that is⦠works perfectly @ serial term)
I did the only reasonable thing to do when stuff dont work, hit the thing with a hammer until it worksā¦
hammer in the form of changing the constant buffer-width in edit.fs from 64 to 32.
erase-all, utils/build_picocalc.sh (had to edit the screenshot stuff out, it hung. Every time)
And it works, sorta⦠I have to fill the blocks with char 32 (space) first, othervise editor hangs. But I can live with that, itās part of the fun! ![]()
anywayz, I still think zeptoforth is great, it makes me able to play with forth on the picocalc.
thank you, tabemann
Are you using an RP2040 and the graphical terminal emulator? That would explain why zeptoed is hanging ā it does not have enough memory for its heap, so when it allots space for its heap it intersects with the memory for the task structures. This is mentioned in USING_THE_PICOCALC.md, but so you donāt have to dig that up, Iāll mention what is involved here:
First, execute unused and it will output the remaining about of space in the main taskās RAM dictionary, amongst other things.
Then execute <desired heap size> to zeptoed-heap-size, replacing <desired heap size> with the amount of unused space in the main taskās RAM dictionary minus about 10 KiB. As you load code into the main taskās RAM dictionary you can adjust this value multiple times as needed.
Then execute s" YOURFILE.FS" zed or like, with your choice of file path instead of s" YOURFILE.FS".
However, if you find this annoying, or run into problems with restricted heap space for zeptoed (zeptoed will unceremoniously exit with an exception if it runs out of heap space), I recommend installing the text-only terminal emulator instead of the graphical terminal emulator. The text-only terminal emulator only stores a character/attribute matrix in memory rather than also using a 320x320 framebuffer, which saves a significant amount of RAM.
The problems with the screenshot tool you are having may also be memory-related, which makes sense if you are using an RP2040 and the graphical terminal emulator. Note that if you use utils/build_picocalc.sh and you select the text-only terminal emulator it will automatically select the proper screenshot tool (there are actually two screenshot tools, one for the graphical terminal emulator and one for the text-only terminal emulator).
hung with text terminal too⦠tried that first
since I just wanted to play with it, instead of getting into a reinstall loop, I started lookin @ the source and found a solution that works for me⦠I am waiting for some rp2350 modules, expect me to bother you when they arrive⦠![]()