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.

Error 10099-D. Are these declarations of globals causing it?

Other Parts Discussed in Thread: MSP430G2210, MSP-FET, CCSTUDIO

Colleagues,

I have these global variable declarations (names of variables changed to protect the guilty) :

Foo g_objFoo;
Bar g_objBar(&g_objFoo);

The program does not build, generates this error:

> #10099-D program will not fit into available memory.  placement with alignment fails for section ".text" size 0x8d0 .

and in the .map file

.text      0    00000000    000008d0     FAILED TO ALLOCATE

If I declare g_objBar as a local variable in main(), then the code builds.  That suggests that I haven't actually run out of memory.

Heap size is set to 16 bytes, which should be enough.  The objects have only few fields.

What could I be missing?

Any suggestion, insight or reference is really appreciated!

Cheers,
- Nick

My development environment: CCStudio 6.1.1.00022, MSP-FET via Spy-Bi-Wire, MSP430G2210.

  • Nick Alexeev said:
    If I declare g_objBar as a local variable in main(), then the code builds.  That suggests that I haven't actually run out of memory.

    Global variables are allocated by the Linker and the Linker says you do not have enough memory.

    Local variables  are allocated in the stack at run-time and you might blow the stack at that time.

  • old_cow_yellow said:
    Global variables are allocated by the Linker and the Linker says you do not have enough memory.

    Local variables  are allocated in the stack at run-time and you might blow the stack at that time.


    Noted.

    At the same time, I suspect that there is something else in play here that I don't understands, because this is my first foray into CCStudio.  (Just a month ago, I have posted this dummy questions on a related subject.)

    Here's another experiment.  This builds.

    // globals
    Foo g_objFoo;
    Foo g_obj0, g_obj1, g_obj2;

    But this doesn't build

    // globals
    Foo g_objFoo;
    Foo g_obj[2];

    and generates the message:

    #10099-D program will not fit into available memory.  placement with alignment fails for section ".text" size 0x962 .

    , even though the second snippet has fewer instances and should require less memory.

  • Nick Alexeev said:
    even though the second snippet has fewer instances and should require less memory

    Some questions trying to understand what is causing that:

    1) Is Foo a C++ class with a constructor?

    2) In both test cases, are all the variables g_obj, g_obj0, g_obj1 and g_obj2 referenced in the rest of the code?

    If they are not referenced, the Linker can exclude them, thus reducing the required memory usage.

  • Sorry, my previous response may be entirely irrelevant. You are short in Flash Memory, not RAM.

    Which variation of MSP430 chip are you trying to use? How much Flash does it have? How much of that is used before you add your Foo's and Bar's?

    I think you have a camel with very weak back already carrying a almost full load. Another straw may or may not break its back depending on even the slightest difference of the extra weight of the straw.
  • old_cow_yellow said:
    Sorry, my previous response may be entirely irrelevant. You are short in Flash Memory, not RAM.

    It's possible that I'm running out of Flash.  I've got a puny MSP430G2210 with 2KB flash.  The last version that did build occupied 1.7KB.

    One thing strikes me as odd, though.  If I declare g_objBar as a local variable in main(), then the program builds.  Shouldn't the local declaration take the same amount of code memory as the global one?

  • I use a different compiler/linker (IAR). Perhaps you could show me your original source code and all the various additions; and I can figure out how much additional RAM and Flash are used for each of the various source code additions under IAR.
  • old_cow_yellow said:
    I use a different compiler/linker (IAR). Perhaps you could show me your original source code and all the various additions

    There are the source code for the test cases in the following thread on the TI C/C++ Compiler Forum - https://e2e.ti.com/support/development_tools/compiler/f/343/t/466711

  • I do not use CCS and have no idea what is "The setup: CCStudio 6.1.1.00022, MSP-FET via Spy-Bi-Wire, MSP430G2210."

**Attention** This is a public forum