<meter id="pryje"><nav id="pryje"><delect id="pryje"></delect></nav></meter>
          <label id="pryje"></label>

          新聞中心

          EEPW首頁 > 嵌入式系統(tǒng) > 設計應用 > 基于STM32F10x的uC/GUI初始化設置

          基于STM32F10x的uC/GUI初始化設置

          作者: 時間:2016-12-02 來源:網(wǎng)絡 收藏
          STM32F10x Device,ICF使用外部SRAM,Heap放入SRAM中。

          /*-Memory Regions-*/

          本文引用地址:http://www.ex-cimer.com/article/201612/325058.htm

          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 CSTACKwith alignment = 8, size = __ICFEDIT_size_cstack__{ };

          define block HEAPwith 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生產(chǎn)Library,然后在工程中引用。

          在linker中使用自定義icf,以及/GUI的<.a>格式lib。
          IAR->Option->Linker->Library->Additional libraries:$PROJ_DIR$DebugExe GUI_Lib.a

          /GUI編譯生成library。

          基本的設置就不說了,比方說LCDConf.h,GUITo hConf.h,GUIConf.h。需要注意的是,當使用GUI_SUPPORT_MEMDEV時,使用的內(nèi)存量增加,故需要適度的將#define GUI_ALLOC_SIZE 64*1024擴大到夠用為止,以防止stack溢出。

          #define HEAPBASE((unsignedchar*)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;

          在函數(shù)初始化時修改如下:

          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申請到的內(nèi)存初始化一下,如果工程函數(shù)中沒有初始化外部RAM的數(shù)據(jù),GUI分配不到內(nèi)存,LCD無法顯示。



          評論


          技術專區(qū)

          關閉
          看屁屁www成人影院,亚洲人妻成人图片,亚洲精品成人午夜在线,日韩在线 欧美成人 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();