You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Continuing to play around with my little serial monitor I was able to test support of two
interesting instructions MOVW and MOVT which the THUMB compiler actually doesn't support.
Both are composed of 2 16-bit instructions as documented in the tables below.
I am able to assemble and run them interactively on the device, so I am sure that both
are supported and working as expected.
EDIT: After further investigation I figured out that the bit #11 of the 16-bit immediate has to be encoded in bit #10 of the first instruction.
You find this information on page 4-166 in the "ARM Architecture Reference Manual Thumb-2 Supplement".
The following code shows a working instruction sequence, where first the lower halfword of R7 is loaded with a 16-bit immediate value using MOVW.
Then another 16-bit immediate value is loaded into the upper halfword of R7 using the MOVT instruction.
Using this two instructions, it is possible to load a 32-bit immediate value into any register, except PC.
It is important to follow this sequence, since MOVW erases the contents of the entire register before writing into the lower halfword, where MOVT preserves the content.
Hi!
Continuing to play around with my little serial monitor I was able to test support of two
interesting instructions
MOVW
andMOVT
which the THUMB compiler actually doesn't support.Both are composed of 2 16-bit instructions as documented in the tables below.
I am able to assemble and run them interactively on the device, so I am sure that both
are supported and working as expected.
EDIT: After further investigation I figured out that the bit #11 of the 16-bit immediate has to be encoded in bit #10 of the first instruction.
You find this information on page 4-166 in the "ARM Architecture Reference Manual Thumb-2 Supplement".
The following code shows a working instruction sequence, where first the lower halfword of R7 is loaded with a 16-bit immediate value using
MOVW
.Then another 16-bit immediate value is loaded into the upper halfword of R7 using the
MOVT
instruction.Using this two instructions, it is possible to load a 32-bit immediate value into any register, except
PC
.It is important to follow this sequence, since
MOVW
erases the contents of the entire register before writing into the lower halfword, whereMOVT
preserves the content.Call executed on the real device (STM32F103C8 Cortex-M3) where you can see
the two 16-bit immediate values combined in R7.
It would be nice having support for them in the THUMB assembler.
Regards.
The text was updated successfully, but these errors were encountered: