@@ -318,9 +318,9 @@ int esp32_apptrace_dest_init(struct esp32_apptrace_dest dest[], const char *dest
318318 return i ;
319319}
320320
321- int esp32_apptrace_dest_cleanup (struct esp32_apptrace_dest dest [], int max_dests )
321+ int esp32_apptrace_dest_cleanup (struct esp32_apptrace_dest dest [], unsigned int max_dests )
322322{
323- for (int i = 0 ; i < max_dests ; i ++ ) {
323+ for (unsigned int i = 0 ; i < max_dests ; i ++ ) {
324324 if (dest [i ].clean && dest [i ].priv ) {
325325 int res = dest [i ].clean (dest [i ].priv );
326326 dest [i ].priv = NULL ;
@@ -511,7 +511,9 @@ int esp32_apptrace_cmd_ctx_init(struct target *target, struct esp32_apptrace_cmd
511511
512512 cmd_ctx -> running = 1 ;
513513 if (cmd_ctx -> mode != ESP_APPTRACE_CMD_MODE_SYNC ) {
514- int res = target_register_timer_callback (esp32_apptrace_data_processor , 0 , TARGET_TIMER_TYPE_PERIODIC ,
514+ int res = target_register_timer_callback (esp32_apptrace_data_processor ,
515+ 0 ,
516+ TARGET_TIMER_TYPE_PERIODIC ,
515517 cmd_ctx );
516518 if (res != ERROR_OK ) {
517519 LOG_ERROR ("Failed to start trace data timer callback (%d)!" , res );
@@ -621,12 +623,11 @@ static int esp32_apptrace_cmd_init(struct target *target,
621623 cmd_ctx -> stop_tmo = -1.0 ; /* infinite */
622624 cmd_data -> max_len = UINT32_MAX ;
623625 cmd_data -> poll_period = 0 /*ms*/ ;
624- if (argc > 1 ) {
626+ if (argc > 1 )
625627 /* parse remaining args */
626628 esp32_apptrace_cmd_args_parse (cmd_ctx , cmd_data , & argv [1 ], argc - 1 );
627- }
628- LOG_USER (
629- "App trace params: from %d cores, size %" PRId32 " bytes, stop_tmo %g s, poll period %" PRId32
629+
630+ LOG_USER ("App trace params: from %d cores, size %" PRId32 " bytes, stop_tmo %g s, poll period %" PRId32
630631 " ms, wait_rst %d, skip %" PRId32 " bytes" , cmd_ctx -> cores_num ,
631632 cmd_data -> max_len ,
632633 cmd_ctx -> stop_tmo ,
@@ -880,7 +881,7 @@ int esp_apptrace_usr_block_write(const struct esp32_apptrace_hw *hw, struct targ
880881 }
881882
882883 return hw -> buffs_write (target ,
883- sizeof (buf_sz ) / sizeof ( buf_sz [ 0 ] ),
884+ ARRAY_SIZE (buf_sz ),
884885 buf_sz ,
885886 bufs ,
886887 block_id ,
@@ -956,7 +957,7 @@ static int esp32_apptrace_process_data(struct esp32_apptrace_cmd_ctx *ctx,
956957 if (cmd_data -> data_dest .log_progress )
957958 LOG_USER ("%" PRId32 " " , ctx -> tot_len );
958959 /* check for stop condition */
959- if (( ctx -> tot_len > cmd_data -> skip_len ) && (ctx -> tot_len - cmd_data -> skip_len >= cmd_data -> max_len )) {
960+ if (ctx -> tot_len > cmd_data -> skip_len && (ctx -> tot_len - cmd_data -> skip_len >= cmd_data -> max_len )) {
960961 ctx -> running = 0 ;
961962 if (duration_measure (& ctx -> read_time ) != 0 ) {
962963 LOG_ERROR ("Failed to stop trace read time measure!" );
@@ -1102,7 +1103,7 @@ static int esp32_apptrace_poll(void *priv)
11021103 /* LOG_DEBUG("Block %d (%d bytes) on target (%s)!", target_state[0].block_id,
11031104 * target_state[0].data_len, target_name(ctx->cpus[0])); */
11041105 if (fired_target_num == UINT32_MAX ) {
1105- /* no data has been received, but block could be switched due to the data transfered
1106+ /* no data has been received, but block could be switched due to the data transferred
11061107 * from host to target */
11071108 if (ctx -> cores_num > 1 ) {
11081109 uint32_t max_block_id = 0 , min_block_id = ctx -> hw -> max_block_id ;
@@ -1621,7 +1622,7 @@ int esp32_cmd_apptrace_generic(struct target *target, int mode, const char **arg
16211622 }
16221623 s_at_cmd_ctx .stop_tmo = 0.01 ; /* use small stop tmo */
16231624 s_at_cmd_ctx .process_data = esp32_apptrace_process_data ;
1624- /* check for exit signal and comand completion */
1625+ /* check for exit signal and command completion */
16251626 while (!openocd_is_shutdown_pending () && s_at_cmd_ctx .running ) {
16261627 res = esp32_apptrace_poll (& s_at_cmd_ctx );
16271628 if (res != ERROR_OK ) {
0 commit comments