Microsemi RISC-V project:

Reorganize project to separate Microsemi code into its own directory.
    Add many more demo and tests.
This commit is contained in:
Richard Barry 2018-12-10 20:55:32 +00:00
parent 6b37800ade
commit 866635d2ad
41 changed files with 128 additions and 52 deletions

View file

@ -113,19 +113,19 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/drivers/CoreGPIO}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Microsemi_Code/drivers/CoreGPIO}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/drivers/Core16550}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Microsemi_Code/drivers/Core16550}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/drivers/CoreUARTapb}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Microsemi_Code/drivers/CoreUARTapb}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/drivers/CoreTimer}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Microsemi_Code/drivers/CoreTimer}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/drivers/CoreSPI}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Microsemi_Code/drivers/CoreSPI}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/hal}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Microsemi_Code/hal}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/riscv_hal}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Microsemi_Code/riscv_hal}&quot;"/>
</option> </option>
@ -153,7 +153,7 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.scriptfile.746597241" name="Script files (-T)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.scriptfile" useByScannerDiscovery="false" valueType="stringList"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.scriptfile.746597241" name="Script files (-T)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.linker.scriptfile" useByScannerDiscovery="false" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/riscv_hal/microsemi-riscv-ram.ld}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Microsemi_Code/riscv_hal/microsemi-riscv-ram.ld}&quot;"/>
</option> </option>
@ -177,7 +177,7 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.scriptfile.1026577013" name="Script files (-T)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.scriptfile" valueType="stringList"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.scriptfile.1026577013" name="Script files (-T)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.cpp.linker.scriptfile" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/riscv_hal/microsemi-riscv-ram.ld}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/Microsemi_Code/riscv_hal/microsemi-riscv-ram.ld}&quot;"/>
</option> </option>

View file

@ -34,6 +34,11 @@
<type>2</type> <type>2</type>
<locationURI>virtual:/virtual</locationURI> <locationURI>virtual:/virtual</locationURI>
</link> </link>
<link>
<name>full_demo/common_demo_tasks/AbortDelay.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/AbortDelay.c</locationURI>
</link>
<link> <link>
<name>full_demo/common_demo_tasks/EventGroupsDemo.c</name> <name>full_demo/common_demo_tasks/EventGroupsDemo.c</name>
<type>1</type> <type>1</type>
@ -44,6 +49,21 @@
<type>1</type> <type>1</type>
<locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/GenQTest.c</locationURI> <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/GenQTest.c</locationURI>
</link> </link>
<link>
<name>full_demo/common_demo_tasks/MessageBufferDemo.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/MessageBufferDemo.c</locationURI>
</link>
<link>
<name>full_demo/common_demo_tasks/StreamBufferDemo.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/StreamBufferDemo.c</locationURI>
</link>
<link>
<name>full_demo/common_demo_tasks/StreamBufferInterrupt.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/StreamBufferInterrupt.c</locationURI>
</link>
<link> <link>
<name>full_demo/common_demo_tasks/TaskNotify.c</name> <name>full_demo/common_demo_tasks/TaskNotify.c</name>
<type>1</type> <type>1</type>
@ -59,6 +79,16 @@
<type>1</type> <type>1</type>
<locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/blocktim.c</locationURI> <locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/blocktim.c</locationURI>
</link> </link>
<link>
<name>full_demo/common_demo_tasks/countsem.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/countsem.c</locationURI>
</link>
<link>
<name>full_demo/common_demo_tasks/death.c</name>
<type>1</type>
<locationURI>FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/death.c</locationURI>
</link>
<link> <link>
<name>full_demo/common_demo_tasks/dynamic.c</name> <name>full_demo/common_demo_tasks/dynamic.c</name>
<type>1</type> <type>1</type>

View file

@ -11,7 +11,7 @@
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" 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="-604317697749717917" 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="-564858745062802889" 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.gcc"/>

View file

@ -94,8 +94,8 @@
//#define configCPU_CLOCK_HZ ( ( unsigned long ) ( SYS_CLK_FREQ / 100 ) ) /*_RB_ Seems to be a factor of 100 between machine timer frequency and CPU frequency. */ //#define configCPU_CLOCK_HZ ( ( unsigned long ) ( SYS_CLK_FREQ / 100 ) ) /*_RB_ Seems to be a factor of 100 between machine timer frequency and CPU frequency. */
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 ) #define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 5 ) #define configMAX_PRIORITIES ( 5 )
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 256 ) /* Can be as low as 60 but some of the demo tasks that use tis constant require it to be higher. */ #define configMINIMAL_STACK_SIZE ( ( unsigned short ) 200 ) /* Can be as low as 60 but some of the demo tasks that use this constant require it to be higher. */
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 256 * 1024 ) ) #define configTOTAL_HEAP_SIZE ( ( size_t ) ( 300 * 1024 ) )
#define configMAX_TASK_NAME_LEN ( 16 ) #define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_TRACE_FACILITY 0 #define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
@ -135,6 +135,9 @@ to exclude the API function. */
#define INCLUDE_vTaskDelay 1 #define INCLUDE_vTaskDelay 1
#define INCLUDE_eTaskGetState 1 #define INCLUDE_eTaskGetState 1
#define INCLUDE_xTimerPendFunctionCall 1 #define INCLUDE_xTimerPendFunctionCall 1
#define INCLUDE_xTaskAbortDelay 1
#define INCLUDE_xTaskGetHandle 1
#define INCLUDE_xSemaphoreGetMutexHolder 1
/* Normal assert() semantics without relying on the provision of an assert.h /* Normal assert() semantics without relying on the provision of an assert.h
header file. */ header file. */

