CBZ CBNZ instruction usage in inline assembly
Hi,
I am trying to compile the following inline assembly.
I am compiling for cortex-m4 (stm32f407 device).
I tried different toolchain version, all give the same result.
__ASM volatile
(
"ldr r2, =0x42418234\n\t"
"label1:\n\t"
"ldr.w r3, [r2, #0]\n\t" //load TXE bit value using bit band register
"cbnz r3, label1\n\t"
: // no output
: [ptr] "r" (buf_ptr),
[ptr_end] "r" (buf_end)
: "cc", "r2","r3"
);
and I am getting an error:
/tmp/ccOYDN40.s: Assembler messages:
/tmp/ccOYDN40.
make: *** [src/com_proc.o] Error 1
src/subdir.mk:81: recipe for target 'src/com_proc.o' failed
I am aware that CBNZ can only branch within 4_130 bytes, which I think is the case in my code.
replacing "cbnz r3, label1\n\t" with
"cmp r3, #0\n\t"
"bne label1\n\t"
works fine.
I am not sure what I am doing wrong with cbnz instruction?
Question information
- Language:
- English Edit question
- Status:
- Solved
- Assignee:
- No assignee Edit question
- Solved by:
- Danielius
- Solved:
- Last query:
- Last reply: