fw/altos
2 years agoupdate Releasing with wisdom from 1.8.4 release process
Bdale Garbee [Fri, 22 Dec 2017 03:40:28 +0000 (20:40 -0700)]
update Releasing with wisdom from 1.8.4 release process

2 years agoBump for version 1.8.4
Keith Packard [Fri, 22 Dec 2017 01:37:10 +0000 (17:37 -0800)]
Bump for version 1.8.4

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoDoc updates for version 1.8.4
Keith Packard [Fri, 22 Dec 2017 01:36:24 +0000 (17:36 -0800)]
Doc updates for version 1.8.4

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/micropeak: Remove all compiler results
Keith Packard [Wed, 20 Dec 2017 00:57:33 +0000 (16:57 -0800)]
altos/micropeak: Remove all compiler results

Not just the current version.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/attiny: Add ADC implementation
Keith Packard [Wed, 20 Dec 2017 00:56:33 +0000 (16:56 -0800)]
altos/attiny: Add ADC implementation

It's primitive, but might serve to read ADC values. Untested.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoao-bringup: turnon_easymini was left with dfu_util disabled
Keith Packard [Wed, 20 Dec 2017 00:21:23 +0000 (16:21 -0800)]
ao-bringup: turnon_easymini was left with dfu_util disabled

This was presumably changed for some test and left in the wrong
state.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/easymini-v2.0: Adapt to final hardware pin assignment changes
Keith Packard [Wed, 20 Dec 2017 00:19:40 +0000 (16:19 -0800)]
altos/easymini-v2.0: Adapt to final hardware pin assignment changes

Beeper moved from PB0 to PB1 (Tim3 CH4)
Drogue fire moved from PB6 to PB3
Bootloader moved from PB1 to PB6

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lambdakey-v1.0: Add back and/or macros
Keith Packard [Tue, 19 Dec 2017 21:09:24 +0000 (13:09 -0800)]
altos/lambdakey-v1.0: Add back and/or macros

With scheme shrinking a bit, there's now space for these useful macros.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Replace per-type indexed stash with poly stash heap
Keith Packard [Tue, 19 Dec 2017 20:39:20 +0000 (12:39 -0800)]
altos/scheme: Replace per-type indexed stash with poly stash heap

Instead of having a random set of stash arrays with explicit indices
used by callers, just have a general heap. Less error prone, and less code.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Replace memory pool macros with inlines
Keith Packard [Tue, 19 Dec 2017 20:16:24 +0000 (12:16 -0800)]
altos/scheme: Replace memory pool macros with inlines

AO_SCHEME_IS_CONST -> ao_scheme_is_const_addr
AO_SCHEME_IS_POOL -> ao_scheme_is_pool_addr

Provides better typechecking and avoids confusion with
ao_scheme_is_const inline (which takes an ao_poly instead of a void *)

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: AO_SCHEME_IS_CONS -> ao_scheme_is_cons
Keith Packard [Tue, 19 Dec 2017 19:51:33 +0000 (11:51 -0800)]
altos/scheme: AO_SCHEME_IS_CONS -> ao_scheme_is_cons

This inline was already defined; just use it. Also, switch some places
to use ao_scheme_is_pair instead as appropriate.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: ao_scheme__cons -> ao_scheme_cons
Keith Packard [Tue, 19 Dec 2017 19:43:23 +0000 (11:43 -0800)]
altos/scheme: ao_scheme__cons -> ao_scheme_cons

Fix the double underscore in this name. Ick.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Don't optimize ao_scheme_make_const
Keith Packard [Tue, 19 Dec 2017 19:40:08 +0000 (11:40 -0800)]
altos/scheme: Don't optimize ao_scheme_make_const

Performance isn't interesting, and it's nice to have a bare system
ready for debugging.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Clean up test CFLAGS
Keith Packard [Tue, 19 Dec 2017 19:39:39 +0000 (11:39 -0800)]
altos/scheme: Clean up test CFLAGS

make it easy to switch between debug and optimized builds.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: (define (foo . bar)) has a pair, not list as card
Keith Packard [Tue, 19 Dec 2017 19:37:33 +0000 (11:37 -0800)]
altos/scheme: (define (foo . bar)) has a pair, not list as card

When defining a lambda with varargs, the args are not a list as the
final element is not a pair or nil. Use pair? instead of list? to
detect this form correctly.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: apply also needs to not free value list on lambdas
Keith Packard [Tue, 19 Dec 2017 19:35:09 +0000 (11:35 -0800)]
altos/scheme: apply also needs to not free value list on lambdas

When apply is invoked on any function, the cons in the argument list
cannot be immediately freed as they have been passed to the
function. That applies to both built-ins as well as lambdas; this
patch removes the special ao_scheme_skip_cons_free global and just
marks the stack in both cases.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Rework display/write code
Keith Packard [Tue, 19 Dec 2017 19:33:36 +0000 (11:33 -0800)]
altos/scheme: Rework display/write code

Unify output functions and add bool to switch between write and
display mode. Make that only affect strings (as per r⁷rs).

Use print recursion detection in frame and stack code, eliminating
PRINT flags in type field.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Compile scheme test with -O3
Keith Packard [Mon, 18 Dec 2017 10:14:57 +0000 (02:14 -0800)]
altos/scheme: Compile scheme test with -O3

This level of optimization caused trouble, so use it all of the time.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Work around gcc 7.2.0 optimization bug in memory manager
Keith Packard [Mon, 18 Dec 2017 10:12:04 +0000 (02:12 -0800)]
altos/scheme: Work around gcc 7.2.0 optimization bug in memory manager

After marking a set of memory chunks, it's possible that all of them
will be packed tight against 'top', in which case none of them will be
moving. In that case, gcc 7.2.0 appears to generate incorrect code
causing the loop to be abandoned, meaning that we don't actually
collect anything at all.

Add a quick short-circuit test just after the mark phase that skips
the code which wouldn't do anything in this case.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: rearrange debugging defines
Keith Packard [Mon, 18 Dec 2017 10:11:07 +0000 (02:11 -0800)]
altos/scheme: rearrange debugging defines

Allow applications to redefine these as desired, add more flexibility
in what the various memory debugging flags can do.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: abort when we try to print an invalid value
Keith Packard [Mon, 18 Dec 2017 10:08:23 +0000 (02:08 -0800)]
altos/scheme: abort when we try to print an invalid value

This can catch a host of interpreter bugs; best to abandon the program
when it happens.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Use memory manager mark code to note recursive print
Keith Packard [Mon, 18 Dec 2017 06:22:50 +0000 (22:22 -0800)]
altos/scheme: Use memory manager mark code to note recursive print

This flags any object being printed and checks before recursing to
avoid infinite loops.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Use AO_SCHEME_IS_CONS in cons memory funcs
Keith Packard [Mon, 18 Dec 2017 06:19:38 +0000 (22:19 -0800)]
altos/scheme: Use AO_SCHEME_IS_CONS in cons memory funcs

More efficient than ao_scheme_poly_type as it doesn't care about
non-prim types.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoao-bringup/test-chaoskey: Make finding most recent device more reliable
Keith Packard [Fri, 15 Dec 2017 07:10:43 +0000 (23:10 -0800)]
ao-bringup/test-chaoskey: Make finding most recent device more reliable

Use dmesg -t to strip off the timestamp, which avoids having a
variable number of fields for awk to look at.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lambdakey-v1.0: shrink scheme code to fit the ROM
Keith Packard [Fri, 15 Dec 2017 07:09:02 +0000 (23:09 -0800)]
altos/lambdakey-v1.0: shrink scheme code to fit the ROM

scheme has grown a bit; adapt

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: swap BIGINT and STRING types
Keith Packard [Fri, 15 Dec 2017 07:04:39 +0000 (23:04 -0800)]
altos/scheme: swap BIGINT and STRING types

This lets BIGINT be a primitive type, allowing it to use all 32 bits
for storage. This does make strings another byte longer, and also
slightly harder to deal with. It's a trade off.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: integer? is builtin on all versions
Keith Packard [Wed, 13 Dec 2017 02:07:06 +0000 (18:07 -0800)]
altos/scheme: integer? is builtin on all versions

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lambdakey-v1.0: Make stack larger
Keith Packard [Wed, 13 Dec 2017 02:02:17 +0000 (18:02 -0800)]
altos/lambdakey-v1.0: Make stack larger

scheme doesn't like to run with less than a 1kB stack.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: inline some mem calls to reduce stack usage.
Keith Packard [Wed, 13 Dec 2017 02:01:21 +0000 (18:01 -0800)]
altos/scheme: inline some mem calls to reduce stack usage.

Also includes some code to display stack usage during collect calls.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Use direct calls from frame to frame_vals mem functions
Keith Packard [Wed, 13 Dec 2017 02:00:12 +0000 (18:00 -0800)]
altos/scheme: Use direct calls from frame to frame_vals mem functions

Avoids the extra stack depth of the poly versions.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: More compiler warning cleanups
Keith Packard [Wed, 13 Dec 2017 01:59:26 +0000 (17:59 -0800)]
altos/scheme: More compiler warning cleanups

Make local funcs static. Don't mix decls and code.x

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: apply const to places taking const strings.
Keith Packard [Wed, 13 Dec 2017 01:54:03 +0000 (17:54 -0800)]
altos/scheme: apply const to places taking const strings.

Mostly printf and friends.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/stm: Align 'data' to 8 bytes, just like textram
Keith Packard [Tue, 12 Dec 2017 23:31:27 +0000 (15:31 -0800)]
altos/stm: Align 'data' to 8 bytes, just like textram

The textram section must be aligned to 8 bytes to keep the linker
happy. However, if that section contains no data, the declaration will
set the __data_start__ value to that alignment, but the data section
itself would start on a 4-byte alignment, potentially 4 bytes lower
than the value indicated by __data_start__. This completely scrambles
initialized memory as the startup code will copy the data segment to
__data_start__, 4 bytes off of the actual data segment start.

Fix this by forcing the data segment to also be aligned to 8 bytes.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/kernel: Allow ao_cmd to be built without tasking
Keith Packard [Tue, 12 Dec 2017 23:30:45 +0000 (15:30 -0800)]
altos/kernel: Allow ao_cmd to be built without tasking

Useful for single-threaded applications, like lambdakey

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lambdakey-v1.0: Get this building again
Keith Packard [Tue, 12 Dec 2017 23:27:26 +0000 (15:27 -0800)]
altos/lambdakey-v1.0: Get this building again

The lambdakey can't hold a full implementation of the scheme
interpreter, so use only a subset, removing floats, bigints and
vectors. Also reduce the pre-loaded lisp code as well.

It's pretty spare at this point; but it does fill the ROM.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Support scheme subsetting via feature settings
Keith Packard [Tue, 12 Dec 2017 23:25:51 +0000 (15:25 -0800)]
altos/scheme: Support scheme subsetting via feature settings

This provides for the creation of smaller versions of the interpreter,
leaving out options like floating point numbers and vectors.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Add ao_scheme_vector.c
Keith Packard [Tue, 12 Dec 2017 23:15:41 +0000 (15:15 -0800)]
altos/scheme: Add ao_scheme_vector.c

Useful to include the code for implementing vectors

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agodoc: Don't 'publish' release notes, don't build pdf release notes
Keith Packard [Tue, 12 Dec 2017 06:36:00 +0000 (22:36 -0800)]
doc: Don't 'publish' release notes, don't build pdf release notes

All we use the release notes for is to include into the main AltOS
page. Also remove the docinfo for these files so that information
isn't duplicated for each set of release notes.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoupdate Releasing with changes discovered in 1.8.3 release process
Bdale Garbee [Tue, 12 Dec 2017 05:15:46 +0000 (22:15 -0700)]
update Releasing with changes discovered in 1.8.3 release process

2 years agoTeleMega default is now v3.0
Bdale Garbee [Tue, 12 Dec 2017 04:33:21 +0000 (21:33 -0700)]
TeleMega default is now v3.0

2 years agodoc: Update release notes and docinfo for 1.8.3
Keith Packard [Tue, 12 Dec 2017 00:30:46 +0000 (16:30 -0800)]
doc: Update release notes and docinfo for 1.8.3

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Keep old GPS values when updating data
Keith Packard [Mon, 11 Dec 2017 22:42:45 +0000 (14:42 -0800)]
altoslib: Keep old GPS values when updating data

This way, updating satellite information doesn't drop all of the
regular GPS data on the floor.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos: Actually store current MPU9250 data in data ring
Keith Packard [Mon, 11 Dec 2017 22:08:32 +0000 (14:08 -0800)]
altos: Actually store current MPU9250 data in data ring

The ring is updated when the ADC finishes; all of the other sensor
data needs to be copied in at that point.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos: Remove more software for hardware prototypes
Keith Packard [Mon, 11 Dec 2017 21:47:54 +0000 (13:47 -0800)]
altos: Remove more software for hardware prototypes

These never saw the light of day.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agotake telescience out of the routine builds
Bdale Garbee [Mon, 11 Dec 2017 21:44:15 +0000 (14:44 -0700)]
take telescience out of the routine builds

2 years agoBump to version 1.8.3
Keith Packard [Mon, 11 Dec 2017 20:23:29 +0000 (12:23 -0800)]
Bump to version 1.8.3

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agodoc: Note TeleMega v3.0 support in 1.8.3 relnotes
Keith Packard [Mon, 11 Dec 2017 20:23:00 +0000 (12:23 -0800)]
doc: Note TeleMega v3.0 support in 1.8.3 relnotes

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/drivers: Hook up mag sensor for MPU9250
Keith Packard [Tue, 5 Dec 2017 20:22:34 +0000 (12:22 -0800)]
altos/drivers: Hook up mag sensor for MPU9250

Set mag sensor to provide data at 100Hz.
Set i2c master to pull mag data at sample rate (200Hz).

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Allow ao_scheme_read_eval_print to be restarted
Keith Packard [Mon, 11 Dec 2017 02:35:53 +0000 (18:35 -0800)]
altos/scheme: Allow ao_scheme_read_eval_print to be restarted

Reset exceptions at the top so that we can call it more than once.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos: Allow building with newlib + avr stdio on ARM
Keith Packard [Mon, 11 Dec 2017 02:34:49 +0000 (18:34 -0800)]
altos: Allow building with newlib + avr stdio on ARM

Redefines some stdio bits so that we can build with either pdclib or
newlib + avr stdio.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos: Add scheme for stm discovery board demo
Keith Packard [Mon, 11 Dec 2017 02:32:18 +0000 (18:32 -0800)]
altos: Add scheme for stm discovery board demo

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lambdakey-v1.0: Switch to newlib, get things compiling again
Keith Packard [Mon, 11 Dec 2017 02:21:01 +0000 (18:21 -0800)]
altos/lambdakey-v1.0: Switch to newlib, get things compiling again

scheme is now way too large to fit on this device; some subsetting is
clearly indicated.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Add Makefile for scheme test app
Keith Packard [Mon, 11 Dec 2017 00:55:57 +0000 (16:55 -0800)]
altos/scheme: Add Makefile for scheme test app

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Make test scheme app heap maximum size
Keith Packard [Mon, 11 Dec 2017 00:54:50 +0000 (16:54 -0800)]
altos/scheme: Make test scheme app heap maximum size

It's only 32kB.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Make eqv? work for numbers and strings
Keith Packard [Mon, 11 Dec 2017 00:53:25 +0000 (16:53 -0800)]
altos/scheme: Make eqv? work for numbers and strings

Large numbers, floats and strings need a value check, not just a
comparison between ao_polys

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Stash cons across value allocation in compare
Keith Packard [Mon, 11 Dec 2017 00:52:26 +0000 (16:52 -0800)]
altos/scheme: Stash cons across value allocation in compare

Large ints, strings and floats can cause allocation, requiring that
the 'cons' pointer be stashed and retrieved in case it moved.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: add list-copy
Keith Packard [Mon, 11 Dec 2017 00:51:25 +0000 (16:51 -0800)]
altos/scheme: add list-copy

A lot easier as a built-in; the obvious scheme version is recursive.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Use 64-bit ints to track memory allocation stats
Keith Packard [Mon, 11 Dec 2017 00:50:06 +0000 (16:50 -0800)]
altos/scheme: Use 64-bit ints to track memory allocation stats

These are only collected for debug purposes, but can get quite large
if the interpreter runs for a while.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Add a bunch of string and vector builtins
Keith Packard [Sun, 10 Dec 2017 21:13:27 +0000 (13:13 -0800)]
altos/scheme: Add a bunch of string and vector builtins

Just make the language closer to r7rs

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoTeleMega v3.0 turnon scripts
Bdale Garbee [Mon, 11 Dec 2017 17:17:40 +0000 (10:17 -0700)]
TeleMega v3.0 turnon scripts

2 years agoMerge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
Bdale Garbee [Mon, 11 Dec 2017 17:16:24 +0000 (10:16 -0700)]
Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos

2 years agoaltos/scheme: Avoid crashing with non-list in length
Keith Packard [Sun, 10 Dec 2017 08:02:34 +0000 (00:02 -0800)]
altos/scheme: Avoid crashing with non-list in length

Use ao_scheme_cons_cdr to fetch the next list element as that returns
NULL for non-cons elements.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Add vectors
Keith Packard [Sun, 10 Dec 2017 08:02:00 +0000 (00:02 -0800)]
altos/scheme: Add vectors

Constant time and smaller can be a feature.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Fix name of constant scheme file
Keith Packard [Sun, 10 Dec 2017 08:00:23 +0000 (00:00 -0800)]
altos/scheme: Fix name of constant scheme file

.lisp -> .scheme

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltoslib: Fix 8 to 12 bit conversion for Mega pyro voltage data
Keith Packard [Sun, 10 Dec 2017 00:57:35 +0000 (16:57 -0800)]
altoslib: Fix 8 to 12 bit conversion for Mega pyro voltage data

The conversion was losing the replicated top four bits by shifting by
the wrong amount.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Let readline know if there's a list in progress
Keith Packard [Sun, 10 Dec 2017 00:56:20 +0000 (16:56 -0800)]
altos/scheme: Let readline know if there's a list in progress

This lets the interactive prompt change based on what state the lexer
is in

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoMerge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
Bdale Garbee [Tue, 5 Dec 2017 20:23:09 +0000 (13:23 -0700)]
Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos

2 years agoaltos/drivers: Start adding defines to get mag data out of MPU9250
Keith Packard [Tue, 5 Dec 2017 20:22:34 +0000 (12:22 -0800)]
altos/drivers: Start adding defines to get mag data out of MPU9250

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agomoving to TeleMega v3.0 by default
Bdale Garbee [Tue, 5 Dec 2017 20:18:45 +0000 (13:18 -0700)]
moving to TeleMega v3.0 by default

2 years agohandle repeated invocations without failing as often
Bdale Garbee [Tue, 5 Dec 2017 20:17:18 +0000 (13:17 -0700)]
handle repeated invocations without failing as often

2 years agoaltos/cortexelf-v1: Adapt to lisp->scheme name change
Keith Packard [Tue, 5 Dec 2017 18:48:04 +0000 (10:48 -0800)]
altos/cortexelf-v1: Adapt to lisp->scheme name change

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Add explicit dependency on ao_scheme_builtin.h for ao_scheme_make_const
Keith Packard [Tue, 5 Dec 2017 18:42:02 +0000 (10:42 -0800)]
altos/scheme: Add explicit dependency on ao_scheme_builtin.h for ao_scheme_make_const

