#include "GUI.h" #include "trace.h" volatile GUI_TIMER_TIME OS_TimeMS; void GUI_X_InitOS(void) { /*OS_CreateRSema(&RSema);*/ } void GUI_X_Unlock(void) { /*OS_Unuse(&RSema);*/ } void GUI_X_Lock(void) { /*OS_Use(&RSema);*/ } U32 GUI_X_GetTaskId(void) { return 0; /*(U32)OS_GetTaskID();*/ } GUI_TIMER_TIME GUI_X_GetTime(void) { DEBUG("GUI_X_GetTime\r\n"); return OS_TimeMS; } void GUI_X_Delay(int ms) { DEBUG("GUI_X_Delay %d\r\n", ms); int tEnd = OS_TimeMS + ms; while ((tEnd - OS_TimeMS) > 0); } void GUI_X_Init(void) { DEBUG("GUI_X_Init\r\n"); } void GUI_X_ExecIdle(void) { DEBUG("GUI_X_ExecIdle\r\n");} void GUI_X_Log (const char *s) { DEBUG("Log: %s\r\n", s); } void GUI_X_Warn (const char *s) { DEBUG("Warn: %s\r\n", s); } void GUI_X_ErrorOut(const char *s) { DEBUG("ErrorOut: %s\r\n", s); } |
#include <string.h> #include <stdint.h> #include "GUI.h" #include "trace.h" #define GUI_NUMBYTES 1024 * 4 #define GUI_BLOCKSIZE 0x128 void GUI_X_Config(void) { DEBUG("GUI_X_Config \r\n"); static uint8_t aMemory[GUI_NUMBYTES]; GUI_ALLOC_AssignMemory(aMemory, GUI_NUMBYTES); GUI_ALLOC_SetAvBlockSize(GUI_BLOCKSIZE); GUI_SetDefaultFont(GUI_FONT_8X16); } |
#include "GUI.h" #include "GUIDRV_Lin.h" #include "trace.h" #define XSIZE_PHYS 416 #define YSIZE_PHYS 240 #define COLOR_CONVERSION GUICC_1 #define DISPLAY_DRIVER GUIDRV_LIN_1 void LCD_X_Config(void) { DEBUG("LCD_X_Config"); GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0); LCD_SetSizeEx (0, XSIZE_PHYS, YSIZE_PHYS); LCD_SetVSizeEx(0, XSIZE_PHYS, YSIZE_PHYS); } int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void * pData) { DEBUG("LCD_X_DisplayDriver layer: %x, cmd: %x, data %p\r\n", LayerIndex, Cmd, pData); switch (Cmd) { case LCD_X_INITCONTROLLER: { return 0; } default: { return -1; } } } |
int main(void) { ... DEBUG("START\r\n"); ... DEBUG("Entering GUI_Init\r\n"); led4 = GUI_Init(); DEBUG("Exited GUI_Init\r\n"); |
START Entering GUI_Init Log: GUI_Init() GUI_X_Config LCD_X_ConfigLCD_X_DisplayDriver layer: 0, cmd: 7, data 0x10007b28 GUI_X_Init Log: LCD_Init... LCD_X_DisplayDriver layer: 0, cmd: 1, data 0x0 LCD_X_DisplayDriver layer: 0, cmd: 4, data 0x10007b08 LCD_X_DisplayDriver layer: 0, cmd: 4, data 0x10007b08 LCD_X_DisplayDriver layer: 0, cmd: 5, data 0x0 LCD_X_DisplayDriver layer: 0, cmd: 3, data 0x10007b38 Log: GUI_ALLOC_Alloc... requesting %d, %d avail 0x0000002C 0x00000838 Log: GUI_ALLOC_AllocNoInit... requesting %d, %d avail 0x0000002C 0x00000844 Log: GUI_ALLOC_AllocNoInit : Handle 0x00000002 Exited GUI_Init LCD_X_DisplayDriver layer: 0, cmd: 2, data 0x10007b64 |
START Entering GUI_Init Log: GUI_Init() GUI_X_Config LCD_X_ConfigLCD_X_DisplayDriver layer: 0, cmd: 7, data 0x10007b30 GUI_X_Init Log: LCD_Init... LCD_X_DisplayDriver layer: 0, cmd: 1, data 0 LCD_X_DisplayDriver layer: 0, cmd: 4, data 0x10007b10 LCD_X_DisplayDriver layer: 0, cmd: 4, data 0x10007b10 |
__BSS(RAM2) FrameBuffer buffer; //Global variable ... and void GUI_X_Config(void) { __BSS(RAM2) static uint8_t aMemory[GUI_NUMBYTES]; ... |
... .bss_RAM2 0x2007c000 0x48c0 *(.bss.$RAM2*) .bss.$RAM2 0x2007c000 0x30c0 ./src/main.o 0x2007c000 buffer .bss.$RAM2 0x2007f0c0 0x1800 ./emWin_Config/GUIConf.o ... |
extern "C" void HardFault_Handler() { DEBUGLN("In Hard Fault Handler\n"); DEBUGLN("SCB->HFSR = 0x%08lx\n", SCB->HFSR); DEBUGLN("SCB->DFSR = 0x%08lx\n", SCB->DFSR); DEBUGLN("SCB->CFSR = 0x%08lx\n", SCB->CFSR); DEBUGLN("SCB->MMFAR = 0x%08lx\n", SCB->MMFAR); DEBUGLN("SCB->BFAR = 0x%08lx\n", SCB->BFAR); DEBUGLN("SCB->AFSR = 0x%08lx\n", SCB->AFSR); while(1); } |
In Hard Fault Handler SCB->HFSR = 0x40000000 SCB->DFSR = 0x00000008 SCB->CFSR = 0x00000400 SCB->MMFAR = 0xe000ed34 SCB->BFAR = 0xe000ed38 SCB->AFSR = 0x00000000 |