I'm trying to create a matching GBA disassembly using devkitpro, and I'm having trouble with the THUMB instruction LDR R1, =0x3FF
.
I want it to place 0x3FF
in the literal pool and generate a PC-relative address, which is what the assembled version does, however it insists on creating a MOVW
32-bit instruction instead.
I've tried using the length specifier LDR.N
to force it to generate a 16-bit instruction, however this appears to have made no difference at all.
While I could just use the PC-relative address directly, since this is in the middle of the literal pool it would cause me to have to delete a large amount of the pool and implement the loads in the same way, which would be very messy, so this is only a last resort. If anyone knows some way I could force this instruction to generate a PC-relative address that would be very helpful. Thanks!
Your should provide a Minimal, Reproducible Example next time you ask a question since this will make easier for people to help you.
I may have misunderstood your question, but I am not getting any
movw
instruction in the code assembled from the following program - you may just have specified the wrong cpu for the GBA, or you may be using the default cpu which is unlikely to bearm7tdmi
, since it was introduced in 1994.ldr.s
:Setting the cpu , say, to
cortex-m3
, does provide an output consistent with what you are describing:ldr.s
: