2016-08-09 06:04 AM
Hi,
I want to use stemwin gui library with my stm32f429 board without any external ram for driving 320*240 tft LCD, so i will use mcu internal ram. when i use ''GUI_DispString(''Hello world!'')'' function , i can not see anything on the screen. For discovery board there is a external sdram and in ''LCDConf.c'' file the frame buffer is defined as :
#define LCD_LAYER0_FRAME_BUFFER ((uint32_t)0xD0200000)
So, if this is the problem for my board ( i am not sure), what must this value be ? Any advise ? ( when i use the value '' 0x20000000 for buffer adress that is the mcu internal ram adress, the code crashes.)2016-08-09 07:55 AM
When i use the value '' 0x20000000 for buffer address that is the mcu internal ram address, the code crashes.
Ok, it is important to tell the linker to NOT use that same space for stacks and variables.This is accomplished by carving out a hole in what you describe in the Linker Script, Scatter File, or Target Dialog, depending on the tool chain.If you tell the linker it can use 0x20000000..0x20003FFF, you can then place the buffer at 0x20004000, for example.You'll still need to consider if you have enough RAM to serve as a buffer, or not.2016-08-09 09:33 AM
Hi @clive1
I am using IAR embedded workbench and according to linker->Memory Regions settings, The RAM start adress is 0x20000000 and end adress is 0x2002FFFF, so when i use the buffer adress as 0x20004000 is does not work again. The stm32f429xx_flash.icf file has the following values and which values must i change or edit? If i have misunderstood, please correct me with the rigth way./*###ICF### Section handled by ICF editor, don't touch! ****//*-Editor annotation file-*//* IcfEditorFile=''$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml'' *//*-Specials-*/define symbol __ICFEDIT_intvec_start__ = 0x08000000;/*-Memory Regions-*/define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;define symbol __ICFEDIT_region_ROM_end__ = 0x081FFFFF;define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;define symbol __ICFEDIT_region_RAM_end__ = 0x2002FFFF;define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000;define symbol __ICFEDIT_region_CCMRAM_end__ = 0x1000FFFF;/*-Sizes-*/define symbol __ICFEDIT_size_cstack__ = 0x400;define symbol __ICFEDIT_size_heap__ = 0x200;/**** 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 CCMRAM_region = mem:[from __ICFEDIT_region_CCMRAM_start__ to __ICFEDIT_region_CCMRAM_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, block HEAP };2016-08-09 10:16 AM
If you were to shrink the memory visible to the linker, you'd change
define symbol __ICFEDIT_region_RAM_end__ = 0x2002FFFF;todefine symbol __ICFEDIT_region_RAM_end__ = 0x20003FFF;Alternatively you could make the heap very large and malloc() your frame buffer.2016-08-09 11:40 PM
Hi @clive1
when i assign the ram define symbol __ICFEDIT_region_RAM_end__ = x20003FFF; the compiler gives error for section placement like this: ''unable to allocate space for sections/blocks with a total estimated minimum size of 0x288b8 bytes (max align 0x8) in <[0x20000000-0x20003fff]> (total uncommitted space 0x4000).'' So i have changed the RAM end value to 2001B000, then the compiler gives no error but code crashes again ( it goes to HardFault_Handler() function) . Can you give any other advise ? How can i make huge heap and how can i use malloc for frame buffer define?2016-08-10 03:16 AM
Why can't it be done by just declaring a buffer in a global variable and using its address (given there is really enough internal SRAM)?
Something like this: unsigned char buf[FRAMEBUFFER_SIZE]; ... #define LCD_LAYER0_FRAME_BUFFER ((uint32_t)&buf[0])2016-08-10 04:06 AM
void GUI_X_Config(void) {
static U32 aMemory[GUI_NUMBYTES / 8 ];
// // Assign memory to emWin // GUI_ALLOC_AssignMemory(aMemory, GUI_NUMBYTES); // // Set default font // GUI_SetDefaultFont(GUI_FONT_6X8); } And my build output for stm32f429VIT mcu is: 50 898 bytes of readonly code memory 13 462 bytes of readonly data memory 118 707 bytes of readwrite data memory So i think there is enough ram area.2016-08-10 04:23 AM
> (1024) * 150
So, you are declaring 1024x150 = 19200 sized array of 4-byte U32 values (76800 bytes). Which is the same as 240x320. So 1 byte per pixel? Why not just use a U8 array of 240x320 size? Anyway, it shouldn't matter. Are you sure you are using the 4/6/8-bit RGB color mode (like L8, AL44, A8 modes) and not 16-bit mode (which would require 2 times more RAM)? There is another thing, according to the datasheet, there are 4 SRAM regions sized 112KB (0x20000000-0x2001BFFF), 16KB, 64KB, and another 64KB of CCM SRAM. Only the first block is big enough to have your 240x320 sized buffer. If your project compiles and links without problems then it must be OK but just in case check your map file to make sure the buffer has successfully ended up in the 0x20000000-0x2001BFFF range.2016-08-10 04:35 AM
emWin User manual Pg 1248
GUI_ALLOC_AssignMemory()
Description
The function assigns the one and only memory block to emWin which is used by the internal memory management system.... It is never used as frame buffer.
BTW, (although not affecting frame buffer) I think your ''static U32 aMemory[GUI_NUMBYTES / 8 ];
'' should bestatic U32 aMemory[GUI_NUMBYTES / 4 ];
(U32 is 4 bytes wide, not 8) otherwise you're only reserving half the amount of memory that you're telling emWin it can usegood luck2016-08-11 12:25 AM
Hi,
I have figured it out with some troubles. I have specified the ram area from linker settings between 0x20000000 and 0x2002B000, i have defined the frame buffer adress as 0x2002B001. My assign memory define is ''static U32 aMemory[GUI_NUMBYTES / 5 ];'' (
It does not permit to use /4 for space allocation error).
For now i can write something with GUI_DispStringAt() function but i can not use the whole screen coordinates, for example if i use x=30 and y = 30 the string disappears, i can only use coordinates x=10 y = 10. By the way when i use gui_color for red, it appears as blue and, if i use gui_color for blue it appears red, i can not understand why it Works as inverted.