I am trying to use malloc to dynamically allocate an array. After I use it, I only end up with an array of one element. Code is as follows:
uint8_t *arraystuffs;
uint16_t update_size;
//at somepoint, update_size get set to 2448
arraystuffs = (uint8_t *) malloc(update_size);
I then try to assign things to the array that I think I should have. When I look in the debugger, I only have a 1 element array, with the value 0x58 in it. I have used malloc many times before, just as above, and suddenly it does not work. I double checked several examples online of how malloc should work, and I believe that I have it set up right.
I have tried using smaller values for update_size, like 50, but that has not solved the problem.
I have tried taking the typecast out, but that doesn't help either.
I am working on an stm32F4 MCU in the Keil IDE. Any insight?