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/MSP430F5529: memcpy function vs PRAGMA directive CODE_SECTION

Part Number: MSP430F5529

Tool/software: Code Composer Studio

Hi guys,

I have a little problem while using CSS 7.1.0 and my MSP430F5529,

I am trying to use the pragma directive CODE_SECTION. It works fine with my own function, but when I try use it with the memcpy function it do not work at all, do you have a solution or do you know why it does that. I've joined a picture to show my problem. If there is no way to do it I will code my own memcpy function wich is not very complicated, but I'm more interested in the "why" it does not work.  

Thank you very much

Guillaume

Picture explanation:

1. My modification in the linker file in the MEMORY part.

2. My modification in the linker file in theSECtION part.

3. My pragma directive call.

4. The location of the memcpy function

5. The location where I want to put my memcpy function.

  • A #pragma CODE_SECTION has an effect only when the same source file contains the implementation of the function.  This is not the case with memcpy.  It comes from the RTS library.  There is no simple way to change the input section name of a function from a library.  

    There is a straightforward solution.  In your linker command file, in the SECTIONS directive, put ...

        .text:memcpy > fctmemcpy

    The input section which contains the code for mempy is named .text:memcpy.  This line says to create an output section named .text:memcpy.  It is made up of all the input sections that are also named .text:memcpy.  In this case, there is only one such input section.  This output section is allocated to the memory range named fctmemcpy.

    Thanks and regards,

    -George