Jump to content

About HEAP_SIZE.


SunBae

Recommended Posts

I am developing ugfx_2.9 for a DIY product. Keil uVision is used and the main MCU is nRF52840.

1.
The display uses E-ink's ET011TJ2. Is the driver IC correct for UC8173?


2.
However, g->priv = 0 in the initialization function of <gdisp_lld_UC8173.c> as follows. So return gFalse; proceed with As a result, the initialization routine does not proceed.
sizeof(UC8173_Private) = 14412

How can I initialize normally?

3.
I tried changing HESP_SIZE in various ways as follows. But in all cases g->priv = 0 .

#define GFX_OS_HEAP_SIZE 14412 //0 //4095 //20480 // 30720 //10240 //10240 //40960

4.
I have set it up like this:
#define GFX_EMULATE_MALLOC GFXON
Still, g->priv = 0.


Since g->priv = 0 unconditionally, the initialization function cannot proceed.
How to solve it?

<gfxconf.h>

///////////////////////////////////////////////////////////////////////////
// GOS - One of these must be defined, preferably in your Makefile       //
///////////////////////////////////////////////////////////////////////////
//#define GFX_USE_OS_CHIBIOS                           GFXOFF
//#define GFX_USE_OS_FREERTOS                          GFXOFF
//    #define GFX_FREERTOS_USE_TRACE                   GFXOFF
//#define GFX_USE_OS_WIN32                             GFXOFF
//#define GFX_USE_OS_LINUX                             GFXOFF
//#define GFX_USE_OS_OSX                               GFXOFF
//#define GFX_USE_OS_ECOS                              GFXOFF
//#define GFX_USE_OS_RAWRTOS                           GFXOFF
//#define GFX_USE_OS_ARDUINO                           GFXOFF
//#define GFX_USE_OS_KEIL                              GFXON
//#define GFX_USE_OS_RTX5                              GFXOFF
#define GFX_USE_OS_CMSIS                             GFXON			<<<=======
//#define GFX_USE_OS_CMSIS2                            GFXOFF
//#define GFX_USE_OS_RAW32                             GFXOFF
//#define GFX_USE_OS_ZEPHYR                            GFXOFF
//#define GFX_USE_OS_NIOS                              GFXOFF
//#define GFX_USE_OS_QT                                GFXOFF
//    #define INTERRUPTS_OFF()                         optional_code
//    #define INTERRUPTS_ON()                          optional_code

// Options that (should where relevant) apply to all operating systems
//    #define GFX_NO_INLINE                            GFXOFF
//    #define GFX_COMPILER                             GFX_COMPILER_UNKNOWN
//    #define GFX_SHOW_COMPILER                        GFXOFF
//    #define GFX_CPU                                  GFX_CPU_UNKNOWN
//    #define GFX_CPU_NO_ALIGNMENT_FAULTS              GFXOFF
//    #define GFX_CPU_ENDIAN                           GFX_CPU_ENDIAN_UNKNOWN
    #define GFX_OS_HEAP_SIZE                         14412 //0 //4095 //20480 // 30720 //10240 //10240 //40960		<<<=======
//    #define GFX_OS_NO_INIT                           GFXOFF
//    #define GFX_OS_INIT_NO_WARNING                   GFXOFF
//    #define GFX_OS_PRE_INIT_FUNCTION                 myHardwareInitRoutine
//    #define GFX_OS_EXTRA_INIT_FUNCTION               myOSInitRoutine
//    #define GFX_OS_EXTRA_DEINIT_FUNCTION             myOSDeInitRoutine
//    #define GFX_OS_CALL_UGFXMAIN                     GFXOFF
//    #define GFX_OS_UGFXMAIN_STACKSIZE                0
//    #define GFX_EMULATE_MALLOC                       GFXON		<<<=======
//    #define GFX_MEM_LT64K                            GFXOFF


<gdisp_lld_UC8173.c>

LLDSPEC gBool gdisp_lld_init(GDisplay* g)
{
	UC8173_Private	*priv;

	printf("UC8173:gdisp_lld_init - 1 HEAP = %d\r\n", GFX_OS_HEAP_SIZE);
	
	// Allocate the private area
	g->priv = gfxAlloc(sizeof(UC8173_Private));			<<<=======
	printf("UC8173:gdisp_lld_init - 2 memAlloc = %d, sz = %d\r\n", g->priv, sizeof(UC8173_Private));   <<<=======

	if (!g->priv)
		return gFalse;
	priv = (UC8173_Private *)g->priv;

 

gfxconf.h

Link to comment
Share on other sites

Hello & welcome to the µGFX community!

If gfxAlloc() returns NULL, it indeed would indicate an issue with the memory layout/setup/capacity.

You are setting GFX_USE_OS_CMSIS to GFXON. Are you actually using the CMSIS OS? Note that the CMSIS OS is a different component than the CMSIS library itself. If you're not using the actual CMSIS OS, you should select the proper OS instead - or use GFX_OS_RAW32 instead.

After checking the OS situation: To further debug this, I'd recommend disabling the GDISP Module (setting GFX_USE_GDISP to GFXOFF in the configuration file) and trying to do various calls to gfxAlloc() in your main() right after gfxInit(). This way you can more easily figure out what is actually happening.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...