Hi all,
I managed to get the blinking led example to work:
program stmpal;
{$O-}
var
p : Pointer;
MyInt : Integer;
procedure delay;
var
i : uint32;
begin
for i := 0 to 500000 do
begin
asm
nop // empty instruction
end;
end;
end;
begin
// turn on Port C
RCC.APB2ENR := RCC.APB2ENR or (%1 shl 4);
// Pin 13 from Port C to Output
PortC.CRH := $00300000;
MyInt := 350; // works as expected.
GetMem(p,4); // crashes here.
// Note: The LED lights up at LOW.
while true do
begin
// Pin 13 - High
PortC.BSRR := 1 shl 13;
Delay;
// Pin 13 - Low
PortC.BRR := 1 shl 13;
Delay;
end;
end.
However if I add a getmem statement as shown above it crashes. Im at a loss to understand where to proceed. Im assuming I have to do some extra intialization for the getmem statement to work properly. I can add static vars and they work but if i try to reserve memory on the heap to store a value there it crashes.
What am i doing wrong, or not doing? Can someone please point me in the right direction?