[SOLVED] Cannot get linker to generate required default symbol names

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Cannot get linker to generate required default symbol names

    Hello-
    We are working with :
    SEGGER Embedded Studio for ARM
    Release 7.12a Build 2023031402.52776
    Windows x64

    We are compiling 3rd-party code that uses the USB peripheral on the STM32L062. This code is expecting the linker to define a section for the USB's PMA memory area and auto-generate symbol __pma_end__, however, despite our attempts to edit the link process we constantly get errors that this symbol is not defined. After reading the Segger Wiki page covering the memory map XML format :
    wiki.segger.com/Add_new_Memory_Sections_and_Segments

    The memory map XML file now looks like this:

    XML Source Code

    1. <!DOCTYPE Board_Memory_Definition_File>
    2. <root name="STM32L062K8Ux">
    3. <MemorySegment name="FLASH1" start="0x08000000" size="0x00010000" access="ReadOnly" />
    4. <MemorySegment name="RAM1" start="0x20000000" size="0x00002000" access="Read/Write" />
    5. <MemorySegment name="PMA" start="0x40006000" size="0x00000200" access="Write" />
    6. </root>

    And a separate XML file for section placement looks like this:

    XML Source Code

    1. <!DOCTYPE Linker_Placement_File>
    2. <root name="Flash Section Placement">
    3. <MemorySegment name="PMA" />
    4. <ProgramSection alignment="2" load="No" name=".pma" />
    5. </root>
    Originally we tried combining these two sections into one file, but that did not work. The wiki says "The Section Placement File to use is set in the Project Options -> Code -> Linker -> Section Placement File", however, when we check these options, there is only a place to specify the Memory Map File, not one for Section Placement. At this stage we don't know what else to try to correctly define the PMA memory section needed and get the __pma_end__ symbol generated. As an additional point of reference, the original source code used the old-style LD files and did this to create the PMA section :


    Source Code

    1. MEMORY
    2. {
    3. FLASH (RX) : ORIGIN = 0x08000000, LENGTH = 8K
    4. EEPROM (W) : ORIGIN = 0x08080000, LENGTH = 256
    5. RAM (W!RX) : ORIGIN = 0x20000000, LENGTH = 8K
    6. PMA (W) : ORIGIN = 0x40006000, LENGTH = 512 /* 256 x 16bit */
    7. }
    8. /*
    9. ...lots of other stuff from the LD file not included
    10. */
    11. /* USB/CAN Packet Memory Area (PMA) */
    12. .pma :
    13. {
    14. _pma_start = .; /* Start of PMA in real memory space */
    15. . = ALIGN(2);
    16. *(.pma)
    17. *(.pma*)
    18. . = ALIGN(2);
    19. _pma_end = .; /* End of PMA in PMA space */
    20. } > PMA
    Display All
    Changing the project options to use the older LD file style of linking did not help as the __pma_end__ symbol was still not generated.
  • Hello,

    Thank you for your inquiry.
    Are you using the GNU Linker or SEGGER Linker?

    The SEGGER Linker uses different files and formats.
    segger.com/doc/UM20005_Linker.html

    Best regards,
    Nino
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.