Your code footprint will change if you breath on it so instead of finding a spot that is not occupied I would do one of the following instead:
- Pre-allocate your buffer so that the compiler will not attempt to place anything there
- Dynamically allocate your buffer at run time
I like# 1 better and there are different ways to do it. # 2 is just use malloc or something similar to allocate a memory. The reason why I don't like# 2 is that allocating memory at run time should be avoided (if possible) since if you run out of memory that might be hard to debug.
So back to# 1.... You can write your own linker script and declare a region of the memory to hold your buffer and just make sure the linker doesn't attempt to place any code/data there during the linking stage. Or if you know what your buffer size is going to be ahead of time you could just declare an array in your code and use that array as the destination.
Before kicking off the DMA you should make sure your source or destination buffers are not cached. There are many ways to do that so I'll let you search around for that or just read the documentation about the Nios II data cache.