Floating point in shell

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Floating point in shell

ソリューションへジャンプ
953件の閲覧回数
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 件の賞賛
返信
1 解決策
780件の閲覧回数
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 件の賞賛
返信
1 返信
781件の閲覧回数
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 件の賞賛
返信