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

320 Commits

Author SHA1 Message Date
Oleg Semyonov
0116e6a007 spektrum: rework DSM2/DSMJ/DSMX driver for explicit DSMX resolution support
- both CC serial ports are now disabled by default (no telemetry);
- serial ports now have DSM2, DSMX (10bit) and DSMX (11bit) options;
- ReceiverGroups now have DSM (MainPort) and DSM (FlexiPort) options.

For DSM2 protocol there is an explicit resolution bit in the stream, so
the DSM2 should be selected. For DSMX there is no such bit, and user
should choose the resolution from the list configuring the spektrum port.
ReceiverGroups have single DSM option which is handled by the same driver.

Downside: this implementation saves received frame first, unrolls by the
end of frame. This should be ok, but may be improved by unrolling channels
on the fly in the rx callback.

Another minor difference is that a ChannelGroup is now bound to port:
DSM (MainPort) or DSM (FlexiPort). This was considered as acceptable
solution in order to not have 6 DSM options for each ChannelGroup and
even more in case of new DSM protocol variations.

Known problem: it is not possible to choose same protocols like
DSM2/DSM2 for two ports. It can be enabled by adding an exception to
common rule, though.

The DSMX throttle channel misbehavior (zero value) is not treated
specially yet. It should trigger the failsafe being out of bounds.
More info and data dumps are required to handle this properly.
2011-10-30 19:29:03 +02:00
James Cotton
0f8ae1e076 Merge branch 'next' into ins
Conflicts:
	flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj
2011-10-26 13:18:44 -05:00
Oleg Semyonov
a19bbba858 Merge branch 'next' into os/alternative_spektrum_driver 2011-10-25 11:55:05 +03:00
James Cotton
27bf2b383e Merge remote-tracking branch 'origin/james/remap_outputs' into next 2011-10-23 18:35:25 -05:00
Oleg Semyonov
4ed23dd891 Output Remapping: renamed PPM_SERVO option to PPM+Servo 2011-10-24 00:34:01 +03:00
James Cotton
24d6ae731b Output Remapping: Added option to just use servo outputs on input lines but not
PPM.  This saves resources.  Good suggestion Os.  In this configuration we
could allow 12 channels of output but for now I'll leave it capped at 10 to
lessen resources on the mixer table.

With spektrum and camera stab enabled there was
1632 bytes heap remaining
180 bytes irq stack remaining
2011-10-23 15:21:40 -05:00
Oleg Semyonov
2a98a52f4c gps: include optional GPS module by default 2011-10-23 00:41:18 +03:00
Oleg Semyonov
6a9208e8c3 Merge branch 'next' into os/TxPID-module 2011-10-22 23:34:58 +03:00
Oleg Semyonov
58d0812309 sbus: better frame syncronization, some cosmetic changes
In the previous version the decoder could in rare cases get synced from
the middle of data stream in case of data byte equal to the S.Bus start
of frame (SOF) byte (wrong data will be rejected but it was not perfect).
Now it waits for the real start of frame and then checks the SOF byte.
2011-10-22 00:44:09 +03:00
Oleg Semyonov
62bca651d5 spektrum: alternative DSMx (DSM2/DSMJ/DSMX) driver
- does not glitch when used in 2-frame mode (DM9, 9503, etc)
- does NOT provides yet DSMX stream decoding - do NOT merge
- uses a bit more time in the interrupt, but frees 16 bytes of RAM.
  This is done to help decoding the weird DSMX stream which does not
  contain explicit resolution/frame/lost frames info and needs special
  processing (to be done yet).
2011-10-21 23:35:17 +03:00
James Cotton
e0cc289de0 Remapping inputs to outputs: Drop S2 so there are ten outputs
Output 7 = S3 input
Output 8 = S4 input
Output 9 = S5 input
Output 10 = S6 input

Also fix bug that prevented them outputting signal
2011-10-20 06:28:07 -05:00
James Cotton
ce7f424131 CC: When receiver port is set to PPM_SERVO use the spare pins as outputs 2011-10-15 16:59:42 -05:00
James Cotton
19c9528d80 CopterControl: Create structures to supply more output channels 2011-10-15 16:59:42 -05:00
Oleg Semyonov
469feecb13 pios: remove some unused #defines 2011-09-28 23:40:12 +03:00
Oleg Semyonov
ed8cf89888 Initcall: fix compilation errors for firmware which does not use Initcalls 2011-09-28 22:57:18 +03:00
Oleg Semyonov
a38c569cd0 HwSettings: move Telemetry and add GPS port speed to the HwSettings object
TelemetrySettings object removed (saved 200+ bytes of RAM). Telemetry
port speed moved to the HwSettings object. Added GPS port speed setting.
GCS code updated to reflect changes and support both fields.
2011-09-28 22:11:42 +03:00
Oleg Semyonov
53c098dd08 Merge branch 'next' into os/GPS-on-CopterControl_next_v2
Conflicts:
	flight/OpenPilot/System/pios_board.c
	flight/OpenPilot/UAVObjects.inc
	shared/uavobjectdefinition/hwsettings.xml
2011-09-28 22:02:02 +03:00
James Cotton
cf6a59468f Merge branch 'next' into ins
Conflicts:
	flight/INS/Makefile
	flight/Project/OpenOCD/stm32f1x.cfg
	flight/Project/OpenOCD/stm32f2x.cfg
	make/firmware-defs.mk
2011-09-27 01:02:06 -05:00
James Cotton
f1e70d2ff5 Merge remote-tracking branch 'origin/msmith/OP-578' into next 2011-09-23 16:43:00 -05:00
Oleg Semyonov
d923117c25 TxPID: optional module to tune PID settings using R/C transmitter
This module will periodically update values of stabilization PID settings
depending on configured input control channels. New values of stabilization
settings are not saved to flash, but updated in RAM. It is expected that the
module will be enabled only for tuning. When desired values are found, they
can be read via GCS and saved permanently. Then this module should be
disabled again.
2011-09-17 22:49:51 +03:00
James Cotton
acf2aa218b Merge remote-tracking branch 'origin/stac/upgrade-to-openocd-0.5.0' into next 2011-09-14 11:49:01 -05:00
James Cotton
400ba3bd47 Merge branch 'next' into ins 2011-09-12 18:57:11 -05:00
James Cotton
6457276438 Merge branch 'input_configuration' into next 2011-09-11 18:52:35 -05:00
Oleg Semyonov
7b3056d10f Input Configuration: fix S.Bus receiver in multi-receiver code 2011-09-12 02:06:48 +03:00
Mike Smith
deade53c5d OP-578 - check for CODE_SOURCERY before setting -fpromote-loop-indices 2011-09-11 10:49:09 -07:00
James Cotton
01cd2ded57 Mainboard config: The rcvr port is used for PPM/PWM/Spektrum so make these one
setting that is mutually exclusive.
2011-09-10 14:20:51 -05:00
James Cotton
eb191d869a Mainboard: Get spektrum working again. 2011-09-10 14:19:54 -05:00
James Cotton
c2a8cc3faa Mainboard config: The rcvr port is used for PPM/PWM/Spektrum so make these one
setting that is mutually exclusive.
2011-09-10 14:19:12 -05:00
James Cotton
1d2a424296 Mainboard: Get spektrum working again. 2011-09-09 09:42:13 -05:00
James Cotton
3239fdf21b Merge branch 'next' into ins
Conflicts:
	flight/CopterControl/Makefile
	flight/OpenPilot/System/pios_board.c
	flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj
2011-09-09 08:33:34 -05:00
Stacey Sheldon
2f86e4dd4f Make PWM/PPM and Servo drivers play nicely together
PWM and PPM can now coexist in the same load and be
selected at boot time via the hwsettings UAVObject.

This is basically a complete restructuring of the
way the drivers interact with the TIM peripheral in
the STM32.

As a side effect, the PWM and PPM drivers are now
ready to support multiple instances of each.

This also provides the first step toward being able
to reassign some of the PWM input pins to be servo
output pins.  Still more work required, but this is
a good start.
2011-08-27 21:39:56 -04:00
James Cotton
c5746335c6 Initialize GCSReceiver object if it is being used 2011-08-27 15:57:09 -05:00
James Cotton
dc340596f5 Merge branch 'next' into GCS_ChangesToUI-RuntimeCFG
Conflicts:
	flight/CopterControl/Makefile
	flight/OpenPilot/System/pios_board.c
	flight/OpenPilot/UAVObjects.inc
	flight/PiOS/STM32F10x/pios_spektrum.c
	ground/openpilotgcs/src/plugins/config/config.pro
	ground/openpilotgcs/src/plugins/config/configgadget.qrc
	ground/openpilotgcs/src/plugins/uavobjects/uavobjects.pro
	shared/uavobjectdefinition/hwsettings.xml
2011-08-27 15:26:05 -05:00
Stacey Sheldon
f29b99521e openocd: collapse JTAG rules for STM32F1 and STM32F2 2011-08-27 10:43:02 -04:00
James Cotton
274333a9bf Merge branch 'next' into stac/use-malloc-failed-hook 2011-08-27 00:12:45 -05:00
Corvus Corax
0065842de7 Makefiles: fixed comment line 2011-08-25 16:28:34 +02:00
Corvus Corax
8173c7b7c6 Refactor GPS_PURISTIC into GPS_MINIMAL 2011-08-25 15:44:49 +02:00
Corvus Corax
3690586f3a Optional Modules: Forced re-generation of mod init.h when makefile has changed 2011-08-25 15:42:11 +02:00
Corvus Corax
c63a10d05e CopterControl: Fix GPS buffer sizes 2011-08-25 15:37:38 +02:00
Corvus Corax
4bd72923e5 Merge branch 'CorvusCorax_unidirectional-GPS-com' into CC_GPS
Conflicts:
	flight/Modules/GPS/GPS.c
	flight/Modules/GPS/GTOP_BIN.c
	flight/Modules/GPS/NMEA.c
	shared/uavobjectdefinition/hwsettings.xml
2011-08-25 15:33:23 +02:00
James Cotton
5f7a9b513a Merge branch 'sambas/dsmx_stuff' of ssh://git.openpilot.org/OpenPilot into next
Conflicts:
	shared/uavobjectdefinition/hwsettings.xml
2011-08-24 11:37:30 -05:00
Stacey Sheldon
edc0caf521 heap: set memory critical alarm on malloc failures
Activate the FreeRTOS malloc failed hook and use it
to set the memory critical alarm.
2011-08-21 23:14:32 -04:00
James Cotton
e1afc9a19a Merge branch 'next' into ins
Conflicts:
	flight/Libraries/inc/fifo_buffer.h
	flight/PiOS/STM32F10x/link_STM3210E_INS_sections.ld
	flight/Project/OpenPilotOSX/OpenPilotOSX.xcodeproj/project.pbxproj
2011-08-21 00:47:43 -05:00
Corvus Corax
7395a369a9 Optional Modules: Ported optional module concept to OpenPilot and Sim_Posix 2011-08-20 13:02:44 +02:00
Corvus Corax
53d0732fc6 Enable GPS module as "optional module" in CooterControl 2011-08-20 01:25:49 +02:00
Corvus Corax
dfd301571a HWSettings: Allow late Initialization and Start of Modules as defined in Makefile(available modules) and UAVObject(actually started modules) 2011-08-20 01:24:06 +02:00
James Cotton
86b652bbab Merge branch 'next' into camera_stabilization 2011-08-14 18:07:57 -05:00
zedamota
e736b17cc4 Merge remote-tracking branch 'remotes/origin/next' into GCS_ChangesToUI-RuntimeCFG
Conflicts:
	ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp
	ground/openpilotgcs/src/plugins/config/configgadgetwidget.h
	ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp
2011-08-14 15:48:16 +01:00
James Cotton
f766ba47aa Increase the size of the eventdispatcher task and lower the maximum queue size. 2011-08-13 19:21:58 -05:00
James Cotton
9c7799dfe6 UAVObject Init: Get rid of deprecated linker init code 2011-08-10 22:48:42 -05:00
James Cotton
f11aa80444 CameraStabilization: Make the CameraStabilization module put the desired
position into another object (will help with configuration).
2011-08-09 20:45:38 -05:00
James Cotton
a0d77faf4b PiOS: Move pios_iap out of common. It is STM32F1x specific. Created an
STM32F2xx stub version.  This needs cleaning up - there is some common code,
most of which can probably move to the bl_helper function.
2011-08-06 20:24:07 -05:00
sambas
1e67b5e3b5 DSMx_binder, hw setting 0 disabled, 1-10 bind pulses. Manual disable after successful bind. Only for flexiport. 2011-08-06 22:16:47 +03:00
James Cotton
a592e7d398 ManualControlSettings must be also initialized in pios_board.c 2011-08-04 07:47:50 -05:00
Stacey Sheldon
90b2625deb rcvractivity: Add tracking of Rx channel activity 2011-08-02 01:27:37 -04:00
Stacey Sheldon
06cdeb7b61 rcvr: support multiple simultaneous receivers
Now also supports multiple instances of the Spektrum driver.
These are configured as Spektrum1 and Spektrum2.
2011-08-02 01:22:04 -04:00
Stacey Sheldon
829b8b83f6 rcvr: Add GCS receiver driver for rcvr via telemetry
This allows the GCS to emulate a receiver device via the
telemetry link.

Select "GCS" as your input type in the manualcontrol config
screen and calibrate it as normal.

Note: The expected values for the channels are in microseconds
      just like a PWM or PPM input device.  The channel values
      are validated against minimum/maximum pulse lengths just
      like normal receivers.
2011-08-02 01:22:04 -04:00
James Cotton
035b4103c4 Need to initialize the HwSettings before using them. 2011-07-31 09:42:15 +09:00
James Cotton
3df730c64f Merge branch 'stac/refactor-usart-com' into camera_stabilization 2011-07-30 13:38:43 +09:00
James Cotton
387a22398e Make it possible to optionally enable the CameraStab module 2011-07-30 12:08:47 +09:00
Stacey Sheldon
8c0b60099f rcvr: don't init spektrum and sbus rcvrs twice 2011-07-29 22:59:50 -04:00
James Cotton
132e19d613 Change the makefiles - always compile the optional objects but the flag
indicates whether they are registered
2011-07-30 11:29:29 +09:00
James Cotton
ae67c51632 Register some missing objects with their modules 2011-07-30 11:28:21 +09:00
James Cotton
2e5a36a4db Merge branch 'stac/refactor-usart-com' into camera_stabilization 2011-07-30 10:55:16 +09:00
James Cotton
b2d2114ede Disable auto registration of all objects. Later the uavobj_init linker scripts
should be deleted to not carry around old code.
2011-07-30 10:24:46 +09:00
James Cotton
23e9b56839 Dos2unix flight/CopterControl/System/coptercontrol.c 2011-07-30 10:06:35 +09:00
James Cotton
96c2d24253 Merge branch 'next' into camera_stabilization
Conflicts:
	flight/CopterControl/Makefile
	flight/CopterControl/System/coptercontrol.c
	flight/Modules/Actuator/actuator.c
	flight/Modules/GPS/GPS.c
	flight/Modules/ManualControl/manualcontrol.c
	flight/Modules/Stabilization/stabilization.c
	flight/Modules/System/systemmod.c
	shared/uavobjectdefinition/manualcontrolsettings.xml
	shared/uavobjectdefinition/stabilizationdesired.xml
