Hot!MZ DA heap location

Author
friesen
Super Member
  • Total Posts : 1548
  • Reward points : 0
  • Joined: 2008/05/08 05:23:35
  • Location: Indiana, USA
  • Status: offline
2017/07/12 14:35:47 (permalink)
0

MZ DA heap location

How would one go about forcing the heap location to DDR in the DA series?
 
Is it going to take linker mods, or is this the wrong way to go about it?

Erik Friesen
#1

4 Replies Related Threads

    simong123
    Lab Member No. 003
    • Total Posts : 987
    • Reward points : 0
    • Joined: 2012/02/07 18:21:03
    • Location: Future Gadget Lab (UK Branch)
    • Status: offline
    Re: MZ DA heap location 2017/07/12 16:19:52 (permalink)
    3 (1)
    For static allocation you can use regions.
    For dynamic allocation, I think the linker determines the heap automagically, and it's location cannot be specified. I think you will have to supply your supply your own malloc(), realloc(), free() etc. Fortunately the stdlib functions are weak, so if you supply these functions yourself Harmony etc. will use your version. I'm sure you can find some suitable malloc replacements on the web which can be modified.
    You might include some heuristics such that allocations < a certain size go to RAM, larger ones to DDR, in effect maintaining two heaps.
    #2
    friesen
    Super Member
    • Total Posts : 1548
    • Reward points : 0
    • Joined: 2008/05/08 05:23:35
    • Location: Indiana, USA
    • Status: offline
    Re: MZ DA heap location 2017/07/12 18:48:48 (permalink)
    0
    Really what I am trying to do is have the tcpip stack use ddr, and it appears easy enough to specify a different malloc calloc and free.

    Erik Friesen
    #3
    friesen
    Super Member
    • Total Posts : 1548
    • Reward points : 0
    • Joined: 2008/05/08 05:23:35
    • Location: Indiana, USA
    • Status: offline
    Re: MZ DA heap location 2017/07/14 13:06:14 (permalink)
    3 (1)
    Are there any docs anywhere, or any future plans for the DA chip and memory management?  Pretty much right now it looks like user managed memory.  It seems obvious that malloc is going to have to idea whether or not ddr is enabled.  Any idea where I could find pic32 malloc source?

    Erik Friesen
    #4
    jdeguire
    Super Member
    • Total Posts : 334
    • Reward points : 0
    • Joined: 2012/01/13 07:48:44
    • Location: United States
    • Status: offline
    Re: MZ DA heap location 2017/07/17 06:04:25 (permalink)
    0
    The allocation functions I think call sbrk() to get blocks from the OS (normally Unix/Linux, but a bare metal shim in this case), so you might be able to look into implementing that instead.  You can find Microchip's sbrk() implementation in "<xc32 install dir>/pic32-libs/libpic32/stubs/sbrk.c".  You may need to unzip the libpic32 sources first on XC32 v1.43 or newer.
    #5
    Jump to:
    © 2017 APG vNext Commercial Version 4.5