File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,8 @@ typedef enum slot {
121121
122122/*** Info about the core being debugged. ***/
123123
124- #define WALL_CLOCK_TIMEOUT 2
124+ #define WALL_CLOCK_TIMEOUT 2
125+ #define WALL_CLOCK_RESET_TIMEOUT 30
125126
126127struct trigger {
127128 uint64_t address ;
@@ -1882,14 +1883,17 @@ void riscv013_reset_current_hart(struct target *target)
18821883 control = set_field (control , DMI_DMCONTROL_NDMRESET , 0 );
18831884 dmi_write (target , DMI_DMCONTROL , control );
18841885
1885- for (unsigned i = 0 ; i < 256 ; i ++ ) {
1886+ time_t start = time (NULL );
1887+
1888+ while (1 ) {
18861889 uint32_t dmstatus = dmi_read (target , DMI_DMSTATUS );
18871890 if (get_field (dmstatus , DMI_DMSTATUS_ALLHALTED )) {
18881891 break ;
18891892 }
1890- if (i == 255 ) {
1891- LOG_ERROR ("Hart didn't halt coming out of reset; dmstatus=0x%x" ,
1892- dmstatus );
1893+ if (time (NULL ) - start > WALL_CLOCK_RESET_TIMEOUT ) {
1894+ LOG_ERROR ("Hart didn't halt coming out of reset in %ds; "
1895+ "dmstatus=0x%x" , WALL_CLOCK_RESET_TIMEOUT , dmstatus );
1896+ return ;
18931897 }
18941898 }
18951899
You can’t perform that action at this time.
0 commit comments