]> git.sur5r.net Git - freertos/commitdiff
Introduce option that permits a smaller printf() library to be used when sizeof(...
authorrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 6 Jan 2011 11:10:51 +0000 (11:10 +0000)
committerrichardbarry <richardbarry@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Thu, 6 Jan 2011 11:10:51 +0000 (11:10 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1233 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

Source/portable/CCS4/MSP430X/portmacro.h
Source/portable/IAR/MSP430X/portmacro.h
Source/tasks.c

index d4422d9ec03e4752fc594b688fb3d5be84f08f32..cea0e4ace5a3916ef9e21bcc4eef5ffc0eb40950 100644 (file)
@@ -156,5 +156,9 @@ extern void vTaskSwitchContext( void );
        \r
 void vApplicationSetupTimerInterrupt( void );\r
 \r
+/* sizeof( int ) != sizeof( long ) so a full printf() library is required if\r
+run time stats information is to be displayed. */\r
+#define portLU_PRINTF_SPECIFIER_REQUIRED\r
+\r
 #endif /* PORTMACRO_H */\r
 \r
index d52f130e1f686e4b187d7c4c6f26af05f8b01e01..0e3b284bdf8b7bcc409a62eaa08bad62eae2433a 100644 (file)
@@ -156,5 +156,9 @@ extern void vTaskSwitchContext( void );
        \r
 void vApplicationSetupTimerInterrupt( void );\r
 \r
+/* sizeof( int ) != sizeof( long ) so a full printf() library is required if\r
+run time stats information is to be displayed. */\r
+#define portLU_PRINTF_SPECIFIER_REQUIRED\r
+\r
 #endif /* PORTMACRO_H */\r
 \r
index 3f8d1aad01655e887ac6410f269cac91aa4c8cdc..ab4bc9f384322ab68569918a8dd645147dd87598 100644 (file)
@@ -2131,13 +2131,33 @@ tskTCB *pxNewTCB;
 \r
                                        if( ulStatsAsPercentage > 0UL )\r
                                        {\r
-                                               sprintf( pcStatsString, ( char * ) "%s\t\t%lu\t\t%lu%%\r\n", pxNextTCB->pcTaskName, pxNextTCB->ulRunTimeCounter, ulStatsAsPercentage );\r
+                                               #ifdef portLU_PRINTF_SPECIFIER_REQUIRED\r
+                                               {\r
+                                                       sprintf( pcStatsString, ( char * ) "%s\t\t%lu\t\t%lu%%\r\n", pxNextTCB->pcTaskName, pxNextTCB->ulRunTimeCounter, ulStatsAsPercentage );                                                 \r
+                                               }\r
+                                               #else\r
+                                               {\r
+                                                       /* sizeof( int ) == sizeof( long ) so a smaller\r
+                                                       printf() library can be used. */\r
+                                                       sprintf( pcStatsString, ( char * ) "%s\t\t%u\t\t%u%%\r\n", pxNextTCB->pcTaskName, ( unsigned int ) pxNextTCB->ulRunTimeCounter, ( unsigned int ) ulStatsAsPercentage );\r
+                                               }\r
+                                               #endif\r
                                        }\r
                                        else\r
                                        {\r
                                                /* If the percentage is zero here then the task has\r
                                                consumed less than 1% of the total run time. */\r
-                                               sprintf( pcStatsString, ( char * ) "%s\t\t%lu\t\t<1%%\r\n", pxNextTCB->pcTaskName, pxNextTCB->ulRunTimeCounter );\r
+                                               #ifdef portLU_PRINTF_SPECIFIER_REQUIRED\r
+                                               {\r
+                                                       sprintf( pcStatsString, ( char * ) "%s\t\t%lu\t\t<1%%\r\n", pxNextTCB->pcTaskName, pxNextTCB->ulRunTimeCounter );                                                       \r
+                                               }\r
+                                               #else\r
+                                               {\r
+                                                       /* sizeof( int ) == sizeof( long ) so a smaller\r
+                                                       printf() library can be used. */\r
+                                                       sprintf( pcStatsString, ( char * ) "%s\t\t%u\t\t<1%%\r\n", pxNextTCB->pcTaskName, ( unsigned int ) pxNextTCB->ulRunTimeCounter );\r
+                                               }\r
+                                               #endif\r
                                        }\r
                                }\r
 \r