Hi, I'm using an STM32F429-Discovery development board with STemWin. The STM32F429 has a 240 x 320 LCD screen on the board. I'm wanting to use an emWin Memory Device to avoid flicker. I'm trying to use code that is very similar to the example code shown in section 16.4 of the emWin User Reference Guide v5.4.0. The code:
//// Create a Memory Device associated with layer 1//
GUI_SelectLayer(1);
hMem = GUI_MEMDEV_Create(0, 0, 100, 100);
GUI_MEMDEV_Select(hMem);
GUI_DrawLine(0, 0, 99, 99);
GUI_MEMDEV_Select(0);
//// Select layer 0//
GUI_SelectLayer(0);
//// The following line copies the Memory Device to layer 1 and not to layer 0//
GUI_MEMDEV_CopyToLCD(hMem);
The above code works. However, I'd like my MEMDEV to cover the entire screen (240 x 320) and not just 100 x 100. So, I change the parameters to the GUI_MEMDEV_Create call to:
hMem = GUI_MEMDEV_Create(0, 0, 240, 320);
This compiles and runs, but the MEMDEV is not successfully created. hMem gets a return value of zero and there is flickering during the drawing operations that do not exist when I used the smaller (100 x 100) dimensions. I've learned the issue is that the GUI_NUMBYTES in GUIConf.c is not large enough to support the chunk of memory necessary for the 240 x 320 MEMDEV and that I must increase the multiplier. For example, the default was this:
//// Define the available number of bytes available for the GUI//
#define GUI_NUMBYTES (1024) * 150
...and I need to increase the "150" to maybe "200" or more like this:
//// Define the available number of bytes available for the GUI//
#define GUI_NUMBYTES (1024) * 200
The problem I run into when doing this is that the RAM necessary for the resulting binary overflows the amount available on the board:
10:15:34 **** Incremental Build of configuration Debug for project STM32F429I_DISCO_MB1075 ****
make all
Building target: STM32F429I_DISCO_MB1075.elf
Invoking: MCU GCC Linker
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -L"C:\tmp\STM32Cube_FW_F4_V1.18.0\Middlewares\ST\STemWin\Lib" -specs=nosys.specs -specs=nano.specs -T"../STM32F429ZITx_FLASH.ld" -Wl,-Map=output.map -Wl,--gc-sections -o "STM32F429I_DISCO_MB1075.elf" @"objects.list" -l:STemWin540_CM4_GCC.a -lm
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe: STM32F429I_DISCO_MB1075.elf section `.bss' will not fit in region `RAM'
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 30880 bytes
collect2.exe: error: ld returned 1 exit status
makefile:39: recipe for target 'STM32F429I_DISCO_MB1075.elf' failed
make: *** [STM32F429I_DISCO_MB1075.elf] Error 1
I'm wondering if anyone else has run into this problem and how they've best dealt with it? Am I just not going to be able to create a MEMDEV the size of the entire screen?
//// Create a Memory Device associated with layer 1//
GUI_SelectLayer(1);
hMem = GUI_MEMDEV_Create(0, 0, 100, 100);
GUI_MEMDEV_Select(hMem);
GUI_DrawLine(0, 0, 99, 99);
GUI_MEMDEV_Select(0);
//// Select layer 0//
GUI_SelectLayer(0);
//// The following line copies the Memory Device to layer 1 and not to layer 0//
GUI_MEMDEV_CopyToLCD(hMem);
The above code works. However, I'd like my MEMDEV to cover the entire screen (240 x 320) and not just 100 x 100. So, I change the parameters to the GUI_MEMDEV_Create call to:
hMem = GUI_MEMDEV_Create(0, 0, 240, 320);
This compiles and runs, but the MEMDEV is not successfully created. hMem gets a return value of zero and there is flickering during the drawing operations that do not exist when I used the smaller (100 x 100) dimensions. I've learned the issue is that the GUI_NUMBYTES in GUIConf.c is not large enough to support the chunk of memory necessary for the 240 x 320 MEMDEV and that I must increase the multiplier. For example, the default was this:
//// Define the available number of bytes available for the GUI//
#define GUI_NUMBYTES (1024) * 150
...and I need to increase the "150" to maybe "200" or more like this:
//// Define the available number of bytes available for the GUI//
#define GUI_NUMBYTES (1024) * 200
The problem I run into when doing this is that the RAM necessary for the resulting binary overflows the amount available on the board:
10:15:34 **** Incremental Build of configuration Debug for project STM32F429I_DISCO_MB1075 ****
make all
Building target: STM32F429I_DISCO_MB1075.elf
Invoking: MCU GCC Linker
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -L"C:\tmp\STM32Cube_FW_F4_V1.18.0\Middlewares\ST\STemWin\Lib" -specs=nosys.specs -specs=nano.specs -T"../STM32F429ZITx_FLASH.ld" -Wl,-Map=output.map -Wl,--gc-sections -o "STM32F429I_DISCO_MB1075.elf" @"objects.list" -l:STemWin540_CM4_GCC.a -lm
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe: STM32F429I_DISCO_MB1075.elf section `.bss' will not fit in region `RAM'
c:/ac6/systemworkbench/plugins/fr.ac6.mcu.externaltools.arm-none.win32_1.15.0.201708311556/tools/compiler/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/ld.exe: region `RAM' overflowed by 30880 bytes
collect2.exe: error: ld returned 1 exit status
makefile:39: recipe for target 'STM32F429I_DISCO_MB1075.elf' failed
make: *** [STM32F429I_DISCO_MB1075.elf] Error 1
I'm wondering if anyone else has run into this problem and how they've best dealt with it? Am I just not going to be able to create a MEMDEV the size of the entire screen?
The post was edited 4 times, last by TMD ().