Editing the task template when using Processor Expert

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Editing the task template when using Processor Expert

2,997 Views
georgejoseph
Contributor III

I'm new to MQX. I am using the Kinetis tools to create software using MQX. I have auto generated software using the Processor Expert. The task template is created automatically in the auto generated code folder. I would like to have the freedom to create tasks myself without the help of Processor Expert, but the file containing the task template will get stepped on every time I use PE for other things. Do you have to use the task template to create tasks? If so how do you tell it the stack size etc. without the template? It would be nice to use the template to tell a task to autostart etc, but the auto-generated  is not supposed to be edited.

0 Kudos
6 Replies

2,166 Views
billnd
Contributor IV

GJ, did you get a solution to this? I'm trying to solve the exact same problem.

Cheers,

NDBill

0 Kudos

2,166 Views
soledad
NXP Employee
NXP Employee

Hello George,

Which MQX version are you using  (traditional MQX RTOS; MQX Lite; or MQX RTOS for Kinetis SDK)??

Regards

Sol

0 Kudos

2,166 Views
georgejoseph
Contributor III

I have to assume we are using MQX RTOS for Kinetis SDK.

0 Kudos

2,166 Views
soledad
NXP Employee
NXP Employee

Hi,

The task template list, which is a list of task templates (TASK_TEMPLATE_STRUCT), defines an initial set of templates that are used to create tasks on the processor if the MQX_CUSTOM_MAIN is not set.

At initialization, MQX RTOS creates one instance of each task, whose template defines it as an autostart task. In addition, while an application is running, it can create other tasks using a task template that either the task template list defines or the application defines dynamically. The end of the task template list is a zero-filled task template.

You can assign any combination of the following attributes to a task:

• Autostart - when MQX RTOS starts, it creates one instance of the task.

• DSP - MQX RTOS saves the DSP co-processor registers as part of the task's context.

• Floating point - MQX RTOS saves floating-point registers as part of the task's context.

• Time slice - MQX RTOS uses round robin scheduling for the task (the default is FIFO scheduling).

For example:

TASK_TEMPLATE_STRUCT MQX_template_list[] =

{

{ MAIN_TASK, world_task, 0x2000, 5, "world_task",

MQX_AUTO_START_TASK, 0L, 0},

{ HELLO, hello_task, 0x2000, 5, "hello_task",

MQX_TIME_SLICE_TASK, 0L, 100},

{ FLOAT, float_task, 0x2000, 5, "Float_task",

MQX_AUTO_START_TASK | MQX_FLOATING_POINT_TASK, 0L, 0},

{ 0, 0, 0, 0, 0, 0, 0L, 0 }

};

world_task

The world_task is an autostart task. So, at initialization, MQX RTOS creates one instance of the task with a creation parameter of zero. The application defines the task template index (MAIN_TASK). The task is of priority five. The function world_task() is the code-entry point for the task. The stack size is 0x2000 single-addressable units.

hello_task

The hello_task task is a time-slice task with a time slice of 100, in milliseconds, if the default compile-time configuration options are used.

Float_task

The Float_task task is both a floating-point task and an autostart task.

Multiple tasks, created from the same task template can coexist, and each task is a unique instance.

You can also create, manage, and terminate tasks, while the application runs.

Any task (creator) can create another task (child) by calling either the create_task(), _task_create(), _task_create_at() or the _task_create_blocked(), and passing the processor number, a task template index, and a task-creation parameter. The application defines one creation parameter, which is normally used to provide initialization information to the child.

I suggest to check the following docs.

https://community.freescale.com/docs/DOC-103405

https://community.freescale.com/docs/DOC-102663

In addition, please check the attachment.


Have a great day,
Sol

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

2,166 Views
georgejoseph
Contributor III

Thanks Soledad. I think I understand how to create a task using the template. My problem is I don’t have access to the template. You mentioned that you can create a task dynamically. The taskcreate()

Has only 3 parameters, and I have read that the index parameter is set to zero if not using MQX_template_list[]. How do you define the task this way (name, priority, function..)? The 3rd parameter is called “parameter”. I think this eventually refers to a template. Would this be a template of my creation (not MQX_template_list[])? Can I create a task template and use it?

0 Kudos

2,166 Views
georgejoseph
Contributor III

If the jpg images are a reply I see nothing when I open them.

0 Kudos