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.

TMS320F280025: failed to allocate section to specified memory by using __attribute__

Part Number: TMS320F280025

Hi Team,

Here's an issue from the customer may need your help:

(also tried this way:  )

But .user is failed to allocate to USER by checking map file:

--

Thanks & Regards

  • Hello,

    I have brought this thread to the attention of the compiler experts. Please note that many people are away for the holidays so responses may be delayed.

    Thanks

    ki

  • Note that, on C2000 devices, addresses are counted in terms of 16-bit words, and not 8-bit bytes.  Thus the length of the memory range USER1 is 4 16-bit words.  

    Please read the first part of the article Linker Command File Primer.  I think that should give you the background you need to create and allocate an output section as required.  If not, please put the linker command file and the linker map file into a zip, and attach that zip to your next post.

    Thanks and regards,

    -George

  • Hi George,

    I need to store the bootloader version and other related information in a fixed address in 0x00080002-0x00082000 (bootloader), so that I can read this information on the upper computer.

    /cfs-file/__key/communityserver-discussions-components-files/171/cmd_2B00_map.zip

    Thanks and Regards,

    Enya

  • I can describe the problem.  I cannot tell you the best way to fix it.

    The memory range USER1 is defined ...

       USER1             : origin = 0x00081FF2, length = 0x00000004

    The output section .user1 is defined and allocated ...

       .user1           : > USER1,  ALIGN(8)

    Notice the ALIGN(8).  That means the output section .user1 must begin on an address that is a multiple of 8.  No address in the memory range USER1 is a multiple of 8.  I assume you get an error when you try to link.  Is that correct?

    A possible solution is to remove the ALIGN(8).  But then .user1 does not begin on an address that is a multiple of 8, which may cause other problems.

    Thanks and regards,

    -George

  • I assume you get an error when you try to link.  Is that correct?

    Add ALIGN(8) and there is no error.

    A possible solution is to remove the ALIGN(8).

    There was no error when ALIGN(8) was removed, as there was no ALIGN(8) originally.

    That means the output section .user1 must begin on an address that is a multiple of 8.

    I changed the start address of user1 to 0x00081FF0, and the result was the same.

       FLASH_BANK0_SEC0  : origin = 0x080002, length = 0x001FEE	/* on-chip Flash0x000FFE */
       USER1             : origin = 0x00081FF0, length = 0x0000000F

    Thanks and Regards,

    Enya

  • The problem must be that the section .user1 is ignored by the linker.  To prevent that, add the retain attribute.  Since you already use the section attribute, you can write it ...

    __attribute__((section(".user1"), retain))

    For additional background, please see the conditional linking part of the larger article C2000 Migration from COFF to EABI.

    I apologize for not recognizing the problem sooner.

    Thanks and regards,

    -George

  • The issue was resolved with the addition of the retain attribute.

    Thank you for your support,wish you a nice day!

    Thanks and Regards,

    Enya