diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.cproject b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.cproject
index aee56475b..31d9f3fbd 100644
--- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.cproject
+++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.cproject
@@ -60,6 +60,7 @@
-
+
+
-
+
-
+
diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.project b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.project
index b83209ea4..82efe8a68 100644
--- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.project
+++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.project
@@ -32,17 +32,17 @@
FreeRTOS_Source/event_groups.c1
- FREERTOS_ROUTE/FreeRTOS/Source/event_groups.c
+ FREERTOS_ROOT/FreeRTOS/Source/event_groups.cFreeRTOS_Source/include2
- FREERTOS_ROUTE/FreeRTOS/Source/include
+ FREERTOS_ROOT/FreeRTOS/Source/includeFreeRTOS_Source/list.c1
- FREERTOS_ROUTE/FreeRTOS/Source/list.c
+ FREERTOS_ROOT/FreeRTOS/Source/list.cFreeRTOS_Source/portable
@@ -52,22 +52,27 @@
FreeRTOS_Source/queue.c1
- FREERTOS_ROUTE/FreeRTOS/Source/queue.c
+ FREERTOS_ROOT/FreeRTOS/Source/queue.cFreeRTOS_Source/stream_buffer.c1
- FREERTOS_ROUTE/FreeRTOS/Source/stream_buffer.c
+ FREERTOS_ROOT/FreeRTOS/Source/stream_buffer.cFreeRTOS_Source/tasks.c1
- FREERTOS_ROUTE/FreeRTOS/Source/tasks.c
+ FREERTOS_ROOT/FreeRTOS/Source/tasks.cFreeRTOS_Source/timers.c1
- FREERTOS_ROUTE/FreeRTOS/Source/timers.c
+ FREERTOS_ROOT/FreeRTOS/Source/timers.c
+
+
+ full_demo/common_demo_tasks
+ 2
+ virtual:/virtualFreeRTOS_Source/portable/GCC
@@ -79,20 +84,60 @@
2virtual:/virtual
+
+ full_demo/common_demo_tasks/EventGroupsDemo.c
+ 1
+ FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c
+
+
+ full_demo/common_demo_tasks/GenQTest.c
+ 1
+ FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/GenQTest.c
+
+
+ full_demo/common_demo_tasks/TaskNotify.c
+ 1
+ FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/TaskNotify.c
+
+
+ full_demo/common_demo_tasks/TimerDemo.c
+ 1
+ FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/TimerDemo.c
+
+
+ full_demo/common_demo_tasks/blocktim.c
+ 1
+ FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/blocktim.c
+
+
+ full_demo/common_demo_tasks/dynamic.c
+ 1
+ FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/dynamic.c
+
+
+ full_demo/common_demo_tasks/include
+ 2
+ FREERTOS_ROOT/FreeRTOS/Demo/Common/include
+
+
+ full_demo/common_demo_tasks/recmutex.c
+ 1
+ FREERTOS_ROOT/FreeRTOS/Demo/Common/Minimal/recmutex.c
+
FreeRTOS_Source/portable/GCC/RISC-V-RV322
- FREERTOS_ROUTE/FreeRTOS/Source/portable/GCC/RISC-V-RV32
+ FREERTOS_ROOT/FreeRTOS/Source/portable/GCC/RISC-V-RV32FreeRTOS_Source/portable/MemMang/heap_4.c1
- FREERTOS_ROUTE/FreeRTOS/Source/portable/MemMang/heap_4.c
+ FREERTOS_ROOT/FreeRTOS/Source/portable/MemMang/heap_4.c
- FREERTOS_ROUTE
+ FREERTOS_ROOT$%7BPARENT-3-PROJECT_LOC%7D
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 53c0c6365..59b35b22e 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 c9e825c50..db200a519 100644
--- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/FreeRTOSConfig.h
+++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/FreeRTOSConfig.h
@@ -88,14 +88,14 @@
#define configCLINT_BASE_ADDRESS CLINT_CTRL_ADDR
#define configUSE_PREEMPTION 1
#define configUSE_IDLE_HOOK 0
-#define configUSE_TICK_HOOK 0
+#define configUSE_TICK_HOOK 1
#define configCPU_CLOCK_HZ ( 10000000 ) /*QEMU*/
#define configTICK_RATE_HZ ( ( TickType_t ) 1000 )
#define configMAX_PRIORITIES ( 5 )
-#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 512 )
-#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 8 * 1024 ) )
+#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 85 )
+#define configTOTAL_HEAP_SIZE ( ( size_t ) 14300 )
#define configMAX_TASK_NAME_LEN ( 16 )
-#define configUSE_TRACE_FACILITY 1
+#define configUSE_TRACE_FACILITY 0
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 0
#define configUSE_MUTEXES 1
@@ -112,10 +112,10 @@
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
/* Software timer definitions. */
-#define configUSE_TIMERS 0
-#define configTIMER_TASK_PRIORITY ( 2 )
-#define configTIMER_QUEUE_LENGTH 2
-#define configTIMER_TASK_STACK_DEPTH ( configMINIMAL_STACK_SIZE )
+#define configUSE_TIMERS 1
+#define configTIMER_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
+#define configTIMER_QUEUE_LENGTH 7
+#define configTIMER_TASK_STACK_DEPTH ( 120 )
/* Task priorities. Allow these to be overridden. */
#ifndef uartPRIMARY_PRIORITY
@@ -132,20 +132,21 @@ to exclude the API function. */
#define INCLUDE_vTaskDelayUntil 1
#define INCLUDE_vTaskDelay 1
#define INCLUDE_eTaskGetState 1
+#define INCLUDE_xTimerPendFunctionCall 1
/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
-#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }
+void vAssertCalled( void );
+#define configASSERT( x ) if( ( x ) == 0 ) vAssertCalled()
-/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS
-standard names - or at least those used in the unmodified vector table. */
-//#define vPortSVCHandler SVCall_Handler
-//#define xPortPendSVHandler PendSV_Handler
-//#define vPortSysTickHandler SysTick_Handler
+/* 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 120
+#define configEVENT_GROUP_SET_BIT_TEST_TASK_STACK_SIZE 110
+#define configEVENT_GROUP_RENDEZVOUS_TASK_STACK_SIZE 100
+#define configRECURSIVE_MUTEX_TASK_STACK_SIZE 100
-extern void vApplicationMallocFailedHook();
-
-
-extern void vUARTWriteString( const char * const pcString );
+#define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
#endif /* FREERTOS_CONFIG_H */
diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/blinky_demo/main_blinky.c b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/blinky_demo/main_blinky.c
new file mode 100644
index 000000000..f5222adc1
--- /dev/null
+++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/blinky_demo/main_blinky.c
@@ -0,0 +1,203 @@
+/*
+ * FreeRTOS Kernel V10.1.1
+ * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+/******************************************************************************
+ * NOTE 1: This project provides two demo applications. A simple blinky
+ * style project, and a more comprehensive test and demo application. The
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
+ * between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
+ * in main.c. This file implements the simply blinky style version.
+ *
+ * NOTE 2: This file only contains the source code that is specific to the
+ * basic demo. Generic functions, such FreeRTOS hook functions, and functions
+ * required to configure the hardware are defined in main.c.
+ ******************************************************************************
+ *
+ * main_blinky() creates one queue, and two tasks. It then starts the
+ * scheduler.
+ *
+ * The Queue Send Task:
+ * The queue send task is implemented by the prvQueueSendTask() function in
+ * this file. prvQueueSendTask() sits in a loop that causes it to repeatedly
+ * block for 1000 milliseconds, before sending the value 100 to the queue that
+ * was created within main_blinky(). Once the value is sent, the task loops
+ * back around to block for another 1000 milliseconds...and so on.
+ *
+ * The Queue Receive Task:
+ * The queue receive task is implemented by the prvQueueReceiveTask() function
+ * in this file. prvQueueReceiveTask() sits in a loop where it repeatedly
+ * blocks on attempts to read data from the queue that was created within
+ * main_blinky(). When data is received, the task checks the value of the
+ * data, and if the value equals the expected 100, writes 'Blink' to the UART
+ * (the UART is used in place of the LED to allow easy execution in QEMU). The
+ * 'block time' parameter passed to the queue receive function specifies that
+ * the task should be held in the Blocked state indefinitely to wait for data to
+ * be available on the queue. The queue receive task will only leave the
+ * Blocked state when the queue send task writes to the queue. As the queue
+ * send task writes to the queue every 1000 milliseconds, the queue receive
+ * task leaves the Blocked state every 1000 milliseconds, and therefore toggles
+ * the LED every 200 milliseconds.
+ */
+
+/* Standard includes. */
+#include
+#include
+#include
+
+/* Kernel includes. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "queue.h"
+
+/* Priorities used by the tasks. */
+#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
+#define mainQUEUE_SEND_TASK_PRIORITY ( tskIDLE_PRIORITY + 1 )
+
+/* The rate at which data is sent to the queue. The 200ms value is converted
+to ticks using the pdMS_TO_TICKS() macro. */
+#define mainQUEUE_SEND_FREQUENCY_MS pdMS_TO_TICKS( 1000 )
+
+/* The maximum number items the queue can hold. The priority of the receiving
+task is above the priority of the sending task, so the receiving task will
+preempt the sending task and remove the queue items each time the sending task
+writes to the queue. Therefore the queue will never have more than one item in
+it at any time, and even with a queue length of 1, the sending task will never
+find the queue full. */
+#define mainQUEUE_LENGTH ( 1 )
+
+/*-----------------------------------------------------------*/
+
+/*
+ * Called by main when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 in
+ * main.c.
+ */
+void main_blinky( void );
+
+/*
+ * The tasks as described in the comments at the top of this file.
+ */
+static void prvQueueReceiveTask( void *pvParameters );
+static void prvQueueSendTask( void *pvParameters );
+
+/*-----------------------------------------------------------*/
+
+/* The queue used by both tasks. */
+static QueueHandle_t xQueue = NULL;
+
+/*-----------------------------------------------------------*/
+
+void main_blinky( void )
+{
+ /* Create the queue. */
+ xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );
+
+ if( xQueue != NULL )
+ {
+ /* Start the two tasks as described in the comments at the top of this
+ file. */
+ xTaskCreate( prvQueueReceiveTask, /* The function that implements the task. */
+ "Rx", /* The text name assigned to the task - for debug only as it is not used by the kernel. */
+ configMINIMAL_STACK_SIZE * 2U, /* The size of the stack to allocate to the task. */
+ NULL, /* The parameter passed to the task - not used in this case. */
+ mainQUEUE_RECEIVE_TASK_PRIORITY, /* The priority assigned to the task. */
+ NULL ); /* The task handle is not required, so NULL is passed. */
+
+ xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE * 2U, NULL, mainQUEUE_SEND_TASK_PRIORITY, NULL );
+
+ /* Start the tasks and timer running. */
+ vTaskStartScheduler();
+ }
+
+ /* If all is well, the scheduler will now be running, and the following
+ line will never be reached. If the following line does execute, then
+ there was insufficient FreeRTOS heap memory available for the Idle and/or
+ timer tasks to be created. See the memory management section on the
+ FreeRTOS web site for more details on the FreeRTOS heap
+ http://www.freertos.org/a00111.html. */
+ for( ;; );
+}
+/*-----------------------------------------------------------*/
+
+static void prvQueueSendTask( void *pvParameters )
+{
+TickType_t xNextWakeTime;
+const unsigned long ulValueToSend = 100UL;
+BaseType_t xReturned;
+
+ /* Remove compiler warning about unused parameter. */
+ ( void ) pvParameters;
+
+ /* Initialise xNextWakeTime - this only needs to be done once. */
+ xNextWakeTime = xTaskGetTickCount();
+
+ for( ;; )
+ {
+ /* Place this task in the blocked state until it is time to run again. */
+ vTaskDelayUntil( &xNextWakeTime, mainQUEUE_SEND_FREQUENCY_MS );
+
+ /* Send to the queue - causing the queue receive task to unblock and
+ toggle the LED. 0 is used as the block time so the sending operation
+ will not block - it shouldn't need to block as the queue should always
+ be empty at this point in the code. */
+ xReturned = xQueueSend( xQueue, &ulValueToSend, 0U );
+ configASSERT( xReturned == pdPASS );
+ }
+}
+/*-----------------------------------------------------------*/
+
+static void prvQueueReceiveTask( void *pvParameters )
+{
+unsigned long ulReceivedValue;
+const unsigned long ulExpectedValue = 100UL;
+const char * const pcPassMessage = "Blink\r\n";
+const char * const pcFailMessage = "Unexpected value received\r\n";
+
+ /* Remove compiler warning about unused parameter. */
+ ( void ) pvParameters;
+
+ for( ;; )
+ {
+ /* Wait until something arrives in the queue - this task will block
+ indefinitely provided INCLUDE_vTaskSuspend is set to 1 in
+ FreeRTOSConfig.h. */
+ xQueueReceive( xQueue, &ulReceivedValue, portMAX_DELAY );
+
+ /* To get here something must have been received from the queue, but
+ is it the expected value? If it is, toggle the LED. */
+ if( ulReceivedValue == ulExpectedValue )
+ {
+ write( STDOUT_FILENO, pcPassMessage, strlen( pcPassMessage ) );
+ ulReceivedValue = 0U;
+ }
+ else
+ {
+ write( STDOUT_FILENO, pcFailMessage, strlen( pcFailMessage ) );
+ }
+ }
+}
+/*-----------------------------------------------------------*/
+
diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/full_demo/RegTest.S b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/full_demo/RegTest.S
index e4d87147b..e3d169ab5 100644
--- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/full_demo/RegTest.S
+++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/full_demo/RegTest.S
@@ -28,12 +28,17 @@
.extern ulRegTest1LoopCounter
.extern ulRegTest2LoopCounter
- .global vRegTest1Task
- .global vRegTest2Task
+ .global vRegTest1Implementation
+ .global vRegTest2Implementation
/*-----------------------------------------------------------*/
-vRegTest1Task:
+/*
+ * The register check tasks are described in the comments at the top of
+ * main_full.c.
+ */
+
+vRegTest1Implementation:
/* Fill the core registers with known values. */
li x5, 0x5
@@ -65,9 +70,9 @@ vRegTest1Task:
reg1_loop:
- /* Check each register still contains the expected known value.
- vRegTest1Implementation uses x31 as the temporary, vRegTest2Implementation
- uses x5 as the temporary. */
+ /* Check each register still contains the expected known value.
+ vRegTest1Implementation uses x31 as the temporary, vRegTest2Implementation
+ uses x5 as the temporary. */
li x31, 0x5
bne x31, x5, reg1_error_loop
li x31, 0x6
@@ -121,134 +126,136 @@ reg1_loop:
li x31, 0x1e
bne x31, x30, reg1_error_loop
- /* Everything passed, increment the loop counter. */
+ /* Everything passed, increment the loop counter. */
lw x31, ulRegTest1LoopCounterConst
lw x30, 0(x31)
addi x30, x30, 1
sw x30, 0(x31)
- /* Restore clobbered register reading for next loop. */
- li x30, 0x1e
+ /* Restore clobbered register reading for next loop. */
+ li x30, 0x1e
- /* Yield to increase code coverage. */
- ecall
+ /* Yield to increase code coverage. */
+ ecall
- /* Start again. */
- jal reg1_loop
+ /* Start again. */
+ jal reg1_loop
reg1_error_loop:
- /* Jump here if a register contains an uxpected value. This stops the loop
- counter being incremented so the check task knows an error was found. */
+ /* Jump here if a register contains an uxpected value. This stops the loop
+ counter being incremented so the check task knows an error was found. */
+// ebreak
jal reg1_error_loop
ulRegTest1LoopCounterConst: .word ulRegTest1LoopCounter
/*-----------------------------------------------------------*/
-vRegTest2Task:
+vRegTest2Implementation:
- /* Fill the core registers with known values. */
- li x6, 0x61
- li x7, 0x71
- li x8, 0x81
- li x9, 0x91
- li x10, 0xa1
- li x11, 0xb1
- li x12, 0xc1
- li x13, 0xd1
- li x14, 0xe1
- li x15, 0xf1
- li x16, 0x20
- li x17, 0x21
- li x18, 0x22
- li x19, 0x23
- li x20, 0x24
- li x21, 0x25
- li x22, 0x26
- li x23, 0x27
- li x24, 0x28
- li x25, 0x29
- li x26, 0x2a
- li x27, 0x2b
- li x28, 0x2c
- li x29, 0x2d
- li x30, 0x2e
- li x31, 0x2f
+ /* Fill the core registers with known values. */
+ li x6, 0x61
+ li x7, 0x71
+ li x8, 0x81
+ li x9, 0x91
+ li x10, 0xa1
+ li x11, 0xb1
+ li x12, 0xc1
+ li x13, 0xd1
+ li x14, 0xe1
+ li x15, 0xf1
+ li x16, 0x20
+ li x17, 0x21
+ li x18, 0x22
+ li x19, 0x23
+ li x20, 0x24
+ li x21, 0x25
+ li x22, 0x26
+ li x23, 0x27
+ li x24, 0x28
+ li x25, 0x29
+ li x26, 0x2a
+ li x27, 0x2b
+ li x28, 0x2c
+ li x29, 0x2d
+ li x30, 0x2e
+ li x31, 0x2f
Reg2_loop:
- /* Check each register still contains the expected known value.
- vRegTest2Implementation uses x5 as the temporary, vRegTest1Implementation
- uses x31 as the temporary. */
- li x5, 0x61
- bne x5, x6, reg2_error_loop
- li x5, 0x71
- bne x5, x7, reg2_error_loop
- li x5, 0x81
- bne x5, x8, reg2_error_loop
- li x5, 0x91
- bne x5, x9, reg2_error_loop
- li x5, 0xa1
- bne x5, x10, reg2_error_loop
- li x5, 0xb1
- bne x5, x11, reg2_error_loop
- li x5, 0xc1
- bne x5, x12, reg2_error_loop
- li x5, 0xd1
- bne x5, x13, reg2_error_loop
- li x5, 0xe1
- bne x5, x14, reg2_error_loop
- li x5, 0xf1
- bne x5, x15, reg2_error_loop
- li x5, 0x20
- bne x5, x16, reg2_error_loop
- li x5, 0x21
- bne x5, x17, reg2_error_loop
- li x5, 0x22
- bne x5, x18, reg2_error_loop
- li x5, 0x23
- bne x5, x19, reg2_error_loop
- li x5, 0x24
- bne x5, x20, reg2_error_loop
- li x5, 0x25
- bne x5, x21, reg2_error_loop
- li x5, 0x26
- bne x5, x22, reg2_error_loop
- li x5, 0x27
- bne x5, x23, reg2_error_loop
- li x5, 0x28
- bne x5, x24, reg2_error_loop
- li x5, 0x29
- bne x5, x25, reg2_error_loop
- li x5, 0x2a
- bne x5, x26, reg2_error_loop
- li x5, 0x2b
- bne x5, x27, reg2_error_loop
- li x5, 0x2c
- bne x5, x28, reg2_error_loop
- li x5, 0x2d
- bne x5, x29, reg2_error_loop
- li x5, 0x2e
- bne x5, x30, reg2_error_loop
- li x5, 0x2f
- bne x5, x31, reg2_error_loop
+ /* Check each register still contains the expected known value.
+ vRegTest2Implementation uses x5 as the temporary, vRegTest1Implementation
+ uses x31 as the temporary. */
+ li x5, 0x61
+ bne x5, x6, reg2_error_loop
+ li x5, 0x71
+ bne x5, x7, reg2_error_loop
+ li x5, 0x81
+ bne x5, x8, reg2_error_loop
+ li x5, 0x91
+ bne x5, x9, reg2_error_loop
+ li x5, 0xa1
+ bne x5, x10, reg2_error_loop
+ li x5, 0xb1
+ bne x5, x11, reg2_error_loop
+ li x5, 0xc1
+ bne x5, x12, reg2_error_loop
+ li x5, 0xd1
+ bne x5, x13, reg2_error_loop
+ li x5, 0xe1
+ bne x5, x14, reg2_error_loop
+ li x5, 0xf1
+ bne x5, x15, reg2_error_loop
+ li x5, 0x20
+ bne x5, x16, reg2_error_loop
+ li x5, 0x21
+ bne x5, x17, reg2_error_loop
+ li x5, 0x22
+ bne x5, x18, reg2_error_loop
+ li x5, 0x23
+ bne x5, x19, reg2_error_loop
+ li x5, 0x24
+ bne x5, x20, reg2_error_loop
+ li x5, 0x25
+ bne x5, x21, reg2_error_loop
+ li x5, 0x26
+ bne x5, x22, reg2_error_loop
+ li x5, 0x27
+ bne x5, x23, reg2_error_loop
+ li x5, 0x28
+ bne x5, x24, reg2_error_loop
+ li x5, 0x29
+ bne x5, x25, reg2_error_loop
+ li x5, 0x2a
+ bne x5, x26, reg2_error_loop
+ li x5, 0x2b
+ bne x5, x27, reg2_error_loop
+ li x5, 0x2c
+ bne x5, x28, reg2_error_loop
+ li x5, 0x2d
+ bne x5, x29, reg2_error_loop
+ li x5, 0x2e
+ bne x5, x30, reg2_error_loop
+ li x5, 0x2f
+ bne x5, x31, reg2_error_loop
- /* Everything passed, increment the loop counter. */
- lw x5, ulRegTest2LoopCounterConst
- lw x6, 0(x5)
- addi x6, x6, 1
- sw x6, 0(x5)
+ /* Everything passed, increment the loop counter. */
+ lw x5, ulRegTest2LoopCounterConst
+ lw x6, 0(x5)
+ addi x6, x6, 1
+ sw x6, 0(x5)
- /* Restore clobbered register reading for next loop. */
- li x6, 0x61
+ /* Restore clobbered register reading for next loop. */
+ li x6, 0x61
- /* Start again. */
- jal Reg2_loop
+ /* Start again. */
+ jal Reg2_loop
reg2_error_loop:
- /* Jump here if a register contains an uxpected value. This stops the loop
- counter being incremented so the check task knows an error was found. */
- jal reg2_error_loop
+ /* Jump here if a register contains an uxpected value. This stops the loop
+ counter being incremented so the check task knows an error was found. */
+// ebreak
+ jal reg2_error_loop
ulRegTest2LoopCounterConst: .word ulRegTest2LoopCounter
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
new file mode 100644
index 000000000..5981a38e9
--- /dev/null
+++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/full_demo/main_full.c
@@ -0,0 +1,317 @@
+/*
+ * FreeRTOS Kernel V10.1.1
+ * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+
+/******************************************************************************
+ * NOTE 1: This project provides two demo applications. A simple blinky style
+ * project, and a more comprehensive test and demo application. The
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting in main.c is used to select
+ * between the two. See the notes on using mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
+ * in main.c. This file implements the comprehensive test and demo version.
+ *
+ * NOTE 2: This file only contains the source code that is specific to the
+ * full demo. Generic functions, such FreeRTOS hook functions, and functions
+ * required to configure the hardware, are defined in main.c.
+ *
+ ******************************************************************************
+ *
+ * main_full() creates all the demo application tasks and software timers, then
+ * starts the scheduler. The web documentation provides more details of the
+ * standard demo application tasks, which provide no particular functionality,
+ * but do provide a good example of how to use the FreeRTOS API.
+ *
+ * In addition to the standard demo tasks, the following tasks and tests are
+ * defined and/or created within this file:
+ *
+ * "Reg test" tasks - These fill both the core registers with known values, then
+ * check that each register maintains its expected value for the lifetime of the
+ * task. Each task uses a different set of values. The reg test tasks execute
+ * with a very low priority, so get preempted very frequently. A register
+ * containing an unexpected value is indicative of an error in the context
+ * switching mechanism.
+ *
+ * "Check" task - The check executes every five seconds. It checks that all
+ * 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.".
+ */
+
+/* Standard includes. */
+#include
+#include
+
+/* Kernel includes. */
+#include "FreeRTOS.h"
+#include "task.h"
+#include "timers.h"
+#include "semphr.h"
+
+/* Standard demo application includes. */
+#include "dynamic.h"
+#include "blocktim.h"
+#include "GenQTest.h"
+#include "recmutex.h"
+#include "TimerDemo.h"
+#include "EventGroupsDemo.h"
+#include "TaskNotify.h"
+
+/* SiFive includes. */
+#include "platform.h"
+#include "encoding.h"
+#include "unistd.h"
+
+/* Priorities for the demo application tasks. */
+#define mainCHECK_TASK_PRIORITY ( configMAX_PRIORITIES - 1 )
+
+/* 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 )
+
+/* Parameters that are passed into the register check tasks solely for the
+purpose of ensuring parameters are passed into tasks correctl5. */
+#define mainREG_TEST_TASK_1_PARAMETER ( ( void * ) 0x12345678 )
+#define mainREG_TEST_TASK_2_PARAMETER ( ( void * ) 0x87654321 )
+
+/* The base period used by the timer test tasks. */
+#define mainTIMER_TEST_PERIOD ( 50 )
+
+/* 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 100
+
+/* Size of the stacks to allocated for the register check tasks. */
+#define mainREG_TEST_STACK_SIZE_WORDS 60
+
+/*-----------------------------------------------------------*/
+
+/*
+ * Called by main() to run the full demo (as opposed to the blinky demo) when
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
+ */
+void main_full( void );
+
+/*
+ * The check task, as described at the top of this file.
+ */
+static void prvCheckTask( void *pvParameters );
+
+/*
+ * Register check tasks as described at the top of this file. The nature of
+ * these files necessitates that they are written in an assembly file, but the
+ * entry points are kept in the C file for the convenience of checking the task
+ * parameter.
+ */
+static void prvRegTestTaskEntry1( void *pvParameters );
+extern void vRegTest1Implementation( void );
+static void prvRegTestTaskEntry2( void *pvParameters );
+extern void vRegTest2Implementation( void );
+
+/*
+ * Tick hook used by the full demo, which includes code that interacts with
+ * some of the tests.
+ */
+void vFullDemoTickHook( void );
+
+/*-----------------------------------------------------------*/
+
+/* The following two variables are used to communicate the status of the
+register check tasks to the check task. If the variables keep incrementing,
+then the register check tasks have not discovered any errors. If a variable
+stops incrementing, then an error has been found. */
+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. */
+ xTaskCreate( prvRegTestTaskEntry1, /* The function that implements the task. */
+ "Reg1", /* The name of the task. */
+ mainREG_TEST_STACK_SIZE_WORDS, /* Size of stack to allocate for the task - in words not bytes!. */
+ mainREG_TEST_TASK_1_PARAMETER, /* Parameter passed into the task. */
+ tskIDLE_PRIORITY, /* Priority of the task. */
+ 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 );
+
+ /* 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 );
+
+ /* Start the scheduler. */
+ vTaskStartScheduler();
+
+ /* If all is well, the scheduler will now be running, and the following
+ line will never be reached. If the following line does execute, then
+ there was insufficient FreeRTOS heap memory available for the Idle and/or
+ timer tasks to be created. See the memory management section on the
+ FreeRTOS web site for more details on the FreeRTOS heap
+ http://www.freertos.org/a00111.html. */
+ for( ;; );
+}
+/*-----------------------------------------------------------*/
+
+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";
+char * pcStatusMessage = pcPassMessage;
+
+ /* Just to stop compiler warnings. */
+ ( void ) pvParameters;
+
+ /* Initialise xLastExecutionTime so the first call to vTaskDelayUntil()
+ works correctly. */
+ xLastExecutionTime = xTaskGetTickCount();
+
+ /* Cycle for ever, delaying then checking all the other tasks are still
+ operating without error. The onboard LED is toggled on each iteration.
+ If an error is detected then the delay period is decreased from
+ mainNO_ERROR_CHECK_TASK_PERIOD to mainERROR_CHECK_TASK_PERIOD. This has the
+ effect of increasing the rate at which the onboard LED toggles, and in so
+ doing gives visual feedback of the system status. */
+ for( ;; )
+ {
+ /* Delay until it is time to execute again. */
+ vTaskDelayUntil( &xLastExecutionTime, xDelayPeriod );
+
+ /* 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. */
+ if( xAreDynamicPriorityTasksStillRunning() != pdTRUE )
+ {
+ pcStatusMessage = "ERROR: Dynamic priority demo/tests.\r\n";
+ }
+
+ if ( xAreBlockTimeTestTasksStillRunning() != pdTRUE )
+ {
+ pcStatusMessage = "ERROR: Block time demo/tests.\r\n";
+ }
+
+ if ( xAreGenericQueueTasksStillRunning() != pdTRUE )
+ {
+ pcStatusMessage = "ERROR: Generic queue demo/tests.\r\n";
+ }
+
+ if ( xAreRecursiveMutexTasksStillRunning() != pdTRUE )
+ {
+ pcStatusMessage = "ERROR: Recursive mutex demo/tests.\r\n";
+ }
+
+ if( xAreTimerDemoTasksStillRunning( ( TickType_t ) xDelayPeriod ) != pdPASS )
+ {
+// pcStatusMessage = "ERROR: Timer demo/tests.\r\n";
+ }
+
+ if( xAreEventGroupTasksStillRunning() != pdPASS )
+ {
+ pcStatusMessage = "ERROR: Event group demo/tests.\r\n";
+ }
+
+ if( xAreTaskNotificationTasksStillRunning() != pdPASS )
+ {
+ pcStatusMessage = "ERROR: Task notification demo/tests.\r\n";
+ }
+
+ /* Check that the register test 1 task is still running. */
+ if( ulLastRegTest1Value == ulRegTest1LoopCounter )
+ {
+ pcStatusMessage = "ERROR: Register test 1.\r\n";
+ }
+ ulLastRegTest1Value = ulRegTest1LoopCounter;
+
+ /* Check that the register test 2 task is still running. */
+ if( ulLastRegTest2Value == ulRegTest2LoopCounter )
+ {
+ pcStatusMessage = "ERROR: Register test 2.\r\n";
+ }
+ ulLastRegTest2Value = ulRegTest2LoopCounter;
+
+ /* Write the status message to the UART. */
+ write( STDOUT_FILENO, pcStatusMessage, strlen( pcStatusMessage ) );
+ }
+}
+/*-----------------------------------------------------------*/
+
+static void prvRegTestTaskEntry1( void *pvParameters )
+{
+ /* Although the regtest task is written in assembler, its entry point is
+ written in C for convenience of checking the task parameter is being passed
+ in correctly. */
+ if( pvParameters == mainREG_TEST_TASK_1_PARAMETER )
+ {
+ /* Start the part of the test that is written in assembler. */
+ vRegTest1Implementation();
+ }
+
+ /* The following line will only execute if the task parameter is found to
+ be incorrect. The check task will detect that the regtest loop counter is
+ not being incremented and flag an error. */
+ vTaskDelete( NULL );
+}
+/*-----------------------------------------------------------*/
+
+static void prvRegTestTaskEntry2( void *pvParameters )
+{
+ /* Although the regtest task is written in assembler, its entry point is
+ written in C for convenience of checking the task parameter is being passed
+ in correctly. */
+ if( pvParameters == mainREG_TEST_TASK_2_PARAMETER )
+ {
+ /* Start the part of the test that is written in assembler. */
+ vRegTest2Implementation();
+ }
+
+ /* The following line will only execute if the task parameter is found to
+ be incorrect. The check task will detect that the regtest loop counter is
+ not being incremented and flag an error. */
+ vTaskDelete( NULL );
+}
+/*-----------------------------------------------------------*/
+
+void vFullDemoTickHook( void )
+{
+ /* Called from vApplicationTickHook() when the project is configured to
+ build the full demo. */
+// 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 a33a716a6..0c970d96a 100644
--- a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/main.c
+++ b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/main.c
@@ -1,126 +1,87 @@
-// See LICENSE for license details.
+/*
+ * FreeRTOS Kernel V10.1.1
+ * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+ * the Software, and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+ * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * http://www.FreeRTOS.org
+ * http://aws.amazon.com/freertos
+ *
+ * 1 tab == 4 spaces!
+ */
+/* FreeRTOS kernel includes. */
#include
#include
-#include
-#include
-#include "platform.h"
-#include
-#include "plic/plic_driver.h"
-#include "encoding.h"
-#include
-#include "stdatomic.h"
-
+/******************************************************************************
+ * This project provides two demo applications. A simple blinky style project,
+ * and a more comprehensive test and demo application. The
+ * mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting (defined in this file) is used to
+ * select between the two. The simply blinky demo is implemented and described
+ * in main_blinky.c. The more comprehensive test and demo application is
+ * implemented and described in main_full.c.
+ *
+ * This file implements the code that is not demo specific, including the
+ * hardware setup and standard FreeRTOS hook functions.
+ *
+ * ENSURE TO READ THE DOCUMENTATION PAGE FOR THIS PORT AND DEMO APPLICATION ON
+ * THE http://www.FreeRTOS.org WEB SITE FOR FULL INFORMATION ON USING THIS DEMO
+ * APPLICATION, AND ITS ASSOCIATE FreeRTOS ARCHITECTURE PORT!
+ *
+ */
+/* Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to one to run the simple blinky demo,
+or 0 to run the more comprehensive test and demo application. */
+#define mainCREATE_SIMPLE_BLINKY_DEMO_ONLY 0
/*
- * FreeRTOS hook for when malloc fails, enable in FreeRTOSConfig.
+ * main_blinky() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1.
+ * main_full() is used when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0.
*/
+#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1
+ extern void main_blinky( void );
+#else
+ extern void main_full( void );
+#endif /* #if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 */
+
+/* Prototypes for the standard FreeRTOS callback/hook functions implemented
+within this file. See https://www.freertos.org/a00016.html */
void vApplicationMallocFailedHook( void );
-
-/*
- * FreeRTOS hook for when FreeRtos is idling, enable in FreeRTOSConfig.
- */
void vApplicationIdleHook( void );
-
-/*
- * FreeRTOS hook for when a stack overflow occurs, enable in FreeRTOSConfig.
- */
void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );
+void vApplicationTickHook( void );
-
-
-void vRegTest1Task( void *pvParameters );
-void vRegTest2Task( void *pvParameters );
-
-
-const char * const pcStartMessage = "FreeRTOS demo\r\n";
-volatile uint32_t ulRegTest1LoopCounter = 0, ulRegTest2LoopCounter = 0;
-static void prvCheckTask( void *pvParameters );
-plic_instance_t g_plic;
-uint32_t bitbang_mask = 0;
+/*-----------------------------------------------------------*/
int main( void )
{
- #ifdef HAS_BOARD_BUTTONS
- GPIO_REG(GPIO_OUTPUT_EN) &= ~((0x1 << BUTTON_0_OFFSET) | (0x1 << BUTTON_1_OFFSET) | (0x1 << BUTTON_2_OFFSET));
- GPIO_REG(GPIO_PULLUP_EN) &= ~((0x1 << BUTTON_0_OFFSET) | (0x1 << BUTTON_1_OFFSET) | (0x1 << BUTTON_2_OFFSET));
- GPIO_REG(GPIO_INPUT_EN) |= ((0x1 << BUTTON_0_OFFSET) | (0x1 << BUTTON_1_OFFSET) | (0x1 << BUTTON_2_OFFSET));
- #endif
-
- GPIO_REG(GPIO_INPUT_EN) &= ~((0x1<< RED_LED_OFFSET) | (0x1<< GREEN_LED_OFFSET) | (0x1 << BLUE_LED_OFFSET)) ;
- GPIO_REG(GPIO_OUTPUT_EN) |= ((0x1<< RED_LED_OFFSET)| (0x1<< GREEN_LED_OFFSET) | (0x1 << BLUE_LED_OFFSET)) ;
- GPIO_REG(GPIO_OUTPUT_VAL) |= (0x1 << BLUE_LED_OFFSET) ;
- GPIO_REG(GPIO_OUTPUT_VAL) &= ~((0x1<< RED_LED_OFFSET) | (0x1<< GREEN_LED_OFFSET)) ;
-
- /* For Bit-banging with Atomics demo. */
- #ifdef _SIFIVE_HIFIVE1_H
- bitbang_mask = (1 << PIN_19_OFFSET);
- #else
- #ifdef _SIFIVE_COREPLEXIP_ARTY_H
- bitbang_mask = (0x1 << JA_0_OFFSET);
- #endif
- #endif
-
- GPIO_REG(GPIO_OUTPUT_EN) |= bitbang_mask;
-
-// xTaskCreate( vRegTest1Task, "RegTest1", 1000, NULL, tskIDLE_PRIORITY, NULL );
-// xTaskCreate( vRegTest2Task, "RegTest2", 1000, NULL, tskIDLE_PRIORITY, NULL );
- xTaskCreate( prvCheckTask, "Check", 1000, NULL, configMAX_PRIORITIES - 1, NULL );
-
- vTaskStartScheduler();
-}
-/*-----------------------------------------------------------*/
-
-static void prvCheckTask( void *pvParameters )
-{
-const char *pcMessage = "PASS\r\n";
-const TickType_t xCheckPeriod = pdMS_TO_TICKS( 3000UL );
-uint32_t ulLastRegTest1LoopCounter = 0, ulLastRegTest2LoopCounter = 0;
-volatile uintptr_t mstatus;
-
-volatile uint32_t ulx;
-__asm volatile ("csrr %0, mstatus" : "=r"(mstatus));
-portENABLE_INTERRUPTS();
-__asm volatile ("csrr %0, mstatus" : "=r"(mstatus));
-for( ;; )
-{
-// for( ulx = 0; ulx < 0xffff; ulx++ ) __asm volatile( "NOP" );
-// vPortSetupTimerInterrupt();
- vTaskDelay( xCheckPeriod );
- write( STDOUT_FILENO, "Blip\r\n", strlen( "Blip\r\n" ) );
-}
-#if 0
- for( ;; )
+ /* The mainCREATE_SIMPLE_BLINKY_DEMO_ONLY setting is described at the top
+ of this file. */
+ #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 1 )
{
- vTaskDelay( xCheckPeriod );
-
- if( ulLastRegTest1LoopCounter == ulRegTest1LoopCounter )
- {
- /* The RegTest1 loop counter is no longer incrementing, indicating
- the task failed its self check. */
- pcMessage = "FAIL: RegTest1\r\n";
- }
- else
- {
- ulLastRegTest1LoopCounter = ulRegTest1LoopCounter;
- }
-
- if( ulLastRegTest2LoopCounter == ulRegTest2LoopCounter )
- {
- /* The RegTest1 loop counter is no longer incrementing, indicating
- the task failed its self check. */
- pcMessage = "FAIL: RegTest2\r\n";
- }
- else
- {
- ulLastRegTest2LoopCounter = ulRegTest2LoopCounter;
- }
-
- vUARTWriteString( pcMessage );
+ main_blinky();
}
-#endif
+ #else
+ {
+ main_full();
+ }
+ #endif
}
/*-----------------------------------------------------------*/
@@ -137,6 +98,7 @@ 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( ;; );
}
/*-----------------------------------------------------------*/
@@ -164,39 +126,26 @@ 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( ;; );
}
/*-----------------------------------------------------------*/
-#define mainINTERRUPT_BIT_SET 0x80000000UL
-#define mainENVIRONMENT_CALL 11UL
-#define mainEXTERNAL_INTERRRUPT ( mainINTERRUPT_BIT_SET | 11UL )
-#define mainTIMER_INTERRUPT ( mainINTERRUPT_BIT_SET | 7UL )
-#define mainSOFTWARE_INTERRUPT ( mainINTERRUPT_BIT_SET | 3UL )
-
-extern void Timer_IRQHandler( void );
-
-uint32_t ulPortTrapHandler( uint32_t mcause, uint32_t mepc )
+void vApplicationTickHook( void )
{
- if( mcause == mainENVIRONMENT_CALL )
+ /* The tests in the full demo expect some interaction with interrupts. */
+ #if( mainCREATE_SIMPLE_BLINKY_DEMO_ONLY != 1 )
{
- vTaskSwitchContext();
-
- /* Ensure not to return to the instruction that generated the exception. */
- mepc += 4;
+ extern void vFullDemoTickHook( void );
+ vFullDemoTickHook();
}
- else if( mcause == mainEXTERNAL_INTERRRUPT )
- {
- for( ;; );
- }
- else if( mcause == mainTIMER_INTERRUPT )
- {
- Timer_IRQHandler();
- }
- else if( mcause == mainSOFTWARE_INTERRUPT )
- {
- for( ;; );
- }
-
- return mepc;
+ #endif
+}
+/*-----------------------------------------------------------*/
+
+void vAssertCalled( void )
+{
+ taskDISABLE_INTERRUPTS();
+// __asm volatile( "ebreak" );
+ for( ;; );
}