Problem adding section to linker script

Sysprogs forums Forums VisualGDB Problem adding section to linker script

Tagged: 

Viewing 16 post (of 16 total)
  • Author
    Posts
  • #10300
    engicoder
    Participant

    I figured out the problem with having a separate memory command. The section command has to be marked with the (NOLOAD) section type as there is no data to load. GDB was telling me that with the error:

    
    One or more sections of the target image does not match the loaded file
    

    I just had to figure out what it meant. objdump clued me in when the .settings section was marked “CONTENTS, ALLOC, LOAD, DATA“, which indicated that the GDB would try to allocate the section and load its contents. With the (NOLOAD) section type the .settings section is only marked “ALLOC“.

    The corresponding linker script entries:
    For the MEMORY command:

    
    MEMORY
    {
        FLASH (RX)     : ORIGIN = 0x08000000, LENGTH = 64K - 1K
        SETTINGS(R)    : ORIGIN = 0x0800FC00, LENGTH = 1K
        SRAM (RWX)     : ORIGIN = 0x20000000, LENGTH = 8K
    }
    

    and for the SECTION command:

    
        .settings (NOLOAD) :
        {
            *(.settings)
        } > SETTINGS 
    
Viewing 16 post (of 16 total)
  • You must be logged in to reply to this topic.