GD32F303 flash memory

GD32f303 FLASH

insert image description here

chip macro Total RAM capacity FLASH size Page startup file
GD32F303RCT6 GD32F30x_HD 48K (256K) Belongs to high-density products (256K~512K) startup_gd32f30x_hd.s
GD32F303RET6 GD32F30x_HD 64K (256K+256K) Belongs to high-density products (256K~512K) startup_gd32f30x_hd.s
GD32f303RGT6 GD32F30x_XD 96K (256K+768K) 0 ~ 127, 256 ~ 448 pages Belongs to ultra-high density products (greater than 512K) startup_gd32f30x_xd.s
GD32F305xx GD32F307xx GD32F30x_CL connected product startup_gd32f30x_cl.s
  • For GD32F30x_CL and GD32F30x_XD, two flash memories are used, the first 512KB capacity is in the first flash memory (bank0), and the subsequent capacity is in the second flash memory (bank1);
  • In the first 256K bytes of flash memory, the CPU executes instructions with zero waiting time, and outside this range, there is a long delay for the CPU to read instructions;
  • For GD32F30x_CL and GD32F30x_HD whose main storage flash memory capacity is not more than 512KB, only bank0 is used.
  • For GD32F30x_CL and - GD32F30x_HD, GD32F30x_XD, the flash page size of bank0 is 2KB, and the flash page size of bank1 is 4KB;

FLASH read and write operations

video link

Store the picture data and font library in the specified flash address

Use chip GD32f303RGT6

insert image description here
FLASH address distribution
insert image description here

For GD32, if there is a slow FLASH behind, put the static resources on blank1.

Use scatter loading

Method 1 (specify address when defining)

Define the LVGL image image_comp_map (image for storing symbols) array to 0X8040000

const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_IMAGE_COMP uint8_t image_comp_map[] __attribute__((at(0X8040000))) = {
    
    
}

Define the LVGL picture image_language_map (image for storing symbols) array to 0X8042000

const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_IMAGE_LANGUAGE uint8_t image_language_map[] __attribute__((at(0X8042000))) = {
    
    
}

Define the LVGL image image_laser_map (image for storing symbols) array to 0X8044000

const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_IMAGE_LASER uint8_t image_laser_map[] __attribute__((at(0X8044000))) = {
    
    
}

Define the LVGL image image_rotate_map (image for storing symbols) array to 0X8046000

const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_IMAGE_ROTATE uint8_t image_rotate_map[] __attribute__((at(0X8046000))) = {
    
    
}

Define the array of LVGL image image_touch_map (image for storing symbols) to 0X8048000

const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_IMAGE_TOUCH uint8_t image_touch_map[] __attribute__((at(0X8048000))) = {
    
    
}

Define the array of LVGL fonts (images storing symbols) to 0X804A000

static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] __attribute__((at(0X8040000))) = {
    
    
  /* U+20 " " */
    0x0,

    /* U+2b "+" */
    0x0, 0x1, 0xe5, 0x0, 0x0, 0x0, 0x1e, 0x50,
    0x0, 0x0, 0x1, 0xe5, 0x0, 0x7, 0xaa, 0xbf,
    0xca, 0xa7, 0x7a, 0xab, 0xfc, 0xaa, 0x70, 0x0,
    0x1e, 0x50, 0x0, 0x0, 0x1, 0xe5, 0x0, 0x0,
    0x0, 0x1e, 0x50, 0x0,

    /* U+2d "-" */
    0x7a, 0xaa, 0xaa, 0xaa, 0x77, 0xaa, 0xaa, 0xaa,
    0xa7,
};

View the map file, the font array (global variable area) and image array (static local variable) are stored in the specified address
insert image description here
insert image description here

Method 2 (using scatter-loading files)

insert image description here

LR_IROM1 0x08000000 0x00040000  {
    
        ; load region size_region
  ER_IROM1 0x08000000 0x00040000  {
    
      ; load address = execution address
   *.o (RESET, +First)
   *(InRoot$$Sections)
   .ANY (+RO)
   .ANY (+XO)
  }
  RW_IRAM1 0x20000000 0x00018000  {
    
      ; RW data
   .ANY (+RW +ZI)
  }
}

LR_IROM2 0x08040000 0x000c0000   {
    
                  ;load region size_region
  ER_IROM2 0x08040000 0x000c0000 {
    
                  ;load address = execution address
    lcd.O (LCD_Clear) 						
    ili9320.O(ili9320_Initializtion)        ; ili9320.O 表示函数所在的文件生成的.O 文件
    ili9320.O(ili9320_Clear)                ;ili9320_Clear 表示需要分散加载的目标,名字可以随,
  }                                           ;为了方便区分,我们都按照原本的函数名或者是数组名命名。
} 

Add a section declaration to the function, and add the following code outside the function definition.

void LCD_Clear(void) __attribute__((section ("LCD_Clear")));
void ili9320_Initializtion(void) __attribute__((section ("ili9320_Initializtion")));
void ili9320_Clear(void) __attribute__((section ("ili9320_Clear")));

Guess you like

Origin blog.csdn.net/m0_37187962/article/details/125788614