[fpc-devel] Arm embedded on cortex m0
Alfred
alfred at consulab.nl
Mon Sep 3 12:59:27 CEST 2018
Hello,
I have a problem using a TObject on arm embedded (cortex m0: an atmel
samd10x14).
It boils down to this:
00002124 <SYSTEM_$$_GETMEM$POINTER$LONGWORD>:
2124: b510 push {r4, lr}
2126: b08a sub sp, #40 ; 0x28
2128: 1c04 adds r4, r0, #0
212a: 1c08 adds r0, r1, #0
212c: 4902 ldr r1, [pc, #8] ; (2138
<SYSTEM_$$_GETMEM$POINTER$LONGWORD+0x14>)
212e: 6809 ldr r1, [r1, #0]
2130: 4788 blx r1
2132: 6020 str r0, [r4, #0]
2134: b00a add sp, #40 ; 0x28
2136: bd10 pop {r4, pc}
2138: 20000140 andcs r0, r0, r0, asr #2
When the debugger stops at 212e, r1 is correctly filled with 0x20000140.
On the next step, r1 is zero , and the program crashes on the blx.
Could anybody point me towards the right direction ? What should I
expect as the normal behavior at this point.
Thanks.
Ps1: this is fpc_getmem
00002178 <fpc_getmem>:
2178: b500 push {lr}
217a: b08a sub sp, #40 ; 0x28
217c: 4902 ldr r1, [pc, #8] ; (2188
<fpc_getmem+0x10>)
217e: 6809 ldr r1, [r1, #0]
2180: 4788 blx r1
2182: b00a add sp, #40 ; 0x28
2184: bd00 pop {pc}
2186: 46c0 nop ; (mov r8, r8)
2188: 20000140 andcs r0, r0, r0, asr #2
Ps2: the memory at 0x20000140 is filled with zeros.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20180903/ad7e6e1a/attachment.html>
More information about the fpc-devel
mailing list