summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAge
* altos/draw: Add a reasonable API for drawing, add lines.lispKeith Packard2016-11-20
| | | | | | | Also, move the demo drawing into the stm-vga app and out of the vga driver. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Don't wait while idle if trying to minimize interrupt latencyKeith Packard2016-11-20
| | | | | | | | 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. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Interrupt priority is in the upper bits of the priority maskKeith Packard2016-11-20
| | | | | | | | | | 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. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Use basepri instead of primask for controlling interruptsKeith Packard2016-11-20
| | | | | | | | | 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. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm-vga: Fix DMA reset to load scanline each timeKeith Packard2016-11-20
| | | | | | | | | | If we load the scanline register while DMA is running, it doesn't actually get reloaded until after the first transfer from the next line, leaving a weird jog in the middle of the screen. Also flip to SPI1, as Bdale is using that on the 1802 board. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Clean up hanoi.lisp demo a bitKeith Packard2016-11-20
| | | | | | No serious changes. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm-vga: Implement VGA out from the STM processorKeith Packard2016-11-20
| | | | | | | | | Generates vsync/hsync using timers and pixel data using the SPI port. 320x240 video using 640x480 mode and a 24MHz "pixel" clock. Includes the beginings of rendering code for the frame buffer, including bitblt, solid fill and text with a 5x7 font. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Move stack recursion check after null checkKeith Packard2016-11-18
| | | | | | Don't crash when printing null stack this way. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Include memory stats for test programKeith Packard2016-11-18
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Cleanup some DBG definesKeith Packard2016-11-18
| | | | | | Get rid of the remaining duplicate defines. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Share binary search for memory chunk between mark and moveKeith Packard2016-11-18
| | | | | | Save some text space. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Add builtin 'collect'Keith Packard2016-11-18
| | | | | | Collect memory, return amount free. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Sort frames by atomKeith Packard2016-11-18
| | | | | | | | | 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. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Build new ao_lisp_stack.c into test and lambdakeyKeith Packard2016-11-18
| | | | | | Helpful to include the new source file. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: bounds check in move_map plus binary searchKeith Packard2016-11-18
| | | | | | | | | | This makes move_map faster by skipping all addresses which aren't changing. Also changed the interface from address to offset to avoid computing the offset multiple times. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Empty lambda body is not an errorKeith Packard2016-11-18
| | | | | | It's not very exciting, but it's still legal Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Use poly stashes for stacksKeith Packard2016-11-18
| | | | | | Saves some memory. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Make DBG settings globalKeith Packard2016-11-18
| | | | | | This avoids having different values in different files, which wasn't useful. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Add continuationsKeith Packard2016-11-18
| | | | | | This provides call/cc and makes 'stacks' visible to the application. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Take advantage of implicit progns in hanoi demoKeith Packard2016-11-17
| | | | | | | Remove extra progn wrappers now that cond, lambda and while all support implicit ones. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: have 'while' return the last body valueKeith Packard2016-11-17
| | | | | | | Instead of always returning 'nil', let while return the last body value. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Take advantage of implicit progn in ROM codeKeith Packard2016-11-17
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Make lambda, cond and while all have implicit prognsKeith Packard2016-11-17
| | | | | | | This lets all of these execute more than one sexpr, returning the value of the last. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Compile ao_lisp_make_const -no-pieKeith Packard2016-11-17
| | | | | | Makes debugging easier Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Fix uninitialized values in ao_lisp_make_constKeith Packard2016-11-17
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Dump globals on errorKeith Packard2016-11-17
| | | | | | Useful for debugging Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Fix error atom name in ao_lisp_lengthKeith Packard2016-11-17
| | | | | | Cut&paste error. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Remove some stale frame debugging checksKeith Packard2016-11-17
| | | | | | No-one sets frame->_num to 0xff to hit these Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Clean up hanoi.lisp comments.Keith Packard2016-11-17
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Eliminate compiler warning about array bounds at -O3Keith Packard2016-11-17
| | | | | | | | | 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. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: binary search for chunk in collectKeith Packard2016-11-17
| | | | | | Speeds up collect a bit Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/test: Disable position independent executablesKeith Packard2016-11-17
| | | | This makes debugging programs so much harder
* altos/lisp: Allow empty defun bodiesKeith Packard2016-11-17
| | | | | | This allows for (defun foo()) Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Optimize chunk searching in collectKeith Packard2016-11-17
| | | | | | | 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>
* altos/lisp: Add incremental collectionKeith Packard2016-11-17
| | | | | | | | | | | | 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>
* altos/lisp: Make hanoi example output a bit prettierKeith Packard2016-11-17
| | | | | | Make the towers symmetrical instead of lopsided. Much nicer looking. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: remove nth from hanoi.lispKeith Packard2016-11-17
| | | | | | It's now in ROM. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lambdakey: Strip out unused codeKeith Packard2016-11-17
| | | | | | Make space for more lisp bits! Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Take advantage of multi-arg macros. Add more ROM funcsKeith Packard2016-11-17
| | | | | | Added nth, or and and. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Allow macro/nlambda/lexpr to have multiple argsKeith Packard2016-11-17
| | | | | | | | 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>
* altos/lisp: Do better checking for un-evaluated macros in ROMKeith Packard2016-11-17
| | | | | | | | 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>
* altos/lisp: re-use small framesKeith Packard2016-11-17
| | | | | | | | | 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>
* altos/lisp: remove duplicate 'length' lambda from hanoi exampleKeith Packard2016-11-17
| | | | | | This function is now a builtin. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Get lambdakey and nucleo-32 building againKeith Packard2016-11-17
| | | | | | Remove exti from the build list to make things fit. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Evaluate macros once, then smash them into placeKeith Packard2016-11-17
| | | | | | | This assumes that macros are all pure functions, which should be true for syntactic macros. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Add license to hanoi demoKeith Packard2016-11-17
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Improve hanoi demoKeith Packard2016-11-17
| | | | | | | Repaint in place, without first clearing. This makes the updates a lot clealyer looking. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Show number of collect calls in ao_lisp_testKeith Packard2016-11-17
| | | | | | This helps tune the allocator Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/lisp: Cache freed cons and stack itemsKeith Packard2016-11-17
| | | | | | | | | 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>
* altos/lisp: Simplify GC a bit by only marking the head of each objectKeith Packard2016-11-17
| | | | | | | | | 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>