Code: Select all
No errors. Target device: ZX24n, Code: 18590 bytes, RAM: 4206 bytes, Persistent memory: 32 bytes
Code: Select all
No errors. Target device: ZX24n, Code: 18590 bytes, RAM: 4206 bytes, Persistent memory: 32 bytes
Is it that you believe there were errors?mikep wrote:I compiled some code for the ZX-24n and received the following result which looks wrong to me
I just realized that the RAM value that you showed exceeds the mega644P's RAM size of 4096. I'll look into whether there is no check performed or if it's being done incorrectly.mikep wrote:the following result [...] looks wrong to me
We should be able to estimate the size of the Main() task stack just like we do for all tasks.dkinzer wrote:However, the fact that the size of statically allocated RAM is less than RAM size is not sufficient to guarantee proper execution because additional space is needed for the Main() task stack and for the heap, both of which are unknown at compile time.
Code: Select all
No errors. Target device: ZX24, Code: 4020 bytes, Allocated RAM: 1186 bytes, Main() RAM: 147 bytes, RAM Left: 203 bytes, Persistent memory: 0 bytes
This may help but we already have the HeapSize option to bound the variable part of the RAM.dkinzer wrote:The best we can do at present is to add a directive similar to Option.CodeLimit which, if present, will result in a warning if the size of statically allocated RAM exceeds the value specified.
For native mode devices, RAM is partitioned into three blocks as depicted in the ZBasic Reference Manual. The first, lowest addressed, block contains all of the statically allocated variables (with contributions from both system and user code). Immediately following that is the Main() task stack and finally the heap.mikep wrote:This may help but we already have the HeapSize option to bound the variable part of the RAM.
I though the following error message was intelligent when I used the same size stack as the ZVM version.dkinzer wrote: The first, lowest addressed, block contains all of the statically allocated variables (with contributions from both system and user code). Immediately following that is the Main() task stack and finally the heap.
Code: Select all
FooBar.bas:117: Warning(13): task stack is too small, at least 60 bytes is needed
Yes, given the number of bytes required for saving the task's context, it seems that 60 bytes or so constitutes an absolute minimum for almost any task. That is the rationale behind that message.mikep wrote:Now I understand that it is a standard message for all native mode stacks under 60 bytes.
Code: Select all
in r28, 0x3d
in r29, 0x3e
sbiw r28, 0x0c
Code: Select all
in r28, 0x3d
in r29, 0x3e
sub r28, r26
sbc r29, r27