The debug register configure code list below:
i use the Generate_Stack_error() function to test this stack checking mechanism, but nothing happened! i wonder what's wrong with my code? Thank you very much!
PS:(__STACK_SIZE = 4096 )
anyone help that?
I have never tried this before, but I found, there is DAC1 and DAC2 settings in DBCR0 register. DAC1 and DAC2 should be set to 0x3, please look at the figures below:
Please try and let me know, if it helps.
i tried, but it seems do not work.
PS: i expect when run Generate_Stack_error() function, the machinecheck_handler will happen
Sorry for delay, I did not forget about this case, but I am little bit overloaded right now. I will try to create some simple example as soon as I have some time.
Thank you very much! hope to hear good news from you
Hi Martin, have you tried this ? Thank you very much!
I am really sorry, but I was working on different projects. I will try to focus on this problem today.
do you use debugger probe while you run the code you shared above? If yes, which debug probe you use?
I found two important points.
1) Implicitly, it is not possible to write to debug registers while debugger is attached.
2) The function Generate_Stack_error generates Machine check error by default, because you allocate more memory space than stack size is. The result of this allocation is Machine check exception before the first for loop is executed. Instruction stwux write to address 0x13fffff80 which is out of address range.
Please check, if you have set ME bit in MSR register, if yes, you have to see machine check exception. If not, set ME in MSR register.
Solution for the point two:
You must not allocate static array in the function and use pointer arithmetic instead of it. Check, if any machine check error does not occur while you have debug probe connected.
In the next step, add your assembler code and also DBCR0 settings. Disconnect the debug probe, and run the code. Then attach to micro via debugger and check, if you are in IVOR1 exception.
The PIC above the the read value from register. Is there any wrong for the register's configuration?
I didn't run my program using the debugger. It is running in normal mode(Powerdown-->PowerUP---->RUN)
PS: in my program if the cpu enter IVOR1 interrupt. It will print something to the computer. But whatever i configure, the program run as Nothing happened.
Thank you very much!
Problem solved! It seems configure DBCR2 = 0xC0 0000 will work. Thank you very much!
We are implementing a stack limit check for our MPC5744P based system. We are following the example above and plan to test the functionality using a function like Generate_Stack_error() above. You mention that the function Generate_Stack_error() should be modified so that pointer arithmetic is used instead. Can you please show how the function would look like after such a modification?
Retrieving data ...