The error in the assembly instruction for STM32F4xx based boards

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
kudle19
Posts: 1
Joined: Mon Jan 28, 2019 2:06 pm

The error in the assembly instruction for STM32F4xx based boards

Post by kudle19 » Mon Jan 28, 2019 2:23 pm

Hi,
it seems there is some error in the <AND> Cortex M4 (STM32F405xxx) instruction. Below are two chunks of code for the <AND>
and <ORR> instructions for comparison:

MicroPython v1.10-15-gdeb67569f on 2019-01-28; PYBv1.1 with STM32F405RG
Type "help()" for more information.

Code: Select all

>>> @micropython.asm_thumb
... def f1():
...     movwt(r0, 5)
...     movwt(r1, 7)
...     and(r0, r1)
...
Traceback (most recent call last):
  File "<stdin>", line 5
SyntaxError: invalid syntax

>>> @micropython.asm_thumb
... def f1():
...     movwt(r0, 5)
...     movwt(r1, 7)
...     orr(r0, r1)
...
>>> f1()
7

User avatar
Roberthh
Posts: 1461
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: The error in the assembly instruction for STM32F4xx based boards

Post by Roberthh » Mon Jan 28, 2019 3:10 pm

The AND instruction is and_ (with trailing underline), because and is a Python keyword.

Post Reply