SDK 1.4 issue os_zalloc

scargill
Posts: 70
Joined: Sun Nov 02, 2014 8:09 pm

SDK 1.4 issue os_zalloc

Postby scargill » Tue Sep 22, 2015 2:30 am

Hi

Up to now, various SDKs have been drop-in and recompile - this time with 1.4 I get an error when compiling this (which sadly I did not write so I don't want to mess it up).


void ICACHE_FLASH_ATTR QUEUE_Init(QUEUE *queue, int bufferSize)
{
queue->buf = (uint8_t*)os_zalloc(bufferSize);
RINGBUF_Init(&queue->rb, queue->buf, bufferSize);
}


mqtt/queue.c:42:2: error: too many arguments to function 'pvPortZalloc'
queue->buf = (uint8_t*)os_zalloc(bufferSize);
^

User avatar
kolban
Posts: 131
Joined: Tue Jun 16, 2015 1:09 pm
Location: Fort Worth, Texas, USA

Re: SDK 1.4 issue os_zalloc

Postby kolban » Tue Sep 22, 2015 3:07 am

When using SDK supplied APIs try and find the corresponding C header file that contains the prototype definitions. For os_<memory> functions, this is the file called "mem.h" contained in <SDK>/include/mem.h. Looking at that file, we will find that the definitions for items such as "os_zalloc" have been defined as macros with additional parameters for memory leak debugging.

I'd suggest including mem.h and removing any previously manually defined definitions of os_<memory> functions that you may have coded.

Neil

eriksl
Posts: 159
Joined: Fri May 22, 2015 6:22 pm

Re: SDK 1.4 issue os_zalloc

Postby eriksl » Wed Sep 23, 2015 12:05 am

Yes indeed, it looks this function now finally has a proper prototype and the prototype guessed by the author apparently was wrong.

This is actually a good thing, because improperly prototyped function calls can cause crashed and other unpredictable behaviour.

tve
Posts: 123
Joined: Sun Feb 15, 2015 4:33 pm

Re: SDK 1.4 issue os_zalloc

Postby tve » Wed Sep 23, 2015 9:38 am

The prototype changed with the memory tracing in SDK 1.4

Who is online

Users browsing this forum: No registered users and 27 guests