This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Function malloc() cause to trigger Reset Handler

I am working with cortex-m4 microcontroller from TI TM4C123GH6PM. I am trying to allocate the memory space by following c syntax

        char *target;
        int size=10;
        target=(char *)malloc(size*sizeof(char)); //allocating size for string
        if(target==0)red;
        else green;
        free(target);

The line where I am trying to assign the allocated space address to the char pointer cause Reset Handler to trigger at line
LDR R0, =SystemInit

Disassembly
0x0000090c BEAB 0xAB

commenting that line cause to glow red led, means rest of the lines are executing perfectly. Same with the calloc function. I don't have any idea about this error please help.