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.

MSP430F2350: Overlay sections with UNION statement in the linker script

Part Number: MSP430F2350

To reduce the ram usage I'm trying to use the UNION statement in the linker script to overlay the globals in remote_update.c with the globals used in the reset of the firmware. The following works, but I'm not happy with it. How can I tell the linker to overlay the globals from remote_update.c with ALL other globals, not just the ones from link.c?

	UNION:
	{
		.bss:p1:		: { link.obj(.bss) }
		.bss:p2:		: { remote_update.obj(.bss) }
	}		 > RAM
  	.bss        : {} > RAM                  /* Global & static vars              */

  • Please read the first part of the article Linker Command File Primer, especially to get an understanding of the term output section.  A UNION is a collection of output sections which all begin at the same address.  So I suggest you do something similar to ...

    UNION
    {
        .bss_remote          /* global & static vars for remote */
        { 
            remote_update.obj(.bss)
        }
    
        .bss                 /* all other global & static vars  */
    
    } > RAM

    Thanks and regards,

    -George

  • Thanks George,

    I had tried something similar but I was getting the syntax wrong. I did have to tweek your answer just a bit. Thanks again.


    UNION: { .bss_remote : { remote_update.obj(.bss) } /* global & static vars for remote */ .bss /* all other globals & static vars */ } > RAM

**Attention** This is a public forum