Joel D'Souza
Joel D'Souza

Reputation: 41

How to generate STRH instruction instead of STRH.W GHS compiler for ARM Cortex-M7 processor?

I am currently working on interfacing an external flash memory S26H in XIP mode (by directly dereferencing the memory addresses) which has the restriction that all memory accesses must be 2-byte aligned. At the following instruction, the controller goes into an IMPRECISERR bus exception:

strh.w r0, [r2, #0xAAA] ;r0 =0x1234, r2= 0x60000000 for example

what I find surprising here is that the address 0x60000AAA is a 2-byte aligned address, it still leads to an alignment error raised by the memory interface in the micro-controller.

On a code compiled in a different environment, I did not find this problem. The only difference seems to be that in the working code, the instruction used is strh instead of strh.w. In both cases, the compiler was the same i.e. GHS.

How do I force the assembler to generate this instruction?

Upvotes: 0

Views: 41

Answers (0)

Related Questions