Fixed some tasks regarding priority and stack

Updated makefile structure to support multi build 

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@362 05563f52-14a8-4384-a975-3d1654cca0fa
This commit is contained in:
mmi
2017-12-14 15:15:03 +00:00
parent 56558e4f1a
commit cf36c08380
13 changed files with 143 additions and 94 deletions

View File

@@ -70,30 +70,31 @@ INCLUDES = \
-I$(HAL_DIR)/inc \
-I$(PLATFORM_DIR)/inc \
OBJDIR_PREFIX = obj
all: OLI_STM32_H107
OLI_STM32_H107: export OBJ_DIR := obj_release/
OLI_STM32_H107: export OBJ_DIR := $(OBJDIR_PREFIX)_$(BUILD)_$(LANG)/
OLI_STM32_H107: export OBJECTS := $(OBJECTS_GEN)
OLI_STM32_H107: export OBJECTS_MAIN := $(OBJECTS_MAIN)
OLI_STM32_H107: export CROSS_COMPILE := arm-none-eabi-
OLI_STM32_H107: export CCFLAGS := -c -O2 -Wall -Werror -g -lc -lm -fno-common -mcpu=cortex-m3 -mthumb $(PLATFORM) $(RELEASE_DEFINES) $(LANGUAGE) $(INCLUDES) $(ADDITIONAL_SWITCHES)
OLI_STM32_H107: export ASFLAGS := -g -mapcs-32
OLI_STM32_H107: export LDFLAGS := -g -nostartfiles -mcpu=cortex-m3 -mthumb -T$(LINKER_SCRIPTS_DIR)/$(LINKER_SCRIPT) -Wl,-Map=hsb_mrts_OLI_STM32_H107.map
OLI_STM32_H107: export LDARCHIVES := -L. -L$(STM32_STDPERIPH_ROOT) -L$(PLATFORM_DIR) -L$(HAL_DIR) -lhsb_mrts_OLI_STM32_H107 -lPlatform -lHAL -lSTM_StdPeriph
OLI_STM32_H107: export LDFLAGS := -g -nostartfiles -mcpu=cortex-m3 -mthumb -T$(LINKER_SCRIPTS_DIR)/$(LINKER_SCRIPT) -Wl,-Map=$(FILENAME).map
OLI_STM32_H107: export LDARCHIVES := -L. -L$(STM32_STDPERIPH_ROOT) -L$(PLATFORM_DIR) -L$(HAL_DIR) -l$(FILENAME) -lPlatform_$(BUILD)_$(LANG) -lHAL_$(BUILD)_$(LANG) -lSTM_StdPeriph_$(BUILD)_$(LANG)
OLI_STM32_H107: export ARFLAGS := ru
OLI_STM32_H107: export OBJCOPYFLAGS := -O binary
OLI_STM32_H107: export OBJDUMPFLAGS := -x --syms -S
OLI_STM32_H107: export EXECUTABLE := hsb_mrts_OLI_STM32_H107.out
OLI_STM32_H107: export BINFILE := hsb_mrts_OLI_STM32_H107.bin
OLI_STM32_H107: export LIBRARY := libhsb_mrts_OLI_STM32_H107.a
OLI_STM32_H107: export LISTFILE := hsb_mrts_OLI_STM32_H107.list
OLI_STM32_H107: export EXECUTABLE := $(FILENAME).out
OLI_STM32_H107: export BINFILE := $(FILENAME).bin
OLI_STM32_H107: export LIBRARY := lib$(FILENAME).a
OLI_STM32_H107: export LISTFILE := $(FILENAME).list
OLI_STM32_H107: ;@$(MAKE)
clean:
rm -f hsb_mrts_OLI_STM32_H107.out hsb_mrts_OLI_STM32_H107.map hsb_mrts_OLI_STM32_H107.bin hsb_mrts_OLI_STM32_H107.list hsb_mrts_OLI_STM32_H107.map libhsb_mrts_OLI_STM32_H107.a
rm -rf obj_release
rm -f *.out *.map *.bin *.list *.a ../*.bin
rm -rf $(OBJDIR_PREFIX)*
flash:
st-flash write hsdb_mrts_OLI_STM32_H107.bin 0x8000000

View File

@@ -50,6 +50,9 @@
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_TRACE_FACILITY 1
#define configGENERATE_RUN_TIME_STATS 1
/* Co-routine definitions. */
#define configUSE_CO_ROUTINES 0
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )

View File

@@ -55,6 +55,8 @@ typedef enum
// Function declarations
// -----------------------------------------------------------------------------
///TODO TEMPORARY
extern TaskHandle_t warningTaskHandle;
/** ----------------------------------------------------------------------------
* Warning_construct

View File

@@ -71,7 +71,15 @@ void OS_logTaskInfo(xTaskHandle taskHandle)
LOGGER_INFO(mainLog, text);
highWaterMark = uxTaskGetStackHighWaterMark(taskHandle);
snprintf(text, sizeof(text), "***** Stack high water mark : %lu long words", highWaterMark);
snprintf(text, sizeof(text), " Stack high water mark : %lu long words", highWaterMark);
LOGGER_INFO(mainLog, text);
TaskStatus_t taskStatus;
vTaskGetInfo(taskHandle, &taskStatus, pdFALSE, eRunning);
snprintf(text, sizeof(text), " Number: %d \t Priority: %d \t BasePriority: %d \t runtime: %d\n", (int)taskStatus.xTaskNumber,
(int)taskStatus.uxCurrentPriority,
(int)taskStatus.uxBasePriority,
(int)taskStatus.ulRunTimeCounter);
LOGGER_INFO(mainLog, text);
}

View File

@@ -51,7 +51,8 @@ struct WarningQueueItem
// -----------------------------------------------------------------------------
static struct Observable observable;
static TaskHandle_t warningTaskHandle;
///TODO TEMPORARY
TaskHandle_t warningTaskHandle;
static QueueHandle_t warningQueue;
// -----------------------------------------------------------------------------
@@ -70,7 +71,7 @@ ErrorStatus Warning_construct(void)
Observable_construct(&observable);
warningQueue = xQueueCreate(WARNING_QUEUE_SIZE, sizeof(struct WarningQueueItem));
xTaskCreate(WarningTask, "ErrorTask", 300, NULL, 1, &warningTaskHandle);
xTaskCreate(WarningTask, "WarningTask", 300, NULL, 1, &warningTaskHandle);
return SUCCESS;
}

View File

@@ -118,29 +118,29 @@ ErrorStatus hsb_enableSafetyWithError(void)
CoverSolenoid_lock();
}
// if (returnValue == SUCCESS)
// {
// // Check for INTERLOCK CLOSE
// if (Interlock_isClosed(interlock))
// {
// // Enable Interrupt for interlock switch
// Interlock_setEXTI(interlock, ENABLE);
// }
// else
// {
// Error_postError(INTERLOCK_COMMON_FAIL);
// returnValue = ERROR;
// }
// }
//
// if (returnValue == SUCCESS)
// {
// // In case of a TESLA repair, release the teslaGunSafety
// if (PCBA_getInstance()->pcba == PCBA_Tesla)
// {
// TeslaGunSafety_release();
// }
// }
if (returnValue == SUCCESS)
{
// Check for INTERLOCK CLOSE
if (Interlock_isClosed(interlock))
{
// Enable Interrupt for interlock switch
Interlock_setEXTI(interlock, ENABLE);
}
else
{
Error_postError(INTERLOCK_COMMON_FAIL);
returnValue = ERROR;
}
}
if (returnValue == SUCCESS)
{
// In case of a TESLA repair, release the teslaGunSafety
if (PCBA_getInstance()->pcba == PCBA_Tesla)
{
TeslaGunSafety_release();
}
}
if (returnValue == SUCCESS)
{
@@ -164,29 +164,29 @@ ErrorStatus hsb_enableSafetyWithWarning(void)
CoverSolenoid_lock();
}
// if (returnValue == SUCCESS)
// {
// // Check for INTERLOCK CLOSE
// if (Interlock_isClosed(interlock))
// {
// // Enable Interrupt for interlock switch
// Interlock_setEXTI(interlock, ENABLE);
// }
// else
// {
// Warning_postWarning(WARNING_INTERLOCK_COMMON_FAIL);
// returnValue = ERROR;
// }
// }
//
// if (returnValue == SUCCESS)
// {
// // In case of a TESLA repair, release the teslaGunSafety
// if (PCBA_getInstance()->pcba == PCBA_Tesla)
// {
// TeslaGunSafety_release();
// }
// }
if (returnValue == SUCCESS)
{
// Check for INTERLOCK CLOSE
if (Interlock_isClosed(interlock))
{
// Enable Interrupt for interlock switch
Interlock_setEXTI(interlock, ENABLE);
}
else
{
Warning_postWarning(WARNING_INTERLOCK_COMMON_FAIL);
returnValue = ERROR;
}
}
if (returnValue == SUCCESS)
{
// In case of a TESLA repair, release the teslaGunSafety
if (PCBA_getInstance()->pcba == PCBA_Tesla)
{
TeslaGunSafety_release();
}
}
if (returnValue == SUCCESS)
{

View File

@@ -104,6 +104,7 @@ struct HwValidationMenu* hwValidation = &_hwValidation;
static struct CachedStorage cs = {.initialized = false};
static struct CachedStorage deviceParameters = {.initialized = false};
//static char taskList[600];
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
@@ -166,22 +167,44 @@ static ErrorStatus systeminfoCommandHandler(void)
snprintf(text, sizeof(text), "Free heap memory: %d bytes", (int)freeMemory);
LOGGER_INFO(mainLog, text);
vTaskDelay(10);
UBaseType_t numberOfTasks;
numberOfTasks = uxTaskGetNumberOfTasks();
snprintf(text, sizeof(text), "Number of managed tasks: %d", (int)numberOfTasks);
LOGGER_INFO(mainLog, text);
// vTaskList(taskList);
// IODevice_write((struct IODevice*)uart1, taskList, 600);
vTaskDelay(100);
OS_logTaskInfo(initTaskHandle);
vTaskDelay(10);
OS_logTaskInfo(ledTaskHandle);
vTaskDelay(10);
OS_logTaskInfo(sysTaskHandle);
vTaskDelay(10);
OS_logTaskInfo(mainMenu->menuCore->taskHandle);
vTaskDelay(10);
OS_logTaskInfo(rp->taskHandle);
vTaskDelay(10);
OS_logTaskInfo(mainDisplay->taskHandle);
vTaskDelay(10);
vTaskDelay(100);
OS_logTaskInfo(errorTaskHandle);
vTaskDelay(10);
vTaskDelay(100);
OS_logTaskInfo(warningTaskHandle);
vTaskDelay(100);
OS_logTaskInfo(interlock->taskHandle);
vTaskDelay(100);
OS_logTaskInfo(mainLog->taskHandle);
vTaskDelay(100);
OS_logTaskInfo(keypad->taskHandle);
vTaskDelay(100);
OS_logTaskInfo(mainBuzzer->taskHandle);
vTaskDelay(100);
vTaskDelay(100);
OS_logTaskInfo(mainDisplay->taskHandle);
#ifdef ENABLE_HW_VALIDATION
OS_logTaskInfo(hwValidation->taskHandle);
#endif
vTaskDelay(100);
OS_logTaskInfo(sysTaskHandle);
vTaskDelay(100);
OS_logTaskInfo(ledTaskHandle);
vTaskDelay(100);
OS_logTaskInfo(mainMenu->menuCore->taskHandle);
vTaskDelay(100);
OS_logTaskInfo(rp->taskHandle);
@@ -277,15 +300,15 @@ static void initTask(void* parameters)
hwTestItems.pcba = PCBA_getInstance();
hwTestItems.keypad = keypad;
// EEPROM TO BE DONE
HwValidationMenu_construct(hwValidation, &uart3->device, &hwTestItems, 1, 1024);
HwValidationMenu_construct(hwValidation, &uart3->device, &hwTestItems, 3, 1024);
}
#endif
if (returnValue == SUCCESS)
{
// Create task that repeats to print out TASK information on the logger
xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 0, &sysTaskHandle);
xTaskCreate(printSystemInfoTask, (const char* const)"SysInfoTask", 512, NULL, 4, &sysTaskHandle);
// Create a small task that only blinks a LED and flashes the identification letter on the display
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 100, &ledTaskArguments, 0, &ledTaskHandle);
xTaskCreate(ledBlinkTask, (const char* const)"ledTask", 100, &ledTaskArguments, 4, &ledTaskHandle);
}
if (returnValue == SUCCESS)

View File

@@ -49,6 +49,7 @@
#include "MenuText.h"
#include "CoverSolenoid.h"
#include "Leds.h"
#include "Logger.h"
#include "Interlock.h"
#include "internalADC.h"