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.

Reduce the code size in CCS



Hi

         I'm working on C55xx with CCSv5.2 my code size too large so i cant allocate the buffer while running using malloc() function.

        How to know the code size and how to reduce the code size?

        .text     >> SARAM1|SARAM2|SARAM0|DARAM0  /* Code

This is my allocation for code and its occupy the full memory and i can allocate just 3KB using malloc() function.

        If convert the core parts of project into *.lib then i create the application in the sense its will reduce my code size or not?

      What is the use of using *lib files it will decrease the code size?

I need 40KB of buffer how to obtain it and how to reduce the code size ?

Thanks

Sangly

  • Hi,

    Here's how you can check you code size:

    You can find the static memory usage by inspecting the linker map file that is automatically generated inside the output directory (Debug or Release).

    From the project explorer, you can open the output directory and search for a file with extension .map. Among other info, it will show the device's memory regions and their usage.

    Regards,

    Gautam

  • Hi Gautam.

             I'm aware of this. But my question is how to reduce the code size, and converting as library will reduce the code size or not. 

            And also we can find the code size by ODF utility by CCS so that's not a issue for me. 

            Let me know how to reduce the code size? and in text. section there is stdio,maths,etc.. header files are there in my project i've used plenty of system header files how to reduce the size of it, is there any compiler option ?

    -opt_for_space, -ms =3 doesn't help in all levels i'm getting just 3.5KB free space.

    My main question is if i convert the core section as library and use the library of project is will reduce the code size or not?

  • Sangly,

    Are you using the --gen_func_subsections compiler option?

    By default, when the linker allocates code, it allocates all the functions in a single source file as a group. This means that if any function in a file is referenced and needs to be linked into the executable, then all the functions in the file are linked in. The --gen_func_subsections option places each function in a file in its own subsection. Thus, only the functions that are referenced in the application will be linked into the final executable. This can result in an overall code size reduction. Please see the C55x Compiler Users Guide for more information on this option.

    You could try using this compiler option and see if it helps reduce code size. Other techniques are the usual ones you are already aware of, like trying different optimization levels.

  • Check if the compiler allows "--symdebug:none". This is going to disable all debugging symbols and reduce the size drastically.

    ~Amit