pico]OS
1.0.4
|
Data Structures | |
struct | PICOEVENT |
Event info structure. More... | |
struct | PICOTASK |
Task info structure. More... |
Macros | |
#define | P_ASSERT(text, x) if (!(x)) POSCALL p_pos_assert((const char*)(text), __FILE__, __LINE__) |
pico]OS assertion macro. | |
#define | POS_SETTASKNAME(taskhandle, taskname) |
This macro assigns a name to a pico]OS task. | |
#define | POS_SETEVENTNAME(eventhandle, name) |
This macro assigns a name to a pico]OS event. |
Typedefs | |
typedef struct PICOEVENT | PICOEVENT |
Event info structure. | |
typedef struct PICOTASK | PICOTASK |
Task info structure. |
Enumerations | |
enum | PTASKSTATE { task_notExisting = 0, task_created = 1, task_running = 2, task_suspended = 3, task_sleeping = 4, task_waitingForSemaphore = 5, task_waitingForSemaphoreWithTimeout = 6, task_waitingForMutex = 7, task_waitingForMutexWithTimeout = 8, task_waitingForFlag = 9, task_waitingForFlagWithTimeout = 10, task_waitingForMessage = 11, task_waitingForMessageWithTimeout = 12 } |
Task states (used for debugging when POSCFG_FEATURE_DEBUGHELP is set to 1) More... | |
enum | PEVENTTYPE { event_semaphore = 0, event_mutex = 1, event_flags = 2 } |
Event types (used for debugging when POSCFG_FEATURE_DEBUGHELP is set to 1) More... |
Variables | |
struct PICOTASK * | picodeb_taskhistory [3] |
This array contains the last 3 tasks that run. | |
struct PICOTASK * | picodeb_tasklist |
Pointer to the list of active tasks. | |
struct PICOEVENT * | picodeb_eventlist |
Pointer to the list of all system events. |
Sometimes it is really hard to debug multitasking applications. Pico]OS supports you by providing assess to some helpful informations. In conjunction with an incircuit-debugger with the appropriated debugger IDE you will have a powerfull tool to debug your applications.
You need to enable the internal pico]OS debugging support by setting the define POSCFG_FEATURE_DEBUGHELP to 1. It is also required that you compile the code with debug flags set, and the global preprocessor define _DBG must be set.
Pico]OS exports some variables that are helpful for debugging:
Hint:
The global variables picodeb_tasklist and picodeb_eventlist are pointing to double-chained lists. This lists contain helpful informations about the state of tasks and events. When you observe that some task of your application hangs and you don't know why, you can search the task-list for the appropriated task (simply follow as often as necessary the 'next' pointer in the structure until you have found the task) and then have a look to the tasks state. If the task pends on an event, you can follow the event reference pointer to observe the current state of the event. Some IDE do have a kind of "OS-awareness". The both variables picodeb_tasklist and picodeb_eventlist should make it possible to teach your IDE the pico]OS. Please have a look into the debuggers documentation for how to integrate OS-awareness into your debugger.
If you consider to use the internal pico]OS debug feature, you should name your tasks and events. This simplifies the search for tasks and events in the global lists. Pico]OS provides two macros for doing this: POS_SETTASKNAME and POS_SETEVENTNAME.
#define P_ASSERT | ( | text, | |
x | |||
) | if (!(x)) POSCALL p_pos_assert((const char*)(text), __FILE__, __LINE__) |
pico]OS assertion macro.
For testing and debugging you should enable pico]OS internal assertions. To do so, you must set the define HAVE_PLATFORM_ASSERT in your port.h -file and your platform port must provide this function: void p_pos_assert(const char* text, const char *filename, int linenumber). The function gets called every time pico]OS has failed an assertion.
#define POS_SETEVENTNAME | ( | eventhandle, | |
name | |||
) |
This macro assigns a name to a pico]OS event.
You can use this macro to assign a name to a pico]OS events, such as semaphores, mutextes and flag events. This is usefull when you are debugging your application by using the global eventlist that is referenced by the variable picodeb_eventlist. It is easier to navigate through the list when the events have names. Example:
#define POS_SETTASKNAME | ( | taskhandle, | |
taskname | |||
) |
This macro assigns a name to a pico]OS task.
This is usefull when you are debugging your application by using the global tasklist that is referenced by the variable picodeb_tasklist. It is easier to navigate through the list when the tasks have names. Examples:
Event info structure.
This structure can be used by a debugger IDE to display event status information. (used for debugging when POSCFG_FEATURE_DEBUGHELP is set to 1)
Task info structure.
This structure can be used by a debugger IDE to display task status information. (used for debugging when POSCFG_FEATURE_DEBUGHELP is set to 1)
enum PEVENTTYPE |
Event types (used for debugging when POSCFG_FEATURE_DEBUGHELP is set to 1)
enum PTASKSTATE |
Task states (used for debugging when POSCFG_FEATURE_DEBUGHELP is set to 1)
struct PICOEVENT* picodeb_eventlist |
Pointer to the list of all system events.
This variable can be used for debugging. It points to a list of all active events in the system. An event can be a semaphore, a mutex or a flag object. To differentiate the events, there is a type-field in the PICOEVENT structure. The list is double-chained with next- and prev- pointers. See the description of the PICOEVENT structure for details.
struct PICOTASK* picodeb_taskhistory[3] |
This array contains the last 3 tasks that run.
This array can be used for debugging. The array has 3 entries, each is pointing to a task debug structure. This array is a history of the last 3 tasks that has run, and array element 0 is the task that currently runs, element 1 points to the task before, and so on.
struct PICOTASK* picodeb_tasklist |
Pointer to the list of active tasks.
This variable can be used for debugging. It points to a list of all currently active (=created) tasks in the system. The list is double-chained with next- and prev- pointers. See the description of the PICOTASK structure for details.