boxeur

L1 scratchpad for stack and RSI issues: bug in example rsi.c for BF504 (and possibly others)

Discussion created by boxeur on Mar 23, 2013
Latest reply on Apr 3, 2013 by CraigG

Hi,

 

The example code to work with SD cards is using automatic variables (uint8_t buffer[8];) for DMA buffers. Of course, when the stack is in the scratchpad memory, that can't work.

 

Since the example code is very likely to be used as a basis for other applications, you might want to consider either making the buffer global or at least putting a big fat warning about the necessity to keep all DMA buffers out of automatic variables. I can also recommend adding a runtime assertion to ensure the address passed is in the right range.

 

It's likely that other drivers might suffer from similar problems so a more thorough investigation might be necessary.

 

Best regards.

Outcomes