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.

memory allocation and IQmath library

Other Parts Discussed in Thread: CONTROLSUITE

Dear All,

I have a question/problem with my MCU (F28377D). I been writing a program which includes reading an encoder speed sensor. I did the setup following the example included in ControlSuite for my device. I included all the paths and libraries (IQmath, 2837x_RAM_IQMATH_lnk_cpu1) in the C2000 Linker fields and it worked fine at the beginning.

Later on, I added a lot of extra code to my program and I got a memory oversize error (http://processors.wiki.ti.com/index.php/Compiler/diagnostic_messages/10099) Then I decided to write my code in the FLASH memory (I switched to 2837x_FLASH_IQMATH_lnk_cpu1) rather than in the RAM but I got the same oversize error. However, if I eliminate the encoder reading code and change the C2000 Linker files to 2837x_FLASH_lnk_cpu1 it works well (no oversize) and looking at the memory allocation option there is plenty of free space.

I am not an expert in MCUs so I am slightly lost about what is going on. My only feeling is that  2837x_FLASH_IQMATH_lnk_cpu1 allocates memory (IQmath libraries, etc) in a particular way and there is no enough room for my the rest of my code. So I was wondering if it is possible to combine the FLASH and RAM configurations, let's say use the FLASH memory for my code, and maybe store all the encoder libraries in the RAM memory. I would say if it is possible to include the files 2837x_FLASH_lnk_cpu1 and 2837x_RAM_IQMATH_lnk_cpu1 at the same time in the C2000 Linker or do something similar... or somebody can suggest me another possible solution because I have to deep experience with MCUs.

Thanks in advance for your replies.

Danilo 

  • Hi Danilo,

    Danilo Llano said:
    So I was wondering if it is possible to combine the FLASH and RAM configurations, let's say use the FLASH memory for my code, and maybe store all the encoder libraries in the RAM memory. I would say if it is possible to include the files 2837x_FLASH_lnk_cpu1 and 2837x_RAM_IQMATH_lnk_cpu1 at the same time in the C2000 Linker or do something similar... or somebody can suggest me another possible solution because I have to deep experience with MCUs.

    You can copy Flash sections to RAM for quicker computations but I'm unsure how much space you would save by doing this. Here's the document you can refer:

    5282.Flash to RAM.pdf

    Also, yours is a C2000 device and hence I would recommend you to post it on: C2000 Forum

    Regards,

    Gautam

  • Danilo Llano said:

    Later on, I added a lot of extra code to my program and I got a memory oversize error (http://processors.wiki.ti.com/index.php/Compiler/diagnostic_messages/10099) Then I decided to write my code in the FLASH memory (I switched to 2837x_FLASH_IQMATH_lnk_cpu1) rather than in the RAM but I got the same oversize error. However, if I eliminate the encoder reading code and change the C2000 Linker files to 2837x_FLASH_lnk_cpu1 it works well (no oversize) and looking at the memory allocation option there is plenty of free space.

    The memory oversize errors will occur whenever a compiler generated section (whether it be code or data) is larger than the size of the memory region to which it is allocated. For instance, if your linker command file has this specification:

       .text               : > FLASHB      PAGE = 0

    it is telling it to allocate the .text section (code) to FLASHB. If FLASHB has a length of 0x2000 and your code section is larger than that, then it will not fit.

    If you look closely at the 2837x_FLASH_IQMATH_lnk_cpu1.cmd and 2837x_FLASH_lnk_cpu1.cmd you will find that the section allocations are different. If you are using the default .cmds from ControlSuite, then you will see that 2837x_FLASH_lnk_cpu1.cmd has the following:

       .text               : >> FLASHB | FLASHC | FLASHD | FLASHE      PAGE = 0

    The >> operator indicates that the secton can be split among the multiple memory regions listed ( in this case FLASHB/C/D/E) hence giving it a much larger memory range to fit in.

    Once you have an understanding of the linker command file syntax and how the sections are being allocated in each of the default files, you should be able to choose the best one for your needs or modify it as needed. Note that you can combine contiguous regions of memory to define one larger chunk of memory if needed, to allow for a section to fit in, for example.

    All of this information and more is explained in the C2000 Assembly Language Tools Users Guide. See the section on Linker Command Files. This wiki page also has some great introductory material to understand linking: http://processors.wiki.ti.com/index.php/C28x_Compiler_-_Understanding_Linking

    Hope all of this information is helpful to you in moving forward.

  • Dear AartiG. Thank you so much for your reply. I totally solved my problem. As I said before I am fresher in MCUs but thanks for your references and explanations.

     

    Best regards,

    Danilo