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.
This commit is contained in:
Richard Barry 2018-12-28 00:44:18 +00:00
parent 178fe4f143
commit d369110167
15 changed files with 138 additions and 61 deletions

View file

@ -56,7 +56,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/drivers}&quot;"/>
</option>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.other.855588508" name="Other assembler flags" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.other" useByScannerDiscovery="false" value="-c" valueType="string"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.flags.179185022" name="Assembler flags" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.flags" useByScannerDiscovery="false" valueType="stringList"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.flags.179185022" name="Assembler flags" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.flags" useByScannerDiscovery="false"/>
<option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.defs.1636772541" name="Defined symbols (-D)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="portasmHANDLE_INTERRUPT=handle_trap"/>
</option>

View file

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1445704774232250253" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1688908204914985791" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1449619206437459651" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1692822637120195189" id="ilg.gnumcueclipse.managedbuild.cross.riscv.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT RISC-V Cross GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View file

@ -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 */

View file

@ -17,7 +17,7 @@ PHDRS
SECTIONS
{
__stack_size = DEFINED(__stack_size) ? __stack_size : 2K;
__stack_size = DEFINED(__stack_size) ? __stack_size : 1K;
.init :
{

View file

@ -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();
}

View file

@ -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" );