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.

CCS/EK-TM4C123GXL: Debugger not finding main

Part Number: EK-TM4C123GXL

Tool/software: Code Composer Studio

I am getting these outputs on my debugger, and it cannot seem to find main, even though I have it configured to run to main. I also have some warnings: 

(the other two are pointless comparison warnings, and I know what they mean)

Are these two things related, or can I ignore the warnings? And what settings am I missing that I am getting the above output from the debugger?

  • Meaghan Moeller said:
    I am getting these outputs on my debugger, and it cannot seem to find main, even though I have it configured to run to main.

    The error occurs in the compiler run time library startup code before main is reached. In this case the error is that malloc returns a NULL pointer when attempting to allocate a 32-byte structure for C++ exception handling.

    When a new project is created in CCS for a Tiva device the default is that heap size is set to zero bytes. Under the CCS Project Properties Build -> ARM Linker -> Basic Options you need to set a non-zero value for the "Heap size for C/C++ dynamic memory allocation (--heap_size, -heap)":

    The actual value for the heap size depends upon the program, but for the attached C++ exception handling example which also uses cout 4096 bytes of heap and 2084 bytes of stack was sufficient.

    Meaghan Moeller said:
    I also have some warnings: 

    Warnings of the form "creating output section "<section name>" without a SECTIONS specification" mean the linker is placing sections in an arbitrary memory region, which can cause a failure at run time. The .ARM.extab and .ARM.exidx sections are related to unwinding (according to https://answers.launchpad.net/gcc-arm-embedded/+question/271294). In the SECTIONS of the linker command file (.cmd) add the following to place the sections in flash, which resolves the warnings:

        .ARM.extab > FLASH
        .ARM.exidx > FLASH

    TM4C123_cpp_exceptions.zip

  • Thank you, that helped