From 13134e3800c432a30c6b8cb97ec497547f7fcec4 Mon Sep 17 00:00:00 2001 From: RichardBarry Date: Sun, 24 Apr 2011 19:37:10 +0000 Subject: [PATCH] SmartFusion A2F demo work in progress. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@1386 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../FreeRTOSConfig.h | 11 +++++-- Demo/CORTEX_A2F200_IAR_and_Keil/main-full.c | 33 ++++++------------- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/FreeRTOSConfig.h b/Demo/CORTEX_A2F200_IAR_and_Keil/FreeRTOSConfig.h index b06a3a5c6..de8dac3d1 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/FreeRTOSConfig.h +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/FreeRTOSConfig.h @@ -69,6 +69,12 @@ #ifndef FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H +#ifdef __ICCARM__ + #include + #include + extern uint32_t SystemFrequency; +#endif + /*----------------------------------------------------------- * Application specific definitions. * @@ -81,10 +87,11 @@ * See http://www.freertos.org/a00110.html. *----------------------------------------------------------*/ + #define configUSE_PREEMPTION 1 #define configUSE_IDLE_HOOK 1 #define configUSE_TICK_HOOK 0 -#define configCPU_CLOCK_HZ ( 75000000UL ) +#define configCPU_CLOCK_HZ ( SystemFrequency ) #define configTICK_RATE_HZ ( ( portTickType ) 1000 ) #define configMAX_PRIORITIES ( ( unsigned portBASE_TYPE ) 5 ) #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 90 ) @@ -108,7 +115,7 @@ /* Software timer definitions. */ #define configUSE_TIMERS 1 -#define configTIMER_TASK_PRIORITY ( 3 ) +#define configTIMER_TASK_PRIORITY ( 2 ) #define configTIMER_QUEUE_LENGTH 10 #define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE * 2 ) diff --git a/Demo/CORTEX_A2F200_IAR_and_Keil/main-full.c b/Demo/CORTEX_A2F200_IAR_and_Keil/main-full.c index 51299bc9a..78592ea82 100644 --- a/Demo/CORTEX_A2F200_IAR_and_Keil/main-full.c +++ b/Demo/CORTEX_A2F200_IAR_and_Keil/main-full.c @@ -326,6 +326,12 @@ int main(void) /* Create the web server task. */ xTaskCreate( vuIP_Task, ( signed char * ) "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL ); + + /* The suicide tasks must be created last, as they need to know how many + tasks were running prior to their creation in order to ascertain whether + or not the correct/expected number of tasks are running at any given + time. */ + vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); /* Start the tasks and timer running. */ vTaskStartScheduler(); @@ -443,13 +449,6 @@ static void prvQueueSendTask( void *pvParameters ) portTickType xNextWakeTime; const unsigned long ulValueToSend = 100UL; - /* The suicide tasks must be created last, as they need to know how many - tasks were running prior to their creation in order to ascertain whether - or not the correct/expected number of tasks are running at any given time. - Therefore the standard demo 'death' tasks are not created in main(), but - instead created here. */ - vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY ); - /* The timer command queue will have been filled when the timer test tasks were created in main() (this is part of the test they perform). Therefore, while the check and OLED timers can be created in main(), they cannot be @@ -502,30 +501,16 @@ unsigned long ulReceivedValue; static void vOLEDTimerCallback( xTimerHandle xHandle ) { -volatile size_t xFreeStackSpace; static struct oled_data xOLEDData; static unsigned char ucOffset1 = 0, ucOffset2 = 5; - /* This function is called on each cycle of the idle task. In this case it - does nothing useful, other than report the amount of FreeRTOS heap that - remains unallocated. */ - xFreeStackSpace = xPortGetFreeHeapSize(); - - if( xFreeStackSpace > 100 ) - { - /* By now, the kernel has allocated everything it is going to, so - if there is a lot of heap remaining unallocated then - the value of configTOTAL_HEAP_SIZE in FreeRTOSConfig.h can be - reduced accordingly. */ - } - xOLEDData.line1 = FIRST_LINE; xOLEDData.char_offset1 = ucOffset1++; - xOLEDData.string1 = "www.FreeRTOS.org"; + xOLEDData.string1 = " www.FreeRTOS.org"; xOLEDData.line2 = SECOND_LINE; xOLEDData.char_offset2 = ucOffset2++; - xOLEDData.string2 = "www.FreeRTOS.org"; + xOLEDData.string2 = " www.FreeRTOS.org"; xOLEDData.contrast_val = OLED_CONTRAST_VAL; xOLEDData.on_off = OLED_HORIZ_SCROLL_OFF; @@ -540,6 +525,8 @@ static unsigned char ucOffset1 = 0, ucOffset2 = 5; static void prvSetupHardware( void ) { + SystemCoreClockUpdate(); + /* Disable the Watch Dog Timer */ MSS_WD_disable( ); -- 2.39.5