@@ -318,9 +318,9 @@ int esp32_apptrace_dest_init(struct esp32_apptrace_dest dest[], const char *dest
318
318
return i ;
319
319
}
320
320
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 )
322
322
{
323
- for (int i = 0 ; i < max_dests ; i ++ ) {
323
+ for (unsigned int i = 0 ; i < max_dests ; i ++ ) {
324
324
if (dest [i ].clean && dest [i ].priv ) {
325
325
int res = dest [i ].clean (dest [i ].priv );
326
326
dest [i ].priv = NULL ;
@@ -511,7 +511,9 @@ int esp32_apptrace_cmd_ctx_init(struct target *target, struct esp32_apptrace_cmd
511
511
512
512
cmd_ctx -> running = 1 ;
513
513
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 ,
515
517
cmd_ctx );
516
518
if (res != ERROR_OK ) {
517
519
LOG_ERROR ("Failed to start trace data timer callback (%d)!" , res );
@@ -621,12 +623,11 @@ static int esp32_apptrace_cmd_init(struct target *target,
621
623
cmd_ctx -> stop_tmo = -1.0 ; /* infinite */
622
624
cmd_data -> max_len = UINT32_MAX ;
623
625
cmd_data -> poll_period = 0 /*ms*/ ;
624
- if (argc > 1 ) {
626
+ if (argc > 1 )
625
627
/* parse remaining args */
626
628
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
630
631
" ms, wait_rst %d, skip %" PRId32 " bytes" , cmd_ctx -> cores_num ,
631
632
cmd_data -> max_len ,
632
633
cmd_ctx -> stop_tmo ,
@@ -880,7 +881,7 @@ int esp_apptrace_usr_block_write(const struct esp32_apptrace_hw *hw, struct targ
880
881
}
881
882
882
883
return hw -> buffs_write (target ,
883
- sizeof (buf_sz ) / sizeof ( buf_sz [ 0 ] ),
884
+ ARRAY_SIZE (buf_sz ),
884
885
buf_sz ,
885
886
bufs ,
886
887
block_id ,
@@ -956,7 +957,7 @@ static int esp32_apptrace_process_data(struct esp32_apptrace_cmd_ctx *ctx,
956
957
if (cmd_data -> data_dest .log_progress )
957
958
LOG_USER ("%" PRId32 " " , ctx -> tot_len );
958
959
/* 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 )) {
960
961
ctx -> running = 0 ;
961
962
if (duration_measure (& ctx -> read_time ) != 0 ) {
962
963
LOG_ERROR ("Failed to stop trace read time measure!" );
@@ -1102,7 +1103,7 @@ static int esp32_apptrace_poll(void *priv)
1102
1103
/* LOG_DEBUG("Block %d (%d bytes) on target (%s)!", target_state[0].block_id,
1103
1104
* target_state[0].data_len, target_name(ctx->cpus[0])); */
1104
1105
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
1106
1107
* from host to target */
1107
1108
if (ctx -> cores_num > 1 ) {
1108
1109
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
1621
1622
}
1622
1623
s_at_cmd_ctx .stop_tmo = 0.01 ; /* use small stop tmo */
1623
1624
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 */
1625
1626
while (!openocd_is_shutdown_pending () && s_at_cmd_ctx .running ) {
1626
1627
res = esp32_apptrace_poll (& s_at_cmd_ctx );
1627
1628
if (res != ERROR_OK ) {
0 commit comments