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.

iostream on C2000 TMS320F28377S

Other Parts Discussed in Thread: TMS320F28377S

Hi,


For a project I'm working with the TMS320F28377S. So far my understanding is that embedded c++ should work on this devide. I tried to make a small programm to test the use of classes. Howerver, I do get a message that the code won't fit in the memory.

line 47: error #10099-D: program will not fit into available memory.  placement with alignment/blocking fails for section ".text" size 0x3bea page 0.  Available memory ranges:

I think this is due to the size of the iostream lib. Usually I would choose to go with a compiler flag such as -W1,-gc-sections. Is this also possible with ccs? or should I do a workaround and not use classes?

my test code:

/**
 * testFile to see whether classes do work with the TI launchpad
 *
 */

#include <iostream>
//#include <string>
#include <stdio.h>

class testClass{
	public:
		testClass();
		~testClass();
};

testClass::testClass(void){

}

testClass::~testClass(void){

}

void main(void){
	//puts("test to see if classes work\n");
	//testClass first;

}

can someone help me out?

  • iostream is implemented as a bunch of template classes, and is bound to generate a lot of object code when you use it. It may be that a typical program using iostream is too big for the memory on a C28x device. Could you please generate the linker map file (linker option --map_file) for the case where the program does not fit in memory, and post the map file here?
  • I hope this is the file you're looking for.

    sorry for my late response, I didn't get any popups that I had a reply

    8737.test.txt

  • Yes, that's the correct file.  It tell me that the linker failed to allocate the .text section, even though it split .text between several FLASH areas.  There is technically plenty of space left on your device, it's just divided up into units that are too small.  In particular, one of the library files, section in libc.a<unified_locale.obj>, has a .text section of size 0xf82f, which is very large; by itself, it is larger than any of your FLASH sections.

    Your only practical remedies are:

    • Use printf instead of iostream
    • Modify the linker command file to merge several FLASH areas until you have a single FLASH area big enough to hold the .text section from unified_locale.obj

  • Isn't there a way to exclude all of the unused parts of the header file? such as one would do with compiler flags? Next to that printf doens't work either on the platform due to space.
    I wanted to use iostream for classes as I rather use that over loose functions.
  • There aren't any unused parts from iostream in your program. For COFF, the compiler doesn't instantiate the templates unless they are needed. Unfortunately, if you want to use iostream, you drag in a lot of stuff.
  • Also, if printf doesn't work, iostream is certainly not going to work.
  • you know there's a difference between iostream and printf right? I wanted to use the iostream for classes, not for debugging output.
    Is there a special support for classes in custom libraries from TI? I could do a workaround, however classes would make life way easier...
  • I had assumed from the start you were trying to get output. If that's not the case, I guess I'm not quite sure what you're trying to do with iostream. Could you show a short example of what you're trying to accomplish?

    I don't know what you mean by "special support." You can create whatever classes you like, and you can put whatever object code you like in a library. As far as I know, the TI compiler supports everything you'd need to use in C++, but I don't know about anything beyond that.