Open yuhui-zheng opened 4 years ago
I repeat the above tests on SiFive HiFive1 revb with same observations.
After I reset the board and run the original code again, I see the "store_access_fault_handler" is triggered. I add a printf("Entered store_access_fault_handler !\n") tag statement at the beginning of the handler function, I see the log is printed.
I also have an hifive1 revb and am having the same issue. In fact it wasn't mentioned above but after loading this program, I am forced to use safe mode to recover to a new program. Just mentioning this in case someone else gets stuck after trying to run this.
To get into safe mode press 'reset' and when the green led flashes immediately press it again. If you time it right then it should start flashing red. This will now allow you to overwrite with a new program while led is flashing red.
I'm experimenting with the example-pmp demo https://github.com/sifive/example-pmp/blob/master/example-pmp.c. At line 100, it seems
mcause
register is not set for me and program doesn't enterstore_access_fault_handler()
, which is incorrect. I'm also observingprotected_global[0]
is not updated by executing line 100, which is the correct behavior. Could you confirm this is the intended behavior on SiFive HiFive1 revb? Thank you.I'm using
More steps taken to identify the issue scope: I also modified the demo -- have a
load_access_fault_handler()
and register the exception with error code = 5. (Per RISC-V privileged spec v1.10 section 3.1.20, load access fault has error code 0x05.) This time I set the same region to be R=0 (cannot read). Now if I readprotected_global[0]
, the program entersload_access_fault_handler()
, which is as expected. So, questioning the write access exception part...