Problem with multistack and STM32F4 Discovery LCD
Posted: Fri May 16, 2014 8:00 am
Hi, I'm trying to use the LCD/Touchscreen provided by element14 expansion set (for the touch, STMPE811QTR) with erika.
I have developed an erika project in which a task (TaskLCD) waits in polling for an event in the touch, as shown in the demo by element14.
Other tasks handle events related to the object on the screen.
This program works, but since the LCD task remains blocked I want to make the LCD task stack private instead shared, to avoid problems.
In order to do this, I used the pic30 demo for multistack as example, but doing this the program does not work anymore: after the first "touch event", which is detected, the program crashes.
Which may be the cause?
I attach my oil file (in the c file, each task has TerminateTask() as last instruction).
Thanks,
Daniel
I have developed an erika project in which a task (TaskLCD) waits in polling for an event in the touch, as shown in the demo by element14.
Other tasks handle events related to the object on the screen.
This program works, but since the LCD task remains blocked I want to make the LCD task stack private instead shared, to avoid problems.
In order to do this, I used the pic30 demo for multistack as example, but doing this the program does not work anymore: after the first "touch event", which is detected, the program crashes.
Which may be the cause?
I attach my oil file (in the c file, each task has TerminateTask() as last instruction).
Thanks,
Daniel
Code: Select all
CPU mySystem {
OS myOs {
EE_OPT = "DEBUG";
CPU_DATA = CORTEX_MX {
MODEL = M4;
APP_SRC = "code.c";
APP_SRC = "LCD_Touch_Lib.c";
APP_SRC = "pictures.c";
APP_SRC = "Objects.c";
APP_SRC = "Tasks.c";
APP_SRC = "Utility.c";
APP_SRC = "STMPE811QTR.c";
//COMPILER_TYPE = KEIL;
COMPILER_TYPE = GNU;
MULTI_STACK = TRUE{
IRQ_STACK = TRUE {
SYS_SIZE=64;
};
};
};
EE_OPT = "__USE_SYSTICK__";
MCU_DATA = STM32 {
MODEL = STM32F4xx;
};
KERNEL_TYPE = ECC2;
EE_OPT = "__OO_STARTOS_OLD__";
/*STATUS = EXTENDED;
STARTUPHOOK = FALSE;
ERRORHOOK = FALSE;
SHUTDOWNHOOK = FALSE;
PRETASKHOOK = FALSE;
POSTTASKHOOK = FALSE;
USEGETSERVICEID = FALSE;
USEPARAMETERACCESS = FALSE;
USERESSCHEDULER = FALSE;*/
STATUS = EXTENDED;
STARTUPHOOK = FALSE;
ERRORHOOK = FALSE;
SHUTDOWNHOOK = FALSE;
PRETASKHOOK = FALSE;
POSTTASKHOOK = FALSE;
USEGETSERVICEID = FALSE;
USEPARAMETERACCESS = FALSE;
USERESSCHEDULER = TRUE;
EE_OPT = "__ADD_LIBS__";
LIB = ENABLE { NAME = "ST_CMSIS"; };
LIB = ENABLE { NAME = "STM32F4XX_SPD";
STM32F4XX_SPD = ENABLE {
USEGPIO = TRUE;
USESPI = TRUE;
USEEXTI = TRUE;
USEMISC = TRUE;
USEFLASH = TRUE;
USEI2C = TRUE;
USEDMA = TRUE;
//USEUSART = TRUE;
//USESYSCFG = TRUE;
};
};
LIB = ENABLE { NAME = "STM32F4_DISCOVERY";
STM32F4_DISCOVERY = ENABLE {
USELCD = TRUE;
};
};
//LIB = ENABLE { NAME = "ST_GUI"; };
//LIB = ENABLE { NAME = "ST_GUI_HAL"; };
};
COUNTER myCounter {
MINCYCLE = 2;
MAXALLOWEDVALUE = 0xFFFF ;
TICKSPERBASE = 1;
};
ALARM AlarmTaskLCDTouch {
COUNTER = myCounter;
ACTION = ACTIVATETASK { TASK = TaskLCDTouch; };
};
ALARM AlarmTaskButton {
COUNTER = myCounter;
ACTION = ACTIVATETASK { TASK = TaskButton; };
};
ALARM AlarmTaskSwitch {
COUNTER = myCounter;
ACTION = ACTIVATETASK { TASK = TaskSwitch; };
};
ALARM AlarmTaskSlideRed {
COUNTER = myCounter;
ACTION = ACTIVATETASK { TASK = TaskSlideRed; };
};
ALARM AlarmTaskSlideGreen {
COUNTER = myCounter;
ACTION = ACTIVATETASK { TASK = TaskSlideGreen; };
};
ALARM AlarmTaskSlideBlue {
COUNTER = myCounter;
ACTION = ACTIVATETASK { TASK = TaskSlideBlue; };
};
TASK TaskLCDTouch {
PRIORITY = 0x01; /* Low priority */
AUTOSTART = FALSE;
STACK = PRIVATE {
SYS_SIZE = 2048;
};
ACTIVATION = 1; /* only one pending activation */
SCHEDULE = FULL;
};
TASK TaskButton {
PRIORITY = 0x02; /* High priority */
RESOURCE = "ButtonStateLock";
RESOURCE = "RedSlideStateLock";
RESOURCE = "GreenSlideStateLock";
RESOURCE = "BlueSlideStateLock";
RESOURCE = "ScreenLock";
AUTOSTART = FALSE;
STACK = SHARED;
ACTIVATION = 1; /* only one pending activation */
SCHEDULE = FULL;
};
TASK TaskSwitch {
PRIORITY = 0x02; /* High priority */
RESOURCE = "SwitchStateLock";
RESOURCE = "ScreenLock";
AUTOSTART = FALSE;
STACK = SHARED;
ACTIVATION = 1; /* only one pending activation */
SCHEDULE = FULL;
};
TASK TaskSlideRed {
PRIORITY = 0x02; /* High priority */
RESOURCE = "RedSlideStateLock";
RESOURCE = "ScreenLock";
AUTOSTART = FALSE;
STACK = SHARED;
ACTIVATION = 1; /* only one pending activation */
SCHEDULE = FULL;
};
TASK TaskSlideGreen {
PRIORITY = 0x02; /* High priority */
AUTOSTART = FALSE;
STACK = SHARED;
ACTIVATION = 1; /* only one pending activation */
SCHEDULE = FULL;
};
TASK TaskSlideBlue {
PRIORITY = 0x02; /* High priority */
AUTOSTART = FALSE;
STACK = SHARED;
ACTIVATION = 1; /* only one pending activation */
SCHEDULE = FULL;
};
RESOURCE ScreenLock { RESOURCEPROPERTY = STANDARD; };
RESOURCE ButtonStateLock { RESOURCEPROPERTY = STANDARD; };
RESOURCE SwitchStateLock { RESOURCEPROPERTY = STANDARD; };
RESOURCE RedSlideStateLock { RESOURCEPROPERTY = STANDARD; };
RESOURCE GreenSlideStateLock { RESOURCEPROPERTY = STANDARD; };
RESOURCE BlueSlideStateLock { RESOURCEPROPERTY = STANDARD; };
ISR systick_handler {
CATEGORY = 2;
ENTRY = "SYSTICK";
PRIORITY = 1;
};
};