In next few days, I would scribe what I know about MQX. The notes can be used by the newbies. So here we go....
Whats MQX
MQX is a real time operating system from ARC and is designed for uni processor, multi processor and distributed processors. MQX provide you runtime library of functions which can be used by multitasking real-time applications.
There are certain services which are marked as core which would anyway would come with MQX, while others can be added as per your requirements.
Core services/components include automatic task creation, task scheduling, lightweight semaphores, task errors etc.
You can always add toppings like watchdogs, exception handling, message queues, event handling, semaphores, interrupts, kernel log etc.
How you would initialize the MQX/Where in my code MQX is getting started
Well, if you are working on project which is using MQX rots, you search for the function call named _mqx.
This function 'mqx' would take few very important arguments which would tell how would MQX would behave for you. Some of this would include
a)Number of processors in you system (remember when i told it can work for multiprocessor systems as well)
b)RAM start/end address for kernel
c)stack area for Interrupts
d) address of task template, if you fill this template, these tasks would be created by the MQX after initializations. Lots to guess but, this task template would provide information about the task stack size, priority, name, default time slice etc.
e)Max hardware interrupt level. This is important filed, keep this in mind, will come back to this later.
Task template creates tasks once RTOS initialization has finished, but user is allowed to create the task at run time. You can also provide an optional exception handler or exit function. MQX would call them appropriately
AOM - Automated Overlay Manager
This feature is really useful when your target system has limited main memory and large external memory. You can use the Overlays to put the 'different functions and data to the same memory location in the RAM at different point of times'. What else you want isn't that cool.
An overlay can consist of a function, a group of function or data. When a overlay is loaded in the RAM, it may overwrite the existing overlay.
Overlays are not part of standard C language and developer must write their over libs or rely on vendor tools like Automated Overlay Manger. Well, you know it now, MQX has already done that for you.
To a make a function overlay, function name must be prefixed by _Overlay(). This call would create a distinctive overlay for that function.You can also create a overlay group by giving group id as _Overlap(GroupID).
You need to specify the size of overlay memory in linker configurations (I would come back to it later).
Events
Bit based synchronization mechanism used by tasks and interrupts.
Timers
Timers provide periodic execution of an application function. MQX supports oneshot timers (they expire once) and periodic timers (they expire repeatedly at a given interval). You can set timers to start at a specified time or after a specified duration.
When you set a timer, you specify the notification function that Timer Task calls when the timer expires. The notification function can be used to synchronize tasks by sending messages, setting events, or using one of the other MQX synchronization mechanisms.
Watchdogs
Watchdogs are an option component that lets you detect task starvation and deadlock conditions at the task level.
Interrupt and exception handling
MQX services all hardware interrupts within a range that the BSP defines and saves a minimum context for the active task. MQX supports fully nested interrupts. Once inside an interrupt service routine (ISR), an application can re-enable any interrupt level. To further reduce interrupt latencies, MQX defers task rescheduling until after all ISRs have run. In addition, MQX reschedules only if a new task has been made ready by an ISR. To reduce stack size, MQX supports a separate interrupt stack.
An ISR is not a task; it is a small, high-speed routine that reacts quickly to hardware interrupts. An ISR is usually written in C. Its duties include resetting the device, getting its data, and signaling the appropriate task. An ISR can be used to signal a task with any non-blocking MQX functions.
There are few other components as well but what I discussed above are the core ones. Will come back to them at appropriate times.
Read about Scheduling Tasks and Starting MQX here.
Whats MQX
MQX is a real time operating system from ARC and is designed for uni processor, multi processor and distributed processors. MQX provide you runtime library of functions which can be used by multitasking real-time applications.
There are certain services which are marked as core which would anyway would come with MQX, while others can be added as per your requirements.
Core services/components include automatic task creation, task scheduling, lightweight semaphores, task errors etc.
You can always add toppings like watchdogs, exception handling, message queues, event handling, semaphores, interrupts, kernel log etc.
How you would initialize the MQX/Where in my code MQX is getting started
Well, if you are working on project which is using MQX rots, you search for the function call named _mqx.
This function 'mqx' would take few very important arguments which would tell how would MQX would behave for you. Some of this would include
a)Number of processors in you system (remember when i told it can work for multiprocessor systems as well)
b)RAM start/end address for kernel
c)stack area for Interrupts
d) address of task template, if you fill this template, these tasks would be created by the MQX after initializations. Lots to guess but, this task template would provide information about the task stack size, priority, name, default time slice etc.
e)Max hardware interrupt level. This is important filed, keep this in mind, will come back to this later.
Task template creates tasks once RTOS initialization has finished, but user is allowed to create the task at run time. You can also provide an optional exception handler or exit function. MQX would call them appropriately
AOM - Automated Overlay Manager
This feature is really useful when your target system has limited main memory and large external memory. You can use the Overlays to put the 'different functions and data to the same memory location in the RAM at different point of times'. What else you want isn't that cool.
An overlay can consist of a function, a group of function or data. When a overlay is loaded in the RAM, it may overwrite the existing overlay.
Overlays are not part of standard C language and developer must write their over libs or rely on vendor tools like Automated Overlay Manger. Well, you know it now, MQX has already done that for you.
To a make a function overlay, function name must be prefixed by _Overlay(). This call would create a distinctive overlay for that function.You can also create a overlay group by giving group id as _Overlap(GroupID).
You need to specify the size of overlay memory in linker configurations (I would come back to it later).
Events
Bit based synchronization mechanism used by tasks and interrupts.
Timers
Timers provide periodic execution of an application function. MQX supports oneshot timers (they expire once) and periodic timers (they expire repeatedly at a given interval). You can set timers to start at a specified time or after a specified duration.
When you set a timer, you specify the notification function that Timer Task calls when the timer expires. The notification function can be used to synchronize tasks by sending messages, setting events, or using one of the other MQX synchronization mechanisms.
Watchdogs
Watchdogs are an option component that lets you detect task starvation and deadlock conditions at the task level.
Interrupt and exception handling
MQX services all hardware interrupts within a range that the BSP defines and saves a minimum context for the active task. MQX supports fully nested interrupts. Once inside an interrupt service routine (ISR), an application can re-enable any interrupt level. To further reduce interrupt latencies, MQX defers task rescheduling until after all ISRs have run. In addition, MQX reschedules only if a new task has been made ready by an ISR. To reduce stack size, MQX supports a separate interrupt stack.
An ISR is not a task; it is a small, high-speed routine that reacts quickly to hardware interrupts. An ISR is usually written in C. Its duties include resetting the device, getting its data, and signaling the appropriate task. An ISR can be used to signal a task with any non-blocking MQX functions.
There are few other components as well but what I discussed above are the core ones. Will come back to them at appropriate times.
Read about Scheduling Tasks and Starting MQX here.
No comments:
Post a Comment