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.

Custom memory segments with SYS/BIOS

I have a SYS/BIOS, CCS v4.2 project and want to place some variables in shared memory (SL2RAM, which starts at address 0x00200000). However, to ensure proper memory alignment, for efficiency reasons, I want to make sure that arrays start at locations that are multiples of 128, and single variables can be placed anywhere (preferably after the arrays).

I thought I could achieve that by defining memory ranges in the MEMORY part of the linker command file, like this

 

MEMORY
{

    Custom_SL2: o = 0x00200080 l = 0x00000080    /*will start at multiple of 128*/

}

SECTIONS

{

"Aligned_Loc" > Custom_SL2

}

and in the code,

#pragma DATA_SECTION(myVar, "Aligned_Loc")

However, I get an error saying

Custom_SL2 memory range overlaps existing memory range SL2RAM

I understand that it overlaps, but isn't that the point of defining custom memory segments? In a non-BIOS project, you are apparently free to lay out memory however you like. Do you a way around this restriction with SYS/BIOS?

                                Thanks,
                                Andrey

  • Andrey,

    Check out the #pragma DATA_ALIGN in the C Compiler User's Guide. This will do what you want without having to make changes outside the C code.

    RandyP

     

    If this answers your question, please click the  Verify Answer  button below. If not, please reply back with more information.

  • Yes, I've been using that, thank you. Just to clarify, you cannot enter define specific memory locations in the linker command file with SYS/BIOS?

     

     

  • You can do lots of complicated things with your memory segment definitions within the SYS/BIOS configuration and outside of the SYS/BIOS configuration. The CCS-based build infrastructure is very flexible, but you have to understand a lot more detail than the average programmer wants to understand. This is documented in the combination of the SYS/BIOS User's Guide and API Reference Guide and Optimizing Compiler User's Guide and Assembly Language Tools User's Guide.

    Since you marked a post as a Verified Answer, I assume you are okay with the solution you have now and you do not need to go through all that documentation to figure it out.

    Regards,
    RandyP