This ensures that a parallel build will wait for ao_scheme_builtin.h
to be complete before attempting to compile ao_scheme_make_const

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Move scheme test program to scheme sub-directory
Keith Packard [Tue, 5 Dec 2017 18:38:14 +0000 (10:38 -0800)]
altos/scheme: Move scheme test program to scheme sub-directory

Keeps it away from the usual test setup

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/scheme: Rename to 'scheme', clean up build
Keith Packard [Tue, 5 Dec 2017 18:29:13 +0000 (10:29 -0800)]
altos/scheme: Rename to 'scheme', clean up build

Constant block is now built in a subdir to avoid messing up source
directory.

Renamed to ao_scheme to reflect language target.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lisp: Switch to scheme formal syntax for varargs
Keith Packard [Mon, 4 Dec 2017 03:54:18 +0000 (19:54 -0800)]
altos/lisp: Switch to scheme formal syntax for varargs

Scheme uses bare symbols to indicate a varargs parameter; any bare
(i.e., not wrapped in a cons cell) parameter will get the 'rest' of
the parameter list. This works for lambdas, nlambdas and macros. As a
result, the 'lexpr' form has been removed as it is equivalent to a
lambda with a varargs formal.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lisp: Fix stash usage across frame allocation
Keith Packard [Mon, 4 Dec 2017 03:52:11 +0000 (19:52 -0800)]
altos/lisp: Fix stash usage across frame allocation

Must un-stash before allocation failure check.
Use frame_stash instead of poly_stash for frames.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lisp: Check only cdr base type when moving cons cells
Keith Packard [Mon, 4 Dec 2017 03:49:20 +0000 (19:49 -0800)]
altos/lisp: Check only cdr base type when moving cons cells

The cdr may have moved, so we can't look at the target object
type. Fortunately, the base type encoded in the reference itself is
sufficient to check for a non-cons cdr.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lisp: Split out read debug, add memory validation
Keith Packard [Mon, 4 Dec 2017 03:47:03 +0000 (19:47 -0800)]
altos/lisp: Split out read debug, add memory validation

Split read debug into a separate #define to reduce debug noise
Add some memory validation -- validate stash API, and validate
cons_free calls.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lisp: use strtof instead of atof
Keith Packard [Sun, 3 Dec 2017 05:21:55 +0000 (23:21 -0600)]
altos/lisp: use strtof instead of atof

atof returns double, strtof returns float.

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lisp: Convert more builtin lisp code to scheme format
Keith Packard [Sun, 3 Dec 2017 05:21:01 +0000 (23:21 -0600)]
altos/lisp: Convert more builtin lisp code to scheme format

Use defines where possible, use (define (name args ...)) form for lambdas

Signed-off-by: Keith Packard <keithp@keithp.com>
2 years agoaltos/lisp: Overflow int computations to float
Keith Packard [Sun, 3 Dec 2017 05:19:44 +0000 (23:19 -0600)]
altos/lisp: Overflow int computations to float

When an int computation overflows, switch to float.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltoslib: Add support for TeleMega v3.0 log files
Keith Packard [Sat, 2 Dec 2017 21:59:17 +0000 (15:59 -0600)]
altoslib: Add support for TeleMega v3.0 log files

These look much like TeleMega v2.0 log files, except that the mag
sensor data now comes from the mpu9250 instead of an external
hmc5883. The gyro and 3-axis accel data from the mpu9250 are the same
as the mpu6000.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Build TeleMega v3.0 by default
Keith Packard [Sat, 2 Dec 2017 21:53:05 +0000 (15:53 -0600)]
altos: Build TeleMega v3.0 by default

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos: Add TeleMega v3.0
Keith Packard [Sat, 2 Dec 2017 21:31:06 +0000 (15:31 -0600)]
altos: Add TeleMega v3.0

Adds files to build telemega v3.0 flash loader and firmware

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/kernel: MPU9250 support
Keith Packard [Sat, 2 Dec 2017 21:32:38 +0000 (15:32 -0600)]
altos/kernel: MPU9250 support

