A Scheme Interpreter for ARM Microcontrollers:
ChangeLog for Snapshot 00.0225
Changes from snapshot 00.0215:
The source code of this snapshot is separated into multiple files in an
attempt to increase flexibility (see the common/ sub-directory for details).
Important bugs in the floating point component of snapshot 00.0215
(and 00.0186) have been fixed.
This includes the behavior of inexact->exact with 0. as input argument
and comparison operators, such as less-than and greater-than (and likely
max and min as well) that produced erroneous results for floats
in 00.0186 and 00.0215 because of sign-testing code that was removed
when transitioning from snapshot 00.0171 to 00.0186.
A bug related to rational and complex numbers that could affect macro expansion
has been fixed (related tests were added, eg. to subsz8:, in the form of the
Treatment of special cases (0, inf, nan) has been improved in
Taylor-series based arithmetic functions.
Exact versions of inf and nan are now available in the form of 1/0,
-1/0 and 0/0 (eg. (inexact->exact (/ 100. 0.)) -> 1/0).
Modulo, remainder, gcd and lcm have been updated to work with
rationals following srfi-70.
Logior, logand and logxor now work with more than 2 input arguments if
provided (like +, *, ...).
The parser has been improved to properly read the most negative integer
(-536870912) and to exercise more care when reading characters that might
extend past the end of a proper expression.
Basic bytevector functionality is now implemented in the form of the
five functions: 'bytevector?, 'make-bytevector, 'bytevector-length, 'bytevector-u8-ref
The garbage collector has been improved to properly treat empty sized
objects (vector, string, bytevector) that are shared between several
other objects (eg. as a result of (make-vector 2 (vector))).
The built-in variable 'version is now bound to the symbol '00.0225
rather than to a thunk that returns this symbol.
A function named _BIE has been added.
With no input argument it returns the built-in environment
(which includes the built-in object array, or obarray).
If called with an input argument, that argument has to be a
properly formatted built-in environment and the function sets
the armpit scheme built-in environment to that input argument.
A built-in environment is a vector of built-in-environment-vectors.
Each built-in-environment-vector consists of a sequence of symbols'
and their values in the form #(sym1 val1 sym2 val2 ...).
The symbols' IDs are determined implicitly by their position in the
built-in-environment-vector and by the position of that vector
in the built-in environment (also a vector).
The objective is to make it possible to add primitives and/or built-in
objects to a running
system from code and data stored in library flash (for example).
Indices in the built-in environment can run from 0 to 126
and those of built-in-environment-vectors can run from 0 to 509
for a theoretical maximum of (* 127 255) -> 32385 built-in symbols
(collisions occur beyond these limits).
This is in addition to symbols defined dynamically by the user
(indexed in the user obarray).
In this snapshot, port models are available to the user
(bound at index 2 in the built-in environment:
(vector-ref (_BIE) 2)).
They are named FILE, MEM, UAR0, UAR1, USB, I2C0 and I2C1 (on supported MCUs).
The port models are vectors containing 3 items:
1) the base address of the port (shifted right by 4 bits);
2) the input port-vector, and;
3) the output port-vector for the port.
This is meant to make it easier to copy the functionality of existing
ports in user-defined ports.
Variables _IPR and _OPR have been removed (use (vector-ref UAR0 1)
and (vector-ref UAR0 2) instead).
The functions 'read and 'write have been extended to allow reading and writing
the first 4 octets of a byytevector from/to a memory port.
To do this, the offset is specified as a negative integer and all offsets
are internally forced to 4-byte alignment such that (read address -1), for example,
where address is the 4-bit-shifted address of a register or non-heap object,
returns a bytevector (little-endian) of the 32-bit content of the specified address.
Conversely, as with previous versions and snapshots, (read address 0) returns the
content of the memory location as a scheme integer (i.e. with the top 2 bits shifted out).
An example use of this functionality could be to write the address of the screen buffer
(located above-heap) to the LCD controller (register) on the LPC2478-STK.
Future snapshots of Armpit Scheme might possibly include arithmetic and logical operations
that work with 4-octect-long bytevectors to ease the manipulation of full 32-bit data.
The function 'pack now returns a bytevector (replaces the former piclosure datatype).
The function 'unpack, unpacks a bytevector representing a packed object
to the heap, above the heap or
into library flash depending on the value of its 2nd input argument (null,
0+ or negative, respectively).
Pack can now be used to re-pack a packed object and unpack can be re-applied
several times to the result of unpacking an object (provided unpacking produced
a packed object).
The function 'install has been removed (superseded by unpack).
Libraries (for MCUs with sufficient FLASH space from which code can run,
i.e. not the LPC2103, LPC2131, LPC2888, CS-EP93xx, S3C24xx or OMAP35xx)
are now to be formatted and managed by the user with the help of the 'flib
thunk that returns the lowest address currently used by library flash
(i.e. the latest item written to library flash).
The 'load-lib function loads a library in the format defined in snapshot
00.0215 but the current version allows for more flexibility of format and
for corresponding user-defined management functions.
It is possible, for example, to attach libraries to the built-in environment
in this snapshot.
FLASH libraries are not loaded automatically on boot in this release.
The 'erase function has been extended to allow either all file flash,
all library flash, or a single sector of flash, to be erased based on the
value of its input argument (null-list/no-argument, negative, or sector start address shifted
right by 4 bits, respectively).
A new function, 'fpgw, also makes it possible to write the contents of a bytevector
(pointed to from a pseudo file-descriptor) to an arbitray flash page.
A single (8-bit) tag is now used in the internal representation of primitives,
procedures, continuations and compiled objects.
Additional bits (beyond the 8-bit tag) are used to differentiate
these objects and, in the case of primitives, to indicate the number of input arguments
and whether the primitive is of syntax type.
The printed representation of these objects has also been shortened slightly.
The size of the READBUFFER has been increased to 1KB on the smallest MCUs
and to a minium of 2KB on others (eg. see mcu_specific/LPC_2000/TINY_2131.h).
On Cortex-M3 MCUs, a bug in the read-char function for memory input ports
has been fixed.
On LPC 2000 MCUs, a bug whereby In-Application-Programming (IAP, flash writing)
mangled the _ISR vector has been fixed.
Assembly switches at the top of armpit_00.0225.s have been modified.
All version now use macro implementations of let, let*, and, or...
The small MCU version (24KB flash image) now uses integers only (no
floats, rationals or complex) and excludes the i2c subsystem.
Miscellaneous other source code adjustments have been performed to
maintain or enhance the compact size, functionality and performance
of the system.
Where appropriate, program examples are under development to
illustrate the application of the new features described above.
Last updated May 29, 2010