Guy's I'm lost, and don't know what to try. I have a recursive function for deleting folder contents. I'm allocating memory from the stack but it has stopped working when I decided not to use my own malloc function.
Have a look, maybe someone can give me some insight has to what to try!
void delete_folder_contents(FILEX * file){ unsigned int root_address = file->cluster_nr; unsigned int source = file->dir_clusters->sequence; dir_insert_cluster(file); /** * Using the GNU Compiler Collection (GCC) aligned (alignment) This * attribute specifies a minimum alignment for the variable or * structure field, measured in bytes. For example, the * declaration: int x __attribute__ ( (aligned (16))) = 0; * causes the compiler to allocate the global variable x on a * 16-byte boundary. */ // Allocate Memory of the Stack for the recursive call unsigned char cache[cluster_size(file) + 1]__attribute__((aligned(32))); // perform DMA read of directory location to ensure the data is up-to-date dma_hardware_read(1, file->cluster_addr, sectors_per_cluster(file), cache, 0); //Code
when I use malloc to do it, it will work but it will only go 2 calls deep in the recursion. For example:
cache = rtos_malloc(cluster_size(file) + 32); cache = (unsigned char *)(((unsigned int)cache + 31) &~ 0x1f);
Anyone suggest what to do?
Thanks Freaks.