How to Change Code Storage Address in Keil and IAR

Follow+Star Public Account, don’t miss exciting content

How to Change Code Storage Address in Keil and IAR

Author | strongerHuang

WeChat Public Account | Embedded Column

Sometimes, we do not want the program to be stored at the starting position, for example, if we have a bootloader, the corresponding app’s (application) storage location will have an offset address.
So, how do we let the program be stored at a specified offset address?
Below, we will discuss how to set the starting address to 0x08010000 in the Keil and IAR development environments, using STM32 as an example.

Embedded Column

1

Keil Configuration Method

Open Project Target Options:

Project -> Options for Target -> Target.

Modify the target ROM starting address as shown below:

How to Change Code Storage Address in Keil and IAR

Note:
1. The checked IROM corresponds to the storage area;
2. The starting address (Start) and size (Size) should be configured according to your actual situation;

Embedded Column

1

IAR Configuration Method

Using a similar method, enter the Configuration Interface:

A. Enter the configuration interface: Project -> Options -> Linker -> Config;
B. Check “Override default”;
C. Click “Edit” to modify the ROM starting address;
D. Click “Save” to save (for the first modification, select the default file name and path for xxx.icf).
As shown below:

How to Change Code Storage Address in Keil and IAR

Embedded Column

3

Verify Code Storage Address

For STM32 chips, you can directly use the STM32 ST-LINK Utility tool to read FLASH data to verify whether the code is stored at the corresponding address. Other chips can also use corresponding tools that can read FLASH data for verification.

As shown below:

How to Change Code Storage Address in Keil and IAR
From the above figure, you can see that the code is stored starting from 0x08010000. Checking the previous storage area, you can find that the data is all 0xFFFF, meaning these sectors are not occupied by the code.
———— END ————

Reply with ‘STM32’, ‘Keil’, ‘IAR’ to read more related articles.

Welcome to follow my public account, reply ‘Join Group’ to join the technical exchange group as per the rules, reply ‘1024’ to see more content.
Welcome to follow my video account:

How to Change Code Storage Address in Keil and IAR

Click “Read Original” to see more shares, and feel free to share, bookmark, like, and view.

Leave a Comment