Code execution from RAM in RA8M1

I want to execute functions from RAM instead of FLASH. I am using RA8M1. How can change code execution from FLASH to RAM?

  • Are you asking how to build a software project that executes from RAM?  From a high level, the RAM must be initialized from nonvolatile memory, which is accomplished by copying the code from code-flash at some point in the initialization.  This can be done manually, or better yet automatically using by placing the code into a user defined section that allows the C runtime startup to handle the init.  This has the advantage of allowing symbolic debug of the RAM code, since the symbols will be referencing the RAM addresses.

    A word of caution on this topic - the on-chip flash of the RA devices is quite fast, and the devices are designed for optimal use by execution from the code-flash.  You cannot beat TCM for zero-wait access, but if you considering execution from other RAM you are likely better off to leave it in flash.  Unlike other ARM MCUs that have much slower flash technology, where there is advantage to executing from RAM over flash, RA devices don't need this approach.

  • Hi,

    Thanks for the response. I am trying to place the .text section in the ITCM and .data section in the DTCM. But I am not able to understand how to change the .lld script for this. Is there a quick way to address this issue?

  • Hello,

    You can change the linker script to place the whole .text section in ITCM and .data section in DTCM but it is a bit risky because ITCM and DTCM are only 64KB and an overflow is very likely to occur. This TCM areas are to be used with critical code/data for  fast access.

    You can also refer to section 2.5.3, 2.5.4 on this app note:

    https://www.renesas.com/en/document/apn/getting-started-ra8-memory-architecture-configurations-and-topologies?r=25447396

    It is recommended to place only the code/data you need in ITCM/DTCM one by one and not placing entire sections there.