This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
GAS, ARM: 'str.w' instruction crashes
- From: Jens Bauer <jens-lists at gpio dot dk>
- To: binutils at sourceware dot org
- Date: Sun, 26 May 2013 11:58:23 +0200
- Subject: GAS, ARM: 'str.w' instruction crashes
I've been experiencing some crashes when using the STR instruction to [pc,#offset].
;/* The following crashes with a HardFault, when run on a Cortex-M3... */
str r6,.patch1t
Disassembly:
1000156a: f8cf 60a4 str.w r6, [pc, #164] ; 10001610 <.patch1t>
;/* But the following does not... */
adr r2,.patch1t
str r6,[r2]
Disassembly:
1000156a: a229 add r2, pc, #164 ; (adr r2, 10001610 <.patch1t>)
1000156c: 6016 str r6, [r2, #0]
In the first example, I've tried a number of different approaches. adding 'nop' instructions on each side of the 'str' instruction, aligning the destination address on a 16-byte boundary, adding/subtracting offsets between -3 and +3, but so far, it crashes no matter what I do.
I do not get any warnings, so I do not know if I'm not supposed to use this instruction on the Cortex-M3 / Thumb2.
Both instructions are run from the internal SRAM on LPC1768, thus writing to SRAM as well.
...Is the str.w r6,[pc,#164] instruction generated correctly (I can't find the opcode documentation anywhere) ?
...If it is, does anyone know why it would crash ?
Love
Jens