Fix: Build enable trace facility (#890)

* Fix IAR GCC build for Qemu MPS2

* Add removed file

* Add timer function for runtime stats

* Add lexicon entry
pull/894/head
alfred gedeon 2 years ago committed by GitHub
parent e85b49ad18
commit 101c263371
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -82,4 +82,4 @@ jobs:
- name: Qemu MPS2 MPU build Cortex M3
run: cd workspace/FreeRTOS/Demo/CORTEX_MPU_M3_MPS2_QEMU_GCC && make
- name: Qemu MPS2 IAR build Cortex M3
run: cd workspace/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/build/gcc && sed -i '/configUSE_STATS_FORMATTING_FUNCTIONS/c\#define configUSE_STATS_FORMATTING_FUNCTIONS 0' ../../FreeRTOSConfig.h && make
run: cd workspace/FreeRTOS/Demo/CORTEX_MPS2_QEMU_IAR_GCC/build/gcc && make

@ -39,6 +39,15 @@
* See http://www.freertos.org/a00110.html
*----------------------------------------------------------*/
#define configUSE_TRACE_FACILITY 1
#define configGENERATE_RUN_TIME_STATS 1
void vConfigureTimerForRunTimeStats( void );
unsigned long ulGetRunTimeCounterValue( void );
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() vConfigureTimerForRunTimeStats( )
#define portGET_RUN_TIME_COUNTER_VALUE() ulGetRunTimeCounterValue()
#define configUSE_TICKLESS_IDLE 0
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
@ -48,7 +57,6 @@
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 80 )
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 60 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 12 )
#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
#define configUSE_MUTEXES 1

@ -50,6 +50,8 @@
#include "FreeRTOS.h"
#include "task.h"
#include "CMSDK_CM3.h"
/* Standard includes. */
#include <stdio.h>
#include <string.h>
@ -75,6 +77,11 @@ required UART registers. */
#define UART0_BAUDDIV ( * ( ( ( volatile uint32_t * )( UART0_ADDRESS + 16UL ) ) ) )
#define TX_BUFFER_MASK ( 1UL )
#define TIMER_POSTSCALER ( 8UL )
/* Time at start of day (in ns). */
static volatile unsigned long ulRunTimeOverflowCount = 0U;
/*
* main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
* main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
@ -307,6 +314,37 @@ void *malloc( size_t size )
for( ;; );
}
/*-----------------------------------------------------------*/
void vConfigureTimerForRunTimeStats( void )
{
/* PCLK / SystemCoreClock is 25MHz, Timer clock is always PCLK */
CMSDK_TIMER0->CTRL &= ~( CMSDK_TIMER_CTRL_EN_Msk );
CMSDK_TIMER0->RELOAD = 0xFFFFFFFF;
/* Enable overflow interrupt and start the timer */
CMSDK_TIMER0->CTRL |= CMSDK_TIMER_CTRL_IRQEN_Msk;
CMSDK_TIMER0->CTRL |= CMSDK_TIMER_CTRL_EN_Msk;
}
/*-----------------------------------------------------------*/
unsigned long ulGetRunTimeCounterValue( void )
{
unsigned long ulTimerValue = CMSDK_TIMER0->RELOAD - CMSDK_TIMER0->VALUE;
/*
* 32 bits will overflow after ~ ( 2**32 / 25000000 ) == 171 seconds,
* So we remove the lower 8 bits and borrow 8 bits from the overflow counter.
*/
ulTimerValue = ( ulTimerValue >> TIMER_POSTSCALER );
/* Add remaining 8 bits from ulRunTimeOverflowCount */
ulTimerValue |= ( ulRunTimeOverflowCount << ( 32UL - TIMER_POSTSCALER ) );
return ulTimerValue;
}

@ -2923,6 +2923,7 @@ ulreportid
ulrestartoffset
ulreturned
ulrlar
ulruntimeoverflowcount
ulsecondnotificationvalueconst
ulsecondnotifiedconst
ulsecondnotifiedvalueconst

Loading…
Cancel
Save