From 81ce0b247d9688f08262b3d919866a57abeffd5f Mon Sep 17 00:00:00 2001 From: rtel Date: Fri, 28 Dec 2018 00:44:18 +0000 Subject: [PATCH] Allow the size of the stack used by many of the standard demo/test tasks to be overridden by FreeRTOSConfig.h settings. Update the Freedom Studio RISC-V project so the 'full' build configuration is now functional. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2614 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- .../Demo/Common/Minimal/EventGroupsDemo.c | 16 ++++-- FreeRTOS/Demo/Common/Minimal/GenQTest.c | 13 +++-- FreeRTOS/Demo/Common/Minimal/TaskNotify.c | 12 ++++- FreeRTOS/Demo/Common/Minimal/TimerDemo.c | 10 ++-- FreeRTOS/Demo/Common/Minimal/blocktim.c | 10 ++-- FreeRTOS/Demo/Common/Minimal/dynamic.c | 7 ++- FreeRTOS/Demo/Common/Minimal/recmutex.c | 10 ++-- .../.cproject | 2 +- .../.settings/language.settings.xml | 4 +- .../FreeRTOSConfig.h | 34 ++++++++---- .../env/freedom-e300-hifive1/dhrystone.lds | 2 +- .../full_demo/main_full.c | 49 ++++++++++-------- .../RISC-V-Qemu-sifive_e-FreedomStudio/main.c | 28 ++++++++-- FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo | Bin 56832 -> 72704 bytes .../Source/portable/GCC/RISC-V-RV32/portASM.S | 2 +- 15 files changed, 138 insertions(+), 61 deletions(-) diff --git a/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c b/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c index 9953082ca..2dc528bc5 100644 --- a/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c +++ b/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c @@ -88,6 +88,14 @@ event bits in a group are unblocked as appropriate as different bits get set. */ #define ebSELECTIVE_BITS_1 0x03 #define ebSELECTIVE_BITS_2 0x05 +#ifndef ebRENDESVOUS_TEST_TASK_STACK_SIZE + #define ebRENDESVOUS_TEST_TASK_STACK_SIZE configMINIMAL_STACK_SIZE +#endif + +#ifndef ebEVENT_GROUP_SET_BITS_TEST_TASK_STACK_SIZE + #define ebEVENT_GROUP_SET_BITS_TEST_TASK_STACK_SIZE configMINIMAL_STACK_SIZE +#endif + /*-----------------------------------------------------------*/ /* @@ -179,10 +187,10 @@ TaskHandle_t xTestSlaveTaskHandle; * * Create the test tasks as described at the top of this file. */ - xTaskCreate( prvTestSlaveTask, "WaitO", configMINIMAL_STACK_SIZE, NULL, ebWAIT_BIT_TASK_PRIORITY, &xTestSlaveTaskHandle ); - xTaskCreate( prvTestMasterTask, "SetB", configMINIMAL_STACK_SIZE, ( void * ) xTestSlaveTaskHandle, ebSET_BIT_TASK_PRIORITY, NULL ); - xTaskCreate( prvSyncTask, "Rndv", configMINIMAL_STACK_SIZE, ( void * ) ebRENDESVOUS_TASK_1_SYNC_BIT, ebWAIT_BIT_TASK_PRIORITY, &xSyncTask1 ); - xTaskCreate( prvSyncTask, "Rndv", configMINIMAL_STACK_SIZE, ( void * ) ebRENDESVOUS_TASK_2_SYNC_BIT, ebWAIT_BIT_TASK_PRIORITY, &xSyncTask2 ); + xTaskCreate( prvTestSlaveTask, "WaitO", ebRENDESVOUS_TEST_TASK_STACK_SIZE, NULL, ebWAIT_BIT_TASK_PRIORITY, &xTestSlaveTaskHandle ); + xTaskCreate( prvTestMasterTask, "SetB", ebEVENT_GROUP_SET_BITS_TEST_TASK_STACK_SIZE, ( void * ) xTestSlaveTaskHandle, ebSET_BIT_TASK_PRIORITY, NULL ); + xTaskCreate( prvSyncTask, "Rndv", ebRENDESVOUS_TEST_TASK_STACK_SIZE, ( void * ) ebRENDESVOUS_TASK_1_SYNC_BIT, ebWAIT_BIT_TASK_PRIORITY, &xSyncTask1 ); + xTaskCreate( prvSyncTask, "Rndv", ebRENDESVOUS_TEST_TASK_STACK_SIZE, ( void * ) ebRENDESVOUS_TASK_2_SYNC_BIT, ebWAIT_BIT_TASK_PRIORITY, &xSyncTask2 ); /* If the last task was created then the others will have been too. */ configASSERT( xSyncTask2 ); diff --git a/FreeRTOS/Demo/Common/Minimal/GenQTest.c b/FreeRTOS/Demo/Common/Minimal/GenQTest.c index 37251f5e3..6f4c1e7cc 100644 --- a/FreeRTOS/Demo/Common/Minimal/GenQTest.c +++ b/FreeRTOS/Demo/Common/Minimal/GenQTest.c @@ -56,6 +56,13 @@ #define genqMUTEX_MEDIUM_PRIORITY ( tskIDLE_PRIORITY + 2 ) #define genqMUTEX_HIGH_PRIORITY ( tskIDLE_PRIORITY + 3 ) +#ifndef genqMUTEX_TEST_TASK_STACK_SIZE + #define configMINIMAL_STACK_SIZE +#endif + +#ifndef genqGENERIC_QUEUE_TEST_TASK_STACK_SIZE + #define genqGENERIC_QUEUE_TEST_TASK_STACK_SIZE configMINIMAL_STACK_SIZE +#endif /*-----------------------------------------------------------*/ /* @@ -158,7 +165,7 @@ SemaphoreHandle_t xMutex; /* Create the demo task and pass it the queue just created. We are passing the queue handle by value so it does not matter that it is declared on the stack here. */ - xTaskCreate( prvSendFrontAndBackTest, "GenQ", configMINIMAL_STACK_SIZE, ( void * ) xQueue, uxPriority, NULL ); + xTaskCreate( prvSendFrontAndBackTest, "GenQ", genqGENERIC_QUEUE_TEST_TASK_STACK_SIZE, ( void * ) xQueue, uxPriority, NULL ); } /* Create the mutex used by the prvMutexTest task. */ @@ -177,9 +184,9 @@ SemaphoreHandle_t xMutex; /* Create the mutex demo tasks and pass it the mutex just created. We are passing the mutex handle by value so it does not matter that it is declared on the stack here. */ - xTaskCreate( prvLowPriorityMutexTask, "MuLow", configMINIMAL_STACK_SIZE, ( void * ) xMutex, genqMUTEX_LOW_PRIORITY, NULL ); + xTaskCreate( prvLowPriorityMutexTask, "MuLow", genqMUTEX_TEST_TASK_STACK_SIZE, ( void * ) xMutex, genqMUTEX_LOW_PRIORITY, NULL ); xTaskCreate( prvMediumPriorityMutexTask, "MuMed", configMINIMAL_STACK_SIZE, NULL, genqMUTEX_MEDIUM_PRIORITY, &xMediumPriorityMutexTask ); - xTaskCreate( prvHighPriorityMutexTask, "MuHigh", configMINIMAL_STACK_SIZE, ( void * ) xMutex, genqMUTEX_HIGH_PRIORITY, &xHighPriorityMutexTask ); + xTaskCreate( prvHighPriorityMutexTask, "MuHigh", genqMUTEX_TEST_TASK_STACK_SIZE, ( void * ) xMutex, genqMUTEX_HIGH_PRIORITY, &xHighPriorityMutexTask ); /* If INCLUDE_xTaskAbortDelay is set then additional tests are performed, requiring two instances of prvHighPriorityMutexTask(). */ diff --git a/FreeRTOS/Demo/Common/Minimal/TaskNotify.c b/FreeRTOS/Demo/Common/Minimal/TaskNotify.c index e4b4cd46b..8e3aee1d4 100644 --- a/FreeRTOS/Demo/Common/Minimal/TaskNotify.c +++ b/FreeRTOS/Demo/Common/Minimal/TaskNotify.c @@ -41,6 +41,11 @@ /* Demo program include files. */ #include "TaskNotify.h" +/* Allow parameters to be overridden on a demo by demo basis. */ +#ifndef notifyNOTIFIED_TASK_STACK_SIZE + #define notifyNOTIFIED_TASK_STACK_SIZE configMINIMAL_STACK_SIZE +#endif + #define notifyTASK_PRIORITY ( tskIDLE_PRIORITY ) #define notifyUINT32_MAX ( ( uint32_t ) 0xffffffff ) #define notifySUSPENDED_TEST_TIMER_PERIOD pdMS_TO_TICKS( 50 ) @@ -104,7 +109,12 @@ void vStartTaskNotifyTask( void ) { /* Create the task that performs some tests by itself, then loops around being notified by both a software timer and an interrupt. */ - xTaskCreate( prvNotifiedTask, "Notified", configMINIMAL_STACK_SIZE, NULL, notifyTASK_PRIORITY, &xTaskToNotify ); + xTaskCreate( prvNotifiedTask, /* Function that implements the task. */ + "Notified", /* Text name for the task - for debugging only - not used by the kernel. */ + notifyNOTIFIED_TASK_STACK_SIZE, /* Task's stack size in words, not bytes!. */ + NULL, /* Task parameter, not used in this case. */ + notifyTASK_PRIORITY, /* Task priority, 0 is the lowest. */ + &xTaskToNotify ); /* Used to pass a handle to the task out is needed, otherwise set to NULL. */ /* Pseudo seed the random number generator. */ uxNextRand = ( size_t ) prvRand; diff --git a/FreeRTOS/Demo/Common/Minimal/TimerDemo.c b/FreeRTOS/Demo/Common/Minimal/TimerDemo.c index 02c9d29ac..1e980b058 100644 --- a/FreeRTOS/Demo/Common/Minimal/TimerDemo.c +++ b/FreeRTOS/Demo/Common/Minimal/TimerDemo.c @@ -48,7 +48,11 @@ #define tmrdemoDONT_BLOCK ( ( TickType_t ) 0 ) #define tmrdemoONE_SHOT_TIMER_PERIOD ( xBasePeriod * ( TickType_t ) 3 ) -#define trmdemoNUM_TIMER_RESETS ( ( uint8_t ) 10 ) +#define tmrdemoNUM_TIMER_RESETS ( ( uint8_t ) 10 ) + +#ifndef tmrTIMER_TEST_TASK_STACK_SIZE + #define tmrTIMER_TEST_TASK_STACK_SIZE configMINIMAL_STACK_SIZE +#endif /*-----------------------------------------------------------*/ @@ -137,7 +141,7 @@ void vStartTimerDemoTask( TickType_t xBasePeriodIn ) task, which will then preempt this task). */ if( xTestStatus != pdFAIL ) { - xTaskCreate( prvTimerTestTask, "Tmr Tst", configMINIMAL_STACK_SIZE, NULL, configTIMER_TASK_PRIORITY - 1, NULL ); + xTaskCreate( prvTimerTestTask, "Tmr Tst", tmrTIMER_TEST_TASK_STACK_SIZE, NULL, configTIMER_TASK_PRIORITY - 1, NULL ); } } /*-----------------------------------------------------------*/ @@ -546,7 +550,7 @@ uint8_t ucTimer; configASSERT( xTestStatus ); } - for( ucTimer = 0; ucTimer < trmdemoNUM_TIMER_RESETS; ucTimer++ ) + for( ucTimer = 0; ucTimer < tmrdemoNUM_TIMER_RESETS; ucTimer++ ) { /* Delay for half as long as the one shot timer period, then reset it. It should never expire while this is done, so its callback count should diff --git a/FreeRTOS/Demo/Common/Minimal/blocktim.c b/FreeRTOS/Demo/Common/Minimal/blocktim.c index 5b25d8c73..44dd2208e 100644 --- a/FreeRTOS/Demo/Common/Minimal/blocktim.c +++ b/FreeRTOS/Demo/Common/Minimal/blocktim.c @@ -39,7 +39,7 @@ /* Demo includes. */ #include "blocktim.h" -/* Task priorities. Allow these to be overridden. */ +/* Task priorities and stack sizes. Allow these to be overridden. */ #ifndef bktPRIMARY_PRIORITY #define bktPRIMARY_PRIORITY ( configMAX_PRIORITIES - 3 ) #endif @@ -48,6 +48,10 @@ #define bktSECONDARY_PRIORITY ( configMAX_PRIORITIES - 4 ) #endif +#ifndef bktBLOCK_TIME_TASK_STACK_SIZE + #define bktBLOCK_TIME_TASK_STACK_SIZE configMINIMAL_STACK_SIZE +#endif + /* Task behaviour. */ #define bktQUEUE_LENGTH ( 5 ) #define bktSHORT_WAIT pdMS_TO_TICKS( ( TickType_t ) 20 ) @@ -111,8 +115,8 @@ void vCreateBlockTimeTasks( void ) vQueueAddToRegistry( xTestQueue, "Block_Time_Queue" ); /* Create the two test tasks. */ - xTaskCreate( vPrimaryBlockTimeTestTask, "BTest1", configMINIMAL_STACK_SIZE, NULL, bktPRIMARY_PRIORITY, NULL ); - xTaskCreate( vSecondaryBlockTimeTestTask, "BTest2", configMINIMAL_STACK_SIZE, NULL, bktSECONDARY_PRIORITY, &xSecondary ); + xTaskCreate( vPrimaryBlockTimeTestTask, "BTest1", bktBLOCK_TIME_TASK_STACK_SIZE, NULL, bktPRIMARY_PRIORITY, NULL ); + xTaskCreate( vSecondaryBlockTimeTestTask, "BTest2", bktBLOCK_TIME_TASK_STACK_SIZE, NULL, bktSECONDARY_PRIORITY, &xSecondary ); } } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/Common/Minimal/dynamic.c b/FreeRTOS/Demo/Common/Minimal/dynamic.c index dd90d7f0d..ba17e03f7 100644 --- a/FreeRTOS/Demo/Common/Minimal/dynamic.c +++ b/FreeRTOS/Demo/Common/Minimal/dynamic.c @@ -105,6 +105,9 @@ static portTASK_FUNCTION_PROTO( vQueueReceiveWhenSuspendedTask, pvParameters ); static portTASK_FUNCTION_PROTO( vQueueSendWhenSuspendedTask, pvParameters ); /* Demo task specific constants. */ +#ifndef priSUSPENDED_RX_TASK_STACK_SIZE + #define priSUSPENDED_RX_TASK_STACK_SIZE ( configMINIMAL_STACK_SIZE ) +#endif #define priSTACK_SIZE ( configMINIMAL_STACK_SIZE ) #define priSLEEP_TIME pdMS_TO_TICKS( 128 ) #define priLOOPS ( 5 ) @@ -159,9 +162,9 @@ void vStartDynamicPriorityTasks( void ) xTaskCreate( vContinuousIncrementTask, "CNT_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY, &xContinuousIncrementHandle ); xTaskCreate( vLimitedIncrementTask, "LIM_INC", priSTACK_SIZE, ( void * ) &ulCounter, tskIDLE_PRIORITY + 1, &xLimitedIncrementHandle ); - xTaskCreate( vCounterControlTask, "C_CTRL", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vCounterControlTask, "C_CTRL", priSUSPENDED_RX_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); xTaskCreate( vQueueSendWhenSuspendedTask, "SUSP_TX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); - xTaskCreate( vQueueReceiveWhenSuspendedTask, "SUSP_RX", priSTACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( vQueueReceiveWhenSuspendedTask, "SUSP_RX", priSUSPENDED_RX_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, NULL ); } } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/Common/Minimal/recmutex.c b/FreeRTOS/Demo/Common/Minimal/recmutex.c index dc5db2188..232b7e4d3 100644 --- a/FreeRTOS/Demo/Common/Minimal/recmutex.c +++ b/FreeRTOS/Demo/Common/Minimal/recmutex.c @@ -85,6 +85,10 @@ be overridden by a definition in FreeRTOSConfig.h. */ #define recmuNO_DELAY ( ( TickType_t ) 0 ) #define recmu15ms_DELAY ( pdMS_TO_TICKS( 15 ) ) +#ifndef recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE + #define recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE configMINIMAL_STACK_SIZE +#endif + /* The three tasks as described at the top of this file. */ static void prvRecursiveMutexControllingTask( void *pvParameters ); static void prvRecursiveMutexBlockingTask( void *pvParameters ); @@ -119,9 +123,9 @@ void vStartRecursiveMutexTasks( void ) defined to be less than 1. */ vQueueAddToRegistry( ( QueueHandle_t ) xMutex, "Recursive_Mutex" ); - xTaskCreate( prvRecursiveMutexControllingTask, "Rec1", configMINIMAL_STACK_SIZE, NULL, recmuCONTROLLING_TASK_PRIORITY, &xControllingTaskHandle ); - xTaskCreate( prvRecursiveMutexBlockingTask, "Rec2", configMINIMAL_STACK_SIZE, NULL, recmuBLOCKING_TASK_PRIORITY, &xBlockingTaskHandle ); - xTaskCreate( prvRecursiveMutexPollingTask, "Rec3", configMINIMAL_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, NULL ); + xTaskCreate( prvRecursiveMutexControllingTask, "Rec1", recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE, NULL, recmuCONTROLLING_TASK_PRIORITY, &xControllingTaskHandle ); + xTaskCreate( prvRecursiveMutexBlockingTask, "Rec2", recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE, NULL, recmuBLOCKING_TASK_PRIORITY, &xBlockingTaskHandle ); + xTaskCreate( prvRecursiveMutexPollingTask, "Rec3", recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE, NULL, recmuPOLLING_TASK_PRIORITY, NULL ); } } /*-----------------------------------------------------------*/ diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.cproject b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.cproject index 67f12793c..b963a9fc9 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.cproject +++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.cproject @@ -56,7 +56,7 @@ diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.settings/language.settings.xml b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.settings/language.settings.xml index d1fe80906..7ac15d6a2 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.settings/language.settings.xml +++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/FreeRTOSConfig.h index ec696dba3..f239c1c3c 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/FreeRTOSConfig.h +++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/FreeRTOSConfig.h @@ -73,6 +73,16 @@ #include "platform.h" +/* + * For some reason the standard demo timer demo/test tasks fail when executing + * in QEMU, although they pass on other RISC-V platforms. This requires + * further investigation, but for now, defining _WINDOWS_ has the effect of + * using the wider timer test thresholds that are normally only used when the + * tests are used with the FreeRTOS Windows port (which is not deterministic + * and therefore requires wider margins). + */ +#define _WINDOWS_ + /*----------------------------------------------------------- * Application specific definitions. * @@ -92,8 +102,8 @@ #define configCPU_CLOCK_HZ ( 10000000 ) /*QEMU*/ #define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) #define configMAX_PRIORITIES ( 7 ) -#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 95 ) -#define configTOTAL_HEAP_SIZE ( ( size_t ) 14300 ) +#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 ) +#define configTOTAL_HEAP_SIZE ( ( size_t ) 14100 ) #define configMAX_TASK_NAME_LEN ( 16 ) #define configUSE_TRACE_FACILITY 0 #define configUSE_16_BIT_TICKS 0 @@ -106,6 +116,7 @@ #define configUSE_APPLICATION_TASK_TAG 0 #define configUSE_COUNTING_SEMAPHORES 1 #define configGENERATE_RUN_TIME_STATS 0 +#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 /* Co-routine definitions. */ #define configUSE_CO_ROUTINES 0 @@ -115,7 +126,7 @@ #define configUSE_TIMERS 1 #define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) #define configTIMER_QUEUE_LENGTH 4 -#define configTIMER_TASK_STACK_DEPTH ( 120 ) +#define configTIMER_TASK_STACK_DEPTH ( 100 ) /* Task priorities. Allow these to be overridden. */ #ifndef uartPRIMARY_PRIORITY @@ -141,13 +152,14 @@ void vAssertCalled( void ); /* Overwrite some of the stack sizes allocated to various test and demo tasks. Like all task stack sizes, the value is the number of words, not bytes. */ -#define configTIMER_TEST_TASK_STACK_SIZE 150 -#define configNOTIFIED_TEST_TASK_STACK_SIZE 130 -#define configEVENT_GROUP_SET_BIT_TEST_TASK_STACK_SIZE 110 -#define configEVENT_GROUP_RENDEZVOUS_TASK_STACK_SIZE 100 -#define configRECURSIVE_MUTEX_TASK_STACK_SIZE 110 -#define configBLOCK_TIME_TEST_TASK_STACK_SIZE 110 - -#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 +#define bktBLOCK_TIME_TASK_STACK_SIZE 100 +#define notifyNOTIFIED_TASK_STACK_SIZE 120 +#define priSUSPENDED_RX_TASK_STACK_SIZE 90 +#define tmrTIMER_TEST_TASK_STACK_SIZE 100 +#define ebRENDESVOUS_TEST_TASK_STACK_SIZE 100 +#define ebEVENT_GROUP_SET_BITS_TEST_TASK_STACK_SIZE 115 +#define genqMUTEX_TEST_TASK_STACK_SIZE 90 +#define genqGENERIC_QUEUE_TEST_TASK_STACK_SIZE 100 +#define recmuRECURSIVE_MUTEX_TEST_TASK_STACK_SIZE 90 #endif /* FREERTOS_CONFIG_H */ diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/freedom-e-sdk/env/freedom-e300-hifive1/dhrystone.lds b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/freedom-e-sdk/env/freedom-e300-hifive1/dhrystone.lds index a01b66136..302bf743b 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/freedom-e-sdk/env/freedom-e300-hifive1/dhrystone.lds +++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/freedom-e-sdk/env/freedom-e300-hifive1/dhrystone.lds @@ -17,7 +17,7 @@ PHDRS SECTIONS { - __stack_size = DEFINED(__stack_size) ? __stack_size : 2K; + __stack_size = DEFINED(__stack_size) ? __stack_size : 1K; .init : { diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/full_demo/main_full.c b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/full_demo/main_full.c index eeaab9d71..a71ff0d5c 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/full_demo/main_full.c +++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/full_demo/main_full.c @@ -57,7 +57,9 @@ * the standard demo tasks, and the register check tasks, are not only still * executing, but are executing without reporting any errors. If the check task * discovers that a task has either stalled, or reported an error, then it - * prints an error message to the UART, otherwise it prints "Pass.". + * prints an error message to the UART, otherwise it prints "Pass" followed + * by an additional period (".") after each successful loop of its implementing + * function. */ /* Standard includes. */ @@ -89,7 +91,7 @@ /* The period of the check task, in ms, converted to ticks using the pdMS_TO_TICKS() macro. */ -#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 3000UL ) +#define mainNO_ERROR_CHECK_TASK_PERIOD pdMS_TO_TICKS( 5000UL ) /* Parameters that are passed into the register check tasks solely for the purpose of ensuring parameters are passed into tasks correctl5. */ @@ -101,10 +103,10 @@ purpose of ensuring parameters are passed into tasks correctl5. */ /* The size of the stack allocated to the check task (as described in the comments at the top of this file. */ -#define mainCHECK_TASK_STACK_SIZE_WORDS 110 +#define mainCHECK_TASK_STACK_SIZE_WORDS 85 /* Size of the stacks to allocated for the register check tasks. */ -#define mainREG_TEST_STACK_SIZE_WORDS 70 +#define mainREG_TEST_STACK_SIZE_WORDS 50 /*-----------------------------------------------------------*/ @@ -148,17 +150,6 @@ volatile uint32_t ulRegTest1LoopCounter = 0UL, ulRegTest2LoopCounter = 0UL; void main_full( void ) { - /* Start all the other standard demo/test tasks. They have no particular - functionality, but do demonstrate how to use the FreeRTOS API and test the - kernel port. */ - vStartDynamicPriorityTasks(); - vCreateBlockTimeTasks(); - vStartGenericQueueTasks( tskIDLE_PRIORITY ); - vStartRecursiveMutexTasks(); -// vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); -// vStartEventGroupTasks(); - vStartTaskNotifyTask(); - /* Create the register check tasks, as described at the top of this file. Use xTaskCreateStatic() to create a task using only statically allocated memory. */ @@ -170,10 +161,20 @@ void main_full( void ) NULL ); /* Can be used to pass out a handle to the created task. */ xTaskCreate( prvRegTestTaskEntry2, "Reg2", mainREG_TEST_STACK_SIZE_WORDS, mainREG_TEST_TASK_2_PARAMETER, tskIDLE_PRIORITY, NULL ); + /* Start all the other standard demo/test tasks. They have no particular + functionality, but do demonstrate how to use the FreeRTOS API and test the + kernel port. */ + vStartDynamicPriorityTasks(); + vCreateBlockTimeTasks(); + vStartGenericQueueTasks( tskIDLE_PRIORITY ); + vStartRecursiveMutexTasks(); + vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); + vStartEventGroupTasks(); + vStartTaskNotifyTask(); + /* Create the task that performs the 'check' functionality, as described at the top of this file. */ -// xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE_WORDS, NULL, mainCHECK_TASK_PRIORITY, NULL ); - xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE_WORDS, NULL, tskIDLE_PRIORITY, NULL ); + xTaskCreate( prvCheckTask, "Check", mainCHECK_TASK_STACK_SIZE_WORDS, NULL, mainCHECK_TASK_PRIORITY, NULL ); /* Start the scheduler. */ vTaskStartScheduler(); @@ -193,12 +194,14 @@ static void prvCheckTask( void *pvParameters ) const TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD; TickType_t xLastExecutionTime; static unsigned long ulLastRegTest1Value = 0, ulLastRegTest2Value = 0; -const char * const pcPassMessage = "Pass.\r\n"; -const char * pcStatusMessage = pcPassMessage; +const char * const pcPassMessage = "Pass"; +const char * pcStatusMessage = "."; /* Just to stop compiler warnings. */ ( void ) pvParameters; + write( STDOUT_FILENO, pcPassMessage, strlen( pcPassMessage ) ); + /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil() works correctly. */ xLastExecutionTime = xTaskGetTickCount(); @@ -238,12 +241,12 @@ const char * pcStatusMessage = pcPassMessage; if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) != pdPASS ) { -// pcStatusMessage = "ERROR: Timer demo/tests.\r\n"; + pcStatusMessage = "ERROR: Timer demo/tests.\r\n"; } if( xAreEventGroupTasksStillRunning() != pdPASS ) { -// pcStatusMessage = "ERROR: Event group demo/tests.\r\n"; + pcStatusMessage = "ERROR: Event group demo/tests.\r\n"; } if( xAreTaskNotificationTasksStillRunning() != pdPASS ) @@ -311,7 +314,7 @@ void vFullDemoTickHook( void ) { /* Called from vApplicationTickHook() when the project is configured to build the full demo. */ -// vTimerPeriodicISRTests(); -// vPeriodicEventGroupsProcessing(); + vTimerPeriodicISRTests(); + vPeriodicEventGroupsProcessing(); xNotifyTaskFromISR(); } diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/main.c b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/main.c index ec5fd7624..6bfdefb05 100644 --- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/main.c +++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/main.c @@ -44,6 +44,31 @@ * THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO * APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT! * + * + * NOTE 1: + * + * This project has only been tested in the QEMU emulation of the HiFive board + * from SiFive. + * + * Start QEMU using the following command line: + * + * [your_path_1]\qemu-system-riscv32 -kernel [your_path_2]\FreeRTOS\Demo\RISC-V-Qemu-sifive_e-FreedomStudio\Debug\RTOSDemo.elf -S -s -machine sifive_e + * + * Where [your_path_1] must be replaced with the correct path to your QEMU + * installation and the elf file generated by this project respectively. + * + * + * NOTE 2: + * + * Start GDB using the following command line (this can be entered in the + * Eclipse Debug Launch Configuration dialogue): + * + * riscv64-unknown-elf-gdb.exe -iex "set mem inaccessible-by-default off" -iex "set arch riscv:rv32" -iex "set riscv use_compressed_breakpoint off" + * + * + * Note 3: + * + * Status information is sent to the QEMU serial console. */ /* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo, @@ -98,7 +123,6 @@ void vApplicationMallocFailedHook( void ) to query the size of free heap space that remains (although it does not provide information on how the remaining heap might be fragmented). */ taskDISABLE_INTERRUPTS(); -// __asm volatile( "ebreak" ); for( ;; ); } /*-----------------------------------------------------------*/ @@ -126,7 +150,6 @@ void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName ) configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is called if a stack overflow is detected. */ taskDISABLE_INTERRUPTS(); -// __asm volatile( "ebreak" ); for( ;; ); } /*-----------------------------------------------------------*/ @@ -148,7 +171,6 @@ void vAssertCalled( void ) volatile uint32_t ulSetTo1ToExitFunction = 0; taskDISABLE_INTERRUPTS(); -// __asm volatile( "ebreak" ); while( ulSetTo1ToExitFunction != 1 ) { __asm volatile( "NOP" ); diff --git a/FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo b/FreeRTOS/Demo/WIN32-MSVC/.vs/WIN32/v14/.suo index 11cf75261bbdc5678c1a45f798db6cad9f36322d..976c93a877d32a153d063b6fe2e182e1dcb79c5a 100644 GIT binary patch delta 4483 zcmcIo3s98T75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