Reinitialize the embedded wizard framework

35 views
asked Jan 6 in System Integration by stone112

Hello community,

the embedded wizard framework works properly in my example, but when I deinit and reinit (with the normal initialization routine) the framework, than I get the following error: 

[ERROR in ewgfx.c:1721] Failed to start the update of the viewport 0x6017C558.
[FATAL ERROR in ewobject.c:651] Can not create an object. Out of memory.
assertion "!block_is_last(block)" failed: file "./inc/Misc/tlsf.c", line 248, function: block_next
 

The address   0x60000000, is the address of the external SDRAM.

the initialization routine looks like this:

EmbeddedWizzard_Driver_Status_t Init(void)
{
	MemPool = 0;
	viewport = 0;

	EmbeddedWizzard_Driver_Status_t status;

	EwBspConfigDisplay((uint32_t)FRAME_BUFFER_WIDTH, (uint32_t)FRAME_BUFFER_HEIGHT,(uint32_t) FRAME_BUFFER_ADDR);

	MemPool = tlsf_create_with_pool( MEMORY_POOL_ADDR, MEMORY_POOL_SIZE );


	/* initialize the Graphics Engine and Runtime Environment */
	EwBspConfigSystemTick();

	if (EwInitGraphicsEngine(NULL) == 0)
	{
		return status;
	}

	viewport = EwInitViewport( EwScreenSize, EwNewRect( 0, 0, FRAME_BUFFER_WIDTH, FRAME_BUFFER_HEIGHT ),
			0, 255, (uint32_t*)FRAME_BUFFER_ADDR, (uint32_t*)DOUBLE_BUFFER_ADDR, 0, (XViewportProc)0 );

	rootObject = (CoreRoot)EwNewObjectIndirect( EwApplicationClass, 0 );
	EwLockObject( rootObject );
	(void)CoreRoot__Initialize( rootObject, EwScreenSize ); //Return value can not be tested regarding its consistency

    return 1;
}

and the deinit routine like this:

void DeInit(void)
{
	EwDoneViewport( viewport );
	EwUnlockObject( rootObject );

	/* finished -> release unused resources and memory */
	EwReclaimMemory();
	/* ... and deinitialize the Graphics Engine */
	EwDoneGraphicsEngine();

	tlsf_destroy( MemPool );
}

The external SDRAM is emptied with the function "memset" before embedded wizard gets initialized.

Has anyone an idea why this error occurs?`

Best regards

commented Jan 6 by stone112
As an additional information: I haven't used a rtos, just bare metal.

1 Answer

0 votes
answered Jan 7 by Manfred Schweyer
Hello,

difficult to find the root cause remotely...

It seems to me, that there happens some memory overwriting. Can you ensure that there are no activities ongoing during/after the deinitialization, e.g. some DMA or graphics accelerator operations?

What target are you using? Are you using the latest version of Embedded Wizard and the target Build Environment? Since version 9.30 we provide our own heap manager - there is no need for the third-party TLSF.

Best regads,

Manfred.

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...