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/TMS320F28379D: Array size

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software: Code Composer Studio

Hi community

I have a question about the maximum size of an array that can be defined in program. Does it have a maximum size? what is this maximum size for "float" data ? 

If I want to define an array of 10,000 float number, what should I do? 

best regards

  • You are practically limited by the amount of memory in the device.  For a large array such as this you would have to ensure you have allocated sufficient space in the  linker command file to hold it.  For example, if you declared the array

    float arr[10000];

    ...this will go into your .ebss section, which needs to be large enough to hold both the array and all the other variables in your program.  As an example, you could allocated .ebss into a named array of contiguous memory like this:

    In the MEMORY part of the .cmd file, declare the non-overlapping region

    RAMGS08    : origin = 0x00C000, length = 0x009000

    In the SECTIONS part of the file, map .ebss to this region like this:

    .ebss            : > RAMGS08,    PAGE = 1

    You will find more information on the linker command file in chapter 8 of the Assembly Language Tool Guide, here:

    www.ti.com/.../spru513r.pdf

    Regards,

    Richard

  • Hello and thanks for reply

    I have already changed the size of ".ebss" and ".econst".
    However, I have problem with ".cinit" section. this is from "page 0"
    So how can I allocate such a large memory to this? because I have to initialize my array in the code manually without using an iteration loop. In other words, I have to do like this:

    float floatArray[ 10000 ]= { 1 , 2 , 5 ,6, 3, 2, 8, .....};

    regards
  • Correct. The initialized data will go into the .cinit section so you'll have to increase the size for that too. The run-time support library copies the .cinit records into the .ebss section for you automatically when you start the device, so for large array initialisation like this both sections will have to be increased. You should not need to change .econst, but .cinit will have to be adjusted along the lines of how I described in my last post. Since .cinit goes into page 0 you can map it to internal flash memory (for example) so it's not so space constrained as RAM.

    Regards,

    Richard
  • Thanks again
    Is there any simple way (simple command) for mapping a section to internal flash memory ram?
    regards
  • You're welcome! There isn't a simple command for it. You have to make the adjustments in the linker command file. For example, your .cinit function might be mapped something like this:

    .cinit : > FLASHB PAGE = 0, ALIGN(4)

    There is an example .cmd file in C2000Ware which illustrates how to write a program for flash memory:
    C:\ti\c2000\C2000Ware_1_00_06_00\device_support\f2837xd\common\cmd\2837xD_FLASH_lnk_cpu1.cmd

    Also, although it doesn't specifically cover this device, there is a good application note which describes the steps and considerations when you run from flash, here:
    www.ti.com/.../spra958l.pdf

    Regards,

    Richard