Keith Packard [Sun, 19 Feb 2017 06:53:03 +0000 (22:53 -0800)]
altos/stmf0: Complain if the SPI configuration isn't complete
If the pin usage values SPI_1_PA5_PA6_PA7 or SPI_1_PB3_PB4_PB5 aren't
defined, then the speed values for the pins aren't going to get set
correctly, which results in erratic SPI behaviour.
Keith Packard [Fri, 3 Feb 2017 05:51:11 +0000 (06:51 +0100)]
altos/stmf0: Allow apps to leave interrupt vectors at 0
TeleMini v3.0 doesn't need a boot loader, so we'll have the app run
its interrupt vector right at the bottom of the address space instead
of copying it to the bottom of ram and reconfiguring the chip to use that.
Keith Packard [Sun, 19 Feb 2017 06:46:29 +0000 (22:46 -0800)]
ao-bringup: test-chaoskey needs to use the SerialNumber dmesg line
I had a locally hacked kernel which was reporting the serial number
along with the device name. Instead of depending on that, just look
for the regular SerialNumber report which is in all kernel versions
Keith Packard [Sun, 22 Jan 2017 23:29:13 +0000 (15:29 -0800)]
altos/chaoskey: use both halves of the CRC
When pulling 16 bits from the 32-bit crc, instead of just using the
low bits, xor the two halves together. This appears to even out the
number of zero and one bits.
Keith Packard [Sat, 19 Nov 2016 06:41:46 +0000 (22:41 -0800)]
altos/lisp: Sort frames by atom
Fortunately, the collector always retains the relative order between
addresses, so we can sort based on the atom address itself. This
reduces the time spent looking for names in larger (e.g. global)
frames.
Keith Packard [Wed, 16 Nov 2016 22:12:59 +0000 (14:12 -0800)]
altos/lisp: Eliminate compiler warning about array bounds at -O3
Using ao_lisp_pool - 4 caused the compiler to whinge about computing
an address outside the bounds of the array. Sigh. Restructure the code
to do the adjustment-by-4 in the integer computations instead of the
pointer ones.
Keith Packard [Wed, 16 Nov 2016 20:34:14 +0000 (12:34 -0800)]
altos/lisp: Add incremental collection
Realizing that long-lived objects will eventually float to the bottom
of the heap, I added a simple hack to the collector that 'remembers'
the top of the heap the last time a full collect was run and then runs
incremental collects looking to shift only objects above that
boundary. That doesn't perfectly capture the bounds of transient
objects, but does manage to reduce the amount of time spent not moving
persistent objects each time through the collector.
Keith Packard [Wed, 16 Nov 2016 04:21:47 +0000 (20:21 -0800)]
altos/lisp: Allow macro/nlambda/lexpr to have multiple args
Entries from the params are bound to the formals with whatever
remaining formals there are bound to the last argument as a list.
This makes writing functions a bit easier.
Keith Packard [Wed, 16 Nov 2016 04:18:59 +0000 (20:18 -0800)]
altos/lisp: re-use small frames
This saves a pile more use of the allocator by noting when frames have
not been referenced from another frame and freeing them when they go
out of scope. Frames with references are left to the allocator to deal
with.
Keith Packard [Tue, 15 Nov 2016 03:55:36 +0000 (19:55 -0800)]
altos/lisp: Simplify GC a bit by only marking the head of each object
We don't need to mark the whole object now as we're getting
information about where objects are by walking the tree each time
around the loop; ao_lisp_busy is only useful for terminating the walk
now.
Keith Packard [Sat, 12 Nov 2016 05:16:09 +0000 (21:16 -0800)]
altos/lisp: Add save/restore infrastructure. Needs OS support to work.
This sticks a few globals past the end of the heap and then asks the
OS to save the heap. On restore, the heap is re-populated by the OS
and then various global variables reset.
Keith Packard [Sat, 12 Nov 2016 05:11:13 +0000 (21:11 -0800)]
altos/lisp: Make sure memmove only happens once per object. Other GC fixes
The memmove may be overlapping, so make sure it happens only once by
just checking whether move_size has been set, rather than looking at
ao_lisp_moving; that doesn't get set when moving a noted cons as that
still needs to be walked at a later time.
Fix up the various looping move functions to all use the same
pattern. Atom was busted.
Keith Packard [Fri, 11 Nov 2016 07:29:21 +0000 (23:29 -0800)]
altos/lisp: Deal with memory compation in the middle of operations
Handle memory compaction in places where we've got pointers into the
heap across an allocation operation. Either re-compute the values from
managed global references or add new roots across the allocation.
Keith Packard [Wed, 9 Nov 2016 19:13:58 +0000 (11:13 -0800)]
altos/lisp: macros appear to work now
Needed an extra stack frame to stash the pre-macro state. This
simplified macro processing quite a bit; a macro now just evaluates
the function and then sends that result to be evaluated again.
Keith Packard [Sat, 5 Nov 2016 21:51:58 +0000 (14:51 -0700)]
altos/lisp: Change GC move API
Pass reference to move API so it can change the values in-place, then
let it return '1' when the underlying object has already been moved to
shorten GC times.
Keith Packard [Thu, 3 Nov 2016 05:56:01 +0000 (22:56 -0700)]
altos/lisp: Separate out values from atoms
This enables changing values of atoms declared as constants, should
enable lets, and with some work, even lexical scoping.
this required changing the constant computation to run
ao_lisp_collect() before dumping the block of constant data, and that
uncovered some minor memory manager bugs.
Keith Packard [Wed, 2 Nov 2016 04:14:45 +0000 (21:14 -0700)]
altos/lisp: Change lisp objects to use ao_poly everywhere. Add const
This makes all lisp objects use 16-bit ints for references so we can
hold more stuff in small amounts of memory. Also adds a separate
constant pool of lisp objects for builtins, initial atoms and constant
lisp code.
Keith Packard [Sun, 18 Dec 2016 04:58:36 +0000 (20:58 -0800)]
altos/arm: Align data so that gcc 5.4 doesn't do byte-accesses. Add -Wcast-align
Gcc 5.4.1 tracks alignment of data through assignments, so that a
uint32_t pointer which comes from byte-aligned uint8_t data:
extern uint8_t foo[];
uint32_t *q = (void *) foo;
Fetches and stores through this pointer are done bytewise. This is
slow (meh), but if q references a device register, things to bad very
quickly.
This patch works around this bug in the compiler by adding
__attribute__((aligned(4))) tags to some variables, or changing them
from uint8_t to uint32_t. Places doing this will now be caught as I've
added -Wcast-align to the compiler flags. That required adding (void
*) casts, after the relevant code was checked to make sure the
compiler could tell that the addresses were aligned.