Keil Logo

ARMLINK: Error L6424E Using CMSIS RTOS and Multiple Code Regions


Information in this knowledgebase article applies to:

  • MDK-ARM
  • CMSIS RTOS
  • MicroLib

SYMPTOM

In our CMSIS RTOS-based projects which use MicroLib, we want to use the internal flash to save settings in a dedicated flash area during runtime. So we have to move the location of the code section. But as the interrupt vectors must still reside at the original location, we are forced to split the code section into two pieces.

For that we have created the required memory ranges in the Options for Target ... - Target dialog or created a scatter file like this:

LR_IROM1 0x08000000 0x00004000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00004000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
  }
}

LR_IROM2 0x08008000  0x00078000  {    ; load region size_region
  ER_IROM2 0x08008000 0x00078000  {  ; load address = execution address
   .ANY (+RO)
  }
  RW_IRAM2 0x20000000 0x00010000  {  ; RW data
   .ANY (+RW +ZI)
  }
}

But when we link the project, the linker fails and reports errors like this:

Out.axf: Error: L6424E: Within the same collection, section
.ARM.Collect$$$$000000FF and section .ARM.Collect$$$$00000000
cannot be separated into different execution regions.

CAUSE

The CMSIS RTOS starts the main() function as a thread. To achieve this, in case of MicroLib, the RTOS code hooks into the library startup process by using the linker's section collection feature.

This feature makes sure that the linker includes the required subset of library startup functions in the correct order when generating the program image. But unfortunately, it does not treat section collections as atomic. So it can happen that parts of one section collection end up in different execution regions. That then leads to the observed error.

RESOLUTION

In this case, the scatter file needs to be modified. This also means it is no longer possible to use a auto-generated scatter file by µVision. So if not already done, disable Options for Target ... - Linker - Use Memory Layout from Target Dialog. Edit the scatter file like this:

LR_IROM1 0x08000000 0x00004000  {    ; load region size_region
  ER_IROM1 0x08000000 0x00004000  {  ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   *(.ARM.Collect$$$$000000FF)  <--- added line
   .ANY (+RO)
  }
}

LR_IROM2 0x08008000  0x00078000  {    ; load region size_region
  ER_IROM2 0x08008000 0x00078000  {  ; load address = execution address
   .ANY (+RO)
  }
  RW_IRAM2 0x20000000 0x00010000  {  ; RW data
   .ANY (+RW +ZI)
  }
}

This will ensure that the parts of the section collection from the library startup and the CMSIS RTOS hook will end up in the same execution region and so the project can build without this problem.

MORE INFORMATION

Last Reviewed: Tuesday, April 4, 2017


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.