]> git.sur5r.net Git - freertos/commitdiff
Add kernel code to the RISC-V-Qemu-sifive_e-FreedomStudio demo.
authorrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 24 Nov 2018 04:42:20 +0000 (04:42 +0000)
committerrtel <rtel@1d2547de-c912-0410-9cb9-b8ca96c0e9e2>
Sat, 24 Nov 2018 04:42:20 +0000 (04:42 +0000)
git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@2595 1d2547de-c912-0410-9cb9-b8ca96c0e9e2

FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.cproject
FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.project
FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/.settings/language.settings.xml
FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/FreeRTOSConfig.h [new file with mode: 0644]
FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/main.c

index 02479366e4ce6a06350bd96d0ada8a55fed5e6a6..a9424634c22d81f2c5bb4f5aa882372a5ea31eb4 100644 (file)
@@ -45,7 +45,7 @@
                                                        <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel.93793405" name="Code model" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel" useByScannerDiscovery="false" value="ilg.gnumcueclipse.managedbuild.cross.riscv.option.target.codemodel.any" valueType="enumerated"/>\r
                                                        <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id.1107449554" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.toolchain.id" useByScannerDiscovery="false" value="-2032619395" valueType="string"/>\r
                                                        <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform.1301923652" isAbstract="false" osList="all" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.targetPlatform"/>\r
-                                                       <builder buildPath="${workspace_loc:/RTOSDemo}/Debug" id="ilg.gnumcueclipse.managedbuild.cross.riscv.builder.1496635672" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.builder"/>\r
+                                                       <builder buildPath="${workspace_loc:/RTOSDemo}/Debug" id="ilg.gnumcueclipse.managedbuild.cross.riscv.builder.1496635672" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.builder"/>\r
                                                        <tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler.1472778604" name="GNU RISC-V Cross Assembler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.assembler">\r
                                                                <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor.874608690" name="Use preprocessor" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.usepreprocessor" useByScannerDiscovery="false" value="true" valueType="boolean"/>\r
                                                                <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths.545620458" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths" useByScannerDiscovery="true" valueType="includePath">\r
                                                        </tool>\r
                                                        <tool id="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler.1632260763" name="GNU RISC-V Cross C Compiler" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.tool.c.compiler">\r
                                                                <option id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths.1464742435" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.c.compiler.include.paths" useByScannerDiscovery="true" valueType="includePath">\r
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/include}&quot;"/>\r
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/drivers}&quot;"/>\r
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>\r
+                                                                       <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/RISC-V-RV32}&quot;"/>\r
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/env}&quot;"/>\r
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/env/freedom-e300-hifive1}&quot;"/>\r
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/include}&quot;"/>\r
index 1ee79134ee2831ad20293744ff368d644478864f..b83209ea4b51ed756428a3b18dcb6b8727f91dac 100644 (file)
                <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>\r
                <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>\r
        </natures>\r
+       <linkedResources>\r
+               <link>\r
+                       <name>FreeRTOS_Source</name>\r
+                       <type>2</type>\r
+                       <locationURI>virtual:/virtual</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/event_groups.c</name>\r
+                       <type>1</type>\r
+                       <locationURI>FREERTOS_ROUTE/FreeRTOS/Source/event_groups.c</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/include</name>\r
+                       <type>2</type>\r
+                       <locationURI>FREERTOS_ROUTE/FreeRTOS/Source/include</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/list.c</name>\r
+                       <type>1</type>\r
+                       <locationURI>FREERTOS_ROUTE/FreeRTOS/Source/list.c</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/portable</name>\r
+                       <type>2</type>\r
+                       <locationURI>virtual:/virtual</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/queue.c</name>\r
+                       <type>1</type>\r
+                       <locationURI>FREERTOS_ROUTE/FreeRTOS/Source/queue.c</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/stream_buffer.c</name>\r
+                       <type>1</type>\r
+                       <locationURI>FREERTOS_ROUTE/FreeRTOS/Source/stream_buffer.c</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/tasks.c</name>\r
+                       <type>1</type>\r
+                       <locationURI>FREERTOS_ROUTE/FreeRTOS/Source/tasks.c</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/timers.c</name>\r
+                       <type>1</type>\r
+                       <locationURI>FREERTOS_ROUTE/FreeRTOS/Source/timers.c</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/portable/GCC</name>\r
+                       <type>2</type>\r
+                       <locationURI>virtual:/virtual</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/portable/MemMang</name>\r
+                       <type>2</type>\r
+                       <locationURI>virtual:/virtual</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/portable/GCC/RISC-V-RV32</name>\r
+                       <type>2</type>\r
+                       <locationURI>FREERTOS_ROUTE/FreeRTOS/Source/portable/GCC/RISC-V-RV32</locationURI>\r
+               </link>\r
+               <link>\r
+                       <name>FreeRTOS_Source/portable/MemMang/heap_4.c</name>\r
+                       <type>1</type>\r
+                       <locationURI>FREERTOS_ROUTE/FreeRTOS/Source/portable/MemMang/heap_4.c</locationURI>\r
+               </link>\r
+       </linkedResources>\r
+       <variableList>\r
+               <variable>\r
+                       <name>FREERTOS_ROUTE</name>\r
+                       <value>$%7BPARENT-3-PROJECT_LOC%7D</value>\r
+               </variable>\r
+       </variableList>\r
 </projectDescription>\r
index df1c05bab33d6902b2556718e58de6f30db6ddb1..ba62fc5d659fac9c1be05952bca5fee4bcc82091 100644 (file)
@@ -5,7 +5,7 @@
                        <provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>\r
                        <provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>\r
                        <provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>\r
-                       <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1866420524446515374" 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">\r
+                       <provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="1914048489906665533" 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">\r
                                <language-scope id="org.eclipse.cdt.core.gcc"/>\r
                                <language-scope id="org.eclipse.cdt.core.g++"/>\r
                        </provider>\r
diff --git a/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/FreeRTOSConfig.h b/FreeRTOS/Demo/RISC-V-Qemu-sifive_e-FreedomStudio/FreeRTOSConfig.h
new file mode 100644 (file)
index 0000000..74858e4
--- /dev/null
@@ -0,0 +1,150 @@
+/*\r
+    FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd.\r
+    All rights reserved\r
+\r
+    VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.\r
+\r
+    This file is part of the FreeRTOS distribution.\r
+\r
+    FreeRTOS is free software; you can redistribute it and/or modify it under\r
+    the terms of the GNU General Public License (version 2) as published by the\r
+    Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.\r
+\r
+    ***************************************************************************\r
+    >>!   NOTE: The modification to the GPL is included to allow you to     !<<\r
+    >>!   distribute a combined work that includes FreeRTOS without being   !<<\r
+    >>!   obliged to provide the source code for proprietary components     !<<\r
+    >>!   outside of the FreeRTOS kernel.                                   !<<\r
+    ***************************************************************************\r
+\r
+    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY\r
+    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\r
+    FOR A PARTICULAR PURPOSE.  Full license text is available on the following\r
+    link: http://www.freertos.org/a00114.html\r
+\r
+    ***************************************************************************\r
+     *                                                                       *\r
+     *    FreeRTOS provides completely free yet professionally developed,    *\r
+     *    robust, strictly quality controlled, supported, and cross          *\r
+     *    platform software that is more than just the market leader, it     *\r
+     *    is the industry's de facto standard.                               *\r
+     *                                                                       *\r
+     *    Help yourself get started quickly while simultaneously helping     *\r
+     *    to support the FreeRTOS project by purchasing a FreeRTOS           *\r
+     *    tutorial book, reference manual, or both:                          *\r
+     *    http://www.FreeRTOS.org/Documentation                              *\r
+     *                                                                       *\r
+    ***************************************************************************\r
+\r
+    http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading\r
+    the FAQ page "My application does not run, what could be wrong?".  Have you\r
+    defined configASSERT()?\r
+\r
+    http://www.FreeRTOS.org/support - In return for receiving this top quality\r
+    embedded software for free we request you assist our global community by\r
+    participating in the support forum.\r
+\r
+    http://www.FreeRTOS.org/training - Investing in training allows your team to\r
+    be as productive as possible as early as possible.  Now you can receive\r
+    FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers\r
+    Ltd, and the world's leading authority on the world's leading RTOS.\r
+\r
+    http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,\r
+    including FreeRTOS+Trace - an indispensable productivity tool, a DOS\r
+    compatible FAT file system, and our tiny thread aware UDP/IP stack.\r
+\r
+    http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.\r
+    Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.\r
+\r
+    http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High\r
+    Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS\r
+    licenses offer ticketed support, indemnification and commercial middleware.\r
+\r
+    http://www.SafeRTOS.com - High Integrity Systems also provide a safety\r
+    engineered and independently SIL3 certified version for use in safety and\r
+    mission critical applications that require provable dependability.\r
+\r
+    1 tab == 4 spaces!\r
+*/\r
+\r
+\r
+#ifndef FREERTOS_CONFIG_H\r
+#define FREERTOS_CONFIG_H\r
+\r
+\r
+/*-----------------------------------------------------------\r
+ * Application specific definitions.\r
+ *\r
+ * These definitions should be adjusted for your particular hardware and\r
+ * application requirements.\r
+ *\r
+ * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE\r
+ * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.\r
+ *\r
+ * See http://www.freertos.org/a00110.html.\r
+ *----------------------------------------------------------*/\r
+\r
+#define configCTRL_BASE                                        0x2000000\r
+#define configUSE_PREEMPTION                   1\r
+#define configUSE_IDLE_HOOK                            0\r
+#define configUSE_TICK_HOOK                            0\r
+#define configCPU_CLOCK_HZ                             ( 10000000 ) /*QEMU*/\r
+#define configTICK_RATE_HZ                             ( ( TickType_t ) 1000 )\r
+#define configMAX_PRIORITIES                   ( 5 )\r
+#define configMINIMAL_STACK_SIZE               ( ( unsigned short ) 512 )\r
+#define configTOTAL_HEAP_SIZE                  ( ( size_t ) ( 10 * 1024 ) )\r
+#define configMAX_TASK_NAME_LEN                        ( 16 )\r
+#define configUSE_TRACE_FACILITY               1\r
+#define configUSE_16_BIT_TICKS                 0\r
+#define configIDLE_SHOULD_YIELD                        0\r
+#define configUSE_MUTEXES                              1\r
+#define configQUEUE_REGISTRY_SIZE              8\r
+#define configCHECK_FOR_STACK_OVERFLOW 2\r
+#define configUSE_RECURSIVE_MUTEXES            1\r
+#define configUSE_MALLOC_FAILED_HOOK   1\r
+#define configUSE_APPLICATION_TASK_TAG 0\r
+#define configUSE_COUNTING_SEMAPHORES  1\r
+#define configGENERATE_RUN_TIME_STATS  0\r
+\r
+/* Co-routine definitions. */\r
+#define configUSE_CO_ROUTINES                  0\r
+#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )\r
+\r
+/* Software timer definitions. */\r
+#define configUSE_TIMERS                               0\r
+#define configTIMER_TASK_PRIORITY              ( 2 )\r
+#define configTIMER_QUEUE_LENGTH               2\r
+#define configTIMER_TASK_STACK_DEPTH   ( configMINIMAL_STACK_SIZE )\r
+\r
+/* Task priorities.  Allow these to be overridden. */\r
+#ifndef uartPRIMARY_PRIORITY\r
+       #define uartPRIMARY_PRIORITY            ( configMAX_PRIORITIES - 3 )\r
+#endif\r
+\r
+/* Set the following definitions to 1 to include the API function, or zero\r
+to exclude the API function. */\r
+#define INCLUDE_vTaskPrioritySet               1\r
+#define INCLUDE_uxTaskPriorityGet              1\r
+#define INCLUDE_vTaskDelete                            1\r
+#define INCLUDE_vTaskCleanUpResources  1\r
+#define INCLUDE_vTaskSuspend                   1\r
+#define INCLUDE_vTaskDelayUntil                        1\r
+#define INCLUDE_vTaskDelay                             1\r
+#define INCLUDE_eTaskGetState                  1\r
+\r
+/* Normal assert() semantics without relying on the provision of an assert.h\r
+header file. */\r
+#define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); for( ;; ); }\r
+\r
+/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS\r
+standard names - or at least those used in the unmodified vector table. */\r
+//#define vPortSVCHandler SVCall_Handler\r
+//#define xPortPendSVHandler PendSV_Handler\r
+//#define vPortSysTickHandler SysTick_Handler\r
+\r
+extern void vApplicationMallocFailedHook();\r
+\r
+\r
+extern void vUARTWriteString( const char * const pcString );\r
+\r
+#endif /* FREERTOS_CONFIG_H */\r
index af6c97fe8ab78cf18cfd1ba888437160eeb1d4be..649218528de93fa4ec8ef39760412297bf9612a5 100644 (file)
@@ -1,5 +1,8 @@
 // See LICENSE for license details.\r
 \r
