Difference between revisions of "How to place a function in RAM"
Line 1: | Line 1: | ||
__TOC__ |
__TOC__ |
||
+ | |||
− | In some instances it is beneficial to run certain code parts in RAM instead of ROM. For this e.g. a function from ROM needs to be copied at some point into RAM for later usage. |
||
+ | For some situations it may be beneficial or even necessary to place a function in RAM instead of flash. This for example is needed in case a bootloader (that runs from flash) shall update a firmware (running from the same flash but different sectors). As the flash is not accessible for read accesses while it is programmed, the flash programming routines itself need to run from RAM. |
||
− | The following article will explain how this can be accomplished using Embedded Studio. |
||
In order to put a function into RAM, it needs to be placed into the '''.fast''' section. This is done as follows: |
In order to put a function into RAM, it needs to be placed into the '''.fast''' section. This is done as follows: |
Revision as of 11:49, 21 August 2018
For some situations it may be beneficial or even necessary to place a function in RAM instead of flash. This for example is needed in case a bootloader (that runs from flash) shall update a firmware (running from the same flash but different sectors). As the flash is not accessible for read accesses while it is programmed, the flash programming routines itself need to run from RAM.
In order to put a function into RAM, it needs to be placed into the .fast section. This is done as follows:
__attribute__ ((section(".fast"))) // Place the following function in RAM void _Delay(void) { [...] }