Hello,
How can I allocate a memory in BG96?
Simple code:
char * a = (char *) malloc(sizeof(char));
Trying to allocate variables (int, char, struct, etc).
Is there malloc/calloc for Quectel BG96 lib?
Thanks in advance.
Hello,
How can I allocate a memory in BG96?
Simple code:
char * a = (char *) malloc(sizeof(char));
Trying to allocate variables (int, char, struct, etc).
Is there malloc/calloc for Quectel BG96 lib?
Thanks in advance.
void *malloc(size_t size)
{
if (!size)
return NULL;
void *ptr;
if (tx_byte_allocate(heap, (VOID **)&ptr, size, TX_NO_WAIT))
{
return NULL;
}
return ptr;
}
TX_BYTE_POOL *heap;
ok, thanks
SDK2
TX_BYTE_POOL *heap;
static char heap_buffer[HEAP]; // from -D, user defined
void heap_init(void)
{
if (txm_module_object_allocate(&heap, sizeof(TX_BYTE_POOL)))
abort();
if (tx_byte_pool_create(heap, "heap_byte_pool", heap_buffer, HEAP))
abort();
}