This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

RTX166 workspace and heaps

Hi,

I am having trouble to correctly understand the following :
1) task work spaces
2) rtx166 system heap
3) rtx166 context heap

I am working on one application that uses 11 tasks and with far model.

os_use_heap returns 66132
os_use_heap_far returns 3372

and I have:
static unsigned int huge system_heap[0x1000];
static unsigned int near contxt_heap[0x1000];
for os_start_system().

all task have WSPSIZE=256

now can anyone explain a bit of how this works!!! does rtx dynamically manages the pools!!!

what does os_use_heap and os_use_heap_far really returns for far model?

How can I see if WSPSIZE for each task are ok!
Anyone knows a trick for these configurations?

Any help on this matter will be welcomed.

thanks,
joao


Parents
  • does rtx dynamically manages the pools!!!

    Yes, see chapter 'System- and Context-Heap' in the RTX manual:

    The allocation algorithm used is very simple and fast. Beginning from the lower addresses of the heap the blocks are allocated (the lowest free memory area of sufficient size is used). Blocks may be de-allocated again, thus enabling a re-use. However released blocks are not re-combined by the heap manager possibly leading to holes in the heap area.


    what does os_use_heap and os_use_heap_far really returns for far model?

    The number of bytes actually allocated. Your reported values are greater than the size of the arrays. It looks like the heaps are overwritten.
    In uVision2, you can see the heap usage in numerical and graphical representation:
    - select menu 'Peripherals \ RTX Debug session \ Start'
    - select tab 'System Resources'
    - for see detailed infos of the heaps, click on the box 'used context' or 'used system'


    How can I see if WSPSIZE for each task are ok!
    Anyone knows a trick for these configurations?

    You can try this one:
    Before 'os_start' fill the context heap with a pattern, e.g 0xaa55.
    Start your application.
    Examine the Workspace, you can see the pattern in regions never overwritten.
    If your application dynamically delete and create tasks, this method is not applicable. Free memory blocks are then reused for newly created workspaces.

Reply
  • does rtx dynamically manages the pools!!!

    Yes, see chapter 'System- and Context-Heap' in the RTX manual:

    The allocation algorithm used is very simple and fast. Beginning from the lower addresses of the heap the blocks are allocated (the lowest free memory area of sufficient size is used). Blocks may be de-allocated again, thus enabling a re-use. However released blocks are not re-combined by the heap manager possibly leading to holes in the heap area.


    what does os_use_heap and os_use_heap_far really returns for far model?

    The number of bytes actually allocated. Your reported values are greater than the size of the arrays. It looks like the heaps are overwritten.
    In uVision2, you can see the heap usage in numerical and graphical representation:
    - select menu 'Peripherals \ RTX Debug session \ Start'
    - select tab 'System Resources'
    - for see detailed infos of the heaps, click on the box 'used context' or 'used system'


    How can I see if WSPSIZE for each task are ok!
    Anyone knows a trick for these configurations?

    You can try this one:
    Before 'os_start' fill the context heap with a pattern, e.g 0xaa55.
    Start your application.
    Examine the Workspace, you can see the pattern in regions never overwritten.
    If your application dynamically delete and create tasks, this method is not applicable. Free memory blocks are then reused for newly created workspaces.

Children