1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Flight/Stack sizes: Reduced task stack sizes to free-up memory in preparation of the scripting release. If the firmware is unstable there might be a possible stack overflow, test carefully!

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2350 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
vassilis 2011-01-09 00:03:19 +00:00 committed by vassilis
parent 407e660c97
commit b851c11f53
9 changed files with 20 additions and 20 deletions

View File

@ -40,7 +40,7 @@
#include "baroaltitude.h" // object that will be updated by the module
// Private constants
#define STACK_SIZE configMINIMAL_STACK_SIZE
#define STACK_SIZE_BYTES 500
#define TASK_PRIORITY (tskIDLE_PRIORITY+3)
//#define UPDATE_PERIOD 100
#define UPDATE_PERIOD 25
@ -66,7 +66,7 @@ static void altitudeTask(void *parameters);
int32_t AltitudeInitialize()
{
// Start main task
xTaskCreate(altitudeTask, (signed char *)"Altitude", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
xTaskCreate(altitudeTask, (signed char *)"Altitude", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &taskHandle);
TaskMonitorAdd(TASKINFO_RUNNING_ALTITUDE, taskHandle);
// init down-sampling data

View File

@ -73,7 +73,7 @@ FirmwareIAPObjData data;
static uint32_t get_time(void);
// Private constants
#define STACK_SIZE configMINIMAL_STACK_SIZE
#define STACK_SIZE_BYTES 800
#define TASK_PRIORITY (tskIDLE_PRIORITY+1)
// Private types
@ -166,7 +166,7 @@ static void FirmwareIAPCallback(UAVObjEvent* ev)
// we've met the time requirements.
PIOS_IAP_SetRequest1();
PIOS_IAP_SetRequest2();
xTaskCreate(resetTask, (signed char *)"Reset", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
xTaskCreate(resetTask, (signed char *)"Reset", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &taskHandle);
} else {
iap_state = IAP_STATE_READY;
}

View File

@ -52,7 +52,7 @@ static void setHomeLocation(GPSPositionData * gpsData);
// Private constants
// Unfortunately need a good size stack for the WMM calculation
#define STACK_SIZE configMINIMAL_STACK_SIZE + 1500
#define STACK_SIZE_BYTES 1024
#define TASK_PRIORITY (tskIDLE_PRIORITY + 3)
// Private types
@ -80,7 +80,7 @@ int32_t GPSInitialize(void)
gpsPort = PIOS_COM_GPS;
// Start gps task
xReturn = xTaskCreate(gpsTask, (signed char *)"GPS", STACK_SIZE, NULL, TASK_PRIORITY, &gpsTaskHandle);
xReturn = xTaskCreate(gpsTask, (signed char *)"GPS", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &gpsTaskHandle);
TaskMonitorAdd(TASKINFO_RUNNING_GPS, gpsTaskHandle);
return 0;

View File

@ -57,7 +57,7 @@
#include "velocityactual.h"
// Private constants
#define STACK_SIZE configMINIMAL_STACK_SIZE
#define STACK_SIZE_BYTES 824
#define TASK_PRIORITY (tskIDLE_PRIORITY+1)
// Private types
@ -80,7 +80,7 @@ static void positionPIDcontrol();
int32_t GuidanceInitialize()
{
// Start main task
xTaskCreate(guidanceTask, (signed char *)"Guidance", STACK_SIZE, NULL, TASK_PRIORITY, &guidanceTaskHandle);
xTaskCreate(guidanceTask, (signed char *)"Guidance", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &guidanceTaskHandle);
TaskMonitorAdd(TASKINFO_RUNNING_GUIDANCE, guidanceTaskHandle);
return 0;

View File

@ -44,7 +44,7 @@
#include "flighttelemetrystats.h"
// Private constants
#define STACK_SIZE configMINIMAL_STACK_SIZE
#define STACK_SIZE_BYTES 824
#define TASK_PRIORITY (tskIDLE_PRIORITY+4)
#define UPDATE_PERIOD_MS 20
#define THROTTLE_FAILSAFE -0.1
@ -72,7 +72,7 @@ volatile uint8_t manual_updated;
int32_t ManualControlInitialize()
{
// Start main task
xTaskCreate(manualControlTask, (signed char *)"ManualControl", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
xTaskCreate(manualControlTask, (signed char *)"ManualControl", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &taskHandle);
TaskMonitorAdd(TASKINFO_RUNNING_MANUALCONTROL, taskHandle);
return 0;

View File

@ -45,7 +45,7 @@
// Private constants
#define MAX_QUEUE_SIZE 2
#define STACK_SIZE configMINIMAL_STACK_SIZE
#define STACK_SIZE_BYTES 724
#define TASK_PRIORITY (tskIDLE_PRIORITY+4)
#define FAILSAFE_TIMEOUT_MS 30
@ -98,7 +98,7 @@ int32_t StabilizationInitialize()
StabilizationSettingsConnectCallback(SettingsUpdatedCb);
SettingsUpdatedCb(StabilizationSettingsHandle());
// Start main task
xTaskCreate(stabilizationTask, (signed char*)"Stabilization", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
xTaskCreate(stabilizationTask, (signed char*)"Stabilization", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &taskHandle);
TaskMonitorAdd(TASKINFO_RUNNING_STABILIZATION, taskHandle);
return 0;

View File

@ -52,7 +52,7 @@
#define IDLE_COUNTS_PER_SEC_AT_NO_LOAD 995998 // calibrated by running tests/test_cpuload.c
// must be updated if the FreeRTOS or compiler
// optimisation options are changed.
#define STACK_SIZE configMINIMAL_STACK_SIZE
#define STACK_SIZE_BYTES 924
#define TASK_PRIORITY (tskIDLE_PRIORITY+3)
#define HEAP_LIMIT_WARNING 4000
@ -84,7 +84,7 @@ int32_t SystemModInitialize(void)
// Initialize vars
stackOverflow = 0;
// Create system task
xTaskCreate(systemTask, (signed char *)"System", STACK_SIZE, NULL, TASK_PRIORITY, &systemTaskHandle);
xTaskCreate(systemTask, (signed char *)"System", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &systemTaskHandle);
return 0;
}

View File

@ -37,7 +37,7 @@
// Private constants
#define MAX_QUEUE_SIZE 20
#define STACK_SIZE configMINIMAL_STACK_SIZE
#define STACK_SIZE_BYTES 624
#define TASK_PRIORITY_RX (tskIDLE_PRIORITY + 2)
#define TASK_PRIORITY_TX (tskIDLE_PRIORITY + 2)
#define TASK_PRIORITY_TXPRI (tskIDLE_PRIORITY + 2)
@ -110,9 +110,9 @@ int32_t TelemetryInitialize(void)
TelemetrySettingsConnectQueue(priorityQueue);
// Start telemetry tasks
xTaskCreate(telemetryTxTask, (signed char *)"TelTx", STACK_SIZE, NULL, TASK_PRIORITY_TX, &telemetryTxTaskHandle);
xTaskCreate(telemetryTxPriTask, (signed char *)"TelPriTx", STACK_SIZE, NULL, TASK_PRIORITY_TXPRI, &telemetryTxPriTaskHandle);
xTaskCreate(telemetryRxTask, (signed char *)"TelRx", STACK_SIZE, NULL, TASK_PRIORITY_RX, &telemetryRxTaskHandle);
xTaskCreate(telemetryTxTask, (signed char *)"TelTx", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY_TX, &telemetryTxTaskHandle);
xTaskCreate(telemetryTxPriTask, (signed char *)"TelPriTx", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY_TXPRI, &telemetryTxPriTaskHandle);
xTaskCreate(telemetryRxTask, (signed char *)"TelRx", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY_RX, &telemetryRxTaskHandle);
TaskMonitorAdd(TASKINFO_RUNNING_TELEMETRYTX, telemetryTxTaskHandle);
TaskMonitorAdd(TASKINFO_RUNNING_TELEMETRYTXPRI, telemetryTxPriTaskHandle);
TaskMonitorAdd(TASKINFO_RUNNING_TELEMETRYRX, telemetryRxTaskHandle);

View File

@ -40,7 +40,7 @@
// Private constants
// TODO: Look up maximum task priority and set this to it. Not trying to replicate CPU load.
#define TASK_PRIORITY (tskIDLE_PRIORITY+5)
#define STACK_SIZE configMINIMAL_STACK_SIZE
#define STACK_SIZE_BYTES 324
#define WATCHDOG_TIMEOUT 250
// Private types
@ -64,7 +64,7 @@ int32_t WatchdogInitialize()
manual_updated = 0;
// Start main task
xTaskCreate(watchdogTask, (signed char *)"Watchdog", STACK_SIZE, NULL, TASK_PRIORITY, &taskHandle);
xTaskCreate(watchdogTask, (signed char *)"Watchdog", STACK_SIZE_BYTES/4, NULL, TASK_PRIORITY, &taskHandle);
TaskMonitorAdd(TASKINFO_RUNNING_WATCHDOG, taskHandle);
return 0;