MDK stores data to FLASH specified address

Learning STM32 will also encounter such absolute positioning problems as follows:

Uint8_t UART_RX_BUF[1024] __attribute__ ((at(0X20001000))); // is to locate the data received from the serial port to the start address in RAM as 0x20001000;

Absolute positioning either locates flash or locates RAM. Here we will locate it in flash.

MDK how to achieve the data stored in the FLASH specified address?

When we burn data, we generally start from 0x08000000 in order to burn into the flash inside, how to make the data can be defined to an absolute address such as 0800F000, we must ensure that the file data is also stored in the address, in order to achieve this goal, MDK populates the 0x00 field when generating the file to ensure that data can be defined

MDK stores data to FLASH specified address

From the actual situation can also verify this principle, I use my test code as an example:

Const u16 gFlashDefValue4[512] __attribute__((at(0x0800F000))) = {0x1111, 0x1111, 0x1111, 0x0111, 0x0111, 0x0111};

MDK stores data to FLASH specified address

You can see Code+ReadOnly= 15236+47228 = 62464

The gFlashDefValue4 accounted for the absolute address F000+512*2 = 62464

This view can also be confirmed from the generated BIN file:

MDK stores data to FLASH specified address

MDK stores data to FLASH specified address

If you look at the generated file yourself, you can also find that the middle is filled with a large number of 0x00. However, it should be noted that the length of ZI-Data should be considered when FLASH defines an absolute address, otherwise it may cause FLASH overflow.

CBD Products

Cbd Vape Products Oem,D8 Vape Pen Oem,Cbd Disposable Vape Pen Oem,China Cbd Vape Products Oem

Shenzhen MASON VAP Technology Co., Ltd. , https://www.e-cigarettefactory.com