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.

Newbie question

Other Parts Discussed in Thread: CONTROLSUITE

I got stuck trying to link a C++ abstraction of the flashing leds demo for the 28335.

The code compiled with only a stack size warning if I didn't declare any objects, but generated all kinds of errors when I instantiated an object from my class. The most alarming said that class is not a keyword.

Now the class was created by ccs, and I'm pretty sure that class is a standard c++ keyword ;-) so why the error?

I ran through the fixes proposed here <http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html> all of which seemed to produce weirder and weirder linking errors. Pragmas were suddenly not valid, semicolons were required in silly places ...

Hoping to find a solution I tried loading the hello world demo, which failed to link because it didn't have space for the .cio secrtion. Stop.

What's going on?

 

Peter.

  • Peter,

    Could you provide more details on the specific errors generated by the compiler/linker and if possible, attach the C source file as that would be very helpful in understanding the reason for the error?

    Peter Cusack said:

    Hoping to find a solution I tried loading the hello world demo, which failed to link because it didn't have space for the .cio secrtion. Stop.

    Are you referring to the "Hello World" template program included with CCS4? If so, your errors were probably something like this:

    <Linking>

    warning: creating output section ".cio" without a SECTIONS specification
    warning: creating ".sysmem" section with default size of 0x400; use the -heap option to change the default size
    "../28335_RAM_lnk.cmd", line 125: error: placement fails for object ".text",
    size 0x192c (page 0). Available ranges:
    RAML1 size: 0x1000 unused: 0x1000 max hole: 0x1000
    error: errors encountered during linking; "f28335_hello.out" not built

    Basically this error is happening because the "printf" command used in the "hello world" project takes a large amount of memory which is not available on the default linker command file, 28335_RAM_lnk.cmd. Please see the note related to such errors here: http://processors.wiki.ti.com/index.php/C2000_Getting_Started_with_Code_Composer_Studio_v4#Errors_with_.22hello_world.22_project_using_F281x_Devices

    It is instead recommended to start with the F28xx Header Files and Peripheral examples which contain several examples to get started with programming F28xx parts. These examples are part of ControlSuite software for C2000:
    http://processors.wiki.ti.com/index.php/C28x_Header_Files_and_Peripheral_Examples

  • Thanks Aarti. That is exactly what I see. I guess I expected that a getting started example would actually compile and run on the target. No matter. I'll get on with my original project and try to create a flashing led object from the FlashingLeds example code.

    My first attempt failed. I created a class using the add class button in CCS. It created a new header file and cpp file. I #included the header file in FlashingLeds-Main.c and got an error message "identifier "class" is undefined    Blink    BlinkingLED.h    line 4    1296179000747    221" and a probably spurious message "expected a ";"    Blink    BlinkingLED.h    line 5    1296179000747    222" when I rebuilt the code.

    I guess from this that the c/c++ compiler is behaving like a c only compiler.

    I made  a copy of FlashingLeds-Main.c, re-naming it as FlashingLeds-Main.cpp, and as required, changing the main function to return an int. Building that returned an error message "linkage specification is not allowed    Blink    FlashingLeds-Main.cpp    line 176    1296179390990    226" which currently has me stumped because I didn't intend to specify any linkage, just declare a (mandatory) function.

    Where to from here?

  • It proceeds apace. I found that having made the main file a .cpp file, every *.c file had to be renamed. This left me with two errors, both in FlashingLeds-DevInit_F2833x.cpp:

    "a value of type "void *" cannot be used to initialize an entity of type "Uint32 *"    Blink    FlashingLeds-DevInit_F2833x.cpp    line 580    1296198140775    2375"

    Removing the typecast to void* changed the error to complain about using a variable of type &ISR_ILLEGAL or &PieVectTable to initialise an entity of type "Uint32 *, so I'm no closer to having a running C++ version of the FlashingLeds demo, but I have changed the number and type of errors a lot during the day. ;-)

    If anyone can see where this is going, I'd appreciate knowing the shortcut.