Link error on taskHeadroom()

Discussion of issues related specifically to writing code for native mode devices. This includes ZBasic code as well as assembly language code and C code, both inline and standalone.
Post Reply
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Link error on taskHeadroom()

Post by mikep »

I cannot use System.TaskHeadRoom() in my code. The linker fails to find taskHeadroom in zxLib 2.5.2
Mike Perks
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Link error on taskHeadroom()

Post by dkinzer »

mikep wrote:I cannot use System.TaskHeadRoom() in my code. The linker fails to find taskHeadroom in zxLib 2.5.2
The entry point was missing from the library. You can try the experimental (i.e. not fully tested) ZX Library v2.5.5. The .zip file contains an updated change history.
- Don Kinzer
mikep
Posts: 796
Joined: 24 September 2005, 15:54 PM

Post by mikep »

I have tested the new ZX library code and it works fine on a ZX24n. Here is some empirical data about the relative size of task stacks. These numbers have no margin at all.

[table][mrow]Task[mcol]ZVM Stack[mcol]Native Stack[mcol]Growth
[row]Main[col]103[col]281[col]286%
[row]Task1[col]32[col]63[col]197%
[row]Task2[col]32[col]71[col]222%
[row]Task3[col]72[col]100[col]139%
[row]Task4[col]60[col]115[col]192%
[row]Task5[col]36[col]85[col]236%
[/table]
It is usual to have a ZVM stack margin of 10 bytes. I would suggest for a native mode device that this translates into a 30 byte margin. Here is some sample output from a ported native mode application using System.TaskHeadRoom()

Code: Select all

Main       44
Indicators 30
Receive    30
Send       30
Update     30
Watchdog   44
Note that if you over allocate RAM, a task may still start ok but the stack headroom may get returned as &hFFFF.
Mike Perks
Post Reply