Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Question on example-pmp demo #455

Open
yuhui-zheng opened this issue Apr 1, 2020 · 3 comments
Open

Question on example-pmp demo #455

yuhui-zheng opened this issue Apr 1, 2020 · 3 comments

Comments

@yuhui-zheng
Copy link

yuhui-zheng commented Apr 1, 2020

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 enter store_access_fault_handler(), which is incorrect. I'm also observing protected_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

SiFive Eclipse IDE for C/C++ Development
Version: 4.12.0.2019-08-2

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 read protected_global[0], the program enters load_access_fault_handler(), which is as expected. So, questioning the write access exception part...

@taovcu
Copy link

taovcu commented May 21, 2021

I repeat the above tests on SiFive HiFive1 revb with same observations.

@taovcu
Copy link

taovcu commented May 21, 2021

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.

@Virtual-Machine
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants