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.
So I write a code to test an SRAM. Basically it just writes variables to some addresses and reads it back for validation. However, when I step through functions/procedures in debug mode, I landed in HardFault_Handler. I am sure the program is there and working since the program functions as expected. The code look like this
void sram_test() { //write to address ... //read it back //print error if not valid } int main(void) { int i; for (i=0; i<31; i++){ *((unsigned char*) ADDR+i) = (unsigned char) i; } sram_test(); // the procedure while(1);//end test }
FYI, these are things that I've tried: 1. I can step the lines before procedure call normally 2. step into the procedure sram_test return to Hardfault_handler 3. When I copy all the sram_test() code into the main, replacing the procedure, I can again step it normally 4. If I run it from RAM using .ini file, I can step it normally even though there is procedure or function calling.
Any kind of help will be appreciated. Thank you!
How do I know if my RAM test doing the overwriting stack?
Actually my code reference is from the same site you give. It is the walking 1 code.
Dupe http://www.keil.com/forum/63023/
The Cortex-M0 is going to be sensitive to alignment of 16/32-bit memory accesses.
>>How do I know if my RAM test doing the overwriting stack?
Start by looking at the addresses involved?