2011-07-30 10:06:10 +09:00
Stacey Sheldon
c2fb0d8b43 com: allow run-time allocation of buffers 2011-07-29 15:33:14 -04:00
Stacey Sheldon
5f8760a55c com: Move buffering out of USART/HID layer and into COM layer
This allows the spektrum and sbus receiver drivers to bind
directly to the usart layer using a properly exported API
rather than overriding the interrupt handler.

Bytes are now pushed directly from the usart layer into the
com layer without any buffering.  The com layer performs all
of the buffering.

A further benefit from this approach is that we can put all
blocking/non-blocking behaviour into the COM layer and not
in the underlying drivers.

Misc related changes:
 - Remove obsolete .handler field from irq configs
 - Adapt all users of PIOS_COM_* functions to new API
 - Fixup callers of PIOS_USB_HID_Init()
2011-07-27 19:45:38 -04:00
Stacey Sheldon
8dbace5ee2 Merge branch 'rcvr_mem_reduction'
Conflicts:
	flight/PiOS/STM32F10x/link_STM32103CB_CC_Rev1_sections.ld
2011-07-17 17:14:40 -04:00
James Cotton
d41260d54c Make the stabilization settings query correctly now by increasing the TX buffer
on the CC side to 256 bytes instead of 128 to support large objects (max object
size is 256 bytes)
2011-07-15 10:40:21 -05:00
Stacey Sheldon
6580462916 rcvr: specify drivers for groups of channels
Each channel was previously tracking a separate driver.
Now, channels are grouped within a channel group to save
RAM used for tracking and to better reflect how channels
are actually mapped.
2011-07-14 23:22:42 -04:00
sambas
18a5465246 Bugfix: CC flexiport spektrum config
Working spektrum bind routine, depending your TX try BIND_PULSES 3,5,7,9 (5 works with DX7)
Boot process takes too long on MB so bind command misses the window (20-140ms).
2011-07-14 14:43:26 +03:00
James Cotton
2fe7ee40b1 Merge branch 'OP-423_Mathieu_Change_Init_To_Reduce_Memory_Footprint' 2011-07-12 12:44:59 -05:00
James Cotton
15a2b85729 For OpenPilot use the minimal stack size (512 words) for eventdispatcher as
this is necessary for object saving.  Creating a new define to override this
for CopterControl down to 96.
2011-07-12 12:34:40 -05:00
Mathieu Rondonneau
d38f6167e3 OP-423:
Also reduce heap has it does not fit in SRAM anymore (not with current compiler).
(that's ok since if there is more space available, it will be reclaimed).

Merge branch 'master' into OP-423_Mathieu_Change_Init_To_Reduce_Memory_Footprint

Conflicts:
	flight/CopterControl/System/inc/pios_config.h
	flight/Modules/ManualControl/manualcontrol.c
2011-07-08 06:29:34 -07:00
Stacey Sheldon
b86ef4de82 bootcfg: fix incorrect bounds checking on rcvr registration
This was preventing any receivers from registering their
channels.
2011-07-07 23:59:12 -04:00
Stacey Sheldon
1f004ee896 ppm: port PPM driver onto new CC driver layers
This is a port of a work-in-progress by Sambas onto
the new driver infrastructure needed for boot-time
configuration.

PPM and PWM still don't coexist in a build but this
is closer.
2011-07-07 22:27:57 -04:00
Stacey Sheldon
226f095a2e bootcfg: remove baudrate #defines for USARTs
The initial baud rates of each interface are now forced in the
board init code.

Any modules using USARTs should have fields added to
their settings object to allow the user to change the
baud rate from the default by using the COM layer APIs.

Developers requiring custom baud rates before the settings
objects are in place should locally edit the cfg structs
to specify the desired baud rates.
2011-07-06 23:03:54 -04:00
Stacey Sheldon
a8787ee015 bootcfg: Add support for selecting S.Bus receivers in inputtype 2011-07-06 22:38:23 -04:00
Stacey Sheldon
bf39ab7a22 remove left-over comment about compile time configs
No functional changes.
2011-07-06 22:36:15 -04:00
Stacey Sheldon
e82539c654 bootcfg: additional validation during board init 2011-07-06 22:34:59 -04:00
Stacey Sheldon
dbf7574946 bootcfg: use UAVobj to control boot-time HW config
This should mark an end to the compile-time selection of HW
configurations.

Minor changes in board initialization for all platforms:
 - Most config structs are marked static to prevent badly written
   drivers from directly referring to config data.
 - Adapt to changes in .irq fields in config data.
 - Adapt to changes in USART IRQ handling.

Major changes in board initialization for CC:
 - Use HwSettings UAVObj to decide which drivers to attach to
   the "main" port and the flexi port, and select the appropriate
   device configuration data.
 - HwSettings allows choosing between Disabled, Telemetry, SBUS,
   Spektrum,GPS, and I2C for each of the two ports.
 - Use ManualControlSettings.InputMode to init/configure the
   appropriate receiver module, and register its available rx channels
   with the PIOS_RCVR layer.  Can choose between PWM, Spektrum and PPM
   at board init time.  PPM driver is broken, and SBUS will work once
   it is added to this UAVObj as an option.
 - CC build now includes code for SBUS, Spektrum and PWM receivers in
   every firmware image.

PIOS_USART driver:
 - Now handles its own low-level IRQs internally
 - If NULL upper-level IRQ handler is bound in at board init time
   then rx/tx is satisfied by internal PIOS_USART buffered IO routines
   which are (typically) attached to the COM layer.
 - If an alternate upper-level IRQ handler is bound in at board init
   then that handler is called and expected to clear down the USART
   IRQ sources.  This is used by Spektrum and SBUS drivers.

PIOS_SBUS and PIOS_SPEKTRUM drivers:
 - Improved data/API hiding
 - No longer assume they know where their config data is stored which
   allows for boot-time alternate configurations for the driver.
 - Now registers an upper-level IRQ handlerwith the USART layer to
   decouple the driver from which USART it is actually attached to.
2011-07-05 22:03:25 -04:00
Stacey Sheldon
6415fc84a5 rtc: allow registration of callbacks on RTC tick
This separates the RTC device and interrupt handling
from the devices that rely on the tick notifications.

Drivers can now register tick notification functions
that will be called on each RTC tick event.
2011-07-05 22:03:25 -04:00
Stacey Sheldon
740b5f1584 rcvr: convert PWM, PPM, SBUS and Spektrum to use PIOS_RCVR
All receivers now fall under the same driver API provided
by pios_rcvr.c.

This is part of a larger sequence of commits that will
switch the receiver selection over to boot time dynamic
configuration via UAVObjects.
2011-07-05 22:03:25 -04:00
Stacey Sheldon
0c4facac46 heap: reduce stack size on IDLE and Event tasks
The FreeRTOS IDLE task was using 512 bytes of stack.
The UAVObject Event task was also using 512 bytes of stack.

Both have been reduced, recovering 400+ bytes of heap.
2011-07-05 20:13:00 -04:00
Mathieu Rondonneau
b3740ec025 OP-423: Clean startup and add weak function call for stack swap. 2011-07-03 12:43:38 -07:00
Corvus Corax
fc62f6e522 Module initialisation rework ported to PiOS.posix 2011-06-26 00:25:06 +02:00
Mathieu Rondonneau
6683ce8570 OP-423: Make it more obvious that MODULE_TASKCREATE_ALL and MODULE_INITIALIZE_ALL are macro (for now):
- remove the ;
  - also encapsulate the macro by {} in his own scope.
2011-06-25 11:40:01 -07:00
Mathieu Rondonneau
dcd2774103 OP-423 Fix some comment from code review:
- update example module
- use module init macro for POSIX and WIN to make code cleaner.
2011-06-24 06:59:51 -07:00
James Cotton
493fcaef2a OP-193 OP-511: Add settings to scale the camera input output range 2011-06-23 00:47:27 -05:00
Mathieu Rondonneau
703919daf4 OP-423 Reduce IRQ stack limits (CC onlyt) 2011-06-22 06:32:27 -07:00
Mathieu Rondonneau
0ff5e9a46f Merge branch 'master' into OP-423_Mathieu_Change_Init_To_Reduce_Memory_Footprint 2011-06-21 22:02:13 -07:00
James Cotton
8976d22fad Merge remote-tracking branch 'origin/OP-159_os_sbus' 2011-06-21 17:51:22 -05:00
Oleg Semyonov
fba201c8b3 usart: move default port numbers from pios_config.h to pios_board.c 2011-06-22 01:32:18 +03:00
Mathieu Rondonneau
fc1e3f574c OP-423: Split task create and module init in order to postpone task creation once the full heap is available.
Also implement some ordering (quite ugly still) in the module init and task creation order so we can decide which module to start/init first
and which module to start/init last.
This will be replaced/adapter with the uavobject list later (once it's implemented).
reserving some space for module init and task create parameters to customize module/task creation (this will be usefull once we get the list and customization from customer).

Changes have been made for OP and CC. Tested comped with CC,OP, sim_posix.
Only ran on bench with CC for couple of minutes (code increase expected but no dropping of stack which is good).

This gives task creation at the time wherethe all heap is available.
2011-06-19 22:35:40 -07:00
Oleg Semyonov
6272210df7 sbus: some code cleanup (no functional changes) 2011-06-19 14:30:13 +03:00
Mathieu Rondonneau
2b11395a67 OP-423 just move stack from systemmod back to heap (200 bytes) that are not needed anymore. 2011-06-18 17:31:29 -07:00
Mathieu Rondonneau
5e3e7cc4e3 OP-423 Fix issue with init not properly started in the right order endup up object thinking other where not init. 2011-06-18 17:28:37 -07:00
Oleg Semyonov
59da5055cd usart: make USART ports configurable from make command line
For CopterControl the following make options are available:

USE_TELEMETRY=[YES|NO|1|3]    (default is YES, USART1)
USE_GPS=[YES|NO|1|3]          (default is NO, USART3)
USE_SPEKTRUM=[YES|NO|1|3]     (default is NO, USART3)
USE_SBUS=[YES|NO|1]           (default is NO, USART1 only)
2011-06-18 23:54:32 +03:00
Oleg Semyonov
311902f1f2 sbus: implemented S.Bus stream decoding 2011-06-18 23:19:57 +03:00
James Cotton
724016ffb0 When erasing flash at the end start flashing LED to indicate it is done 2011-06-18 14:32:09 -05:00
James Cotton
5044ea36de Start initializing objects in the modules that consume them. Shouldn't affect
OP yet but not tested.
2011-06-18 14:20:51 -05:00
Mathieu Rondonneau
b67a38661e OP-423: merge master into that branch, resolve conflicts and test with CC and bl_CC
heap reamining is low (about 500) but stacks can be ajusted (specially the 200 bytes from system) to give the level close to 1Ko if needed.

Merge branch 'master' into OP-423_Mathieu_Change_Init_To_Reduce_Memory_Footprint

Conflicts:
	flight/CopterControl/System/inc/FreeRTOSConfig.h
	flight/CopterControl/System/inc/pios_config.h
2011-06-17 19:04:09 -07:00
James Cotton
9720a8444f Make a few things optional if they are mostly for diagnostics to keep memory
down
2011-06-17 21:00:21 -05:00
Mathieu Rondonneau
65cf467ca4 OP-423: move the module initialize funtion into a specific section for OP and CC.
- create linker section for those <module>Initialize()
- later this list will incorporate parameters as well. (this probably will be more a OP feature to swap/remove/delete module on the fly.
- this is not done at compile time anymore by Makefile.
- this will allow us to have control on the module start at run-time (not implemented but build the ground for it).
- this simplify the startup (Part of code re-org).
- this change does not affect sim_posix and win32 (since they don't need that)
- ensure it's compiling for PiOS.posix
- port to PiOS.win32 but not tested (not compiled)
- tested on CC
- compile on OP.
- this free ~200 bytes.
- current avalable bytes (is we keep the same remaining bytes on the stack than before) is easily passed the 1.2Ko mark on CC with new gcc (4.5.2)
- this does not include init-reorg for each module (I still think more can be freed)
2011-06-16 22:13:19 -07:00
Oleg Semyonov
aeda61d252 usart: serial telemetry can be disabled to free USART
It was tested being merged with OP-472_CorvusCorax_CopterControl-Guidance_v3
branch, Spektrum on USART3 and GPS on USART1 and seems to work.

Currently defaults mimic original behavior, that is, if USE_SPEKTRUM
is not defined - define USE_PWM and USE_GPS. Thsi should be refactored
later to make it configurable from the Makefile.

Also it was not ported to the OP MB: it currently does not support the
S.Bus hardware and still has original behavior with the patch. But this
is one more step to dynamic configuration of ports.
2011-06-16 15:06:01 +03:00
Oleg Semyonov
50e819192b usart: make CC USART ports compile-time configurable
TODO: This should be dynamic in the future.
But for now define any compatile combination of:
   USE_I2C (shared with USART3)
   USE_TELEMETRY
   USE_GPS
   USE_SPEKTRUM
   USE_SBUS (USART1 only, it needs an invertor)
and optionally define PIOS_PORT_* to USART port numbers

Defaults are:

#define PIOS_PORT_TELEMETRY 1
#define PIOS_PORT_GPS       3
#define PIOS_PORT_SPEKTRUM  3
#define PIOS_PORT_SBUS      1

#define USE_TELEMETRY
#define USE_GPS

Telemetry, GPS and PWM input are enabled by default.
2011-06-15 22:37:44 +03:00
Oleg Semyonov
d8201ec45b sbus: provide a stub based on Spektrum driver (for CC only) 2011-06-15 22:35:21 +03:00
James Cotton
144f36dfb7 Merge branch 'bugfix-flight' 2011-06-14 10:02:55 -05:00
Mathieu Rondonneau
c95b199166 OP-423 do the arch specific stuff (in reset vector) to hide this from portable code:
- switch back to MSP stack before starting the scheduler so that the sheduler can use the IRQ stack (when/if needed).
 - call the C portable function in heap1 to claim some stack back (the number to claim is taken from linker file).
 - start the scheduler from reset vector (I move this here from main because it make sense to not go back to C (so that I don't need to copy the rolled stack in case the sheduler returns). This make it more clean.
 - Also I have added the call to the mem manager if sheduler return. that way, we don't reset indefinitely if memory runs out. We will go to this handler and figure things out (right now, it's just looping but at least not rebooting. Probably trap NMI would be better (later improvement).

The part missing for this part is the weak attribute for the function in heap1.c so that we don't have to update everything with empty stub.
I think the weak atrribute for C function called in assembly is arch dependent so I am not sure if this is possible (will look into it, maybe somebody outthere nows).
Right now, it's heap1 dependent and won't work with heap2. I will clean that up the next couple of days.

I did some test and it looks good.
this is without init code re-organization so we don't free as much as we will be it's good starts.

This compile with sim_posix (since it does not affect portable code) so this is really clean.
I only tested this with CC. I will port it for OP when I will work on heap2.
2011-06-13 21:49:17 -07:00
James Cotton
404c026188 Patch from Zippe to use cycle timer for CPU monitoring. 2011-06-13 00:24:30 -05:00
Mathieu Rondonneau
7598e898fa OP-423 Step-1: split system stack and implement water mark for IRQstack:
- use IRQStack for ISRs (at begening of SRAM) (let's call it the irq stack)
- use end of heap for stack needed during initialization (let's call it the init stack).
- the systemStats in GCS indicate the remaining bytes in the IRQ stack (this is realy usefull to monitor our (nested) IRQs.

This is the base ground to provide as much memory as possible available at task creation time.

Next step is to re-organize the initialization in order to move all the init out of the thread's stacks onto the init stack.
This will provide as much memory as possible available at task creation time.
Basically the stack during initialization will be destroyed once the scheduler starts and dynamic alloc are made (since the init stack is at the end of the heap). We will need to make sure we don't clobber the heap during initialization otherwise this will lead to stack corruption.
2011-06-12 20:23:00 -07:00
James Cotton
4a59c03b0e OP-493: Unfortuantely have to change stack alarms for this to work :( 2011-06-07 10:31:40 -05:00
James Cotton
1365542103 OP-493: Populate the Accessory Desired from TX 2011-06-05 15:38:57 -05:00
James Cotton
3e5d02cbaf OP-152: Abstract the CRC code out of uavtalk to allow it to be reused (PT -
feel free to test moving this to the hardware CRC unit)
2011-06-04 18:36:26 -05:00
James Cotton
efe50012cb Merge branch 'spektrum_rtc_supervisor' 2011-05-29 17:19:48 -05:00
sambas
17fb31a7fa Spektrum rtc supervisor working, tested on CC and all outputs are activated. Needs review and testing before merge. 2011-05-29 14:52:22 +03:00
Stacey Sheldon
5be27fda83 coptercontrol: Increase stack size for system module
When running flight software from master (cf74908), my
config was pushing the system module stack usage to within
16 bytes of its limit.  This triggers a stack overflow
alarm which prevents the quad from arming/flying.

This change increases the available stack size such
that there are 72 bytes of stack free (a previously stated
safe margin) when my quad is sitting idle and unarmed on
the bench.
2011-05-29 00:12:26 -04:00
Stacey Sheldon
4da671fc82 build: change firmware files from .opf to .opfw extensions 2011-05-25 00:20:02 -04:00
Oleg Semyonov
66804076b8 build: fix release/Makefile for *.opf files and changed targets 2011-05-24 23:49:51 -04:00
Stacey Sheldon
91cb294730 build: remove redundant PHONY for size target 2011-05-24 01:10:40 -04:00
Stacey Sheldon
0eb92fad91 build: refactor jtag program and add jtag wipe target
Macros for JTAG program and wipe for each target are now
provided in firmware-defs.mk.

The _wipe target for each firmware and bootloader image will
erase either the bootloader (bl_*_wipe) or firmware (fw_*_wipe)
bank.
2011-05-24 01:10:31 -04:00
Stacey Sheldon
9973fda23b build: define bootloader and firmware bank spans
The board-info.mk files now define the start and size
of the bootloader and the firmware banks.
2011-05-24 01:03:01 -04:00
Stacey Sheldon
6e406c0232 build: remove all remaining use of -DUSE_BOOTLOADER
The USE_BOOTLOADER compile flag was only being used
to determine where the ISR vector table was located.

Provide this explicitly from the linker since it knows
exactly where it is putting the ISR vector table.
2011-05-23 18:21:42 -04:00
Stacey Sheldon
0a67730d0f build: refactor fw, bl and bu rules
- New macros for fw, bl and bu rules in top-level make
- Per-board info factored into make/board/*/board-info.mk
- Per-board info now shared btw. fw, bl and blupd for each board
   - BOARD_TYPE, BOARD_REVISION, BOOTLOADER_VERSION, HW_TYPE
   - MCU, CHIP, BOARD, MODEL, MODEL_SUFFIX
   - START_OF_BL_CODE, START_OF_FW_CODE
- blupd_* goals renamed to bu_*
- all_blupd goal renamed to all_bu
- firmware goals renamed to fw_*, board name goals are preserved
- bu_*_program now writes updater to correct address for all boards
- BL updater firmware builds now produce .opf format including
  version info blob.
- BL updater firmware name now includes board name.
- INS makefile brought up to date w.r.t. linker scripts
2011-05-23 18:21:42 -04:00
Stacey Sheldon
6ec6425f5e build: build opf images including firmware + version blob 2011-05-22 10:55:13 -04:00
Stacey Sheldon
2044d777e6 coptercontrol: always enable -g debug symbols
This does not affect the size of the image or the RAM
used by the firmware image.  All debugging symbols are
stripped from the elf file during the conversion to a
.bin file.
2011-05-16 08:35:41 -04:00
Oleg Semyonov
39d4f23b67 Merge branch 'master' into OP-483_os_release-packaging 2011-05-15 21:32:20 +03:00
James Cotton
ae2759a957 Merge branch 'bugfix-flight' 2011-05-15 12:50:45 -05:00
Oleg Semyonov
bac95dae11 OP-483: get rid of -D install switch (doesn't work on Mac) and use mkdir -p instead 2011-05-14 23:17:08 +03:00
James Cotton
2087441006 OP-216: Make the object manager use new flash fs for objects 2011-05-14 14:23:02 -05:00
zedamota
a38fbe6cea Make CopterControl firmware non functional when using the ERASE_FLASH=YES compile flag 2011-05-14 19:03:31 +01:00
Oleg Semyonov
37868a4c10 OP-483: add install target for firmware
make INSTALL_DIR=dir INSTALL_PFX=pfx INSTALL_SFX=sfx install
installs binary file into specified install directory adding
optional prefix and/or suffix.
2011-05-13 11:25:32 +03:00
James Cotton
5d28276c49 Reshuffle memory allocation on CC after FlightStatus object introduced 2011-05-11 17:35:52 -05:00
James Cotton
fb8417a0ff Merge remote-tracking branch 'origin/op_475_476_calibrate_during_arming' 2011-05-09 09:23:16 -05:00
Stacey Sheldon
29ec2f198b build: convert all app loads to require bootloaders
This change is made up of a number of tightly coupled
changes:
 - Deprecate the use of the USE_BOOTLOADER command-line
   option.  It is now hard-coded in each Makefile.
   Overriding it on the command line is not allowed.
 - Split apart the memory declaration and the section
   declaration in all linker files (*_memory.ld and
   *_sections.ld).
 - Describe the split between bootloader and app sections
   of flash in each board's _memory.ld file.
 - Change program target to selectively erase flash so
   that the installed bootloader is preserved across even
   JTAG programming operations.
 - All elf files are built with debug symbols and are not
   stripped.  This should help debugging with gdb.  The
   images programmed on the boards are all .bin files now
   which do not include symbols.
2011-05-08 12:40:29 -04:00
Stacey Sheldon
7e99419c8a build: Add support for %.bin.o generation
The .bin.o rule places the contents of a raw .bin file
into an .o file wrapped within fixed symbols for start
and end.  This can be used to embed a binary file inside
of an executable.

The symbols for the embedded binary blob are:
 _binary_start
 _binary_end
 _binary_size

NOTE: The way the .bin.o rule is currently written, you
can only embed one binary blob in an executable since the
symbol names will collide if you add multiple blobs.  This
limitation is easily removed later if necessary.
2011-05-07 18:05:50 -04:00
James Cotton
8e06eb3162 Get the "IDLE_NO_LOAD" level closer for CC with optimizations on, but it would
be great if someone actually calibrated this for me!
2011-05-07 15:07:14 -05:00
James Cotton
80c839d5bb OP-475: Starting to use the new FlightStatus object 2011-05-07 13:17:21 -05:00
James Cotton
d3247c9946 Remove unused code from coptercontrol.c 2011-05-07 06:56:20 -05:00
James Cotton
1f36e00287 Merge remote-tracking branch 'origin/OP_442_OP_437_PT_Dreamer' 2011-05-02 03:34:09 -05:00
David Buzz Carlson
c93ab7e723 Change CC, OP MB, and AHRS to use bootloader by default.
Also change AttitudeActual to update at 10Hz rather than 2 Hz.  The increased bandwidth is minimal and the resulting "polish" that it adds to the look-and-feel of the GCS is signifcant.
2011-05-02 00:50:42 -07:00
zedamota
5dd8a3eea2 Fix a silly mistake on the CC erase_flash compile flag. 2011-05-01 20:10:27 +01:00
zedamota
3d209f2166 Fix to erase option. Erase must be performed after board initialization. 2011-04-30 14:17:44 +01:00
zedamota
8dd46e1465 Should fix the CC showing as OP.
Added a compile flag to make a CC fw version that will erase flash.

Signed-off-by: zedamota <josembarros@hotmail.com>
2011-04-29 23:38:26 +01:00
zedamota
6172e45c0d Should fix CopterControl showing as Openpilot on DropDown box. 2011-04-29 21:42:59 +01:00
James Cotton
5f776f0b58 Merge branch 'master' into OP-439_CorvusCorax_Bootloader-Makefile-and-OpenOCD-config-for-Linux 2011-04-27 23:41:35 -05:00
James Cotton
819bc9d441 Merge branch 'master' into OP-430_Ligi_UAVTalk-Code-Review 2011-04-26 12:49:32 -05:00
James Cotton
69d03ca101 OP-439: Simplify further. Abstract most of the OOCD flags into the common
firmware include and delete all the extra foss-jtag config files.  There is now
a legacy file for the revA board a second for AHRS that changes the port
2011-04-24 10:19:00 -05:00