1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00
Commit Graph

1964 Commits

Author SHA1 Message Date
James Cotton
66293a9788 Merge remote-tracking branch 'origin/stac/led-boottime-config' into next 2012-01-24 10:38:33 -06:00
Stacey Sheldon
5907022b6d Merge remote-tracking branch 'origin/stac/ld-2.22-fix' into next 2012-01-23 23:05:52 -05:00
Stacey Sheldon
bfe6676eed exti: rewrite exti layer to improve portability
The exti layer now allows drivers to register interrupt callbacks
during board initialization.  All details of the driver using a
particular EXTI pin have been removed from the EXTI layer so it
can now be used on any board without board-specific modification.

This includes some nice refinements provided by Mike Smith during
initial review.  His original commits have been squashed into this
one.
2012-01-22 23:23:41 -05:00
Stacey Sheldon
dc4aa07a32 board_hw_defs: factor out board-specific hw config definitions
Board specific HW configuration is now collected in a single .c
file for each board.  This HW configuration is #include'd into
the FW, BL and BU builds for each board.

These new .c files are found in:
  flight/board_hw_defs/<board_name>/board_hw_defs.c

Parts of this information were previously duplicated between
the BL and FW builds.  This commit cleans up the duplication.

Using a #include on a .c file is a bit ugly but it allows us
to ensure that all of the symbols in the board_hw_defs.c file
are *ONLY* used in the PIOS_Board_Init() function for each
software build.
2012-01-22 19:41:41 -05:00
Stacey Sheldon
6bb4f0c61d leds: use boot-time config for PiOS LED layer
LEDs are now configured based on a board-specific initialization
in PIOS_BOARD_Init().

LEDs are now named:
  PIOS_LED_HEARTBEAT
  PIOS_LED_ALARM
2012-01-22 18:22:59 -05:00
Stacey Sheldon
3cbf4499e1 ld: make sure current pointer never goes backwards
Fixes linking on ld version 2.22.
2012-01-21 21:18:06 -05:00
Stacey Sheldon
64202ce092 Merge remote-tracking branch 'origin/stac/i2c_decoupling' into next 2012-01-17 22:35:36 -05:00
Stacey Sheldon
ad141c908a Merge remote-tracking branch 'origin/stac/usb-composite-device-v2' into next 2012-01-17 22:26:38 -05:00
Stacey Sheldon
bffb184b7a usb: add standard boilerplate to new files 2012-01-16 21:32:52 -05:00
Stacey Sheldon
ee0895aa77 usb hid: remove stale files from pipx
These files are no longer relevent for USB configuration.
2012-01-16 21:31:07 -05:00
Stacey Sheldon
3bda0f450d bootfault: force fault when no telemetry available on OP too
If no telemetry link is configured, this will force the board
to reset before finishing init.  The BootFault logic will
catch this after 3 resets and will boot with default hwsettings
on the next reset.

This won't currently ever fire on OP though since we always
configure the serial telemetry interface.  This just makes sure
the pattern is present in case anyone decides to compile without
serial telemetry.
2012-01-15 23:04:31 -05:00
Stacey Sheldon
8cd4816d7b taskmonitor: move taskmonitor into flight/Libraries
taskmonitor.[ch] existed as (nearly) identical copies under
CC and OP directories.  Both builds now reference the common
version under Libraries.
2012-01-15 21:37:10 -05:00
Stacey Sheldon
387ea77d30 diagnostics: enable DIAG_TASKS on OP board by default 2012-01-15 18:16:50 -05:00
Stacey Sheldon
b05697c2cf taskinfo: ensure usage of TaskInfo uavo is covered by DIAG_TASKS
OpenPilot platform (and thus sim too) was missed when the
DIAG_TASKS macro was broken out from the DIAGNOSTICS macro.

This allowed accesses to the TaskInfo UAVO even though it hadn't
been initialized.
2012-01-15 18:16:50 -05:00
Stacey Sheldon
0575b45378 usb: make USB usage depend on PiOS config
USB is not supported on sim platforms.  Let PiOS
config determine when we use it.
2012-01-15 18:16:49 -05:00
Stacey Sheldon
c97b108a1f bootfault: make IAP usage depend on PiOS config
The sim platforms don't support an IAP mechanism.  Let
PiOS config control when we try to use it.
2012-01-15 18:16:49 -05:00
Stacey Sheldon
27ceb7ea92 modules: Allow optional modules to be used as built-in
Some modules are written such that they can be included
or excluded at runtime.  These are added to the OPTMODULES
list in the makefile for a given board.

This change provides a mechanism to allow a build to force
a given module to be built-in (ie. always initialized)
regardless of the configuration in hwsettings.

The main use case for this is to handle a module being optional
on one platform but essential on another.

All modules added to the MODULES list in the Makefile will
automatically result in a matching #define in the form
  MODULE_TheModuleName_BUILTIN
being defined in the CFLAGS for all compiled source.

Note that the capitalization of TheModuleName must match
exactly the capitalization used in the MODULES list.
2012-01-14 16:55:55 -05:00
Stacey Sheldon
53e9ef06b4 altitude: add optional altitude module 2012-01-14 15:38:56 -05:00
Stacey Sheldon
717c1311e6 altitude: allow altitude to be an optional module 2012-01-14 15:38:56 -05:00
Stacey Sheldon
bae08fcad0 bmp085: decouple i2c adapter
Let the bmp085 be attached to different adapters for different
boards.
2012-01-14 15:38:56 -05:00
Stacey Sheldon
4cb0c41338 bmp085: only use eoc and drdy gpios when available
When the bmp085 chip is on an external board, we don't
have access to the eoc and drdy gpio lines.  Only use
them when available.
2012-01-14 15:38:56 -05:00
Stacey Sheldon
a0089f072a i2c: rename main adapter to flexi adapter on CC 2012-01-14 15:38:56 -05:00
Stacey Sheldon
feacec468d i2c: compile-time decoupling of i2c devices from adapters
This allows each device to be moved (at compile time) to a
different adapter.  This is the first step to allowing devices
to be attached to different i2c adapters.
2012-01-14 15:38:56 -05:00
Stacey Sheldon
ec6d550225 i2c: allow i2c adapters to remap pin functions
Allows us to support more complex pin configurations
for i2c.
2012-01-14 15:38:55 -05:00
Stacey Sheldon
a51bf72bc7 usb: allow runtime selection of USB descriptors via hwsettings 2012-01-14 14:28:15 -05:00
Stacey Sheldon
1d14ab00e1 safeboot: add safe boot support to OP and PIPX bootloaders
Application support for OP and PIPX will show up in future
commits.
2012-01-14 14:28:11 -05:00
Stacey Sheldon
2d27c54d48 com_msg: Create new message based COM layer for bootloaders
The main purpose of this new COM implementation is that it is
much simpler, and requires less code space.  This takes a bit
of the pressure off of the CC bootloader which was right at
the limit of available code space in the bootloader partition.

This is not intended to ever be used by the application.

This driver also formalizes the assumptions in the bootloader's
usage of the COM layer.  All messages are assumed to arrive
in atomic chunks from the HID layer.
2012-01-14 14:23:18 -05:00
Stacey Sheldon
b0d1551cc2 Merge remote-tracking branch 'origin/stac/usb-composite-device-v2' into next 2012-01-07 13:35:42 -05:00
Stacey Sheldon
a86abcd140 usb cdc: fix index of first interface in IAD
This error resulted in the HID interface being non
functional on windows platforms.
2012-01-07 09:46:12 -05:00
Stacey Sheldon
3bc45b0036 usb cdc: use proper macro for CDC mgmt endpoint packet size
The hard-coded value (16) in the descriptor differed from the
macro (32) which was used to configure the low-level USB HW
block in the STM32.
2012-01-04 00:38:19 -05:00
Stacey Sheldon
025ed0f43c Merge remote-tracking branch 'origin/stac/usb-composite-device-v2' into next
Conflicts:
	HISTORY.txt
