This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

where is the syntax for .sct (scatter file content) defined?  Did ARM originate this file type?

Automatically generated when I create a new project with Keil:

my.sct

LR_IROM1 0x00400000 0x00020000  {    ; load region size_region

  ER_IROM1 0x00400000 0x00020000  {  ; load address = execution address

   *.o (RESET, +First)

   *(InRoot$$Sections)

   .ANY (+RO)

  }

  RW_IRAM1 0x00300000 0x00014000  {  ; RW data

   .ANY (+RW +ZI)

  }

}

but how do I add a memory mapped device at 0xB200_0000 ?

is there a tutorial that covers how to use the .sct file?

  • See

    Linker User Guide: Scatter File Syntax

    I don't know who originated this particular format.. Linker command scripts in general date back at least 50 years to deal with overlays on early computers.

  • my.sct

    but how do I add a memory mapped device at 0xB200_0000 ?

    Scatter files describe where you want the linker to place things.  Where things are mostly objects, and the ELF sections inside those objects.  You can also use the scatter file to reserve space for things like stacks.

    When it comes you peripherals, you don't necessarily need to describe peripherals in the scatter file at all.  However, one approach is to create a struct that represents the peripheral's registers and then use the scatter file to have that struct placed at the address of the peripheral.  For example:

    // Define a structure that represents the registers of my peripheral (in this case a SP804 timer)
    struct sp804_timer
    {
      volatile unsigned int Time1Load;     // +0x00
      ...
    };
    
    // Declare an instance of the struct, which will be placed in the scatter file
    // The __attribute__ is used to put the struct in it's own EL section, making
    // placement easier
    __attribute__((section(sp804_0"), zero_init)) struct sp804_timer timer0;
    

    Then in the scatter file:

    MY_LOAD_REGION 0x0
    {
      ...
       
      SP804_TIMER_0 0x2C001000 UNINIT
      {
        sp804_timer.o (sp845_0)
      }
    }
    

    This places the instance of the struct "timer0" at address 0x2C001000 (which we're assuming is the address of the timer).  We instantiate and place more timers if we wanted.

    There are other ways of dealing with peripherals.  But this one can be useful, as it keeps the address information in one place (the scatter file).

    Note: The link Daith posted was for the Keil docs.  If you are using DS-5/ARM Compiler 6, it's documentation is here:

    ARM Compiler armlink User Guide : Chapter 8 Scatter File Syntax

    That said, they both use armlink and therefore the same scatter file syntax.

    EDIT: 805 --> 804 in a couple of places.  Obviously not had enough tea yet this morning.