Keith Packard [Thu, 2 Mar 2017 21:37:12 +0000 (13:37 -0800)]
ao-tools/ao-flash-lpc: Adapt to current openocd LPC support
Openocd 0.9.0 has generalized the lpc11xx support for all lpc11xx
processors, not just the lpc11u14. This replaces the specific
lpc11u14.cfg with the general lpc11xx.cfg file.
Unlike the build we were using, this doesn't adjust the
'verify' command to adapt for the checksum which gets added during the
flashing process. Hence, we disable verification and trust that if the
flash loader works to load the OS, it's fine.
Keith Packard [Sun, 20 Nov 2016 10:59:40 +0000 (02:59 -0800)]
altos/stm: Allow use basepri instead of primask for masking interrupts
This allows for high priority interrupts (priority 0) to run, even
when other interrupts are blocked. Code executing in such interrupt
handlers must not attempt to control task execution as that will race
with the scheduler.
Select this by defining AO_NONMASK_INTERRUPT in ao_pins.h.
non-maskable interrupt priority is AO_STM_NVIC_NONMASK_PRIORITY
Keith Packard [Mon, 21 Nov 2016 04:54:10 +0000 (20:54 -0800)]
altos/stm: Interrupt priority is in the upper bits of the priority mask
Because the STM32L only offers 16 priority levels, the bottom four
bits of each priority mask are not used. All of the interrupt priority
settings in the system were using values < 16, making them all
effectively the same. Fix that by moving them into the upper 4 bits
and using symbolic constants everywhere.
Keith Packard [Mon, 21 Nov 2016 04:56:01 +0000 (20:56 -0800)]
altos: Don't wait while idle if trying to minimize interrupt latency
Keeping the scanout running reasonably means keeping interrupt latency
constant, and that requires leaving the CPU running. Don't wait for
interrupts when the system is running in this mode.
Keith Packard [Fri, 6 Jan 2017 17:10:23 +0000 (09:10 -0800)]
ao-tools/ao-usbload: Pad image with 0xff instead of random bits
Clear the temporary block to 0xff before copying in the target data so
that any unused bytes end up being left at 0xff instead of inheriting
whatever data was in the block before.
Keith Packard [Mon, 20 Feb 2017 01:36:04 +0000 (17:36 -0800)]
altoslib: Add TeleMini v3 support
eeprom, telemetry and monitor idle. This is just like TeleMini v2,
except the ADC ranges are all difference as the voltage dividers are
different and the ADC itself has a different range.
Keith Packard [Fri, 3 Feb 2017 05:52:57 +0000 (06:52 +0100)]
altos/telemini-v3.0: Update to second prototype version
Separate radio xtal means we run the processor at 48MHz.
Fix the battery monitoring voltage divider resistor values.
Disable most of the code until we've got the radio working.
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.