@@ -130,7 +130,8 @@ static const command_s cmd_list[] = {
130130#endif
131131#ifdef ENABLE_RTT
132132 {"rtt" , cmd_rtt ,
133- "[enable|disable|status|channel [0..15 ...]|ident [STR]|cblock|ram [RAM_START RAM_END]|poll [MAXMS MINMS "
133+ "[enable|disable|detect|status|channel [0..15 ...]|ident [STR]|cblock|ram [RAM_START RAM_END]|poll [MAXMS "
134+ "MINMS "
134135 "MAXERR]]" },
135136#endif
136137#ifdef PLATFORM_HAS_TRACESWO
@@ -667,6 +668,20 @@ static bool cmd_rtt_status(target_s *const target)
667668 return true;
668669}
669670
671+ static bool cmd_rtt_detect (target_s * const target )
672+ {
673+ if (target == NULL ) {
674+ gdb_outf ("Not attached to target\n" );
675+ return true;
676+ }
677+ poll_rtt (target );
678+ if (rtt_found )
679+ gdb_outf ("Found RTT control block at: %08" PRIx32 "\n" , rtt_cbaddr );
680+ else
681+ gdb_outf ("Failed to locate RTT control block\n" );
682+ return true;
683+ }
684+
670685static bool cmd_rtt (target_s * target , int argc , const char * * argv )
671686{
672687 /* If no arguments are given, return the status information */
@@ -691,6 +706,8 @@ static bool cmd_rtt(target_s *target, int argc, const char **argv)
691706 }
692707 if (!strncmp (command , "status" , command_len ) && argc == 2 )
693708 return cmd_rtt_status (target );
709+ if (!strncmp (command , "detect" , command_len ) && argc == 2 )
710+ return cmd_rtt_detect (target );
694711 if (!strncmp (command , "channel" , command_len )) {
695712 /* Reset the enables */
696713 for (size_t channel = 0 ; channel < MAX_RTT_CHAN ; ++ channel )
0 commit comments