Storage.mod Question
Posted: Mon Mar 11, 2019 9:39 am
I am baffled by the following behaviour (Cortex M3, STM32F207 target). Here's a minimal test case, condensed and abstracted from my actual code.
As you'd expect, I get "13" in the terminal. So far, so good. Now I import also 'Storage':
Now I get no output at all, and no rt-error either. Either I miss something, or things go haywire somehow. I don't know how 'p' is represented internally, but if I assume it's an address, I can check if it's within the heap boundaries:
Without 'Storage' imported, I get '20000220H', with 'Storage' I get '20000204H', which both look OK with a heap starting at '20000200H' (assuming 'p' actually represents an address, ofc).
Code: Select all
MODULE testalloc;
IMPORT Main, Out;
TYPE
P = POINTER TO Pdesc;
Pdesc = RECORD i: INTEGER END;
VAR
p: P;
BEGIN
NEW(p);
p.i := 13;
Out.Int(p.i, 0); Out.Ln
END testalloc.
Code: Select all
MODULE testalloc;
IMPORT Main, Out, Storage;
(* ... same as above *)
Code: Select all
(* ... as above *)
BEGIN
NEW(p);
Out.Hex(SYSTEM.VAL(INTEGER, p), 0); Out.Ln;
p.i := 13;
Out.Int(p.i, 0); Out.Ln
END testalloc.