Use MPU9250 for accel, gyro and mag data in logging, telemetry and
flight status computations.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: split set/def. Add def support to lambdas
Keith Packard [Fri, 1 Dec 2017 21:40:23 +0000 (15:40 -0600)]
altos/lisp: split set/def. Add def support to lambdas

In scheme, set can only re-define existing variables while def cannot
redefine existing variables in lambda context. Def within lambda
creates a new variable at the nearest enclosing scope.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Split out frame vals from frame struct
Keith Packard [Fri, 1 Dec 2017 17:28:16 +0000 (18:28 +0100)]
altos/lisp: Split out frame vals from frame struct

This lets the frame be resized without moving the base structure. The
plan is to allow all frames to be resized, not just the global frame.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Make let distinct from let*
Keith Packard [Fri, 1 Dec 2017 11:06:04 +0000 (12:06 +0100)]
altos/lisp: Make let distinct from let*

let is supposed to define the values all at once, evaluating the
initializers in the enclosing context. let* defines the new names and
then initializes them one at a time.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: return from unmatched cond is #f, not nil
Keith Packard [Fri, 1 Dec 2017 10:32:27 +0000 (11:32 +0100)]
altos/lisp: return from unmatched cond is #f, not nil

Fix the return value when we fall off the end of a cond expression to
be #f

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Fix pairp builtin
Keith Packard [Fri, 1 Dec 2017 10:31:29 +0000 (11:31 +0100)]
altos/lisp: Fix pairp builtin

Pairs are non-nil cons values; add an explicit check for nil here

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Add quasiquote
Keith Packard [Fri, 1 Dec 2017 09:12:38 +0000 (10:12 +0100)]
altos/lisp: Add quasiquote

This adds read support for quasiquote syntax, and then adds a
quasiquote implementation in lisp

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Rename progn to begin
Keith Packard [Sun, 26 Nov 2017 01:29:10 +0000 (17:29 -0800)]
altos/lisp: Rename progn to begin

Match scheme name.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/test: Update to build altos lisp test app
Keith Packard [Mon, 20 Nov 2017 05:07:23 +0000 (21:07 -0800)]
altos/test: Update to build altos lisp test app

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Add floats
Keith Packard [Mon, 20 Nov 2017 05:07:00 +0000 (21:07 -0800)]
altos/lisp: Add floats

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Fix some scheme compat issues
Keith Packard [Sun, 19 Nov 2017 06:00:44 +0000 (22:00 -0800)]
altos/lisp: Fix some scheme compat issues

flush -> flush-output
nth -> list-ref (oh, and add list-tail)
add let* (same as let for now)
write control chars in octal
make hanoi example work

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Add 'big' ints -- 24 bits wide
Keith Packard [Sun, 19 Nov 2017 04:38:15 +0000 (20:38 -0800)]
altos/lisp: Add 'big' ints -- 24 bits wide

With the default ints being only 14 bits, having a larger type with
more precision seems useful. This is not exposed to the application.

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/cortexelf-v1: Make lisp compile again
Keith Packard [Sat, 18 Nov 2017 07:28:08 +0000 (23:28 -0800)]
altos/cortexelf-v1: Make lisp compile again

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/test: Add jiffy funcs to lisp test
Keith Packard [Sat, 18 Nov 2017 07:27:36 +0000 (23:27 -0800)]
altos/test: Add jiffy funcs to lisp test

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Finish first pass through r7rs
Keith Packard [Sat, 18 Nov 2017 07:23:50 +0000 (23:23 -0800)]
altos/lisp: Finish first pass through r7rs

* print -> write, patom -> display
* Add read-char, write-char
* Add exit, current-jiffy, current-second, jiffies-per-second
* Add for-each and string-for-each
* Avoid duplicate builtins with different atoms

Signed-off-by: Keith Packard <keithp@keithp.com>
3 years agoaltos/lisp: Add apply
Keith Packard [Sat, 18 Nov 2017 06:14:19 +0000 (22:14 -0800)]
altos/lisp: Add apply

And all of the library routines that use it, map, string-map and friends.

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