+#include <FreeRTOS.h>\r
+#include <task.h>\r
+\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include "platform.h"\r
@@ -9,6 +12,24 @@
 #include <unistd.h>\r
 #include "stdatomic.h"\r
 \r
+\r
+\r
+/*\r
+ * FreeRTOS hook for when malloc fails, enable in FreeRTOSConfig.\r
+ */\r
+void vApplicationMallocFailedHook( void );\r
+\r
+/*\r
+ * FreeRTOS hook for when FreeRtos is idling, enable in FreeRTOSConfig.\r
+ */\r
+void vApplicationIdleHook( void );\r
+\r
+/*\r
+ * FreeRTOS hook for when a stack overflow occurs, enable in FreeRTOSConfig.\r
+ */\r
+void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName );\r
+\r
+\r
 void reset_demo (void);\r
 \r
 // Structures for registering different interrupt handlers\r
@@ -251,8 +272,55 @@ int main(int argc, char **argv)
 \r
 }\r
 \r
+void vApplicationMallocFailedHook( void )\r
+{\r
+       /* vApplicationMallocFailedHook() will only be called if\r
+       configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h.  It is a hook\r
+       function that will get called if a call to pvPortMalloc() fails.\r
+       pvPortMalloc() is called internally by the kernel whenever a task, queue,\r
+       timer or semaphore is created.  It is also called by various parts of the\r
+       demo application.  If heap_1.c or heap_2.c are used, then the size of the\r
+       heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in\r
+       FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used\r
+       to query the size of free heap space that remains (although it does not\r
+       provide information on how the remaining heap might be fragmented). */\r
+       taskDISABLE_INTERRUPTS();\r
+       for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationIdleHook( void )\r
+{\r
+       /* vApplicationIdleHook() will only be called if configUSE_IDLE_HOOK is set\r
+       to 1 in FreeRTOSConfig.h.  It will be called on each iteration of the idle\r
+       task.  It is essential that code added to this hook function never attempts\r
+       to block in any way (for example, call xQueueReceive() with a block time\r
+       specified, or call vTaskDelay()).  If the application makes use of the\r
+       vTaskDelete() API function (as this demo application does) then it is also\r
+       important that vApplicationIdleHook() is permitted to return to its calling\r
+       function, because it is the responsibility of the idle task to clean up\r
+       memory allocated by the kernel to any task that has since been deleted. */\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+void vApplicationStackOverflowHook( TaskHandle_t pxTask, char *pcTaskName )\r
+{\r
+       ( void ) pcTaskName;\r
+       ( void ) pxTask;\r
+\r
+       /* Run time stack overflow checking is performed if\r
+       configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2.  This hook\r
+       function is called if a stack overflow is detected. */\r
+       taskDISABLE_INTERRUPTS();\r
+       for( ;; );\r
+}\r
+/*-----------------------------------------------------------*/\r
+\r
+\r
 \r
 void trap_entry( void )\r
 {\r
 #warning Dummy until kernel code is incldued.\r
 }\r
+\r
+\r