fw/altos
3 years agoaltos/lisp: Optimize chunk searching in collect
Keith Packard [Wed, 16 Nov 2016 21:19:20 +0000 (13:19 -0800)]
altos/lisp: Optimize chunk searching in collect

Note range of existing chunks to exclude objects outside.
Only look at chunks which have been set to reduce loop cost.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Add incremental collection
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.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Make hanoi example output a bit prettier
Keith Packard [Wed, 16 Nov 2016 04:37:59 +0000 (20:37 -0800)]
altos/lisp: Make hanoi example output a bit prettier

Make the towers symmetrical instead of lopsided. Much nicer looking.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: remove nth from hanoi.lisp
Keith Packard [Wed, 16 Nov 2016 04:25:03 +0000 (20:25 -0800)]
altos/lisp: remove nth from hanoi.lisp

It's now in ROM.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lambdakey: Strip out unused code
Keith Packard [Wed, 16 Nov 2016 04:24:33 +0000 (20:24 -0800)]
altos/lambdakey: Strip out unused code

Make space for more lisp bits!

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Take advantage of multi-arg macros. Add more ROM funcs
Keith Packard [Wed, 16 Nov 2016 04:22:54 +0000 (20:22 -0800)]
altos/lisp: Take advantage of multi-arg macros. Add more ROM funcs

Added nth, or and and.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Allow macro/nlambda/lexpr to have multiple args
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.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Do better checking for un-evaluated macros in ROM
Keith Packard [Wed, 16 Nov 2016 04:20:14 +0000 (20:20 -0800)]
altos/lisp: Do better checking for un-evaluated macros in ROM

Need to look at immediate lambdas as well, and also deal with
recursive functions by checking for recursion at each atom
dereference.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: re-use small frames
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.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: remove duplicate 'length' lambda from hanoi example
Keith Packard [Tue, 15 Nov 2016 18:32:36 +0000 (10:32 -0800)]
altos/lisp: remove duplicate 'length' lambda from hanoi example

This function is now a builtin.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Get lambdakey and nucleo-32 building again
Keith Packard [Tue, 15 Nov 2016 18:18:12 +0000 (10:18 -0800)]
altos/lisp: Get lambdakey and nucleo-32 building again

Remove exti from the build list to make things fit.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Evaluate macros once, then smash them into place
Keith Packard [Tue, 15 Nov 2016 17:55:22 +0000 (09:55 -0800)]
altos/lisp: Evaluate macros once, then smash them into place

This assumes that macros are all pure functions, which should be true
for syntactic macros.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Add license to hanoi demo
Keith Packard [Tue, 15 Nov 2016 07:04:05 +0000 (23:04 -0800)]
altos/lisp: Add license to hanoi demo

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Improve hanoi demo
Keith Packard [Tue, 15 Nov 2016 05:27:41 +0000 (21:27 -0800)]
altos/lisp: Improve hanoi demo

Repaint in place, without first clearing. This makes the updates a lot
clealyer looking.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Show number of collect calls in ao_lisp_test
Keith Packard [Tue, 15 Nov 2016 05:27:03 +0000 (21:27 -0800)]
altos/lisp: Show number of collect calls in ao_lisp_test

This helps tune the allocator

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Cache freed cons and stack items
Keith Packard [Tue, 15 Nov 2016 05:25:38 +0000 (21:25 -0800)]
altos/lisp: Cache freed cons and stack items

Track freed cons cells and stack items from the eval process where
possible so that they can be re-used without needing to collect.

This dramatically reduces the number of collect calls.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Simplify GC a bit by only marking the head of each object
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.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Change GC to do moves in batches of 32
Keith Packard [Tue, 15 Nov 2016 02:45:12 +0000 (18:45 -0800)]
altos/lisp: Change GC to do moves in batches of 32

This should make it quite a bit faster than doing one at a time.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stmf0: Add a comment about the requirements for using ao_flash_stm
Keith Packard [Sat, 12 Nov 2016 07:38:03 +0000 (23:38 -0800)]
altos/stmf0: Add a comment about the requirements for using ao_flash_stm

Need HSI clock and the flashing functions loaded in ram.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lambdakey: Get save/restore working
Keith Packard [Sat, 12 Nov 2016 07:36:22 +0000 (23:36 -0800)]
altos/lambdakey: Get save/restore working

Need the HSI clock running for the flash hardware to work.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Append a CRC to the saved image to validate on restore
Keith Packard [Sat, 12 Nov 2016 07:34:54 +0000 (23:34 -0800)]
altos/lisp: Append a CRC to the saved image to validate on restore

The CRC is actually of the ROM bits, so we can tell if the restored
image relates to the currently running code.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Add save/restore to ao_lisp_test
Keith Packard [Sat, 12 Nov 2016 05:18:50 +0000 (21:18 -0800)]
altos/lisp: Add save/restore to ao_lisp_test

Allow testing of the save/restore code under Linux.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Add save/restore infrastructure. Needs OS support to work.
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.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Make sure memmove only happens once per object. Other GC fixes
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.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Make ao_lisp_ref and ao_lisp_poly non-inline
Keith Packard [Sat, 12 Nov 2016 05:07:09 +0000 (21:07 -0800)]
altos/lisp: Make ao_lisp_ref and ao_lisp_poly non-inline

These functions are pretty large and end up consuming quite a bit of
space if inlined everywhere they are used.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Share mark function for mark and move
Keith Packard [Fri, 11 Nov 2016 08:28:57 +0000 (00:28 -0800)]
altos/lisp: Share mark function for mark and move

These two operations both wanted to walk the referenced objects;
sharing is caring.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: add length, pack, unpack and flush
Keith Packard [Fri, 11 Nov 2016 08:28:31 +0000 (00:28 -0800)]
altos/lisp: add length, pack, unpack and flush

lots more builtins

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Add towers of hanoi example
Keith Packard [Fri, 11 Nov 2016 07:31:10 +0000 (23:31 -0800)]
altos/lisp: Add towers of hanoi example

Uses vt100 escape sequences to animate the display even.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Deal with memory compation in the middle of operations
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.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Improve lisp test program UI
Keith Packard [Fri, 11 Nov 2016 07:28:26 +0000 (23:28 -0800)]
altos/lisp: Improve lisp test program UI

Add a prompt for stdin, read from other files on command line before
stdin.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Make read() return eof atom on end of file
Keith Packard [Fri, 11 Nov 2016 07:25:56 +0000 (23:25 -0800)]
altos/lisp: Make read() return eof atom on end of file

Also make it an exception to hit eof in the middle of an sexpr.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: use regular read-eval-print loop for make const
Keith Packard [Fri, 11 Nov 2016 07:24:11 +0000 (23:24 -0800)]
altos/lisp: use regular read-eval-print loop for make const

No need to open code this sequence of operations.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: add progn, while, read and eval
Keith Packard [Thu, 10 Nov 2016 19:30:55 +0000 (11:30 -0800)]
altos/lisp: add progn, while, read and eval

Progn as a builtin will help with tail-recursion.
while provides for loops until tail-recursion works :-)
read and eval are kinda useful.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Clean up OS integration bits, add defun
Keith Packard [Thu, 10 Nov 2016 00:22:43 +0000 (16:22 -0800)]
altos/lisp: Clean up OS integration bits, add defun

Provide an abstraction for the OS interface so that it
can build more cleanly on Linux and AltOS. Add defun macro.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: macros appear to work now
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.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: working on lexical scoping
Keith Packard [Wed, 9 Nov 2016 17:14:50 +0000 (09:14 -0800)]
altos/lisp: working on lexical scoping

Not working yet

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lambdakey-v1.0: Tweak memory allocations
Keith Packard [Mon, 7 Nov 2016 05:47:31 +0000 (21:47 -0800)]
altos/lambdakey-v1.0: Tweak memory allocations

With non-recursive GC, more memory is available for the heap

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: convert GC to non-recursive
Keith Packard [Sun, 6 Nov 2016 18:53:46 +0000 (10:53 -0800)]
altos/lisp: convert GC to non-recursive

Use a boolean array to note cons cells which would otherwise recurse,
then loop until that array is empty.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: more GC issues. add patom
Keith Packard [Sun, 6 Nov 2016 00:53:15 +0000 (17:53 -0700)]
altos/lisp: more GC issues. add patom

Use global ao_lisp_stack instead of local stack so that gc
moves of that item work.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: make sure stack->formals_last gets moved during GC
Keith Packard [Sat, 5 Nov 2016 22:12:05 +0000 (15:12 -0700)]
altos/lisp: make sure stack->formals_last gets moved during GC

Failing this leads to broken formals chains

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Change GC move API
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.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: get builtin macros working again
Keith Packard [Fri, 4 Nov 2016 23:51:12 +0000 (16:51 -0700)]
altos/lisp: get builtin macros working again

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Start rewriting eval as state machine
Keith Packard [Fri, 4 Nov 2016 23:31:34 +0000 (16:31 -0700)]
altos/lisp: Start rewriting eval as state machine

Ad-hoc code was incomprehensible and I couldn't make 'cond' work, so
I'm starting over.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Add lambdakey
Keith Packard [Fri, 4 Nov 2016 04:51:26 +0000 (21:51 -0700)]
altos: Add lambdakey

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Add lambda support to lisp
Keith Packard [Fri, 4 Nov 2016 04:49:50 +0000 (21:49 -0700)]
altos: Add lambda support to lisp

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Separate out values from atoms
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.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: add set/setq and ' in reader
Keith Packard [Wed, 2 Nov 2016 21:18:54 +0000 (14:18 -0700)]
altos/lisp: add set/setq and ' in reader

Along with other small fixes

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stmf0: Add lisp to include directories
Keith Packard [Wed, 2 Nov 2016 21:18:31 +0000 (14:18 -0700)]
altos/stmf0: Add lisp to include directories

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/kernel: Make ao_cmd_readline public. Return char from ao_cmd_lex.
Keith Packard [Wed, 2 Nov 2016 21:14:23 +0000 (14:14 -0700)]
altos/kernel: Make ao_cmd_readline public. Return char from ao_cmd_lex.

With these two changes, the readline function can be used by other
code.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Change lisp objects to use ao_poly everywhere. Add const
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.

Now builds (and runs!) on the nucleo-32 boards.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Add lisp reader
Keith Packard [Tue, 1 Nov 2016 01:53:09 +0000 (18:53 -0700)]
altos: Add lisp reader

3 years agoAdd first lisp bits
Keith Packard [Mon, 31 Oct 2016 23:43:44 +0000 (16:43 -0700)]
Add first lisp bits

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agouse elf, not ihx
Bdale Garbee [Wed, 25 Jan 2017 19:21:29 +0000 (12:21 -0700)]
use elf, not ihx

3 years agostop using /usr/share for binaries in remaining turnon scripts
Bdale Garbee [Wed, 25 Jan 2017 19:00:20 +0000 (12:00 -0700)]
stop using /usr/share for binaries in remaining turnon scripts

3 years agoaltos/chaoskey: Add a metainfo for the ChaosKey
Richard Hughes [Tue, 10 Jan 2017 17:15:24 +0000 (17:15 +0000)]
altos/chaoskey: Add a metainfo for the ChaosKey

This provides the information necessary to reflash chaoskey using
standard Linux device firmware tooling.

3 years agoaltos/arm: Align data so that gcc 5.4 doesn't do byte-accesses. Add -Wcast-align
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.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm: Make ao_usb_set_address static. Saves a bunch of text space
Keith Packard [Tue, 13 Dec 2016 00:44:47 +0000 (16:44 -0800)]
altos/stm: Make ao_usb_set_address static. Saves a bunch of text space

I'm sure this makes the function end up in-lined, which saves enough
text space to fit the flash loader in ROM again.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-bringup: Improve EasyMini turnon and test scripts
Keith Packard [Fri, 18 Nov 2016 06:17:20 +0000 (22:17 -0800)]
ao-bringup: Improve EasyMini turnon and test scripts

Wait less time before trying the test script.
Have the test script wait for the device to appear. And then use
colors to help make the results clear.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/test: Fix tests
Keith Packard [Mon, 10 Oct 2016 02:42:42 +0000 (19:42 -0700)]
altos/test: Fix tests

A couple of fixups for ao_flight_test to dump pyro info only when
running in debug mode, and to change the aprs testing

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/nucleo-32: Add basic support for STM32F042 Nucleo-32 board
Keith Packard [Mon, 31 Oct 2016 02:08:14 +0000 (19:08 -0700)]
altos/nucleo-32: Add basic support for STM32F042 Nucleo-32 board

This hooks up the LED, USB and the USART.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stmf0: Add USART support
Keith Packard [Mon, 31 Oct 2016 02:06:20 +0000 (19:06 -0700)]
altos/stmf0: Add USART support

The STM32F0 usart can be operated much like the STM32L usart, but the
registers are all moved around.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaugment TeleDongle turn on script to support serial number on command line
Bdale Garbee [Sun, 2 Oct 2016 23:19:14 +0000 (17:19 -0600)]
augment TeleDongle turn on script to support serial number on command line

3 years agoUpdate pdclib to version using arm-specific 'ar' program
Keith Packard [Thu, 22 Sep 2016 00:23:34 +0000 (03:23 +0300)]
Update pdclib to version using arm-specific 'ar' program

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoFix release note html to remove xml bits
Keith Packard [Tue, 6 Sep 2016 04:25:07 +0000 (22:25 -0600)]
Fix release note html to remove xml bits

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoRemove pyro wizard file from master
Keith Packard [Tue, 6 Sep 2016 02:55:17 +0000 (20:55 -0600)]
Remove pyro wizard file from master

This isn't done yet.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoBump version to 1.6.8
Keith Packard [Tue, 6 Sep 2016 02:46:05 +0000 (20:46 -0600)]
Bump version to 1.6.8

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltosui: Don't ship TeleMetrum v3.0 firmware (yet)
Keith Packard [Tue, 6 Sep 2016 02:45:12 +0000 (20:45 -0600)]
altosui: Don't ship TeleMetrum v3.0 firmware (yet)

We haven't finished this yet, so don't deliver firmware for it.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoAdd 1.6.8 release notes
Keith Packard [Sun, 4 Sep 2016 02:02:35 +0000 (21:02 -0500)]
Add 1.6.8 release notes

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm: Set SPI slave DMA priority to HIGH/VERY_HIGH
Keith Packard [Sat, 3 Sep 2016 06:21:34 +0000 (01:21 -0500)]
altos/stm: Set SPI slave DMA priority to HIGH/VERY_HIGH

Set spi slave DMA priority MOSI to HIGH and MISO to VERY_HIGH. Slave
SPI doesn't have the luxury of slowing down when the system is busy,
so provide it maximum memory bandwidth to try and keep up with the
master.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm: Set i2c recv DMA to HIGH
Keith Packard [Sat, 3 Sep 2016 06:20:20 +0000 (01:20 -0500)]
altos/stm: Set i2c recv DMA to HIGH

Make sure receive DMA is higher than any TX dma so that
it always runs in preference.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm: Set MISO DMA priority to HIGH to avoid OVR
Keith Packard [Sat, 3 Sep 2016 05:55:19 +0000 (00:55 -0500)]
altos/stm: Set MISO DMA priority to HIGH to avoid OVR

When the MISO DMA priority is too low, and the processor gets busy,
it's possible for SPI input to overrun the processor, which causes the
MISO DMA to get out of sync and never finish. Set the MISO DMA
priority to HIGH to avoid this.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm: Create funcs to set SPI DMA parameters
Keith Packard [Sat, 3 Sep 2016 05:53:44 +0000 (00:53 -0500)]
altos/stm: Create funcs to set SPI DMA parameters

Instead of having nearly duplicate versions of the SPI DMA
configuration calls, create helper funcs that do most of the work so
that the SPI API funcs are shorter and clearer.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stm: Make ao_spi_duplex out pointer const
Keith Packard [Sat, 3 Sep 2016 05:52:12 +0000 (00:52 -0500)]
altos/stm: Make ao_spi_duplex out pointer const

