[Openmcl-devel] Challenge: CCL port to the RPi Pico (RP2040)

Tim McNerney mc at media.mit.edu
Sun Jul 28 07:54:15 PDT 2024


The popular Raspberry Pi Pico chip (RP2040) is a remarkable microprocessor with memory resources not dissimilar from the Mac 512k, CCL’s debut target. Here are some quick facts. 
Dual ARM Cortex-M0+ @ 133MHz

264kB on-chip SRAM in six independent banks

Support for up to 16MB of off-chip Flash memory via dedicated QSPI bus

Some might argue it’s not comparable to a Mac 512. I claim it is: consider that the RAM would only used for the heap, stack(s), and housekeeping? It is the off-chip flash support that makes all the difference. That’s where you can store static code and data segments that make up the bulk of a CCL image. 

My big questions:

1) Could this chip run CCL?

2) Would it be worth the effort?

I think yes on both fronts. A lot of embedded code is truly modest, so a small heap is useful enough. This is the arena where microPython shines—itself sporting a garbage collector. 

3) Does anyone want to try?

CCL already has 32-bit ARM support. There is no OS interfacing work to do here (only work to make up for the lack of OS). 

This could be a fun little project that would a great way to become familiar with CCL internals without a lot of distractions from OS and GUI issues. First get it working from a serial port console (over Bluetooth maybe?) and focus on embedded applications. Slash and burn the rest, at least for starters. 

--Tim

> On Jul 28, 2024, at 01:32, R. Matthew Emerson <rme at clozure.com> wrote:
> 
> 
>> On Jul 27, 2024, at 8:23 PM, Grégory Vanuxem <g.vanuxem at gmail.com> wrote:
>> 
>> In FriCAS  built on top of Clozure CL I obtain this output in a terminal (WSL2)
>> 
>> (gamma(x) âÃÂàreals && Re(x) > 0) || (x âÃÂàintegers &&
>> gamma(x) âÃÂàreals)
>> 
>> instead of (SBCL)
>> 
>> (gamma(x) ∈ reals && Re(x) > 0) || (x ∉ integers && gamma(x) ∈ reals)
>> 
>> if I (print ...) a string with, for example, ∈, in a pure Clozure CL
>> (recently git cloned) this is correctly printed, no problem.
>> 
>> So I wonder if I have to modify the output stream character encoding
>> or the output routine.
> 
> Check that the external format of the FriCAS output stream is what you expect. In other words, if you pass an explicit :external-format argument to cl:open, make sure it matches what your terminal requires.
> 
> Doing (describe *terminal-io*) might show something interesting. Here’s what it shows for me:
> 
> ? (describe *terminal-io*)      
> #<ECHOING-TWO-WAY-STREAM input #<BASIC-CHARACTER-INPUT-STREAM UTF-8 (TTY/0) #x1824C7D6>, output #<BASIC-CHARACTER-OUTPUT-STREAM UTF-8 (TTY/1) #x1824C2A6> #x1825FBE6>
> Class: #<STANDARD-CLASS ECHOING-TWO-WAY-STREAM>
> Wrapper: #<CLASS-WRAPPER ECHOING-TWO-WAY-STREAM #x18039A16>
> Instance slots
> SHARED-RESOURCE: NIL
> OPEN-P: T
> INPUT-STREAM: #<BASIC-CHARACTER-INPUT-STREAM UTF-8 (TTY/0) #x1824C7D6>
> OUTPUT-STREAM: #<BASIC-CHARACTER-OUTPUT-STREAM UTF-8 (TTY/1) #x1824C2A6>
> 
> The default external format has been #<EXTERNAL-FORMAT :UTF-8/:UNIX #x18249C6E> for quite a long time now.
> 
> https://ccl.clozure.com/docs/ccl.html#characters-and-external-formats
> 
> 
>> 
>> And more importantly, how can I achieve that?
>> 
>> - Greg
>> 
>> PS:
>> (1) -> )lisp CCL:*DEFAULT-EXTERNAL-FORMAT*
>> Value = :UNIX
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20240728/631fb525/attachment.htm>


More information about the Openmcl-devel mailing list