FTDI Community

General Category => Discussion - Software => Topic started by: GHinchliffe on July 27, 2018, 08:10:02 PM

Title: Unable to allocate dynamic memory
Post by: GHinchliffe on July 27, 2018, 08:10:02 PM
Hi,
  I am having no luck in allocating any memory on a Vinculum-II device.  My code so far is very small, simply sets up a couple of test tasks, UART and then outputs strings via the UART. 

  When I attempted to use calloc to allocate some RAM (structure in question is 9 bytes), it returns a NULL.  I have tried with malloc also, same response even for a smaller value of 4.  I am linking in the stdlib.a library along with stdio.a ioctl.a errno.a uart.a and kernel.a

  I have also tried the call vos_malloc(4), which also returns a NULL.

A call to vos_heap_space gives me results of around 10KB for both free and maximum, so it seems like there is a heap configured and available.

Am I missing some crucial configuration command or option?  I assume that I should be able to allocate memory within a task?  I have also tried increasing the size of the task's stack (just in case :) ) and that has had no joy either.

Hope someone can point me in the right direction, thanks.
Title: Re: Unable to allocate dynamic memory
Post by: FTDI Community on August 02, 2018, 09:25:29 AM
Hello,

Please check AN_157 Vinculum II Memory Management (http://www.ftdichip.com/Support/Documents/AppNotes/AN_157_Vinculum%20II%20Memory%20Management.pdf) for all available information on memory management.

The Thread Manager can also be useful. See the Help menu with in the IDE:

(https://s33.postimg.cc/dcatvdkyn/Thread_Manager_VNC2.jpg)

Have you considered our latest MCUs?
A more recent solution is to use the FT90x (http://www.ftdichip.com/Products/ICs/FT90X.html) which allows more customisation than the Vinculum products.

There are significant benefits of FT90x:

-Eclipse based IDE
-Source code for API drivers is provided
-Significant performance improvement
-Actively in development by R&D
-Improved documentation and software examples

Best Regards,
FTDI Community