0

Is there a way of allowing the ARM RealView/Keil linker to select from more than one but not all regions?

I can use the .ANY specifier to allow the linker free reign, and I can use a *(section_name) specifier to locate specific objects to a single region, but I would like to be able to have the linker select from several suitable regions.

To make it clear why this is desirable, I am using an STM32F4xx microcontroller with three distinct but contiguous SRAM regions on separate busses, and a further core-coupled memory region which is not bit-bandable or accessible by DMA. I want to use the smaller SRAM region for DMA to avoid bus contention and improve performance and deterministic behaviour. This region is inconveniently located between two larger regions and I want to be able to use either of the larger regions for bit banding while allowing the CCM memory be used freely for any purpose other than DMA or bit-banding. The regions are currently specified as follows:

  RW_IRAM0 CCM_START CCM_SIZE  
  {
   .ANY (+RW +ZI)
   *(core_coupled_ram)
  }

  ; SRAM1 112Kbytes (Buses: I, D, S, DMA)
  RW_IRAM1 SRAM1_START SRAM1_SIZE  
  {
   .ANY (+RW +ZI)
  }

  ; SRAM2 16Kbytes (Buses: S, DMA)
  RW_IRAM2  SRAM2_START SRAM2_SIZE  
  {
   *(dma_ram)
  }

  ; SRAM3 64Kbytes (Buses: S, DMA)
  RW_IRAM3 SRAM3_START SRAM3_SIZE  
  {
   .ANY (+RW +ZI)
  }

Adding *(bitbandable_ram) to SRAM1 and SRAM3 is rejected by the linker with:

Error: L6223E: Ambiguous selectors found for ctransmissionschedulertask.o(bitbandable_ram) from Exec regions RW_IRAM1 and RW_IRAM3.

Similarly creating an overlapping region does not work:

 ; SRAM 192Kbytes 

  RW_IRAM_ALL SRAM_START (SRAM1_SIZE + SRAM2_SIZE + SRAM3_SIZE)
  {
   .ANY (+RW +ZI)
    *(bitbandable_ram)  
  }

reporting:

Error: L6221E: Execution region RW_IRAM1 with Execution range [0x20000000,0x200045e0) overlaps with Execution region RW_IRAM_ALL with Execution range [0x20000000,0x20018608).

Currently my less-than-ideal solutions are:

  1. to nominate only one region for bit-banding,
  2. to make all the contiguous SRAM a single region (allowing DMA operations may occur in any memory making it less deterministic) thus:

     ; SRAM 192Kbytes 
    
      RW_IRAM_ALL SRAM_START (SRAM1_SIZE + SRAM2_SIZE + SRAM3_SIZE)
      {
       .ANY (+RW +ZI)
        *(bitbandable_ram)  
        *(dma_ram)  
      }
    
  3. Removing the .ANY selector from the CCM region requiring object to be explicitly located there using the core_coupled_ram named section.
4

0 回答 0