mirror of
https://github.com/FreeRTOS/FreeRTOS.git
synced 2025-06-19 22:57:57 +08:00
Implement dumping the Tracelyzer trace when pressing enter (#252)
* Test: Press Enter to Trace dump on posix demo * Test: allow tracedump multiple times * Fix: main full demo
This commit is contained in:
@ -19,8 +19,8 @@
|
||||
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
* http://www.FreeRTOS.org
|
||||
* http://aws.amazon.com/freertos
|
||||
* https://www.FreeRTOS.org
|
||||
* https://github.com/FreeRTOS
|
||||
*
|
||||
* 1 tab == 4 spaces!
|
||||
*/
|
||||
@ -79,7 +79,7 @@
|
||||
extern void main_blinky( void );
|
||||
extern void main_full( void );
|
||||
extern void main_tcp_echo_client_tasks( void );
|
||||
|
||||
static void traceOnEnter( void );
|
||||
/*
|
||||
* Only the comprehensive demo uses application hook (callback) functions. See
|
||||
* http://www.freertos.org/a00016.html for more information.
|
||||
@ -135,6 +135,7 @@ int main( void )
|
||||
/* Start the trace recording - the recording is written to a file if
|
||||
configASSERT() is called. */
|
||||
printf( "\r\nTrace started.\r\nThe trace will be dumped to disk if a call to configASSERT() fails.\r\n" );
|
||||
printf( "\r\nThe trace will be dumped to disk if Enter is hit.\r\n" );
|
||||
uiTraceStart();
|
||||
}
|
||||
#endif
|
||||
@ -142,24 +143,23 @@ int main( void )
|
||||
console_init();
|
||||
#if ( mainSELECTED_APPLICATION == ECHO_CLIENT_DEMO )
|
||||
{
|
||||
console_print("Starting echo client demo\n");
|
||||
console_print("Starting echo client demo\n");
|
||||
main_tcp_echo_client_tasks();
|
||||
}
|
||||
#elif ( mainSELECTED_APPLICATION == BLINKY_DEMO )
|
||||
{
|
||||
console_print("Starting echo blinky demo\n");
|
||||
console_print("Starting echo blinky demo\n");
|
||||
main_blinky();
|
||||
}
|
||||
#elif ( mainSELECTED_APPLICATION == FULL_DEMO)
|
||||
{
|
||||
console_print("Starting full demo\n");
|
||||
console_print("Starting full demo\n");
|
||||
main_full();
|
||||
}
|
||||
#else
|
||||
{
|
||||
#error "The selected demo is not valid"
|
||||
}
|
||||
|
||||
#endif /* if ( mainSELECTED_APPLICATION ) */
|
||||
|
||||
return 0;
|
||||
@ -197,11 +197,14 @@ void vApplicationIdleHook( void )
|
||||
allocated by the kernel to any task that has since deleted itself. */
|
||||
|
||||
|
||||
usleep(15000);
|
||||
traceOnEnter();
|
||||
|
||||
#if ( mainSELECTED_APPLICATION == FULL_DEMO )
|
||||
{
|
||||
/* Call the idle task processing used by the full demo. The simple
|
||||
blinky demo does not use the idle task hook. */
|
||||
vFullDemoIdleFunction();
|
||||
vFullDemoIdleFunction();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -237,6 +240,26 @@ void vApplicationTickHook( void )
|
||||
#endif /* mainSELECTED_APPLICATION */
|
||||
}
|
||||
|
||||
void traceOnEnter()
|
||||
{
|
||||
int ret;
|
||||
struct timeval tv = { 0L, 0L };
|
||||
fd_set fds;
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(0, &fds);
|
||||
ret = select(1, &fds, NULL, NULL, &tv);
|
||||
if ( ret > 0 )
|
||||
{
|
||||
if( xTraceRunning == pdTRUE )
|
||||
{
|
||||
prvSaveTraceFile();
|
||||
}
|
||||
/* clear the buffer */
|
||||
char buffer[200];
|
||||
read(1, &buffer, 200);
|
||||
}
|
||||
}
|
||||
|
||||
void vLoggingPrintf( const char *pcFormat,
|
||||
... )
|
||||
{
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
/*
|
||||
*******************************************************************************
|
||||
* NOTE 1: The Linux port is a simulation (or is that emulation?) only! Do not
|
||||
* expect to get real time behaviour from the Linux port or this demo
|
||||
* NOTE 1: The POSIX port is a simulation (or is that emulation?) only! Do not
|
||||
* expect to get real time behaviour from the POSIX port or this demo
|
||||
* application. It is provided as a convenient development and demonstration
|
||||
* test bed only.
|
||||
*
|
||||
@ -719,13 +719,6 @@ uint32_t ulIdleExecutionTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ulIdleExecutionTime = ulTaskGetIdleRunTimeCounter();
|
||||
if( ulIdleExecutionTime == ulLastIdleExecutionTime )
|
||||
{
|
||||
pcStatusMessage = "Error: Total amount of Idle task execution time did not change";
|
||||
}
|
||||
ulLastIdleExecutionTime = ulIdleExecutionTime;
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
Reference in New Issue
Block a user