Floating point in shell

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

Floating point in shell

Jump to solution
481 Views
matthewkendall
Contributor V

MQX 4.0 on Kinetis K60; hardware floating point; Ethernet port managed by RTCS task; Telnet task listens on port 23 and spawns Shell tasks on connect; all in the usual way.

Some of the commands that the shell executes need to use floating point. Other tasks also use floating point. To ensure FP registers are preserved on context switches my understanding is that all the tasks that use floating point must have the MQX_FLOATING_POINT_TASK attribute set. I have set this attribute on all my other tasks that use floating point, but there appears to be no way to get the RTCS Telnet task to set this attribute on the Shell tasks that it spawns.

Before I implement some nasty hack, has anyone come across this before? What is the cleanest way to get this attribute set on the spawned shell tasks?

0 Kudos
1 Solution
308 Views
matthewkendall
Contributor V

Answering my own question in the hope that it might be useful to someone else:

There appears to be no clean way to get the MQX_FLOATING_POINT_TASK attribute set when the shell task is created, but it doesn't matter because there is a way to set this attribute later from within the task. It is not mentioned in the MQX user guide but the functions are listed in the reference manual:

_task_enable_fp();

/* do floaty things */

_task_disable_fp();

So, just do this from within the particular command that needs floating point, and it will temporarily set and clear the attribute on the shell task.

View solution in original post

0 Kudos
1 Reply
309 Views
matthewkendall
Contributor V

Answering my own question in the hope that it might be useful to someone else:

There appears to be no clean way to get the MQX_FLOATING_POINT_TASK attribute set when the shell task is created, but it doesn't matter because there is a way to set this attribute later from within the task. It is not mentioned in the MQX user guide but the functions are listed in the reference manual:

_task_enable_fp();

/* do floaty things */

_task_disable_fp();

So, just do this from within the particular command that needs floating point, and it will temporarily set and clear the attribute on the shell task.

0 Kudos