How can I place a section at a minimum address?

The following steps will locate the section .section into the memory area RAM at a minimum address of 0xd0005000.

  1. Define a new memory region in the linker script.

    Example MEMORY

    MEMORY
    {
    	RAM (w) : org = 0xd0000000, len = 0x10000
    }
  2. Define an output section (e.g., .somesec) and assign it to the memory region defined in step 1.

  3. Locate the section at a minimum address. The usage of the ternary condition operator (?:) is possible here. It checks whether the address of the section is lower than the minimum address (0xd0005000).

    Example SECTIONS

    SECTIONS
    {
    	.somesec :
    	{
    		/* output section commands */
    	} > RAM
    
    	.section(. < 0xd0005000) ? 0xd0005000 : . :
    	{
    		/* output section commands */
    	} > RAM
    }