by ysapir » Tue Jun 04, 2013 5:01 pm
When using the legacy or fast profiles, some code is placed at the external memory. Normally, it will occupy a 1MB-pre-core region, starting at 0x8e000000. This means that the code will occupy up to 16MB of the external space.
The upper 16MB are allocated for the program heap, again, 1MB per core. When using malloc(), *printf() and other stdio functions that use malloc internally, they will use this heap space for their operation. If you look carefully you'll notice that the heap segments are locates in the "shared_dram" section. This means that what you see is most probably the heap running over your mailbox, or vice-versa.
If this is indeed the case, you can solve it by doing one of these:
1. Using a custom LDF, shrink down the heap and locate it in the upper part of "shared_dram";
2. Assuming that the program operation does not require too much heap space, and that the heap grows linearly, you can place your mailbox in the upper area of the section. In order to do this, you can:
2.1. Change your outbuf from a string to a pointer and assign it a specific address (say 0x8fffff00), discarding the SECTION() attribute. Remember to change the mailbox address in the host program accordingly;
2.2. In a custom LDF, define a new section in a specific address (say 0x8fffff00) and change the outpuf attribute to that section name. See the matmul example for an how-to reference.
The GNU website has a reference manual for linker scripts, if you want to go deeper in the LDF mechanics:
and here's another one: