Discussion:
Arm embedded on cortex m0
(too old to reply)
Alfred
2018-09-03 10:59:27 UTC
Permalink
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.
Alfred
2018-09-03 11:42:30 UTC
Permalink
Thanks very much.
Program runs ... bit bloated, but the (embedded) work can continue !


------ Origineel bericht ------
Van: "Michael Ring" <***@michael-ring.org>
Aan: "Alfred" <***@consulab.nl>
Verzonden: 3-9-2018 13:11:11
Onderwerp: Re: [fpc-devel] Arm embedded on cortex m0
On first look is smells like Memory allocation failed, try including
heapmgr in your code.
Michael
Loading...