Re: Challenge: CCL port to the RPi Pico (RP2040)

Jon Boone <[email protected]> Sun, 28 Jul 2024 11:37:56 -0400
Newsgroups gmane.lisp.openmcl.devel
Message-ID <26bc52c1-cc2c-4cd9-bfc1-bffe9a9f064d@Spark>
--66a665ef_4653df05_3a45
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

=46or those who might be interested in such a project, where would one st=
art=3F

=E2=80=94 jb
On Jul 28, 2024 at 10:54 -0400, Tim McNerney <mc=40media.mit.edu>, wrote:=

> The popular Raspberry Pi Pico chip (RP2040) is a remarkable microproces=
sor with memory resources not dissimilar from the Mac 512k, CCL=E2=80=99s=
 debut target. Here are some quick facts.
>
> =E2=80=A2 > Dual ARM Cortex-M0+ =40 133MHz
> =E2=80=A2 > 264kB on-chip SRAM in six independent banks
> =E2=80=A2 > Support for up to 16MB of off-chip =46lash memory via dedic=
ated QSPI bus
>
> Some might argue it=E2=80=99s not comparable to a Mac 512. I claim it i=
s: consider that the RAM would only used for the heap, stack(s), and hous=
ekeeping=3F It is the off-chip flash support that makes all the differenc=
e. That=E2=80=99s 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=3F
>
> 2) Would it be worth the effort=3F
>
> 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=
=E2=80=94itself sporting a garbage collector.
>
> 3) Does anyone want to try=3F
>
> 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 fam=
iliar with CCL internals without a lot of distractions from OS and GUI is=
sues. =46irst get it working from a serial port console (over Bluetooth m=
aybe=3F) 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=40clozure.com> wro=
te:
> >
> >
> >
> > > On Jul 27, 2024, at 8:23=E2=80=AFPM, Gr=C3=A9gory Vanuxem <g.vanuxe=
m=40gmail.com> wrote:
> > >
> > > In =46riCAS =C2=A0built on top of Clozure CL I obtain this output i=
n a terminal (WSL2)
> > >
> > > (gamma(x) =C3=83=C3=82=C2=A2=C3=83=C3=82=C3=83=C3=82 reals && Re(x)=
 > 0) =7C=7C (x =C3=83=C3=82=C2=A2=C3=83=C3=82=C3=83=C3=82 integers &&
> > > gamma(x) =C3=83=C3=82=C2=A2=C3=83=C3=82=C3=83=C3=82 reals)
> > >
> > > instead of (SBCL)
> > >
> > > (gamma(x) =E2=88=88 reals && Re(x) > 0) =7C=7C (x =E2=88=89 integer=
s && gamma(x) =E2=88=88 reals)
> > >
> > > if I (print ...) a string with, for example, =E2=88=88, in a pure C=
lozure CL
> > > (recently git cloned) this is correctly printed, no problem.
> > >
> > > So I wonder if I have to modify the output stream character encodin=
g
> > > or the output routine.
> >
> > Check that the external format of the =46riCAS output stream is what =
you expect. In other words, if you pass an explicit :external-format argu=
ment to cl:open, make sure it matches what your terminal requires.
> >
> > Doing (describe *terminal-io*) might show something interesting. Here=
=E2=80=99s what it shows for me:
> >
> > =3F (describe *terminal-io*)
> > =23<ECHOING-TWO-WAY-STREAM input =23<BASIC-CHARACTER-INPUT-STREAM UT=46=
-8 (TTY/0) =23x1824C7D6>, output =23<BASIC-CHARACTER-OUTPUT-STREAM UT=46-=
8 (TTY/1) =23x1824C2A6> =23x1825=46BE6>
> > Class: =23<STANDARD-CLASS ECHOING-TWO-WAY-STREAM>
> > Wrapper: =23<CLASS-WRAPPER ECHOING-TWO-WAY-STREAM =23x18039A16>
> > Instance slots
> > SHARED-RESOURCE: NIL
> > OPEN-P: T
> > INPUT-STREAM: =23<BASIC-CHARACTER-INPUT-STREAM UT=46-8 (TTY/0) =23x18=
24C7D6>
> > OUTPUT-STREAM: =23<BASIC-CHARACTER-OUTPUT-STREAM UT=46-8 (TTY/1) =23x=
1824C2A6>
> >
> > The default external format has been =23<EXTERNAL-=46ORMAT :UT=46-8/:=
UNIX =23x18249C6E> for quite a long time now.
> >
> > https://ccl.clozure.com/docs/ccl.html=23characters-and-external-forma=
ts
> >
> >
> > >
> > > And more importantly, how can I achieve that=3F
> > >
> > > - Greg
> > >
> > > PS:
> > > (1) -> )lisp CCL:*DE=46AULT-EXTERNAL-=46ORMAT*
> > > Value =3D :UNIX
> >
> >