Provides a bit better typechecking opportunities for this function.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoBump version to 1.6.7.1
Keith Packard [Sat, 3 Sep 2016 04:40:03 +0000 (23:40 -0500)]
Bump version to 1.6.7.1

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-tools/ao-cal-freq: Re-open usb device each try
Keith Packard [Sat, 3 Sep 2016 04:36:36 +0000 (23:36 -0500)]
ao-tools/ao-cal-freq: Re-open usb device each try

Instead of trying to re-use the same file descriptor, close and
re-open the device each time around the loop to avoid getting stuck
when calibrating TeleMega boards.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-tools/ao-usbload: Fix -f flag, remove debug hacks
Keith Packard [Sat, 3 Sep 2016 04:34:47 +0000 (23:34 -0500)]
ao-tools/ao-usbload: Fix -f flag, remove debug hacks

The code to validate the usb id and product name had some debug hacks
left enabled, which caused it to fail. The short -f version of the
force flag was also not getting parsed correctly.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-bringup/turnon_telemetrum: serial on cmd line. Loop on accel fail
Keith Packard [Sat, 3 Sep 2016 04:33:27 +0000 (23:33 -0500)]
ao-bringup/turnon_telemetrum: serial on cmd line. Loop on accel fail

These make the script easier to use

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltosui: Deal with connect failure in AltosConfigTD
Keith Packard [Fri, 2 Sep 2016 21:13:25 +0000 (16:13 -0500)]
altosui: Deal with connect failure in AltosConfigTD

When the USB connection times out, abort any pending operations and
clean up the thread correctly. Also, deal with the serial line being
closed by checking for null.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-tools/ao-cal-freq: --verbose option has no parameter
Keith Packard [Thu, 1 Sep 2016 03:27:10 +0000 (21:27 -0600)]
ao-tools/ao-cal-freq: --verbose option has no parameter

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-bringup: telemega allow serial on command line, loop on accel fail
Keith Packard [Thu, 1 Sep 2016 03:25:59 +0000 (21:25 -0600)]
ao-bringup: telemega allow serial on command line, loop on accel fail

Allow the serial number on the turnon_telemega command line, instead
of reading it.

When accel cal fails, loop waiting for it to succeed instead of
continuing blindly.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/cc1120: remove unused status from ao_radio_fifo_write_stop
Keith Packard [Mon, 29 Aug 2016 16:27:53 +0000 (09:27 -0700)]
altos/cc1120: remove unused status from ao_radio_fifo_write_stop

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-usbload: Check target device name to avoid mis-flashing
Keith Packard [Sun, 14 Aug 2016 22:57:39 +0000 (15:57 -0700)]
ao-usbload: Check target device name to avoid mis-flashing

Instead of blindly loading firmware, go get the old device's name and
make sure it matches the new firmware.

Add --force option to allow this to be overridden.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-chaosread: Parse -i and -b options
Keith Packard [Sun, 14 Aug 2016 22:55:13 +0000 (15:55 -0700)]
ao-chaosread: Parse -i and -b options

Need to pass the single-byte verisons to getopt_long

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoBump verison to 1.6.7
Keith Packard [Tue, 9 Aug 2016 05:40:41 +0000 (22:40 -0700)]
Bump verison to 1.6.7

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stmf0: Switch ADC fast to ADC clock
Keith Packard [Tue, 9 Aug 2016 05:39:16 +0000 (22:39 -0700)]
altos/stmf0: Switch ADC fast to ADC clock

Using this slower clock eliminates sampling problems with the ADC and
cleans up the chaoskey raw data.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Flash all LEDS during power on
Keith Packard [Thu, 4 Aug 2016 16:54:16 +0000 (09:54 -0700)]
altos: Flash all LEDS during power on

This tests the LEDS to make sure they all work on the following devices:

easymega-v1.0
telebt-v3.0
teledongle-v3.0
telemega-v1.0
telemega-v2.0
telemetrum-v2.0

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-bringup: Add colors to chaoskey test result reporting
Keith Packard [Thu, 4 Aug 2016 16:52:05 +0000 (09:52 -0700)]
ao-bringup: Add colors to chaoskey test result reporting

This makes them show up nice and bright in the terminal window.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoBump to version 1.6.6
Keith Packard [Tue, 2 Aug 2016 23:35:36 +0000 (16:35 -0700)]
Bump to version 1.6.6

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-bringup: Use released files for chaoskey turnon
Keith Packard [Tue, 2 Aug 2016 23:52:39 +0000 (16:52 -0700)]
ao-bringup: Use released files for chaoskey turnon

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-bringup: Test chaoskey using dieharder
Keith Packard [Tue, 2 Aug 2016 23:30:15 +0000 (16:30 -0700)]
ao-bringup: Test chaoskey using dieharder

This uses a subset of the dieharder tests which run in reasonable time
and don't appear to emit false negatives on a regular basis.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-chaosread: Eliminate double-free when serial match fails
Keith Packard [Tue, 2 Aug 2016 23:53:17 +0000 (16:53 -0700)]
ao-chaosread: Eliminate double-free when serial match fails

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoao-chaosread: Add --infinite and --bytes options
Keith Packard [Tue, 2 Aug 2016 23:28:17 +0000 (16:28 -0700)]
ao-chaosread: Add --infinite and --bytes options

The --infinite option keeps writing data.
The --bytes options pulls out bits 1-8 which should provide 8 true
bits of entropy.

This combination allows ao-chaosread to be fed directly into dieharder
to validate the hardware.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Use standard FIPS testing for chaoskey
Keith Packard [Tue, 2 Aug 2016 23:26:49 +0000 (16:26 -0700)]
altos: Use standard FIPS testing for chaoskey

Check to make sure we aren't repeating a block coming from the
unwhitened source, which is the standard online FIPS test for RNGs.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stmf0: Clean .bin files from flash-loader dirs
Keith Packard [Tue, 2 Aug 2016 23:53:50 +0000 (16:53 -0700)]
altos/stmf0: Clean .bin files from flash-loader dirs

The .bin files are what the DFU utility uses to flash the boot loader
using USB.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/stmf0: Hook up clock output support
Keith Packard [Tue, 2 Aug 2016 23:32:43 +0000 (16:32 -0700)]
altos/stmf0: Hook up clock output support

This was used to try and not have two xtals on telemini, but failed
because the provided clock has too much noise.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Make telelcotwo control two boxes instead of two pads
Keith Packard [Tue, 2 Aug 2016 23:31:41 +0000 (16:31 -0700)]
altos: Make telelcotwo control two boxes instead of two pads

telefiretwo is now a single pad box, so telelcotwo needs to switch
between boxes instead of pads on the same box. Do this by re-purposing
the pad arming switches into a box selector and arming switch.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Add 'ao_button_get' to button driver
Keith Packard [Thu, 28 Jul 2016 04:28:34 +0000 (21:28 -0700)]
altos: Add 'ao_button_get' to button driver

This returns the current state of the button; useful to check what the
value is at startup.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: Add a 'seconds' method to AltosGPS
Keith Packard [Tue, 2 Aug 2016 23:33:52 +0000 (16:33 -0700)]
altoslib: Add a 'seconds' method to AltosGPS

This computes the time in seconds since the epoch from GPS time
information.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Stop building cc1111-based telemini v2.0 firmware
Keith Packard [Wed, 27 Jul 2016 20:29:20 +0000 (13:29 -0700)]
altos: Stop building cc1111-based telemini v2.0 firmware

This product never worked, so stop insisting that it actually build.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Don't switch to flight 0 when log fills in flight
Keith Packard [Wed, 27 Jul 2016 20:26:22 +0000 (13:26 -0700)]
altos: Don't switch to flight 0 when log fills in flight

If the log is full at startup, we want to transmit flight 0 to let the
ground station know. However, we don't want to switch to flight 0 in
flight, so save the initial telemetry flight number (0 or the real
flight number) at startup and use that throughout the flight.

Signed-off-by: Keith Packard <keithp@keithp.com>