Power PC heap initialisation on Reset

Hi all,

I have a SOC with a Power PC running on a Virtex II pro. On FPGA configuration, the PPC firmware runs correctly, heap reservation on firmware initialisation is correct. When I reset the SOC with the reset controller, the PPC restarts correctly, but when it tries to use the heap to initialize some dynamic variables, I get a fail on the malloc.

It seem that on the reset the power PC context is not reinitialized. I guess we have to add something in the boot sequence of the PPC to reset the heap pointer.

I'm I right ? It is something that must be standard in the power PC world, does someone have an exemple how to do this ??

Thanks.

Stéphane.

Reply to
sjulhes
Loading thread data ...

Nobody has a clue ?

"sjulhes" a écrit dans le message de news:

466404fb$0$10866$ snipped-for-privacy@news.free.fr...
Reply to
sjulhes

For standalone applications the heap is initialized in sbrk.c which you can find in ppc405_0/libsrc/standalone*/src/sbrk.c

You can see that heap_ptr is initialized on the first call to sbrk() and increases its value after that on every call. It maintains its value through a reset.

To change the behavior you can copy sbrk.c into your own project and change it.

Alternatively, there might also be a compiler option that allows you to initialize static values at run time instead of compile time. You might be able to static char *heap_ptr=0; in combination with the compiler option to get the desired behavior.

- Peter

sjulhes wrote:

Reply to
Peter Ryser

Thanks for your answer, we're working on it !

"Peter Ryser" a écrit dans le message de news: f47n98$ snipped-for-privacy@cnn.xilinx.com...

Reply to
sjulhes

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.