Keil Logo

µVISION DEBUGGER: Loading the programs into the FLASH and RAM


Information in this knowledgebase article applies to:

  • MDK-Arm

QUESTION

I am using an evaluation board and trying to program the Flash and RAM of my device, one by one. This way, without a power cycle, the execution of program that is loaded into the RAM should start and after the power cycle is performed, the execution of program loaded into the FLASH should start.

Is there a way to configure a debug environment for this setup?

I understand that after the power cycle is done, the device will be reset. The previous program in RAM will be lost, because the internal RAM of the microcontroller is volatile. I am not able to run the previous RAM application in this scenario.

ANSWER

Many examples exists in the Pack Installer with FLASH and RAM as individual targets, designed for different memory areas. Our recommendation is to refer the CMSIS-RTOS Blinky examples from the Pack Installer. One broad example is the CMSIS-RTOS Blinky example for the MCBSTM32F400.

If a program is loaded into the flash, it will start in flash, but still use RAM, for read-write data. If you have also loaded a project into RAM, then this separate project must start in a region of RAM.

To start running a program in RAM, a special Debug_RAM.ini file is required. It will set the addresses of the Stack Pointer (SP), the Program Counter (PC), the Vector Table Offset Register (VTOR). This is the bare minimum for many Cortex-M devices. Example implementations for the initialization (*.ini) file are contained in Options for Target => Debug tab, in the Blinky examples.

In this case, after loading the code into the RAM the execution will also start from RAM. When a user cycles the power, the previously loaded program sitting in flash will be executed.

Please note that, the initialization file should be customized by a user, according to the memory layout of the device.

SEE ALSO

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Thursday, January 18, 2018


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.