We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have SPI interrupt defined as FIQ and the execution time for it should be less than 12us, but adding a few checks and the execution time is going out of the limit. I've seen that it takes 2-3us for the ARM7TDMI to enter the FIQ. Can you give some ideas how to optimize it to enter it quickly or execute quickly? What should I use/avoid? I realized I should avoid using % because it takes about 3us to compute a%100! Any advice is welcome.
Code in RAM can definitely result in larger problems than data in RAM.
With data in RAM, undamaged code can keep multiple copies and perform multiple evaluations to verify that the multiple computations give similar results.
With code in RAM, the program may do just about anything. Code corruption will hopefully result in a trap after the program tries to access protected memory areas or gets an invalid opcode. But the only real protection from code corruption is to have multiple processors connected to some majority-vote hardware.
But an important issue here is that the stack stores not just parameter data but also return pointers which is basically function pointers. So stack corruption can result in random code execution just as if processor instructions was stored in RAM. And it's impossible to use any checksumming to protect from stack corruption. We need microcontrollers with ECC-protected RAM if we really want to reduce the dangers from RAM corruption caused by EMI, radioactivity etc.