summaryrefslogtreecommitdiff
path: root/src/stm
Commit message (Collapse)AuthorAge
* altos: Wait after configuring boot pin before testing itKeith Packard2013-05-07
| | | | | | | | Clearly the pin isn't quite ready just after it's been configured, so hang around for a while (100 nops) to let things setting down before testing the value of the pin. Makes booting a lot more reliable. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Create per-product flash loadersKeith Packard2013-05-07
| | | | | | | Split the flash loader prototype into pieces so that each product can build a custom flash loader with very little code. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Get rodata into flash, make sure sections are alignedKeith Packard2013-05-07
| | | | | | | | .rodata* needs to be in flash; otherwise strings get left in ram. Failing to align sections makes the initialized data get dumped into the wrong place in memory. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Run self loader when application sets boot addr to 0Keith Packard2013-05-07
| | | | | | | This causes the flash loader startup code to fall into the loader when the application sets the boot address to zero. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Allow STM usb driver to be used without stdioKeith Packard2013-05-07
| | | | | | | This lets the self flashing loader be linked without any of the stdio code, which saves a bunch of memory. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm-flash: Check target flash address against AO_BOOT_APPLICATION_BASEKeith Packard2013-05-07
| | | | | | Allows that value to change Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Use flash loader on all STM productsKeith Packard2013-05-07
| | | | | | Includes the boot chain stuff Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Provide another 4kB of flash space for appsKeith Packard2013-05-07
| | | | | | With the flash loader now < 4kB, we can use the spare 4kB for applications Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Shrink stm flash loader to < 4kBKeith Packard2013-05-07
| | | | | | Saves 4kB of flash space for applications. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Allow core timer to be excluded from buildKeith Packard2013-05-07
| | | | | | | This removes all of the support for the base 100Hz timer from the system, saving space when not needed Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Don't define task macros when not taskingKeith Packard2013-05-07
| | | | | | The necessary data structures aren't defined in this case. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Add comments to the .ld files explaining how the romconfig stuff ↵Keith Packard2013-05-07
| | | | | | | | | | | works Would be nice to be able to explicitly define addresses for the romconfig variables, but I can't figure out how to make that work. Instead, just explicitly load the files in teh right order to make things land in the right places. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Add .elf to .ihx ruleKeith Packard2013-05-07
| | | | | | Uses objcopy -O ihex to extract the initialized bits from an elf file Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Fix STM flash programmingKeith Packard2013-05-07
| | | | | | | | | | | Wait for flash to go non-busy after writing or erasing a page and before jumping back out of the RAM code. Export a separate 'erase' operation for testing. Re-lock flash after every operation. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Validate boot chain start addressKeith Packard2013-05-07
| | | | | | | | | | If the first block of boot memory has been smashed, and the start address is bogus, don't bother trying to jump to the application. This makes the system more resiliant to flash failures, presuming the loader erases the first block, programs the other blocks and then finally comes back to program the first block. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Mark .boot section as (NOLOAD)Keith Packard2013-05-07
| | | | | | | | | For some reason, the silly linker marks things in section .boot as data rather than bss, so they'd end up initialized by default. Force them to be NOLOAD so they preserve values across reboot so that boot chaining works properly. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Clean up boot loader supportKeith Packard2013-05-07
| | | | | | | Split out code into separate files. Add support for getting back to boot loader from application. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add program flash functionKeith Packard2013-05-07
| | | | | | | | And get it loaded to RAM so it can execute correctly. Nothing calls it yet... Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make stm-flash capable of switching to applicationKeith Packard2013-05-07
| | | | | | | This shrinks the base OS load down a bit as well so that stm-flash fits comfortably in the first 8kB of memory. Signed-off-by: Keith Packard <keithp@keithp.com>
* Add STM self-flashing loaderKeith Packard2013-05-07
| | | | | | | This allows the real application to get loaded at 0x2000 and jumps to that at startup time if the boot pin is set appropriately Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Use SYSTICK on STM32LKeith Packard2013-05-07
| | | | | | | It's probably more power efficient than using one of the timers, and it's certainly easier to configure. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Use separate exception stack on STM32LKeith Packard2013-05-07
| | | | | | | | This reserves 512 bytes of memory for a stack, then makes sure that exceptions continue to use that stack while processes use the per-task stack. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Allow LCD segments to not be multiplexed across digitsKeith Packard2013-05-07
| | | | | | | This allows each LCD segment to be individually configured as to which COM and which SEG drives it, permitting maximum flexibility in wiring. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Remove USB EP0 taskKeith Packard2013-05-07
| | | | | | | Handl EP0 actions from interrupt handler. This allows USB to be used in a taskless environment, like the STM flash loader Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Always declare all romconfig variablesKeith Packard2013-05-07
| | | | | | | | I haven't figured out how to assign addresses for specific initialized variables, so we'll just have to always declare all of them and make sure that we add new ones at the end. Signed-off-by: Keith Packard <keithp@keithp.com>
* name change from MegaMetrum to TeleMegaBdale Garbee2013-04-22
|
* Move cortex toolchain to /opt/cortexKeith Packard2013-04-22
| | | | Signed-off-by: Keith Packard <keithp@keithp.com>
* altoslib/altosui: Carry receiver status around in AltosListenerStateKeith Packard2013-04-09
| | | | | | | | | | This moves the crc_errors into the new structure and adds a receiver battery voltage value there as well. Now the receiver status can be monitored separately from the flight status. That also means that code receiving state updates should be prepared to accept missing listener or flight state values. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Always check for idle IN buffer before sendingKeith Packard2013-03-31
| | | | | | | | | | | | | | Unlike the AVR and CC1111 USB drivers, the STM usb driver queues IN bytes in a local buffer instead of in the driver; this means that the driver is queuing bytes while the previous IN packet is queued for the host, which allows for overlapping execution. It also means that when the local buffer is full, we must check to see if the host has picked up the previous IN packet before trying to queue another IN packet for transmission. This is done by always waiting for the IN buffer to be ready before sending data. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Add debugging mechanism to STM USB driverKeith Packard2013-03-31
| | | | | | | | This adds a pile of debugging hooks to the USB driver to try and isolate various lockup-related issues. It's all disabled by default, of course. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Do not release interrupts from any pollchar functionKeith Packard2013-03-31
| | | | | | | | | | | getchar relies on interrupts being blocked across the pollchar calls and into the sleep call or it may go to sleep with data pending. This prefixes all pollchar functions with _ to indicate that they are to be called with interrupts blocked and eliminates all interrupt manipulation calls from within the pollchar functions. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Use FTDW, clear DATA bit. Disable backup write protectionKeith Packard2013-03-27
| | | | | | | | | The newer(?) chips in telegps didn't like the previous programming scheme, so go back to fixed time for write, which does an implicit erase before every write. Also clear the DATA bit, which is only needed for double word erase/programming. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Ensure SPI always sends 0xff during receiveKeith Packard2013-03-26
| | | | | | SD cards require 0xff when fetching data Signed-off-by: Keith Packard <keithp@keithp.com>
* Merge branch 'telescience-v0.2'Keith Packard2013-02-24
|\
| * altos: Crank fast SPI on STM to 8MHzKeith Packard2013-01-13
| | | | | | | | | | | | | | With the GPIO pins set to 10MHz now, we can run SPI at the maximum possible speed (8MHz). Signed-off-by: Keith Packard <keithp@keithp.com>
| * altos: Set STM GPIO output speed for SPI pins correctlyKeith Packard2013-01-13
| | | | | | | | | | | | | | | | The GPIO pin settings affect the output impedence, and hence the maximum speed for SPI. Cranking these to suitable values allows SPI to run at full speed. Signed-off-by: Keith Packard <keithp@keithp.com>
| * altos: Initial telescience bitsKeith Packard2013-01-12
| | | | | | | | | | | | These might do something, and should at least bring up USB Signed-off-by: Keith Packard <keithp@keithp.com>
* | altos/stm: Add more bits to NVIC register definitionsKeith Packard2013-02-24
|/ | | | | | This cleans up a few values, adds more comments and a few more NVIC fields. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add support for 115200 baud serial ratesKeith Packard2012-11-30
| | | | | | Necessary for flashing skytraq chips Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Make stdio 8-bit clean by making pollchar return intKeith Packard2012-11-30
| | | | | | | | | | We were stealing one value (0xff) in the return value from pollchar to indicate 'not ready yet'. Instead of doing that, use the integer value -1 and have pollchar return an int instead of a char. That necessitated cleaning a few other bits to make sure that 0xff wouldn't get promoted to -1 on accident. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos/stm: Support LEDs on multiple portsKeith Packard2012-11-01
| | | | | | | Split out the bits in a fairly simplistic fashion so that we support no more than 16 LEDs still. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Provide ao_task_alarm_tick to reduce per-tick costKeith Packard2012-10-26
| | | | | | | Cache the next wakeup time and check that before jumping to the task code. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Leave interrupts disabled while checking for task to runKeith Packard2012-10-26
| | | | | | | Otherwise, we run the risk of an interrupt waking a task after we've decided to idle the CPU. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Clean up stm arch macros a bit.Keith Packard2012-10-25
| | | | | | | Turn a bunch of the macros into inline functions. Clean up the reboot method to use the stm_scb structure. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Switch drivers to ao_arch_block/release_interruptsKeith Packard2012-10-25
| | | | | | Stop using cli/sei, which are avr-specific Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add task queues.Keith Packard2012-10-25
| | | | | | | | | This replaces the array-based scheduler with a queue-based one instead. It should have the same basic scheduling semantics, but it walks shorter lists for each operation, making it much more efficient when the system has a lot of tasks. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Add stack-guard code. Uses STM MPU to trap stack overflow.Keith Packard2012-10-25
| | | | | | | | This marks the lowest portion of the stack as inaccessible to the CPU, causing the processor to fault when it reaches it. The fault then generates a panic message so that the user can know what happened. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Replace __critical usage with ao_arch_critical as neededKeith Packard2012-10-25
| | | | | | | | | | | | | sdcc offers __critical as a machine-independent way to block interrupts, but as gcc doesn't, we need to use a compiler-independent construct instead. ao_arch_critical has been around since the AVR port, but some old __critical usages remained. This fixes a bunch of random hangs when communicating with MM over USB or the radio as the various stdio loops were running without interrupts blocked between the test and the sleep. Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: profiling on STM32LKeith Packard2012-10-25
| | | | | | Add sample-based profiling, using a 1kHz timer Signed-off-by: Keith Packard <keithp@keithp.com>
* altos: Force beep timer regs reload when enabling beeperKeith Packard2012-10-25
| | | | | | | Without this, there can be a long delay between asking for the beeper and having it actually start sounding. Signed-off-by: Keith Packard <keithp@keithp.com>