AN4296 · Application noteUse STM32F3/STM32G4 CCM SRAM with IAR Embedded Workbench®, Keil® MDK-ARM, STMicroelectronics STM32CubeIDE, and other GNU-based toolchains
Download .pdfOpen in the full document

Execute a library from CCM SRAM

Execute a library from CCM SRAM

Follow the steps below to execute a library from CCM SRAM:

  1. Add the .ccmram section in the linker file as defined in Execute a function or an interrupt handler from CCM SRAM.
  2. Place the library in CCM SRAM as shown below. The startup file also needs to be updated to copy code from the flash memory to CCM SRAM as described in Execute a function or an interrupt handler from CCM SRAM.

    This example shows how to execute library myLib.a from CCM SRAM:

    /*--- New CCMRAM linker section definition ---*/
    _siccmram = LOADADDR(.ccmram);
    /* CCMRAM section */
    .ccmram :
    {
      . = ALIGN(4);
      _sccmram = .;     /* define a global symbols at ccmram start */
      *(.ccmram)     
      *(.ccmram*)
      *myTestCCM.o(.text .text*)
      *myLib.a:*(.text .text*)
      . = ALIGN(4);
      _eccmram = .;     /* define a global symbols at ccmram end */
    } >CCMRAM AT> FLASH
    /*--- End of CCMRAM linker section definition ---*/

Revision history

Table 3. Document revision history
DateRevisionChanges
23-Jul-20131Initial release.
25-Mar-20142Changed STM32F313xC into STM32F358xC.

Reworked Section 1: Overview of STM32F303xB/C and STM32F358xC CCM RAM.

02-Sep-20143Added STM32F303x6/x8, STM32F328x8, STM32F334x4/x6/x8 in Table 1: Applicable products.

Updated step 2 in Section 2.1: Executing a simple code from CCM RAM (except for interrupt handler), step 3 in Section 2.2.1: Updating the linker file (.icf) and updated Figure 5: EWARM linker update for interrupt handler.

Updated Figure 11: MDK-ARM scatter file.

16-Apr-20194Updated:
  • Title of the document
  • Introduction
  • CCM RAM replaced by CCM SRAM in the whole document
  • Figure 1. STM32F3 devices system architecture
Added:
  • Figure 2. STM32G4 devices system architecture
  • Table 2. CCM SRAM main features
  • Section 1.2.5 CCM SRAM read protection (only on STM32G4 devices)
  • Section 1.2.6 CCM SRAM erase (only on STM32G4 devices)

Removed Table 2. CCM RAM organization.

08-Feb-20215Updated:
  • Title of the document
  • Section 4 description and code examples to authorize code execution in CCM SRAM when using a GNU-based toolchain such as STM32CubeIDE
16-Apr-20256Updated:

Removed STM32F328K8, STM32F328R8, STM32F398RE, and STM32F398ZE from Table 1.