View file

@ -78,9 +78,16 @@
#include "TimerDemo.h" #include "TimerDemo.h"
#include "EventGroupsDemo.h" #include "EventGroupsDemo.h"
#include "TaskNotify.h" #include "TaskNotify.h"
#include "AbortDelay.h"
#include "countsem.h"
#include "death.h"
#include "MessageBufferDemo.h"
#include "StreamBufferDemo.h"
#include "StreamBufferInterrupt.h"
/* Priorities for the demo application tasks. */ /* Priorities for the demo application tasks. */
#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 ) #define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
#define mainCREATOR_TASK_PRIORITY ( tskIDLE_PRIORITY + 3UL )
/* The period of the check task, in ms, converted to ticks using the /* The period of the check task, in ms, converted to ticks using the
pdMS_TO_TICKS() macro. mainNO_ERROR_CHECK_TASK_PERIOD is used if no errors have pdMS_TO_TICKS() macro. mainNO_ERROR_CHECK_TASK_PERIOD is used if no errors have
@ -155,6 +162,11 @@ void main_full( void )
vStartTimerDemoTask( mainTIMER_TEST_PERIOD ); vStartTimerDemoTask( mainTIMER_TEST_PERIOD );
vStartEventGroupTasks(); vStartEventGroupTasks();
vStartTaskNotifyTask(); vStartTaskNotifyTask();
vCreateAbortDelayTasks();
vStartCountingSemaphoreTasks();
vStartMessageBufferTasks( configMINIMAL_STACK_SIZE );
vStartStreamBufferTasks();
vStartStreamBufferInterruptDemo();
/* Create the register check tasks, as described at the top of this file. /* Create the register check tasks, as described at the top of this file.
Use xTaskCreateStatic() to create a task using only statically allocated Use xTaskCreateStatic() to create a task using only statically allocated
@ -171,6 +183,11 @@ void main_full( void )
the top of this file. */ 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, mainCHECK_TASK_PRIORITY, NULL );
/* The set of tasks created by the following function call have to be
created last as they keep account of the number of tasks they expect to see
running. */
vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );
/* Start the scheduler. */ /* Start the scheduler. */
vTaskStartScheduler(); vTaskStartScheduler();
@ -183,7 +200,7 @@ void main_full( void )
for( ;; ); for( ;; );
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
//int count = 0;
static void prvCheckTask( void *pvParameters ) static void prvCheckTask( void *pvParameters )
{ {
TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD; TickType_t xDelayPeriod = mainNO_ERROR_CHECK_TASK_PERIOD;
@ -209,57 +226,76 @@ extern void vToggleLED( void );
doing gives visual feedback of the system status. */ doing gives visual feedback of the system status. */
for( ;; ) for( ;; )
{ {
// if( ++count == 5 ) {taskENTER_CRITICAL();for(;;);}
/* Delay until it is time to execute again. */ /* Delay until it is time to execute again. */
vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod ); vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
// taskENTER_CRITICAL();
// for( int i = 0; i < 100; i++ )
// {
// for( int j = 0; j < 1000; j++ ) taskYIELD();
// taskEXIT_CRITICAL();
// vTaskDelay( 1 );
// taskENTER_CRITICAL();
// }
// taskEXIT_CRITICAL();
/* Check all the demo tasks (other than the flash tasks) to ensure /* Check all the demo tasks (other than the flash tasks) to ensure
that they are all still running, and that none have detected an error. */ that they are all still running, and that none have detected an error. */
if( xAreDynamicPriorityTasksStillRunning() != pdTRUE ) if( xAreDynamicPriorityTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Dynamic priority demo/tests.\r\n"; pcStatusMessage = "ERROR: Dynamic priority demo/tests.\r\n";
} }
if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE ) if ( xAreBlockTimeTestTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Block time demo/tests.\r\n"; pcStatusMessage = "ERROR: Block time demo/tests.\r\n";
} }
if ( xAreGenericQueueTasksStillRunning() != pdTRUE ) if ( xAreGenericQueueTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Generic queue demo/tests.\r\n"; pcStatusMessage = "ERROR: Generic queue demo/tests.\r\n";
} }
if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE ) if ( xAreRecursiveMutexTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Recursive mutex demo/tests.\r\n"; pcStatusMessage = "ERROR: Recursive mutex demo/tests.\r\n";
} }
if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) != pdPASS ) if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) == pdFALSE )
{ {
pcStatusMessage = "ERROR: Timer demo/tests.\r\n"; pcStatusMessage = "ERROR: Timer demo/tests.\r\n";
} }
if( xAreEventGroupTasksStillRunning() != pdPASS ) if( xAreEventGroupTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Event group demo/tests.\r\n"; pcStatusMessage = "ERROR: Event group demo/tests.\r\n";
} }
if( xAreTaskNotificationTasksStillRunning() != pdPASS ) if( xAreTaskNotificationTasksStillRunning() == pdFALSE )
{ {
pcStatusMessage = "ERROR: Task notification demo/tests.\r\n"; pcStatusMessage = "ERROR: Task notification demo/tests.\r\n";
} }
if( xAreAbortDelayTestTasksStillRunning() == pdFALSE )
{
pcStatusMessage = "ERROR: Abort delay.\r\n";
}
if( xAreCountingSemaphoreTasksStillRunning() == pdFALSE )
{
pcStatusMessage = "ERROR: Counting semaphores.\r\n";
}
if( xIsCreateTaskStillRunning() == pdFALSE )
{
pcStatusMessage = "ERROR: Suicide tasks.\r\n";
}
if( xAreMessageBufferTasksStillRunning() == pdFALSE )
{
pcStatusMessage = "ERROR: Message buffer.\r\n";
}
if( xAreStreamBufferTasksStillRunning() == pdFALSE )
{
pcStatusMessage = "ERROR: Stream buffer.\r\n";
}
if( xIsInterruptStreamBufferDemoStillRunning() == pdFALSE )
{
pcStatusMessage = "ERROR: Stream buffer interrupt.\r\n";
}
/* Check that the register test 1 task is still running. */ /* Check that the register test 1 task is still running. */
if( ulLastRegTest1Value == ulRegTest1LoopCounter ) if( ulLastRegTest1Value == ulRegTest1LoopCounter )
{ {
@ -275,7 +311,7 @@ extern void vToggleLED( void );
ulLastRegTest2Value = ulRegTest2LoopCounter; ulLastRegTest2Value = ulRegTest2LoopCounter;
/* Write the status message to the UART. */ /* Write the status message to the UART. */
// vSendString( pcStatusMessage ); vSendString( pcStatusMessage );
vToggleLED(); vToggleLED();
/* If an error has been found then increase the LED toggle rate by /* If an error has been found then increase the LED toggle rate by
@ -326,9 +362,24 @@ static void prvRegTestTaskEntry2( void *pvParameters )
void vFullDemoTickHook( void ) void vFullDemoTickHook( void )
{ {
/* Called from vApplicationTickHook() when the project is configured to /* The full demo includes a software timer demo/test that requires
build the full demo. */ prodding periodically from the tick interrupt. */
vTimerPeriodicISRTests(); vTimerPeriodicISRTests();
/* Call the periodic event group from ISR demo. */
vPeriodicEventGroupsProcessing(); vPeriodicEventGroupsProcessing();
/* Use task notifications from an interrupt. */
xNotifyTaskFromISR(); xNotifyTaskFromISR();
/* Writes to stream buffer byte by byte to test the stream buffer trigger
level functionality. */
vPeriodicStreamBufferProcessing();
/* Writes a string to a string buffer four bytes at a time to demonstrate
a stream being sent from an interrupt to a task. */
vBasicStreamBufferSendFromISR();
/* Called from vApplicationTickHook() when the project is configured to
build the full test/demo applications. */
} }

