[Experimental] chipKIT compiler using Newlib Standard C lib

Announcements for new builds and MPIDE enhancements
username
Posts: 10
Joined: Mon Jan 16, 2012 9:53 pm

Re: [Experimental] chipKIT compiler using Newlib Standard C

Post by username » Sat Jan 28, 2012 11:35 pm

(after a bunch of hair pulling... and it's not like I can really spare the hair, I chased it down to NEW)

The following will cause the link error:

Code: Select all

class foo {
    int a;
    int b;
public:
    foo();
};

foo::foo(){
    a=1;
    b=2;
}

void setup(){ 
     foo myfoo;	// OK
     foo *kablooey = new foo();	// GENERATES LINK ERROR
}

void loop(){
}
Will generate the error:

Code: Select all

/Applications/Mpide.app/Contents/Resources/Java/hardware/pic32/compiler/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/lib/libc.a(lib_a-signalr.o): In function `_kill_r':
/Users/kjason/github-jasonkajita/mac-build/newlib/pic32mx/newlib/libc/reent/../../../../../../pic32-newlib/newlib/libc/reent/signalr.c:61: undefined reference to `kill'
/Applications/Mpide.app/Contents/Resources/Java/hardware/pic32/compiler/pic32-tools/bin/../lib/gcc/pic32mx/4.5.1/../../../../pic32mx/lib/libc.a(lib_a-signalr.o): In function `_getpid_r':
/Users/kjason/github-jasonkajita/mac-build/newlib/pic32mx/newlib/libc/reent/../../../../../../pic32-newlib/newlib/libc/reent/signalr.c:96: undefined reference to `getpid'
collect2: ld returned 1 exit status
And to answer your previous question, I'm porting ArdOSC which does a little more malloc'ing, etc than I'd do if i was writing it from scratch! The network shield examples compile OK.

(edit)

I think what's happening is that operator new() will throw an exception if it can't allocate memory and the exception handling is referring to kill()

rosimildo@gmail.com
Posts: 20
Joined: Mon Sep 26, 2011 6:28 pm

Re: [Experimental] chipKIT compiler using Newlib Standard C

Post by rosimildo@gmail.com » Wed Mar 28, 2012 1:05 pm

This simple program crashes.

The "printf" and others functions are not handling the formating of floats.

void setup()
{
Serial.begin(115200);
}

void loop()
{
char b[100];
double d = 2.7;

sprintf( b, "%f", d );
Serial.println( b );
}

Post Reply