File tree Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Expand file tree Collapse file tree 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -555,13 +555,21 @@ int esp32_apptrace_cmd_ctx_init(struct target *target,
555
555
* TODO: remove that dependency */
556
556
assert (cmd_ctx -> cores_num <= ESP32_APPTRACE_MAX_CORES_NUM && "Too many cores number!" );
557
557
558
- /* TODO: find better way to detect chip arch */
559
- if (strncmp (target_type_name (target ), "esp32c3" , 7 ) == 0 ) {
560
- cmd_ctx -> hw = target_to_esp_riscv (target )-> apptrace .hw ;
561
- cmd_ctx -> algo_hw = target_to_esp_riscv (target )-> algo_hw ;
558
+ const char * arch = target_get_gdb_arch (target );
559
+ if (arch != NULL ) {
560
+ if (strncmp (arch , "riscv" , 5 ) == 0 ) {
561
+ cmd_ctx -> hw = target_to_esp_riscv (target )-> apptrace .hw ;
562
+ cmd_ctx -> algo_hw = target_to_esp_riscv (target )-> algo_hw ;
563
+ } else if (strncmp (arch , "xtensa" , 6 ) == 0 ) {
564
+ cmd_ctx -> hw = target_to_esp_xtensa (target )-> apptrace .hw ;
565
+ cmd_ctx -> algo_hw = target_to_esp_xtensa (target )-> algo_hw ;
566
+ } else {
567
+ LOG_ERROR ("Unsupported target arch '%s'!" , arch );
568
+ return ERROR_FAIL ;
569
+ }
562
570
} else {
563
- cmd_ctx -> hw = target_to_esp_xtensa ( target ) -> apptrace . hw ;
564
- cmd_ctx -> algo_hw = target_to_esp_xtensa ( target ) -> algo_hw ;
571
+ LOG_ERROR ( "Unsupported target arch '%s'!" , arch ) ;
572
+ return ERROR_FAIL ;
565
573
}
566
574
567
575
cmd_ctx -> max_trace_block_sz = cmd_ctx -> hw -> max_block_size_get (cmd_ctx -> cpus [0 ]);
You can’t perform that action at this time.
0 commit comments