How to execute instructions in RAM

Can I run programs in RAM? If the program can be executed in RAM, how can it be executed?

According to the specifications of microcomputers, there are microcomputers that can execute user programs even in built-in RAM. The way to load and run the user program in the built-in RAM depends on the microcomputer. In the manual of the microcomputer, check whether it is possible, and if possible, set it up according to the methods listed in the manual. In some cases, it can be set through an integrated development environment (IDE). In this case, please check the IDE manual.

For STM32 series microcomputers with ARM Cortex-M processors, you can choose to load instructions directly into the built-in RAM, or you can choose to transfer instructions from flash memory to RAM, and then execute the instructions.

If the command is executed in RAM, it will not enter the wait cycle. In addition, comparing the current consumption of the flash memory module and the RAM module, the consumption of RAM is less. Therefore, stopping the flash memory and working only with RAM will reduce power consumption. However, the capacity of RAM is smaller than that of flash memory, and the program size is limited (see Figure 1).
Figure 1 How to execute a program in the built-in RAM

Advantages and disadvantages of executing commands in RAM

advantage

  • Can be executed without waiting
  • RAM consumes less current than flash memory

Disadvantage

  • The memory capacity is small, limited to the executable program capacity
  • If the vector table is not moved to RAM, interrupt processing cannot be performed
  • Turn off the power and clear the RAM

Guess you like

Origin blog.csdn.net/qq_18191333/article/details/107558596
RAM