-
Notifications
You must be signed in to change notification settings - Fork 221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessing FP CSRs crashes the debug unit #820
Comments
I have looked further, and the issue is that accessing the FPU CSRs never completes. When you look at the |
Can you boil that down into a single asm instruction? Perhaps:
|
It isn't accessing the CSR that is the problem, it is accessing the CSR via the debug unit that is the problem. |
I've tried to reset the debug unit when this occurs. The recommended approach to "unsticking" the debug unit is to first reset the hart using Using |
This may or may not be related, but as I understand it, you are attempting to access a non-existant CSR while the core is in debug mode. Assuming that this qualified as a debug exception, the core will jump to address What does the BSP expect to happen when an exception occurs when the core is in debug mode? |
That is not correct; it should point to the appropriate address in the Debug Module. |
Resurrecting this discussion...
This was resolved in CORE-V-MCU Issue #194:
Having said that, we have not confirmed that this issue was investigated at the CV32E40P core level, and I do not see any attempt to access floating point CSRs in any of the |
I'll try to answer to the question of accessing FCSR in debug routines while in debug mode. If you are using CV32E40Pv1 or CV32E40Pv2 without FPU, accessing FPU CSR of FREGS will directly jump to debug exception handler at dm_exception_addr_i. Related to those FCSR/FREGS accesses there is a gcc issue on interrupt routine preamble generation which doesn't look at MSTATUS.FS and creates deadlock situation in some cases when interrupts are received. And to answer to the last question of Mike, yes we do execute F state (FCSR & FREGS) save/restore in debug program code as part of CV32E40Pv2 verification test plan. |
Thanks for this Pascal. I knew most, but not all of this. Very helpful. A few comments/questions:
This is a surprise. I would have thought that accessing FPU CSRs or FREGS when FPU==0 or MSTATUS.FS = OFF would result in an illegal instruction, not a trap to debug-mode.
Can you point me at the right test-program for this? |
This is what I meant, jump to exception handler specific to debug (dm_exception_addr_i) as this happens during debug program execution while in debug mode.
corev_rand_pulp_instr_debug |
At the request of @MikeOpenHWGroup this is a duplicate of
core-v-mcu
issue #159Accessing FP CSRs crashes the debug unit
Type
Indicate whether the type of problem you found:
Steps to Reproduce
Please provide:
First build verilator model library from the core-v-mcu repository. Note: Requires using Verilator 4.200 or later (the example here was using 4.203).
The Verilator model driver is in @jeremybennett fork of the embdebug-target-core-v repository repository. Build as follows (Linux instructions)
jpb-fpu-csr-access-issue
branch and switch to thetarget
directoryMCU_DIR
points points to your checkout of thecore-v-mcu
repository.Note how the
cycle
,instret
CSRs and PC (also a CSR) are read successfully. Then a non-existent FPU CSR is read. Thecycle
,instret
CSRs and PC now all return the last value read successfully (the previous read of the PC).(use a VCD filename of your choice), which will create a VCD in the directory where the program is run.
The text was updated successfully, but these errors were encountered: