Unable to access most Arduino features on the Due

I am trying to get set up with coding on the Due. I went into the Boards Manager and installed the specific package for the Due.

So far I've run into the following problems:

I am unable to use the "byte" type.
The "malloc" function does not exist.
The math library is missing.

Is there a specific way to code on the Due that I'm missing here?

duplicate post

You are certainly missing something because :

  • the math library is already included,
  • there is no issue with using byte, although it’s much better to use uint8-t, …, uint64-t, int8_t,…, int64_t, float and double.
  • malloc and calloc work fine, although there are useless most of the time.

An example sketch which compiles correctly on a DUE (select 250000 baud then select Serial plotter):

const uint16_t sinsize = 480;
double sinus[sinsize];

void setup() {
  Serial.begin(250000);

  for (int i = 0; i < sinsize; i++)
  {
    sinus[i] = 2047 * sin(i * 2 * PI / sinsize) + 2048; //  0 < sinus [i] < 4096
  }

}
void loop() {
  for (int i = 0; i < sinsize; i++)
  {
    Serial.println((uint16_t)sinus[i]);
  }

}

See other post for what your missing.

-jim lee