This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Problems with far segment usage

Hi all,

 

I have a simple main programm which just outputs  "Hello World". This works fine. Now I want to link several CPP code object files to this program. And here is where Iam getting stucked. For example if one of the objects of the CPP code allocates to much memory its static (global) variables, suddenly the print statemant from the main routine does not work anymore. If I increase the memory consumption of such a static variable within the CPP code which is just linked to the main program, the debugger can't even find the main access point anymore.

 

Iam using CCv4.2, developing code for C6748 DSP processor, using CGT v7.0.4 and xdc tool version 3.20.08.88. I use a generated linker file by the xdc platform evm6748 since I also have an evm6748 by LogicPD.

 

Any help on this issue would be very appreciated. Please let me know if you need additional information.

 

Kind Regards,

Steve

  • Steve,

    Have you tried increasing your stack and heap sizes to see if that helps?

    These articles might be helpful in debugging the issue further:
    http://processors.wiki.ti.com/index.php/Creating_Dynamic_Objects_and_Threads_in_BIOS
    http://processors.wiki.ti.com/index.php/Tips_for_using_printf

  • Hi Aarti,

     

    thanks for your answer and the Links. I tried to increase the heap as you mentioned as well as the stack using the CCS option Project->Properties->C/C++Build->C6000 Linker->Basic Options and set the Heap to 0x20000 and the stack size to 0x4000 but without any effect on the execution behaviour. The printf statement simply does not print the string, and even worse if I increase the size of a global static variable within the linked CPP code it can't even find the main entry point! Furthermore the increasement of the stack size has not changed the output within the resulting map file, the stack size there is still 0x1000 (I assume default stack size).

     

    Also I have to say that the code is not executed within any SYS/DSP BIOS context. Just a simple "Hello World" within the main routine. Thats it.

     

    Kind Regards,

    Steve

  • Steve,

    How did you go about creating this project - did you start with one of the example templates provided in CCS or create your own project from scratch? If this is a XDC enabled project, I assume you have a configuration file (.cfg) in your project, then the automatically generated linker command file has a default stack and heap size set (which I believe is 0x1000 for C6748 EVM platform).

    In this case, as a quick test, you could add another linker command file to the project with the new -stack and -heap options to over-ride the default ones. Right-click on the project and select New->File. Give it a file name, and in the file add 2 lines with the desired size of stack and heap (-stack and -heap). Rebuilding the project should now update these to the new values.

    I would also suggest starting off with one of the hello world example templates provided in CCS (appears as part of the CCS New Project wizard) and then adding on other application node as needed.

  • Hi Aarti,

     

    thanks for your answer and sorry for the X-post. Sasha in the thread http://e2e.ti.com/support/embedded/f/355/p/108788/385712.aspx#385712 pointed me to something similar what you've said and it works. But I still can't explain to me why the size of the far sections (and maybe all sections previous to sysmem) (see thread in link) have an impact on the heap section sysmem?

     

    Kind Regards,

    Steve