Attempting to add pico-ice to website.

This commit is contained in:
Brad Nelson
2023-12-08 18:36:26 -08:00
parent 7f49b3503d
commit 7ec27fbeef
9 changed files with 412 additions and 167 deletions

View File

@ -323,6 +323,7 @@ On boot, ESP32forth configures PIN 2 (typically an LED) to be an output and brin
<h3>ESP32forth Specific Words</h3>
{{COMMON}}
{{FILES_COMMON}}
{{POSIX_COMMON}}
<h3>ESP32forth Bindings</h3>

View File

@ -46,43 +46,6 @@ REMAINING ( -- n ) Bytes remaining in Forth heap.
DUMP-FILE ( data data# fn fn# -- ) Write contents of a file throws on error.
</pre>
<h5>Shell Utilities</h5>
<p><b>Requires v7.0.7.3+ -- ONLY Posix + ESP32</b></p>
<pre>
cp ( "src" "dst" -- ) Copy "src" file to "dst".
mv ( "src" "dst" -- ) Rename "src" file to "dst".
rm ( "path" -- ) Remove "path" file.
touch ( "path" -- ) Create "path" file if it doesn't exist.
cat ( "path" -- ) Print contents of "path" file.
ls ( "path" -- ) List files or directories in "path".
</pre>
<p><b>Requires v7.0.7.3+ -- ONLY Posix</b></p>
<pre>
cd ( "path" -- ) Change director to "path".
mkdir ( "path" -- ) Create directory "path".
rmdir ( "path" -- ) Remove directory "path".
pwd ( -- ) Print current directory.
</pre>
<h5>Visual Editor</h5>
<p><b>Requires v7.0.7.2+</b></p>
<pre>
VISUAL EDIT ( "path" --) Enters a visual editor opening file "path".
NOTE: On ESP32 requires connection over an ANSI serial terminal like Putty.
LIMITATIONS: Terminal doesn't know screen dimensions
and is very redraw inefficient.
Keys:
Ctrl-S -- Save now.
Ctrl-X / Ctrl-Q -- Quit, asking Y/N to save.
Ctrl-L -- Redraw the screen.
Backspace -- Delete a character backwards.
Arrow Keys -- Movement.
PgUp/PgDn -- Scroll up/down a page.
</pre>
<h5>Vocabularies</h5>
<p>
{{FORTH}} uses a hybrid of Forth-79 and Forth-83 style vocabularies.
@ -127,73 +90,6 @@ DEFINED? ( "name" -- xt|0 ) Check if a word exists (works at compile time too).
[THEN] ( -- ) Interpret time THEN.
</pre>
<h5>Blocks</h5>
<pre>
USE ( "name" -- ) Use "name" as the blockfile, e.g. USE /spiffs/foo
OPEN-BLOCKS ( a n -- ) Open a file as the block file
LOAD ( n -- ) Evaluate a block
THRU ( a b -- ) Load blocks a thru b
LIST ( n -- ) List a block
BLOCK ( n -- a ) Get a 1024 byte block
BUFFER ( n -- a ) Get a 1024 byte block without regard to old contents
UPDATE ( -- ) Mark the last block modified
FLUSH ( -- ) Save and empty all buffers
EMPTY-BUFFERS ( -- ) Empty all buffers
SAVE-BUFFERS ( -- ) Save all buffers
SCR ( -- a ) Pointer to last listed block
</pre>
<h5>Block Editor</h5>
These words are available inside the <code>EDITOR</code> vocabulary.
Note the block editor places newlines in the 63rd column of each line
to make the block file readable in a text editor.
<pre>
WIPE ( -- ) Blank out the current block
L ( -- ) List the current block
D ( n -- ) Delete a line in the current block
E ( n -- ) Clear a line in the current block
R ( n "text" -- ) Replace a line in the current block
A ( n "text" -- ) Add (insert) a line in the current block
P ( -- ) Move to the previous block
N ( -- ) Move to the next block
</pre>
<h5>Sockets</h5>
<p><b>Requires v7.0.7.2+ for UDP</b></p>
These words are available inside the <code>sockets</code> vocabulary.
<pre>
socket ( domain type protocol -- sock/err )
setsockopt ( sock level optname optval optlen -- 0/err )
bind ( sock addr addrlen -- 0/err )
listen ( sock connections -- 0/err )
sockaccept ( sock addr addrlen -- sock/err ) -- varies from bsd socks
connect ( sock addr addrlen -- 0/err )
select ( numfds readfds writefds errfds timeout -- fd/err )
poll ( pollfds n timeout -- fd/err )
send ( sock a n flags -- n/err )
sendto ( sock a n flags addr addrlen -- n/err )
sendmsg ( sock msg flags -- n/err )
recv ( sock a n flags -- n/err )
recvfrom ( sock a n flags addr addrlen -- n/err )
recvmsg ( sock msg flags -- n/err )
gethostbyname ( hostnamez -- hostent/0 )
errno ( -- err ) -- ESP32 only as of v7.0.7.2
sockaddr ( "name" -- ) creates a sockaddr structure
-&gt;port@ ( a -- n ) get port from sockaddr
-&gt;port! ( n a -- ) set port in sockaddr
-&gt;addr@ ( a -- n ) get big-endian address from sockaddr
-&gt;addr! ( n a -- ) set big-endian address in sockaddr
ip. ( n -- ) Print address as x.y.z.w IP address.
( Constants )
SOCK_STREAM SOCK_DGRAM SOCK_RAW
AF_INET
sizeof(sockaddr_in)
SOL_SOCKET
SO_REUSEADDR
</pre>
<h5>Floating-Point</h5>
<p><b>Requires v7.0.6.5+</b></p>
<p>
@ -290,58 +186,3 @@ Capabilities and limitations:
<li>The low level ANSForth word <code>(LOCAL)</code> is also supported.</li>
</ul>
</p>
<p>
</p>
<h5 id="dictimages">Dictionary Images and Startup</h5>
<p>
<b>WARNING: Danger ahead.</b><br/>
Snapshotting the dictionary may not be stable across reinstallations of the C build of Forth.
</p>
<p>
A collection of non-standard words is provided that allow snapshotting
the dictionary and restoring it at startup, with a start word.
</p>
<pre>
SAVE ( "name" -- ) Saves a snapshot of the current dictionary to a file.
RESTORE ( "name" -- ) Restore a snapshot from a file.
REMEMBER ( -- ) Save a snapshot to the default file
(./myforth or /spiffs/myforth on ESP32).
STARTUP: ( "name" -- ) Save a snapshot to the default file arranging for
"name" to be run on startup.
REVIVE ( -- ) Restore the default filename.
RESET ( -- ) Delete the default filename.
</pre>
<p>
Here's an example usage:
</p>
<pre>
: welcome ." Hello!" cr 100 0 do i . loop cr ;
startup: welcome
bye
( Next boot will run a custom startup message )
reset
( Reset removes the custom message )
</pre>
<p>
The <code>INTERNALS</code> vocabulary has some additional words
for more control.
</p>
<pre>
SAVE-NAME ( a n -- ) Save a snapshot if the current vocabulary to a file.
RESTORE-NAME ( a n -- ) Restore a snapshot from a file.
'COLD ( -- a ) Address of the word that will be run on startup.
REMEMBER-FILENAME ( -- a n ) Deferred word specifying the platform specific
default snapshot filename.
</pre>

174
site/files_common.html Normal file
View File

@ -0,0 +1,174 @@
<!--
Copyright 2021 Bradley D. Nelson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<h5>Shell Utilities</h5>
<p><b>Requires v7.0.7.3+ -- ONLY Posix + ESP32</b></p>
<pre>
cp ( "src" "dst" -- ) Copy "src" file to "dst".
mv ( "src" "dst" -- ) Rename "src" file to "dst".
rm ( "path" -- ) Remove "path" file.
touch ( "path" -- ) Create "path" file if it doesn't exist.
cat ( "path" -- ) Print contents of "path" file.
ls ( "path" -- ) List files or directories in "path".
</pre>
<p><b>Requires v7.0.7.3+ -- ONLY Posix</b></p>
<pre>
cd ( "path" -- ) Change director to "path".
mkdir ( "path" -- ) Create directory "path".
rmdir ( "path" -- ) Remove directory "path".
pwd ( -- ) Print current directory.
</pre>
<h5>Visual Editor</h5>
<p><b>Requires v7.0.7.2+</b></p>
<pre>
VISUAL EDIT ( "path" --) Enters a visual editor opening file "path".
NOTE: On ESP32 requires connection over an ANSI serial terminal like Putty.
LIMITATIONS: Terminal doesn't know screen dimensions
and is very redraw inefficient.
Keys:
Ctrl-S -- Save now.
Ctrl-X / Ctrl-Q -- Quit, asking Y/N to save.
Ctrl-L -- Redraw the screen.
Backspace -- Delete a character backwards.
Arrow Keys -- Movement.
PgUp/PgDn -- Scroll up/down a page.
</pre>
<h5>Blocks</h5>
<pre>
USE ( "name" -- ) Use "name" as the blockfile, e.g. USE /spiffs/foo
OPEN-BLOCKS ( a n -- ) Open a file as the block file
LOAD ( n -- ) Evaluate a block
THRU ( a b -- ) Load blocks a thru b
LIST ( n -- ) List a block
BLOCK ( n -- a ) Get a 1024 byte block
BUFFER ( n -- a ) Get a 1024 byte block without regard to old contents
UPDATE ( -- ) Mark the last block modified
FLUSH ( -- ) Save and empty all buffers
EMPTY-BUFFERS ( -- ) Empty all buffers
SAVE-BUFFERS ( -- ) Save all buffers
SCR ( -- a ) Pointer to last listed block
</pre>
<h5>Block Editor</h5>
These words are available inside the <code>EDITOR</code> vocabulary.
Note the block editor places newlines in the 63rd column of each line
to make the block file readable in a text editor.
<pre>
WIPE ( -- ) Blank out the current block
L ( -- ) List the current block
D ( n -- ) Delete a line in the current block
E ( n -- ) Clear a line in the current block
R ( n "text" -- ) Replace a line in the current block
A ( n "text" -- ) Add (insert) a line in the current block
P ( -- ) Move to the previous block
N ( -- ) Move to the next block
</pre>
<h5>Sockets</h5>
<p><b>Requires v7.0.7.2+ for UDP</b></p>
These words are available inside the <code>sockets</code> vocabulary.
<pre>
socket ( domain type protocol -- sock/err )
setsockopt ( sock level optname optval optlen -- 0/err )
bind ( sock addr addrlen -- 0/err )
listen ( sock connections -- 0/err )
sockaccept ( sock addr addrlen -- sock/err ) -- varies from bsd socks
connect ( sock addr addrlen -- 0/err )
select ( numfds readfds writefds errfds timeout -- fd/err )
poll ( pollfds n timeout -- fd/err )
send ( sock a n flags -- n/err )
sendto ( sock a n flags addr addrlen -- n/err )
sendmsg ( sock msg flags -- n/err )
recv ( sock a n flags -- n/err )
recvfrom ( sock a n flags addr addrlen -- n/err )
recvmsg ( sock msg flags -- n/err )
gethostbyname ( hostnamez -- hostent/0 )
errno ( -- err ) -- ESP32 only as of v7.0.7.2
sockaddr ( "name" -- ) creates a sockaddr structure
-&gt;port@ ( a -- n ) get port from sockaddr
-&gt;port! ( n a -- ) set port in sockaddr
-&gt;addr@ ( a -- n ) get big-endian address from sockaddr
-&gt;addr! ( n a -- ) set big-endian address in sockaddr
ip. ( n -- ) Print address as x.y.z.w IP address.
( Constants )
SOCK_STREAM SOCK_DGRAM SOCK_RAW
AF_INET
sizeof(sockaddr_in)
SOL_SOCKET
SO_REUSEADDR
</pre>
<p>
</p>
<h5 id="dictimages">Dictionary Images and Startup</h5>
<p>
<b>WARNING: Danger ahead.</b><br/>
Snapshotting the dictionary may not be stable across reinstallations of the C build of Forth.
</p>
<p>
A collection of non-standard words is provided that allow snapshotting
the dictionary and restoring it at startup, with a start word.
</p>
<pre>
SAVE ( "name" -- ) Saves a snapshot of the current dictionary to a file.
RESTORE ( "name" -- ) Restore a snapshot from a file.
REMEMBER ( -- ) Save a snapshot to the default file
(./myforth or /spiffs/myforth on ESP32).
STARTUP: ( "name" -- ) Save a snapshot to the default file arranging for
"name" to be run on startup.
REVIVE ( -- ) Restore the default filename.
RESET ( -- ) Delete the default filename.
</pre>
<p>
Here's an example usage:
</p>
<pre>
: welcome ." Hello!" cr 100 0 do i . loop cr ;
startup: welcome
bye
( Next boot will run a custom startup message )
reset
( Reset removes the custom message )
</pre>
<p>
The <code>INTERNALS</code> vocabulary has some additional words
for more control.
</p>
<pre>
SAVE-NAME ( a n -- ) Save a snapshot if the current vocabulary to a file.
RESTORE-NAME ( a n -- ) Restore a snapshot from a file.
'COLD ( -- a ) Address of the word that will be run on startup.
REMEMBER-FILENAME ( -- a n ) Deferred word specifying the platform specific
default snapshot filename.
</pre>

View File

@ -61,9 +61,10 @@ limitations under the License.
<h2>µEforth</h2>
<h3>µEforth Specific Words</h3>
<h3>µEforth Words</h3>
{{COMMON}}
{{FILES_COMMON}}
{{POSIX_COMMON}}
<h3>Linux</h3>

View File

@ -19,6 +19,7 @@ limitations under the License.
<span><a href="https://eforth.appspot.com/web.html">Web</a></span>
<span><a href="https://eforth.appspot.com/linux.html">Linux</a></span>
<span><a href="https://eforth.appspot.com/windows.html">Windows</a></span>
<span><a href="https://eforth.appspot.com/pico-ice.html">pico-ice</a></span>
<span><a href="https://eforth.appspot.com/internals.html">Internals</a></span>
<span><a href="https://eforth.appspot.com/classic.html">Classic</a></span>
</div>

184
site/pico-ice.html Normal file
View File

@ -0,0 +1,184 @@
<!DOCTYPE html>
<!--
Copyright 2023 Bradley D. Nelson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<head>
{{HEAD}}
<title>pico-ice</title>
</head>
<body>
<h1>pico-ice</h1>
{{MENU}}
<div class="wrapper">
<h2>Download</h2>
<h3>Beta Release</h3>
<p>
<a href="https://eforth.storage.googleapis.com/releases/ueforth-pico-ice-{{VERSION}}.zip">ueforth-pico-ice-{{VERSION}}.zip</a><br/>
<i>Version: {{VERSION}} (Beta)</i>
</p>
<hr/>
<p>
<a href="https://eforth.storage.googleapis.com/releases/archive.html" target="_blank">Release Archive</a>
- Prior Releases
</p>
<p>
<a href="https://github.com/flagxor/ueforth" target="_blank">http://github.com/flagxor/ueforth</a>
- Complete Unprocessed Source Code
</p>
<h2>License</h2>
<p>
<b>
NOTE: Although ueforth is licensed under Apache 2.0,
please be aware that binaries are built with SDKs that include other licenses including
<a href="https://github.com/tinyvision-ai-inc/pico-ice-sdk/blob/main/LICENSE.md">MIT</a>,
<a href="https://github.com/raspberrypi/pico-sdk/blob/master/LICENSE.TXT">Raspberry Pi License</a>,
and possibly others.
<u>Be sure to consult a lawyer before using for comercial purposes.</u>
</b>
</p>
<hr/>
<pre>
Copyright 2023 Bradley D. Nelson
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
<a target="_blank" href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
</pre>
<h2>Install</h2>
<p>
<ul>
<li>Connect your pico-ice to USB.</li>
<li>Connect the USB_BOOT pin to ground.</li>
<li>Press reset.</li>
<li>Copy the ueforth-pico-ice.uf2 to the mounted drive.</li>
</ul>
<br/>
<img src="https://pico-ice.tinyvision.ai/images/pico_ice_reset_button.jpg" width="300" height="auto">
<br/>
<a href="https://pico-ice.tinyvision.ai/programming_the_mcu.html">See detailed instructions for MCU programming</a>
</p>
<h2>Use</h2>
<p>
Initially µEforth can be interacted with over a serial port (over USB).
One popular option is to use the serial port option on
<a href="https://www.putty.org/">PuTTY</a>.
Be sure to config the serial port to: <code>baud rate = 115200, data bits = 8, stop bits = 1, and parity = N</code>.
</p>
<h2>pico-ice Features</h2>
<h3>pico-ice Words</h3>
{{COMMON}}
<h3>pico-ice Bindings</h3>
<h5>Allocation</h5>
These words are inside the <code>internals</code> vocabulary.
<pre>
MALLOC ( n -- a | 0 ) System malloc
SYSFREE ( a -- ) System free
REALLOC ( a n -- a | 0 ) System realloc
</pre>
<h5>System</h5>
<pre>
MS ( n -- ) Pause for some number of milliseconds.
MS-TICKS ( -- n ) Time since start in milliseconds.
TERMINATE ( n -- ) Call system exit.
</pre>
<h5>Files</h5>
<pre>
R/O ( -- mode )
R/W ( -- mode )
W/O ( -- mode )
BIN ( mode -- mode )
CLOSE-FILE ( fh -- ior )
OPEN-FILE ( a n mode -- fh ior )
CREATE-FILE ( a n mode -- fh ior )
DELETE-FILE ( a n -- ior )
WRITE-FILE ( a n fh -- ior )
READ-FILE ( a n fh -- n ior )
FILE-POSITION ( fh -- n ior )
REPOSITION-FILE ( n fh -- ior )
FILE-SIZE ( fh -- n ior )
</pre>
<h5>ice</h5>
These words are inside the <code>ice</code> vocabulary.
See <a href="https://pico-ice.tinyvision.ai/pico_ice_sdk.html">here</a>
for details on the underlying SDK.
<pre>
ice_cram_open ( -- ) Open FPGA config RAM connection.
ice_cram_write ( a n -- ) Write bytes to the FPGA config RAM connection.
ice_cram_close ( -- ) Close FPGA config RAM connection.
ICE_FLASH_PAGE_SIZE ( -- n ) Get the size of a flash page.
ice_flash_init ( -- ) Init flash connection.
ice_flash_read ( addr a n -- ) Read from a flash address to a buffer.
ice_flash_erase_sector ( n -- ) Erase a flash sector.
ice_flash_program_page ( addr a -- ) Program a flash page.
ice_flash_erase_chip ( -- ) Erase whole flash.
ice_flash_wakeup ( -- ) Wakeup flash.
ice_flash_sleep ( -- ) Put flash in sleep mode.
ice_fpga_init ( n -- ) Init FPGA to a clock speed in MHz.
Valid inputs: 1, 2, 3, 4, 6, 8, 12, 16, 24, 48
ice_fpga_start ( -- ) Start FPGA.
ice_fpga_stop ( -- ) Stop FPGA.
ice_led_init ( -- ) Initialize LED.
ice_led_red ( f -- ) Set on/off state of led red channel.
ice_led_green ( f -- ) Set on/off state of led green channel.
ice_led_blue ( f -- ) Set on/off state of led blue channel.
ice_spi_init ( -- ) Initialize SPI.
ice_spi_init_cs_pin ( cs_pin active_high -- ) Init selecting more options.
ice_spi_chip_select ( n -- ) Set csn_pin to assert.
Also set the SPI TX and SCK pins to output/drive mode,
and keeps the RX pin to input/high-z mode.
ice_spi_chip_deselect ( n -- ) Set csn_pin to assert.
Also set the SPI TX and SCK pins back to input/high-z mode.
ice_spi_read_blocking ( a n -- ) Read from SPI into buffer.
ice_spi_write_blocking ( a n -- ) Write to SPI from buffer.
ice_sram_init ( -- ) Initialize SRAM.
ice_sram_get_id ( a -- ) Read SRAM id into 8 byte buffer.
ice_sram_read_blocking ( addr a n -- ) Read from address in SRAM to memory.
ice_sram_write_blocking ( addr a n -- ) Write from memory to SRAM.
</pre>

View File

@ -67,9 +67,10 @@ limitations under the License.
<h2>µEforth</h2>
<h3>µEforth Specific Words</h3>
<h3>µEforth Words</h3>
{{COMMON}}
{{FILES_COMMON}}
<h3>Windows</h3>