Add emWin to an existing project

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Add emWin to an existing project

Jump to solution
2,065 Views
lucalavecchia
Contributor II

Hi community,

I'm currently working on a custom board based on the MCB-4300 (LPC4357), my project (IDE: MCUXpresso) works and I'm able to pilot an external TFT display (using the available LDC controller) drawing lines, string, images, etc.

Now I'd like to improve my UI and I read about the EmWin but I've no idea how to include it within my project.

Reading this article Adding emWin do LPC project and C++ application I thought to have found the solution but, there isn't any emWin project to import within the LPCOpen package for Keil MCB 4357!

I even followed the two guides AN11244 and AN11218 but these didn't solve my doubts.

Could anyone provide a clear step by step guide?

thanks 

1 Solution
1,533 Views
lucalavecchia
Contributor II

Hi community,

I've found the problem, the hard fault was related to the function

GUI_DEVICE_CreateAndLink(GUIDRV_LIN_16, GUICC_565, 0, 0);

where I should have used GUIDRV_LIN_4 for 4bpp...

Thanks for the help, hope this is going to help

View solution in original post

0 Kudos
3 Replies
1,534 Views
lucalavecchia
Contributor II

Hi community,

I've found the problem, the hard fault was related to the function

GUI_DEVICE_CreateAndLink(GUIDRV_LIN_16, GUICC_565, 0, 0);

where I should have used GUIDRV_LIN_4 for 4bpp...

Thanks for the help, hope this is going to help

0 Kudos
1,533 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi Luca

I would suggest you refer this article. This should be helpful to you.

Getting start with LPCXpresso54608 & emWin  


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,533 Views
lucalavecchia
Contributor II

Hi ZhangJennie,
Thanks for your reply, at least now I'm able to build the project (a simple hello world ) without any error but (there's always a BUT), now the function GUI_Init() is generating an HardFault... I followed the disassembly and I noticed that the function LCD_Init() is generating it! Any idea?

what I've done is following:

  • within the main() I'm initialising the custom board HW and the LCD controller (LCD_CONFIG_T)
  • then I call the GUI_Init(), which calls: GUI_X_Config(), LCD_X_Config() and LCD_X_DisplayDriver() then after these, within the disassembly view, I can see the hard fault is generated within the LCD_Init after a simple compare instruction (cmp r0,#0)....

this is my GUIConf.c file:

----------------------------------------------------------------------
File : GUIConf.c
Purpose : Display controller initialization
---------------------------END-OF-HEADER------------------------------
*/

#include "GUI.h"
#include "GUIDRV_Lin.h"
#include "LCDConf.h"
#include "LCD_Config.h"


/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* GUI_X_Config
*
* Purpose:
* Called during the initialization process in order to set up the
* available memory for the GUI.
*/
void GUI_X_Config(void)

{
   //
   // 32 bit aligned memory area
   //
   static U32 aMemory[GUI_NUMBYTES / 4];
   //
   // Assign memory to emWin
   //
   GUI_ALLOC_AssignMemory(aMemory, GUI_NUMBYTES);
}
/*******************************************************************************
* Application implemented functions required by emWin library
******************************************************************************/
void LCD_X_Config(void)
{
   #if (NUM_BUFFERS > 1)
   GUI_MULTIBUF_Config(NUM_BUFFERS);
   #endif

   U32 a=GUI_DEVICE_CreateAndLink(GUIDRV_LIN_16, GUICC_565, 0, 0);

   LCD_SetSizeEx(0, LCD_WIDTH, LCD_HEIGHT);
   LCD_SetVSizeEx(0, LCD_WIDTH, LCD_HEIGHT);


   LCD_SetVRAMAddrEx(0, &frame_buf);//(void *)VRAM_ADDR);
}

int LCD_X_DisplayDriver(unsigned LayerIndex, unsigned Cmd, void *pData)
{
   return 0;
}

void GUI_X_Init(void)
{
}

/* Dummy RTOS stub required by emWin */
void GUI_X_InitOS(void)
{
}

/* Dummy RTOS stub required by emWin */
void GUI_X_Lock(void)
{
}

/* Dummy RTOS stub required by emWin */
void GUI_X_Unlock(void)
{
}

/* Dummy RTOS stub required by emWin */
U32 GUI_X_GetTaskId(void)
{
return 0;
}

void GUI_X_ExecIdle(void)
{
}

GUI_TIMER_TIME GUI_X_GetTime(void)
{
return 0;
}

void GUI_X_Delay(int Period)
{
}

void GUI_X_ErrorOut(char const *s)
{
}


/*************************** End of file ****************************/

0 Kudos