基于STM32F10x的uC/GUI初始化设置
2016-10-08 来源:eefocus
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x08000200;
define symbol __ICFEDIT_region_ROM_end__ = 0x0807FFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x2000FFFF;
define symbol __ICFEDIT_region_EXT_SRAM_start__ = 0x64000000;
define symbol __ICFEDIT_region_EXT_SRAM_end__ = 0x6407FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ =0x200;
define symbol __ICFEDIT_size_heap__ = 0x80000;
/**** End of ICF editor section. ###ICF###*/
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
define region EXT_SRAM_region = mem:[from __ICFEDIT_region_EXT_SRAM_start__ to __ICFEDIT_region_EXT_SRAM_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
initialize by copy { readwrite };
do not initialize { section .noinit };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };
place in RAM_region { readwrite, block CSTACK };
place in EXT_SRAM_region { block HEAP };
编译 /GUI生产Library,然后在工程中引用。
在linker中使用自定义icf,以及 /GUI的<.a>格式lib。
IAR->Option->Linker->Library->Additional libraries:$PROJ_DIR$\Debug\Exe\ GUI_Lib.a
/GUI编译生成library。
基本的设置就不说了,比方说LCDConf.h,GUITo hConf.h,GUIConf.h。需要注意的是,当使用GUI_SUPPORT_MEMDEV时,使用的内存量增加,故需要适度的将#define GUI_ALLOC_SIZE 64*1024扩大到够用为止,以防止stack溢出。
#define HEAPBASE ((unsigned char*)0x64000000)外部SRAM在FSMC的blankX,量体裁衣。
由于使用外部SRAM作为heap,GUI_ALLOC的时候,修改
将原文件中的:
GUI_MEM_ALLOC GUI_HEAP GUI_Heap;
GUI_MEM_ALLOC tBlock aBlock[GUI_MAXBLOCKS];
修改为:
GUI_MEM_ALLOC GUI_HEAP *GUI_Heap;
GUI_MEM_ALLOC tBlock *aBlock;
在函数初始化时修改如下:
void GUI_ALLOC_Init(void) {
GUI_Heap = malloc(GUI_ALLOC_SIZE);
aBlock = malloc(GUI_MAXBLOCKS * sizeof(tBlock));
memset(HEAPBASE,0,GUI_ALLOC_SIZE+GUI_MAXBLOCKS * sizeof(tBlock));
将malloc申请到的内存初始化一下,如果工程函数中没有初始化外部RAM的数据,GUI分配不到内存,LCD无法显示。
下一篇:2440test中按键的分析