Clear Thumb bit in xPSR of K60N512 ( Cortex M4 )

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

Clear Thumb bit in xPSR of K60N512 ( Cortex M4 )

ソリューションへジャンプ
1,946件の閲覧回数
Thommi_Tulpe
Contributor IV

Hello,
i have to write a little Assembler for the K60N512 which
runs on the processor. For that I have to clear the Thumb Bit in
the xPSR (EPSR) Register. I only want to use 32-bit ARM-Instructions
I can read the Register with MRS ro, xpsr    but I cant
clear the Bit.

 

How can I swich from Thumb to 32-bit Instruction Mode and reverse?

 

Hope someone can help

Thomas

0 件の賞賛
返信
1 解決策
1,442件の閲覧回数
Thommi_Tulpe
Contributor IV

Thank you Mark, thank you Richard:smileyhappy:

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
1,442件の閲覧回数
FreeRTOS_org
Contributor IV

You cannot clear the thumb bit on a Cortex-M processor, it is fixed.  The processor runs in Thumb2 only, which is a mix of 16 and 32 bit instructions.

0 件の賞賛
返信
1,443件の閲覧回数
Thommi_Tulpe
Contributor IV

Thank you Mark, thank you Richard:smileyhappy:

0 件の賞賛
返信
1,442件の閲覧回数
mjbcswitzerland
Specialist V

Thomas

 

I am not 100% sure, but I thought that the Cortex M4 operates only in Thumb2 mode and so there is no Thumb and ARM modes which can be switched between.

 

The ARM7/9 uses the Thumb/ARM modes to compromise between instruction efficiency and code size but I thought that Thumb2 was based on an automatic best mix of these.

 

On the ARM one can force between modes by aligning the code accordingly. Jumping to an even address causes ARM mode and jumping to an odd address causes Thumb mode (therefore aligning code on an even boundary automatically cause it to be executed in ARM mode - the instructions also need to match the mode too though...).

 

Regards

 

Mark

 

0 件の賞賛
返信