I use part of internal memory in TS201 as a buffer to save some debug info. Section address is 0xC1000 size is about 1000 words. Idea is that when application is running it writes to this buffer some statistics. And when application crashes I can download other firmware to that DSP and read debug info from known place.
I found that when application uses cache, this debug idea doesn't work. When I comment macros "cache_enable(750)" everything works fine. I suppose that's because all debug info I write to debug section goes to cache and doesn't go to phisical RAM. That's why when application craches and I read data from debug area (address 0xC1000) I can't find anything.
How can I flush cache to be sure that data will be written to phisical RAM? I found that there is __builtin_flush for Blackfin processor, but I can't find such function for ADSP TS201.
Problem is solved. To flush cache I use cache copyback comand. Description I found in programmers manual. Following code flushes cache for certain data block: