GUI_Init() gives "GUI_Alloc.c:\nMemory test failed in _InitOnce()." error.

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

GUI_Init() gives "GUI_Alloc.c:\nMemory test failed in _InitOnce()." error.

1,506 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by SeleneSW on Tue Jan 07 06:21:03 MST 2014
Hello,

when the function GUI_Init() is executed, the user-defined error function is called with the following error message:
"GUI_Alloc.c:\nMemory test failed in _InitOnce()."
Then the program halts.
I reserved 3MB of memory for emWin, on external SDRAM.
I'm using the pre-compiled version of emWin 5.20 for NXP and LPCXpresso v6.1.0.

When I run a simpler application which continuously displays a few bitmaps, it works fine though the peripherals init routines, including EMC, are exactly the same.

Any help would be appreciated.

Thanks
Mario


标签 (1)
0 项奖励
回复
4 回复数

1,347 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by SeleneSW on Tue Jan 14 01:08:07 MST 2014
I solved the problem.

I have not understood the real reason, but it deals with linker scripts.
In fact, I have checked the "Manage Linker Scripts" option in linker target settings to make the builder re-create the scripts, and then I have added my sections manually and unchecked the option again.
From that moment on the application is running correctly.

I have to say that the project has been ported from RedSuite 5.

Bye
Mario
0 项奖励
回复

1,347 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by SeleneSW on Fri Jan 10 03:13:25 MST 2014
Any suggestions?
0 项奖励
回复

1,347 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by SeleneSW on Wed Jan 08 00:48:49 MST 2014
Hi mc,

Thank you for the prompt reply.
The value assigned to GUI_NUMBYTES is 0x300000 (that is 1024 * 1024 * 3).
I tried to increase this value to 0x500000 (5 MB) with no effect.

The problem is at startup. After all hw initializations a call to GUI_Init() function is executed. Here you can see the main() function:

int main(void)
{
K_DebugInit();

// interrupt handlers making FreeRTOS calls must not run before vTaskStartScheduler()
K_IntDisable();

GUI_Init();
GUI_Clear();

#ifdef DIAG                          // DIAG program

// Start DIAG task
T_Diag_Start();

#else                                   // STANDARD program

// Mount SD drive
f_mount(DRV_SD);

// Start USB Host task
T_USB_Start();

// Start Advertising task
T_Ad_Start();

// Start custom LCD emulation task
T_CLcd_Start();

// Start tick task
//T_Tick_Start();
#endif// DIAG

/*
* Start the scheduler.
*/
vTaskStartScheduler();

/*
* Will only get here if there was insufficient memory to create the idle task.
*/

return 1;
}


System init is done before entering the main() function.
When I activate the DIAG definition, only HW test routines are compiled and everything works well (including GUI functions).
When I undefine DIAG to compile the real application, the program halts in GUI_Init() with the explained message.
The only difference I can see in the map file is the internal RAM usage that is obviously much lower for the DIAG program.
This impacts on the memory reserved for the stack (heap is allocated on external SDRAM).

What does the error message mean exactly?

P.S. I see that the functions giving the error is GUI_DEVICE_CreateAndLink(DISPLAY_DRIVER, COLOR_CONVERSION, 0, 0); called in LCD_X_Config().
0 项奖励
回复

1,347 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Tue Jan 07 19:05:00 MST 2014
Hi Mario,
What value is assigned to GUI size. What is the value of GUI_NUMBYTES  in GUIConf.c

// Define the available number of bytes available for the GUI
//
#define GUI_NUMBYTES  (1024 * 1024) * 12  // x MByte]
//
// Define the available number of bytes available for the GUI
//
#define GUI_NUMBYTES  (1024 * 1024) * 12  // x MByte

I do not know what are you doing,however you can change this value to see the effect.
0 项奖励
回复