chipKIT® Development Platform

Inspired by Arduino™

libc

Created Thu, 26 May 2011 18:16:54 +0000 by WestfW


WestfW

Thu, 26 May 2011 18:16:54 +0000

Is there a plan to try to extend the compatibility with AVR/Arduino to the libc level? (eg avr-libc functionality) I realize that this isn't really a "fair" request. (Is there a similar "embedded" libc of PIC32 documented elsewhere?)

For example, this trivial sketch to allow an Arduino sketch to use fprintf() fails to compile for uno32

#include <stdio.h>
FILE* ser;

int fput(char c, FILE* f) {
  Serial.print( c, BYTE);
  return 0;
}

int fget(FILE* f) {
  int i = Serial.read();
  if (i < 0) return _FDEV_ERR;
  return i;
}

void setup() {
  Serial.begin(9600);
  Serial.println("\ntesting testing testing");
  delay (5000);
  ser = fdevopen(fput, fget);
}

void loop ()
{
  long long x = 1<<63;
  long y = 1<<31;
  Serial.println ("TestStart\n");
  fprintf(ser, "This is a test of something  %d  %d", x,y);
  Serial.println("TestEnd\n");
  delay(1000);
}

jasonk

Thu, 26 May 2011 20:05:05 +0000

It's something we will need to work on. Maybe directly port avr-libc to PIC32?