View file

@ -87,7 +87,7 @@ static gpio_instance_t g_gpio_out;
int main( void ) int main( void )
{ {
// prvSetupHardware(); prvSetupHardware();
/* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
of this file. */ of this file. */
@ -144,11 +144,6 @@ void vApplicationMallocFailedHook( void )
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/
volatile uint64_t mtimer = 0, mcompare = 0;
volatile uint32_t mstatus;
static volatile uint64_t * const pulCompareLow = ( volatile uint64_t * const ) ( configCLINT_BASE_ADDRESS + 0x4000 );
static volatile uint64_t * const pulTimeLow = ( volatile uint64_t * const ) ( configCLINT_BASE_ADDRESS + 0xBFF8 );
void vApplicationIdleHook( void ) void vApplicationIdleHook( void )
{ {
/* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set
@ -160,9 +155,6 @@ void vApplicationIdleHook( void )
important that vApplicationIdleHook() is permitted to return to its calling important that vApplicationIdleHook() is permitted to return to its calling
function, because it is the responsibility of the idle task to clean up function, because it is the responsibility of the idle task to clean up
memory allocated by the kernel to any task that has since been deleted. */ memory allocated by the kernel to any task that has since been deleted. */
mstatus = read_csr( mstatus );
mtimer = *pulTimeLow;
mcompare = *pulCompareLow;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/