--66a665ef_4653df05_3a45
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<html xmlns=3D=22http://www.w3.org/1999/xhtml=22>
<head>
<title></title>
</head>
<body>
<div name=3D=22messageBodySection=22>
<div dir=3D=22auto=22>=46or those who might be interested in such a proje=
ct, where would one start=3F&=23160;&=23160;</div>
</div>
<div name=3D=22messageSignatureSection=22><br />
=E2=80=94 jb</div>
<div name=3D=22messageReplySection=22>On Jul 28, 2024 at 10:54 -0400, Tim=
 McNerney &lt;mc=40media.mit.edu&gt;, wrote:<br />
<blockquote type=3D=22cite=22 style=3D=22border-left-color: grey; border-=
left-width: thin; border-left-style: solid; margin: 5px 5px;padding-left:=
 10px;=22>
<div dir=3D=22ltr=22>=EF=BB=BFThe popular Raspberry Pi Pico chip (RP2040)=
 is a remarkable microprocessor with <i>memory resources</i> not dissimil=
ar from the Mac 512k, CCL=E2=80=99s debut target. Here are some quick fac=
ts.&=23160;
<div dir=3D=22ltr=22>
<div>
<ul style=3D=22-webkit-text-size-adjust: auto; box-sizing: border-box; fo=
nt-family: Roboto, sans-serif;=22>
<li style=3D=22box-sizing: border-box;=22>
<p style=3D=22box-sizing: border-box; margin: 0px 0px 15px; padding: 0px;=
 font-size: 0.95em; line-height: 1.5em;=22>Dual ARM Cortex-M0+ =40 133MHz=
</p>
</li>
<li style=3D=22box-sizing: border-box;=22>
<p style=3D=22box-sizing: border-box; margin: 0px 0px 15px; padding: 0px;=
 font-size: 0.95em; line-height: 1.5em;=22>264kB on-chip SRAM in six inde=
pendent banks</p>
</li>
<li style=3D=22box-sizing: border-box;=22>
<p style=3D=22box-sizing: border-box; margin: 0px 0px 15px; padding: 0px;=
 font-size: 0.95em; line-height: 1.5em;=22>Support for up to 16MB of off-=
chip =46lash memory via dedicated QSPI bus</p>
</li>
</ul>
<div>Some might argue it=E2=80=99s not comparable to a Mac 512. I claim i=
t is: consider that the RAM would <i>only</i> used for the heap, stack(s)=
, and housekeeping=3F It is the off-chip flash support that makes all the=
 difference. That=E2=80=99s where you can store static code and data segm=
ents that make up the bulk of a CCL image.&=23160;</div>
<div><br /></div>
<div>My big questions:</div>
<div><br /></div>
<div>1) Could this chip run CCL=3F</div>
<div><br /></div>
<div>2) Would it be worth the effort=3F</div>
<div><br /></div>
<div>I think <b>yes</b> on both fronts. A lot of embedded code is truly m=
odest, so a small heap is useful enough. This is the arena where microPyt=
hon shines=E2=80=94itself sporting a garbage collector.&=23160;</div>
<div><br /></div>
<div>3) Does anyone want to try=3F</div>
<div><br /></div>
<div>CCL already has 32-bit ARM support. There is no OS interfacing work =
to do here (only work to make up for the <i>lack</i> of OS).&=23160;</div=
>
<div><br /></div>
<div>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. =46irst get it working from a serial port console (over Bluetoot=
h maybe=3F) and focus on embedded applications. Slash and burn the rest, =
at least for starters.&=23160;</div>
<div><br id=3D=22lineBreakAtBeginningOfSignature=22 />
<div dir=3D=22ltr=22>--Tim</div>
<div dir=3D=22ltr=22><br />
<blockquote type=3D=22cite=22>On Jul 28, 2024, at 01:32, R. Matthew Emers=
on &lt;rme=40clozure.com&gt; wrote:<br />
<br /></blockquote>
</div>
<blockquote type=3D=22cite=22>
<div dir=3D=22ltr=22>=EF=BB=BF<span></span><br />
<span></span><br />
<blockquote type=3D=22cite=22><span>On Jul 27, 2024, at 8:23=E2=80=AFPM, =
Gr=C3=A9gory Vanuxem &lt;g.vanuxem=40gmail.com&gt; wrote:</span><br /></b=
lockquote>
<blockquote type=3D=22cite=22><span></span><br /></blockquote>
<blockquote type=3D=22cite=22><span>In =46riCAS &=23160;built on top of C=
lozure CL I obtain this output in a terminal (WSL2)</span><br /></blockqu=
ote>
<blockquote type=3D=22cite=22><span></span><br /></blockquote>
<blockquote type=3D=22cite=22><span>(gamma(x) =C3=83=C3=82=C2=A2=C3=83=C3=
=82=C3=83=C3=82 reals &amp;&amp; Re(x) &gt; 0) =7C=7C (x =C3=83=C3=82=C2=A2=
=C3=83=C3=82=C3=83=C3=82 integers &amp;&amp;</span><br /></blockquote>
<blockquote type=3D=22cite=22><span>gamma(x) =C3=83=C3=82=C2=A2=C3=83=C3=82=
=C3=83=C3=82 reals)</span><br /></blockquote>
<blockquote type=3D=22cite=22><span></span><br /></blockquote>
<blockquote type=3D=22cite=22><span>instead of (SBCL)</span><br /></block=
quote>
<blockquote type=3D=22cite=22><span></span><br /></blockquote>
<blockquote type=3D=22cite=22><span>(gamma(x) =E2=88=88 reals &amp;&amp; =
Re(x) &gt; 0) =7C=7C (x =E2=88=89 integers &amp;&amp; gamma(x) =E2=88=88 =
reals)</span><br /></blockquote>
<blockquote type=3D=22cite=22><span></span><br /></blockquote>
<blockquote type=3D=22cite=22><span>if I (print ...) a string with, for e=
xample, =E2=88=88, in a pure Clozure CL</span><br /></blockquote>
<blockquote type=3D=22cite=22><span>(recently git cloned) this is correct=
ly printed, no problem.</span><br /></blockquote>
<blockquote type=3D=22cite=22><span></span><br /></blockquote>
<blockquote type=3D=22cite=22><span>So I wonder if I have to modify the o=
utput stream character encoding</span><br /></blockquote>
<blockquote type=3D=22cite=22><span>or the output routine.</span><br /></=
blockquote>
<span></span><br />
<span>Check that the external format of the =46riCAS output stream is wha=
t you expect. In other words, if you pass an explicit :external-format ar=
gument to cl:open, make sure it matches what your terminal requires.</spa=
n><br />
<span></span><br />
<span>Doing (describe *terminal-io*) might show something interesting. He=
re=E2=80=99s what it shows for me:</span><br />
<span></span><br />
<span>=3F (describe *terminal-io*) &=23160;&=23160;&=23160;&=23160;&=2316=
0;</span><br />
<span>=23&lt;ECHOING-TWO-WAY-STREAM input =23&lt;BASIC-CHARACTER-INPUT-ST=
REAM UT=46-8 (TTY/0) =23x1824C7D6&gt;, output =23&lt;BASIC-CHARACTER-OUTP=
UT-STREAM UT=46-8 (TTY/1) =23x1824C2A6&gt; =23x1825=46BE6&gt;</span><br /=
>
<span>Class: =23&lt;STANDARD-CLASS ECHOING-TWO-WAY-STREAM&gt;</span><br /=
>
<span>Wrapper: =23&lt;CLASS-WRAPPER ECHOING-TWO-WAY-STREAM =23x18039A16&g=
t;</span><br />
<span>Instance slots</span><br />
<span>SHARED-RESOURCE: NIL</span><br />
<span>OPEN-P: T</span><br />
<span>INPUT-STREAM: =23&lt;BASIC-CHARACTER-INPUT-STREAM UT=46-8 (TTY/0) =23=
x1824C7D6&gt;</span><br />
<span>OUTPUT-STREAM: =23&lt;BASIC-CHARACTER-OUTPUT-STREAM UT=46-8 (TTY/1)=
 =23x1824C2A6&gt;</span><br />
<span></span><br />
<span>The default external format has been =23&lt;EXTERNAL-=46ORMAT :UT=46=
-8/:UNIX =23x18249C6E&gt; for quite a long time now.</span><br />
<span></span><br />
<span>https://ccl.clozure.com/docs/ccl.html=23characters-and-external-for=
mats</span><br />
<span></span><br />
<span></span><br />
<blockquote type=3D=22cite=22><span></span><br /></blockquote>
<blockquote type=3D=22cite=22><span>And more importantly, how can I achie=
ve that=3F</span><br /></blockquote>
<blockquote type=3D=22cite=22><span></span><br /></blockquote>
<blockquote type=3D=22cite=22><span>- Greg</span><br /></blockquote>
<blockquote type=3D=22cite=22><span></span><br /></blockquote>
<blockquote type=3D=22cite=22><span>PS:</span><br /></blockquote>
<blockquote type=3D=22cite=22><span>(1) -&gt; )lisp CCL:*DE=46AULT-EXTERN=
AL-=46ORMAT*</span><br /></blockquote>
<blockquote type=3D=22cite=22><span>Value =3D :UNIX</span><br /></blockqu=
ote>
<span></span><br />
<span></span><br /></div>
</blockquote>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</body>
</html>

--66a665ef_4653df05_3a45--