AnsweredAssumed Answered

KDS and malloc()

Question asked by Stephen Dame on Jun 2, 2016
Latest reply on Aug 20, 2016 by Chip Audette

I have the following code snippet...


#include <stdint.h>

#include <stdlib.h>

#include "circ.h"


#include "fsl_debug_console.h"


float  *rd_ptr, *wr_ptr;

float  *circ_buffer;

uint32_t size;


void circ_init(float *buf, uint32_t N) {

  circ_buffer = (float *)malloc(N * sizeof(uint32_t));

  rd_ptr = circ_buffer;

  wr_ptr = circ_buffer;


  PRINTF("circ_buffer after malloc:0x%.8X\n",(uint32_t) circ_buffer);

  size = N;



why does the malloc() just return 0x0?  Is there some special intialization that needs to happen? 


This is for a project on the FRDM-K22F.