This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

undefined reference to `init_mempool

i am using Keil uVision3 + ADUC7026, i am trying to allocate

#include <ADuC7026.h>
#include "stdio.h"
#include "stdlib.h"

unsigned char memory_pool[0x400];
int main (void) {
int *i;
init_mempool (memory_pool, sizeof(memory_pool));
i = malloc(sizeof(int));
}

warning: implicit declaration of function 'init_mempool'
..........
error: undefined reference to 'init_mempool'

can someone help me ,why can't find init_mempool? "Do not use Standart Libriries" is uncheckt. and the system can find malloc.

thanks

Parents Reply Children
  • When you start an ARM project, you should first to select the compiler (Keil CARM, GNU, or ARM ADS/RealView) you want to use.

    init_mempool is only part of the Keil CARM Compiler run-time library. For using this function, it is required that you setup a project using the Keil CARM compiler. See Getting Started User's Guide (GSA.CHM, Development Tools, Select the Toolset).

    For using malloc with Keil CARM you need to call the init_mempool function. See: http://www.keil.com/support/man/docs/ca/ca_init_mempool.htm

    For using malloc with GNU Compiler you need a more complex setup.
    See example: Keil\ARM\GNU\Examples\Memory. However, due to the nature of the GNU run-time library (it has a clustering of 32KB and requires a minimum RAM of 32KB) you cannot use malloc on single chip devices.

    Therefore you should consider to use the Keil CARM compiler instead, since the run-time library is designed for single chip systems.

    Reinhard