2012-01-03 00:02:45 -05:00
Stacey Sheldon
e22bc0c51b copyright: remove incorrect attribution in boilerplate text
These files do not contain content from the ID in the header.
This name seems to have been cut/pasted all over throughout
the openpilot source tree and should be removed from any files
that should not rightfully be attributed to this person.
2012-01-02 23:33:07 -05:00
Stacey Sheldon
8d8715c8c1 copyright: add/correct GPL + copyright boilerplate
I missed some of the boilerplate text on some of the
new files I've added recently.  Fixed.
2012-01-02 23:28:53 -05:00
Stacey Sheldon
4d2760f11d cc bl: allow bootloader to force safe-boot into firmware
This can be used by the GCS firmware uploader widget to boot
the firmware with a (temporarily) defaulted hwsettings uavo
so that a user can easily recover from a bad/incompatible
hwsettings configuration without wiping all settings.

This uses the same mechanism that the BootFault auto-recovery
code already uses in the CC firmware.  The auto-recovery is
triggered by setting the failed-boot counter to a maximum
value forcing recovery on the next FW init.
2012-01-02 14:27:06 -05:00
Stacey Sheldon
481a13609e com: remove all references to PIOS_COM_ReceiveBufferUsed()
The PIOS_COM_ReceiveBufferUsed() function call is no longer
necessary since the same semantics can be achieved using calls
to PIOS_COM_ReceiveBuffer().
2012-01-02 14:27:06 -05:00
Stacey Sheldon
b94f4b49a4 usb: major refactoring of USB descriptors, CDC and HID
Summary of changes:
 * USB CDC and HID drivers are completely split apart.
   * This will allow different max buffer sizes for HID and CDC.
 * USB descriptors have been overhauled:
   * Proper structs/macros/enums declared for USB (see pios_usb_defs.h)
   * Two common descriptor definitions.  One for HID+CDC another for HID only.
     See pios_usb_desc_{hid_cdc,hid_only}.c for details.
   * Long standing bugs in OP USB descriptors became much more obvious with the
     new struct definitions.
   * Board specific USB initialization is now in pios_usb_board_data.h in each build target.
   * Definition of USB descriptors is now entirely indpendent of STM32 libs.
     Glue into STM32 libs is provided by pios_usbhook.c.
 * Removed a lot of stale/irrelevant USB #defines throughout the tree.
 * Improved naming consistency throughout USB code:
   * PIOS_USB_HID_* now refers to the HID endpoint code.
   * PIOS_USB_CDC_* now refers to the CDC endpoint code.
   * PIOS_USB_* now refers to the low-level USB code.
   * PIOS_USB_BOARD_* now refers to board-specific USB data
   * PIOS_USBHOOK_* is glue between PIOS and STM32 USB libs.
   * struct usb_* and enum usb_* and USB_* and HID_* are all types from the USB spec.
 * Shrunk the buffer size on the CDC call mgmt endpoint to save some RAM.
 * Made a few more USB related variables static to save some RAM.
2012-01-02 14:27:06 -05:00
Stacey Sheldon
7f03195aba stm32 usb: allow descriptor data to be const through API
This allows a few more data structures to be const to save
some RAM.
2012-01-02 14:27:06 -05:00
Oleg Semyonov
b01e332e03 CameraStab: rename UAVO field 2012-01-02 14:27:05 +02:00
Oleg Semyonov
65abb8f819 CameraStab: small optimization, freed 8 more heap bytes 2012-01-02 14:27:00 +02:00
Oleg Semyonov
406cff296d CameraStab: bypass LPF calculation if ResponseTime is zero 2012-01-02 14:26:58 +02:00
Oleg Semyonov
e11904c42f CameraStab: change ResponseTime type from float to int16 2012-01-02 14:26:56 +02:00
Oleg Semyonov
2eb5130a7c CameraStab: new camera stabilization mode and low-pass stick input filtering
This patch is based on work of Crubier (LPF) and Cossacs (AxisLock mode).
I've just reworked it a bit by adding a dynamic memory allocation for
static module data.
2012-01-02 14:26:54 +02:00
Stacey Sheldon
075eb65603 bootfault: fail initialization if no telemetry link is configured
This detects a locked out state and fails the init.  The new
bootfault detection code will automatically drop to default
hwsettings after 3 consecutive boot failures.  That will put
the board back into an unlocked state where the user can now
enable a telemetry link using the GCS and everything will be
OK.

NOTE: Any configured telemetry link will be considered enough
      to boot up.  If you only configure a serial telemetry
      link but don't know how to hook anything up to it, this
      will not save you.

As the ultimate recovery, you can always load firmware on the
board that wipes the settings entirely and start over.
2011-12-31 13:08:30 -05:00
Stacey Sheldon
6c192f67ee gasp: delete clutter 2011-12-31 13:03:49 -05:00
Stacey Sheldon
e7053c77f0 usb config: remove unused macro for number of endpoints
This is no longer referenced and is confusing.
2011-12-31 13:02:43 -05:00
Stacey Sheldon
5c0921e92c fault: add optional fault insertion module
This module and its associated settings uavo can be used
to test various fault conditions during initialization.

To enable the module, add the TEST_FAULTS=YES to your make
command line:
  make fw_coptercontrol TEST_FAULTS=YES

Once this module is part of your firmware load, you can
enable it in the hwsettings uavo and then select the
type of fault to insert by editing the faultsettings uavo.
On the next reset, the configured fault will be inserted
into the init sequence to allow you to test the boot fault
recovery code.

With a fault inserted, you should see 3 failed boot attempts
followed by a successful (recovery) boot.  You will see the
BootFault alarm set to Critical, and the RAM version of your
hwsettings will be reset to defaults.  Since the defaults have
all optional modules disabled, the fault module will be out of
the way during the recovery boot.

You can then "Load" the flash version of the hwsettings uavo
in the object browser, disable the Fault module and then "Save"
the hwsettings module back to the board.  The next reset will
boot normally without the fault inserted.
2011-12-30 23:05:39 -05:00
Stacey Sheldon
f4f0dab764 fixup make combridge an optional module 2011-12-30 23:05:39 -05:00
Stacey Sheldon
f886af186d bootfault: add support for recovery from init failures
After 3 failed warm start attempts, the init sequence
will force the RAM version of the HWSettings object
to its defaults.  This should allow a user to regain
connectivity to a board that is continually faulting
during init.

This is accomplished by:
 - Incrementing a boot counter that is stored in the
   STM32 BKP registers.  These registers survive a
   warm start but are cleared on a cold start (ie. powerup).
 - On multiple failures, force hwsettings to defaults
   and raise the (new) BootFault alarm to prevent arming.
 - Resetting the boot counter whenever the system manages
   to successfully run the System Module task.

NOTE: This does not actually change the hwsettings object in
      flash.  That's up to the user.

This is intended to catch ONLY faults during early initialization.
It should not be used to recover from faults after the application
is up and running.
2011-12-30 23:05:38 -05:00
Stacey Sheldon
b91f40eb94 iap: extend API to support read/write of boot counter
Also clean up unused/obsolete definitions.
2011-12-30 23:05:38 -05:00
Stacey Sheldon
1543a6dbd3 hwsettings: allow disabling of USB telemetry entirely
The GCS hwsettings config widget now disallows any
configuration that disables both HID and VCP telemetry
over the USB port.

The firmware will allow it if the UAVObj is set manually.

This allows a mechanism to reduce RAM usage by another
500 more bytes if USB telemetry can be sacrificed in
certain configurations.
2011-12-30 23:05:38 -05:00