I'm trying to understand how memory is stored in the msp430. I'm using an msp430f5438a and I'm trying to manipulate large amounts of data.
Here is a snippet of code that works.
#include "stdlib.h"
void fillArrays(float *accX, float *accY, float *accZ);
float AccX[200];
float AccY[200];
float AccZ[200];
void main(void) {
fillArrays(AccX, AccY, AccZ);
}
void fillArrays(float *accX, float *accY, float *accZ) {
AccX[0] = 0.21;
....
AccX[199] = 1;
and so on
}
However, I would like to save as much storage space as possible for other uses so I would like to allocate that space using malloc and free it with free.
#include "stdlib.h"
float *AccX;
void main() {
AccX = (float *) malloc(200*sizeof(float));
}
or
#include "stdlib.h"
void main() {
float *AccX;
AccX = (float *) malloc(200*sizeof(float));
}
However, AccX is always NULL in both cases indicating there isn't enough memory available. In the program that works, to where are the arrays written?
What is the best way to go about doing this?
Thanks,
Kyle