diff --git a/include/FreeRTOSConfig.h b/include/FreeRTOSConfig.h index a70347dff..fad0cf741 100644 --- a/include/FreeRTOSConfig.h +++ b/include/FreeRTOSConfig.h @@ -87,15 +87,14 @@ #define configUSE_DAEMON_TASK_STARTUP_HOOK 0 /* Run time and task stats gathering related definitions. */ -#define configUSE_TRACE_FACILITY 0 // switch on task status output -#define configGENERATE_RUN_TIME_STATS configUSE_TRACE_FACILITY +#define configGENERATE_RUN_TIME_STATS 0 // switch on task status output #define configUSE_STATS_FORMATTING_FUNCTIONS 0 -#if configUSE_TRACE_FACILITY +#if configGENERATE_RUN_TIME_STATS #define TF_TIMER_BASE _u(0x40054000) #define TF_TIMER_TIMERAWL_OFFSET _u(0x00000028) - #warning "configUSE_TRACE_FACILITY is set" + #warning "configGENERATE_RUN_TIME_STATS is set" #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() do {} while( 0 ) #define portALT_GET_RUN_TIME_COUNTER_VALUE( dest ) ( dest = *((uint32_t *)(TF_TIMER_BASE + TF_TIMER_TIMERAWL_OFFSET)) ) #endif @@ -123,9 +122,8 @@ #define configRUN_MULTIPLE_PRIORITIES 1 #if configNUM_CORES != 1 #define configUSE_CORE_AFFINITY 1 -#endif -#if !defined(configUSE_CORE_AFFINITY) || configUSE_CORE_AFFINITY == 0 - #define xTaskCreateAffinitySet(FUN,NAM,STK,PAR,PRI,AFF,HND) xTaskCreate(FUN,NAM,STK,PAR,PRI,HND) + #undef configUSE_TRACE_FACILITY + #define configUSE_TRACE_FACILITY 1 // required for setup of core affinity #endif /* RP2040 specific */ diff --git a/src/main.c b/src/main.c index 8f4031f09..4575e6802 100644 --- a/src/main.c +++ b/src/main.c @@ -361,7 +361,7 @@ void dap_task(void *ptr) -#if configUSE_TRACE_FACILITY +#if configGENERATE_RUN_TIME_STATS static uint32_t tusb_count; static TimerHandle_t timer_task_stat; static EventGroupHandle_t events_task_stat; @@ -473,7 +473,7 @@ void print_task_stat(void *ptr) prev_tick_us[task_ndx] = curr_tick; } printf("---------------------------------------\n"); - printf(" %3lu %3lu\n", percent_sum, percent_total_sum); + printf(" %4lu %4lu\n", percent_sum, percent_total_sum); } printf("---------------------------------------\n"); @@ -542,7 +542,7 @@ void usb_thread(void *ptr) xTaskCreate(dap_task, "CMSIS-DAP", configMINIMAL_STACK_SIZE, NULL, DAP_TASK_PRIO, &dap_taskhandle); #endif -#if configUSE_TRACE_FACILITY +#if configGENERATE_RUN_TIME_STATS { TaskHandle_t task_stat_handle; xTaskCreate(print_task_stat, "Print Task Stat", configMINIMAL_STACK_SIZE, NULL, 30, &task_stat_handle); @@ -585,7 +585,7 @@ void usb_thread(void *ptr) tusb_init(); for (;;) { -#if configUSE_TRACE_FACILITY +#if configGENERATE_RUN_TIME_STATS ++tusb_count; #endif tud_task(); // the FreeRTOS version goes into blocking state if its event queue is empty diff --git a/src/rtt_console.c b/src/rtt_console.c index 40d1faa6f..0e6dc3eb7 100755 --- a/src/rtt_console.c +++ b/src/rtt_console.c @@ -231,6 +231,7 @@ static uint16_t ft_channel; static uint32_t ft_rtt_cb; static uint8_t ft_buf[256]; static uint32_t ft_cnt; +static bool ft_ok; static void rtt_from_target_thread(void *) /** @@ -240,13 +241,11 @@ static void rtt_from_target_thread(void *) */ { for (;;) { - bool ok; - xEventGroupWaitBits(events, EV_RTT_FROM_TARGET_STRT, pdTRUE, pdFALSE, portMAX_DELAY); - ok = swd_read_word(ft_rtt_cb + offsetof(SEGGER_RTT_CB, aUp[ft_channel].WrOff), (uint32_t *)&(ft_aUp->WrOff)); + ft_ok = swd_read_word(ft_rtt_cb + offsetof(SEGGER_RTT_CB, aUp[ft_channel].WrOff), (uint32_t *)&(ft_aUp->WrOff)); - if (ok && ft_aUp->WrOff != ft_aUp->RdOff) { + if (ft_ok && ft_aUp->WrOff != ft_aUp->RdOff) { // // fetch data from target // @@ -259,9 +258,9 @@ static void rtt_from_target_thread(void *) ft_cnt = MIN(ft_cnt, sizeof(ft_buf)); memset(ft_buf, 0, sizeof(ft_buf)); - ok = ok && swd_read_memory((uint32_t)ft_aUp->pBuffer + ft_aUp->RdOff, ft_buf, ft_cnt); + ft_ok = ft_ok && swd_read_memory((uint32_t)ft_aUp->pBuffer + ft_aUp->RdOff, ft_buf, ft_cnt); ft_aUp->RdOff = (ft_aUp->RdOff + ft_cnt) % ft_aUp->SizeOfBuffer; - ok = ok && swd_write_word(ft_rtt_cb + offsetof(SEGGER_RTT_CB, aUp[ft_channel].RdOff), ft_aUp->RdOff); + ft_ok = ft_ok && swd_write_word(ft_rtt_cb + offsetof(SEGGER_RTT_CB, aUp[ft_channel].RdOff), ft_aUp->RdOff); } else { ft_cnt = 0; @@ -299,7 +298,7 @@ static bool rtt_from_target(uint32_t rtt_cb, uint16_t channel, SEGGER_RTT_BUFFER *worked = true; } } - return true; + return ft_ok; #else bool ok = true; uint8_t buf[256];