Hello again, > How to use malloc with PIC 18f4550 & sdcc ? I have been reading few > info pages (http://www.btinternet.com/~Peter.Onion/sdcc/sdcc-intro.html) > and have been trying to get the regression test malloc.c to compile > without luck. I am using latest svn release of sdcc (28-Aug-2008). > > Thank you very much for help, > -Mika Saari
Managed to compile a sample code below with sdcc, but the xdata definition can not be found from header files (except from testfwk.h). What would be the correct way to introduce the heap ? Thank you again, -Mika Code I have been compiling: #include <pic16/pic18f4550.h> #include <stdio.h> #include <math.h> #include <malloc.h> #include <stdlib.h> #include <sdcc-lib.h> // xdata char heap[256]; This gives error of missing xdata data char heap[256]; // data char heap[512]; This gives linker error, do not know why int main() { float f1, f2; char *s1; s1 = (char *) malloc (100); f1 = 3.14; f2 = sqrtf(f1); sprintf(s1, "Float s1=%f and s2=%f", f1,f2); return 0; } ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Sdcc-user mailing list Sdcc-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sdcc-user