ARM assembly cannot use immediate values and ADDS/ADCS together
what Jester said:
.cpu cortex-m0
.text
.thumb
.thumb_func
.global test
test:
mov r0, #0
add r0, r0, #1
bx lr
which gives
0: 2000 movs r0, #0
2: 3001 adds r0, #1
4: 4770 bx lr
or if you go with syntax unified then you have to put the s on there
.syntax unified
.cpu cortex-m0
.text
.thumb
.thumb_func
.global test
test:
movs r0, #0
adds r0, r0, #1
bx lr
which also gives
00000000 <test>:
0: 2000 movs r0, #0
2: 3001 adds r0, #1
4: 4770 bx lr
Somewhat ironically, by using UAL syntax to solve the first problem you've now hit pretty much the same thing, but the other way round and with a rather more cryptic symptom.
The only Thumb encodings for (non-flag-setting) mov
with an immediate operand are 32-bit ones, however Cortex-M0 doesn't support those, so the assembler ends up choking on its own constraints. In UAL you have to explicitly use movs
to get the only "move immediate" instruction Cortex-M0 actually has.