We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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
Well, that's the same version I used and the following compiled just fine.
#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)); while (1); }
thanks Jon, thanks Drew. problem solved. i used GNU, hence the problem...
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