Initial commit
This commit is contained in:
		
							
								
								
									
										152
									
								
								Libs/RiscV/NEORV32/sw/example/demo_freeRTOS/FreeRTOSConfig.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										152
									
								
								Libs/RiscV/NEORV32/sw/example/demo_freeRTOS/FreeRTOSConfig.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,152 @@ | ||||
| /* | ||||
|     FreeRTOS V8.2.3 - Copyright (C) 2015 Real Time Engineers Ltd. | ||||
|     All rights reserved | ||||
|  | ||||
|     VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION. | ||||
|  | ||||
|     This file is part of the FreeRTOS distribution. | ||||
|  | ||||
|     FreeRTOS is free software; you can redistribute it and/or modify it under | ||||
|     the terms of the GNU General Public License (version 2) as published by the | ||||
|     Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception. | ||||
|  | ||||
|     *************************************************************************** | ||||
|     >>!   NOTE: The modification to the GPL is included to allow you to     !<< | ||||
|     >>!   distribute a combined work that includes FreeRTOS without being   !<< | ||||
|     >>!   obliged to provide the source code for proprietary components     !<< | ||||
|     >>!   outside of the FreeRTOS kernel.                                   !<< | ||||
|     *************************************************************************** | ||||
|  | ||||
|     FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY | ||||
|     WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||||
|     FOR A PARTICULAR PURPOSE.  Full license text is available on the following | ||||
|     link: http://www.freertos.org/a00114.html | ||||
|  | ||||
|     *************************************************************************** | ||||
|      *                                                                       * | ||||
|      *    FreeRTOS provides completely free yet professionally developed,    * | ||||
|      *    robust, strictly quality controlled, supported, and cross          * | ||||
|      *    platform software that is more than just the market leader, it     * | ||||
|      *    is the industry's de facto standard.                               * | ||||
|      *                                                                       * | ||||
|      *    Help yourself get started quickly while simultaneously helping     * | ||||
|      *    to support the FreeRTOS project by purchasing a FreeRTOS           * | ||||
|      *    tutorial book, reference manual, or both:                          * | ||||
|      *    http://www.FreeRTOS.org/Documentation                              * | ||||
|      *                                                                       * | ||||
|     *************************************************************************** | ||||
|  | ||||
|     http://www.FreeRTOS.org/FAQHelp.html - Having a problem?  Start by reading | ||||
|     the FAQ page "My application does not run, what could be wrong?".  Have you | ||||
|     defined configASSERT()? | ||||
|  | ||||
|     http://www.FreeRTOS.org/support - In return for receiving this top quality | ||||
|     embedded software for free we request you assist our global community by | ||||
|     participating in the support forum. | ||||
|  | ||||
|     http://www.FreeRTOS.org/training - Investing in training allows your team to | ||||
|     be as productive as possible as early as possible.  Now you can receive | ||||
|     FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers | ||||
|     Ltd, and the world's leading authority on the world's leading RTOS. | ||||
|  | ||||
|     http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products, | ||||
|     including FreeRTOS+Trace - an indispensable productivity tool, a DOS | ||||
|     compatible FAT file system, and our tiny thread aware UDP/IP stack. | ||||
|  | ||||
|     http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate. | ||||
|     Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS. | ||||
|  | ||||
|     http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High | ||||
|     Integrity Systems ltd. to sell under the OpenRTOS brand.  Low cost OpenRTOS | ||||
|     licenses offer ticketed support, indemnification and commercial middleware. | ||||
|  | ||||
|     http://www.SafeRTOS.com - High Integrity Systems also provide a safety | ||||
|     engineered and independently SIL3 certified version for use in safety and | ||||
|     mission critical applications that require provable dependability. | ||||
|  | ||||
|     1 tab == 4 spaces! | ||||
| */ | ||||
|  | ||||
|  | ||||
| #ifndef FREERTOS_CONFIG_H | ||||
| #define FREERTOS_CONFIG_H | ||||
|  | ||||
| //#include "clock_config.h" | ||||
|  | ||||
| /*----------------------------------------------------------- | ||||
|  * Application specific definitions. | ||||
|  * | ||||
|  * These definitions should be adjusted for your particular hardware and | ||||
|  * application requirements. | ||||
|  * | ||||
|  * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE | ||||
|  * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. | ||||
|  * | ||||
|  * See http://www.freertos.org/a00110.html. | ||||
|  *----------------------------------------------------------*/ | ||||
|  | ||||
| /* See https://www.freertos.org/Using-FreeRTOS-on-RISC-V.html */ | ||||
| #define configMTIME_BASE_ADDRESS 	( 0xFFFFFF90UL  ) | ||||
| #define configMTIMECMP_BASE_ADDRESS ( 0xFFFFFF98UL  ) | ||||
|  | ||||
| #define configISR_STACK_SIZE_WORDS ( 128 ) | ||||
|  | ||||
| #define configUSE_PREEMPTION			1 | ||||
| #define configUSE_IDLE_HOOK				1 | ||||
| #define configUSE_TICK_HOOK				1 | ||||
| #define configCPU_CLOCK_HZ				100000000 | ||||
| #define configTICK_RATE_HZ				( ( TickType_t ) 100 ) | ||||
| #define configMAX_PRIORITIES			( 5 ) | ||||
| #define configMINIMAL_STACK_SIZE		( ( unsigned short ) 128 ) /* Can be as low as 60 but some of the demo tasks that use this constant require it to be higher. */ | ||||
| #define configSUPPORT_DYNAMIC_ALLOCATION  1 | ||||
| #define configTOTAL_HEAP_SIZE			( ( size_t ) ( 7 * 1024 ) ) | ||||
| #define configMAX_TASK_NAME_LEN			( 16 ) | ||||
| #define configUSE_TRACE_FACILITY		1 | ||||
| #define configUSE_16_BIT_TICKS			0 | ||||
| #define configIDLE_SHOULD_YIELD			0 | ||||
| #define configUSE_MUTEXES				1 | ||||
| #define configQUEUE_REGISTRY_SIZE		8 | ||||
| #define configCHECK_FOR_STACK_OVERFLOW	2 | ||||
| #define configUSE_RECURSIVE_MUTEXES		1 | ||||
| #define configUSE_MALLOC_FAILED_HOOK	1 | ||||
| #define configUSE_APPLICATION_TASK_TAG	0 | ||||
| #define configUSE_COUNTING_SEMAPHORES	1 | ||||
| #define configGENERATE_RUN_TIME_STATS	0 | ||||
| #define configTASK_NOTIFICATION_ARRAY_ENTRIES 4 | ||||
| #define configUSE_PORT_OPTIMISED_TASK_SELECTION 1 | ||||
|  | ||||
| /* Co-routine definitions. */ | ||||
| #define configUSE_CO_ROUTINES 			0 | ||||
| #define configMAX_CO_ROUTINE_PRIORITIES ( 2 ) | ||||
|  | ||||
| /* Software timer definitions. */ | ||||
| #define configUSE_TIMERS				1 | ||||
| #define configTIMER_TASK_PRIORITY		( configMAX_PRIORITIES - 1 ) | ||||
| #define configTIMER_QUEUE_LENGTH		4 | ||||
| #define configTIMER_TASK_STACK_DEPTH	( configMINIMAL_STACK_SIZE ) | ||||
|  | ||||
| /* Task priorities.  Allow these to be overridden. */ | ||||
| #ifndef uartPRIMARY_PRIORITY | ||||
| 	#define uartPRIMARY_PRIORITY		( configMAX_PRIORITIES - 3 ) | ||||
| #endif | ||||
|  | ||||
| /* Set the following definitions to 1 to include the API function, or zero | ||||
| to exclude the API function. */ | ||||
| #define INCLUDE_vTaskPrioritySet			1 | ||||
| #define INCLUDE_uxTaskPriorityGet			1 | ||||
| #define INCLUDE_vTaskDelete					1 | ||||
| #define INCLUDE_vTaskCleanUpResources		1 | ||||
| #define INCLUDE_vTaskSuspend				1 | ||||
| #define INCLUDE_vTaskDelayUntil				1 | ||||
| #define INCLUDE_vTaskDelay					1 | ||||
| #define INCLUDE_eTaskGetState				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 | ||||
| header file. */ | ||||
| #define configASSERT( x ) if( ( x ) == 0 ) { taskDISABLE_INTERRUPTS(); __asm volatile( "ebreak" ); for( ;; ); } | ||||
|  | ||||
| #endif /* FREERTOS_CONFIG_H */ | ||||
							
								
								
									
										71
									
								
								Libs/RiscV/NEORV32/sw/example/demo_freeRTOS/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										71
									
								
								Libs/RiscV/NEORV32/sw/example/demo_freeRTOS/README.md
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,71 @@ | ||||
|   # FreeRTOS Demo for the NEORV32 Processor | ||||
|  | ||||
| This example shows how to run [FreeRTOS](https://www.freertos.org/) on the NEORV32 processor. It features the default | ||||
| "blinky_demo" and the more sophisticated "full_demo" demo applications. See the comments in `main.c` and the according | ||||
| source files for more information. | ||||
|  | ||||
| The chip-specific extensions folder (`chip_specific_extensions/neorv32`) should be in `$(FREERTOS_HOME)/Source/portable/GCC/RISC-V/chip_specific_extensions`, | ||||
| but is placed in this source directory for simplicity. | ||||
|  | ||||
|  | ||||
| ## Hardware Requirements | ||||
|  | ||||
| * DMEM/IMEM requriements depend on the actual application (for example: 8kB DMEM and 16kB IMEM for *blinky_demo*) | ||||
| * MTIME (machine timer) + UART + GPIO | ||||
| * `Zicsr` CPU extension | ||||
|  | ||||
|  | ||||
| ## Instructions | ||||
|  | ||||
| Download FreeRTOS from the [official GitHub repository](https://github.com/FreeRTOS/FreeRTOS) or from the its official homepage. | ||||
|  | ||||
|     $ git clone https://github.com/FreeRTOS/FreeRTOS.git | ||||
|  | ||||
| Open the makefile from this example folder and configure the `FREERTOS_HOME` variable to point to your FreeRTOS home folder. | ||||
|  | ||||
|     FREERTOS_HOME ?= /mnt/n/Projects/FreeRTOSv10.4.1 | ||||
|  | ||||
| Compile the NEORV32 executable. Do not forget the `RUN_FREERTOS_DEMO` switch. | ||||
|  | ||||
|     $ make USER_FLAGS+=-DRUN_FREERTOS_DEMO clean_all exe | ||||
|  | ||||
| Note: The *.c sources and the FreeRTOS-specific part of the makefile have (include) guards that test if `RUN_FREERTOS_DEMO` is defined. | ||||
| This has no pratical usage for the user - it is just a work-around for the NEORV32 CI environment. | ||||
|  | ||||
| Upload the executable (`neorv32_exe.bin`) to the processor via the bootloader and execute it. | ||||
|  | ||||
| ``` | ||||
| Awaiting neorv32_exe.bin... OK | ||||
| CMD:> e | ||||
| Booting... | ||||
|  | ||||
| FreeRTOS V10.4.1 | ||||
| Blink | ||||
| Blink | ||||
| Blink | ||||
| ``` | ||||
|  | ||||
| ## FreeRTOS Plus | ||||
|  | ||||
| To automatically add source and include files from FreeRTOS plus extensions add one (or more) of the following arguments when invoking `make`: | ||||
|  | ||||
| * FreeRTOS-Plus-CLI: `USER_FLAGS+=-FREERTOS_PLUS_CLI` | ||||
| * FreeRTOS-Plus-TCP: `USER_FLAGS+=-FREERTOS_PLUS_TCP` | ||||
|  | ||||
| Example: | ||||
|  | ||||
|     $ make USER_FLAGS+=-DRUN_FREERTOS_DEMO USER_FLAGS+=-FREERTOS_PLUS_TCP clean_all exe | ||||
|  | ||||
|  | ||||
| ## Notes | ||||
|  | ||||
| The onfiguration of the FreeRTOS home folder (via `FREERTOS_HOME`) is corrupted if the compiler shows the following error: | ||||
|  | ||||
| ``` | ||||
| main.c:36:10: fatal error: FreeRTOS.h: No such file or directory | ||||
|    36 | #include <FreeRTOS.h> | ||||
|       |          ^~~~~~~~~~~~ | ||||
| compilation terminated. | ||||
| make: *** [makefile:203: main.c.o] Error 1 | ||||
| ``` | ||||
|  | ||||
| @@ -0,0 +1,72 @@ | ||||
| /* | ||||
|  * FreeRTOS Kernel V10.3.1 | ||||
|  * Copyright (C) 2020 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! | ||||
|  */ | ||||
|  | ||||
| /* | ||||
|  * The FreeRTOS kernel's RISC-V port is split between the the code that is | ||||
|  * common across all currently supported RISC-V chips (implementations of the | ||||
|  * RISC-V ISA), and code that tailors the port to a specific RISC-V chip: | ||||
|  * | ||||
|  * + FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S contains the code that | ||||
|  *   is common to all currently supported RISC-V chips.  There is only one | ||||
|  *   portASM.S file because the same file is built for all RISC-V target chips. | ||||
|  * | ||||
|  * + Header files called freertos_risc_v_chip_specific_extensions.h contain the | ||||
|  *   code that tailors the FreeRTOS kernel's RISC-V port to a specific RISC-V | ||||
|  *   chip.  There are multiple freertos_risc_v_chip_specific_extensions.h files | ||||
|  *   as there are multiple RISC-V chip implementations. | ||||
|  * | ||||
|  * !!!NOTE!!! | ||||
|  * TAKE CARE TO INCLUDE THE CORRECT freertos_risc_v_chip_specific_extensions.h | ||||
|  * HEADER FILE FOR THE CHIP IN USE.  This is done using the assembler's (not the | ||||
|  * compiler's!) include path.  For example, if the chip in use includes a core | ||||
|  * local interrupter (CLINT) and does not include any chip specific register | ||||
|  * extensions then add the path below to the assembler's include path: | ||||
|  * FreeRTOS\Source\portable\GCC\RISC-V-RV32\chip_specific_extensions\RV32I_CLINT_no_extensions | ||||
|  * | ||||
|  */ | ||||
|  | ||||
| /* | ||||
|  * NEORV32 chip specific extensions | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #ifndef __FREERTOS_RISC_V_EXTENSIONS_H__ | ||||
| #define __FREERTOS_RISC_V_EXTENSIONS_H__ | ||||
|  | ||||
| #define portasmHAS_SIFIVE_CLINT 0 | ||||
| #define portasmHAS_MTIME 1 | ||||
| #define portasmADDITIONAL_CONTEXT_SIZE 0 /* Must be even number on 32-bit cores. */ | ||||
|  | ||||
| .macro portasmSAVE_ADDITIONAL_REGISTERS | ||||
| 	/* No additional registers to save, so this macro does nothing. */ | ||||
| 	.endm | ||||
|  | ||||
| .macro portasmRESTORE_ADDITIONAL_REGISTERS | ||||
| 	/* No additional registers to restore, so this macro does nothing. */ | ||||
| 	.endm | ||||
|  | ||||
| #endif /* __FREERTOS_RISC_V_EXTENSIONS_H__ */ | ||||
							
								
								
									
										266
									
								
								Libs/RiscV/NEORV32/sw/example/demo_freeRTOS/full_demo/RegTest.s
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										266
									
								
								Libs/RiscV/NEORV32/sw/example/demo_freeRTOS/full_demo/RegTest.s
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,266 @@ | ||||
| /* | ||||
|  * FreeRTOS Kernel V10.3.0 | ||||
|  * Copyright (C) 2020 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! | ||||
|  */ | ||||
|  | ||||
| 	.extern ulRegTest1LoopCounter | ||||
| 	.extern ulRegTest2LoopCounter | ||||
|  | ||||
| 	.global vRegTest1Implementation | ||||
| 	.global vRegTest2Implementation | ||||
|  | ||||
| /*-----------------------------------------------------------*/ | ||||
|  | ||||
| /* | ||||
|  * The register check tasks are described in the comments at the top of | ||||
|  * main_full.c. | ||||
|  */ | ||||
|  | ||||
| .align( 4 ) | ||||
| vRegTest1Implementation: | ||||
|  | ||||
| 	/* Fill the core registers with known values. */ | ||||
| 	li x5, 0x5 | ||||
| 	li x6, 0x6 | ||||
| 	li x7, 0x7 | ||||
| 	li x8, 0x8 | ||||
| 	li x9, 0x9 | ||||
| 	li x10, 0xa | ||||
| 	li x11, 0xb | ||||
| 	li x12, 0xc | ||||
| 	li x13, 0xd | ||||
| 	li x14, 0xe | ||||
| 	li x15, 0xf | ||||
| 	li x16, 0x10 | ||||
| 	li x17, 0x11 | ||||
| 	li x18, 0x12 | ||||
| 	li x19, 0x13 | ||||
| 	li x20, 0x14 | ||||
| 	li x21, 0x15 | ||||
| 	li x22, 0x16 | ||||
| 	li x23, 0x17 | ||||
| 	li x24, 0x18 | ||||
| 	li x25, 0x19 | ||||
| 	li x26, 0x1a | ||||
| 	li x27, 0x1b | ||||
| 	li x28, 0x1c | ||||
| 	li x29, 0x1d | ||||
| 	li x30, 0x1e | ||||
|  | ||||
| reg1_loop: | ||||
|  | ||||
| 	/* 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 | ||||
| 	bne x31, x6, reg1_error_loop | ||||
| 	li x31, 0x7 | ||||
| 	bne x31, x7, reg1_error_loop | ||||
| 	li x31, 0x8 | ||||
| 	bne x31, x8, reg1_error_loop | ||||
| 	li x31, 0x9 | ||||
| 	bne x31, x9, reg1_error_loop | ||||
| 	li x31, 0xa | ||||
| 	bne x31, x10, reg1_error_loop | ||||
| 	li x31, 0xb | ||||
| 	bne x31, x11, reg1_error_loop | ||||
| 	li x31, 0xc | ||||
| 	bne x31, x12, reg1_error_loop | ||||
| 	li x31, 0xd | ||||
| 	bne x31, x13, reg1_error_loop | ||||
| 	li x31, 0xe | ||||
| 	bne x31, x14, reg1_error_loop | ||||
| 	li x31, 0xf | ||||
| 	bne x31, x15, reg1_error_loop | ||||
| 	li x31, 0x10 | ||||
| 	bne x31, x16, reg1_error_loop | ||||
| 	li x31, 0x11 | ||||
| 	bne x31, x17, reg1_error_loop | ||||
| 	li x31, 0x12 | ||||
| 	bne x31, x18, reg1_error_loop | ||||
| 	li x31, 0x13 | ||||
| 	bne x31, x19, reg1_error_loop | ||||
| 	li x31, 0x14 | ||||
| 	bne x31, x20, reg1_error_loop | ||||
| 	li x31, 0x15 | ||||
| 	bne x31, x21, reg1_error_loop | ||||
| 	li x31, 0x16 | ||||
| 	bne x31, x22, reg1_error_loop | ||||
| 	li x31, 0x17 | ||||
| 	bne x31, x23, reg1_error_loop | ||||
| 	li x31, 0x18 | ||||
| 	bne x31, x24, reg1_error_loop | ||||
| 	li x31, 0x19 | ||||
| 	bne x31, x25, reg1_error_loop | ||||
| 	li x31, 0x1a | ||||
| 	bne x31, x26, reg1_error_loop | ||||
| 	li x31, 0x1b | ||||
| 	bne x31, x27, reg1_error_loop | ||||
| 	li x31, 0x1c | ||||
| 	bne x31, x28, reg1_error_loop | ||||
| 	li x31, 0x1d | ||||
| 	bne x31, x29, reg1_error_loop | ||||
| 	li x31, 0x1e | ||||
| 	bne x31, x30, reg1_error_loop | ||||
|  | ||||
| 	/* 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 | ||||
|  | ||||
| 	/* Yield to increase code coverage. */ | ||||
| 	ecall | ||||
|  | ||||
| 	/* 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. */ | ||||
| 	ebreak | ||||
| 	jal reg1_error_loop | ||||
|  | ||||
| .align( 4 ) | ||||
| ulRegTest1LoopCounterConst: .word ulRegTest1LoopCounter | ||||
|  | ||||
| /*-----------------------------------------------------------*/ | ||||
|  | ||||
| .align( 4 ) | ||||
| 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 | ||||
|  | ||||
| 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 | ||||
|  | ||||
| 	/* 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 | ||||
|  | ||||
| 	/* 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. */ | ||||
| 	ebreak | ||||
| 	jal reg2_error_loop | ||||
|  | ||||
| .align( 4 ) | ||||
| ulRegTest2LoopCounterConst: .word ulRegTest2LoopCounter | ||||
|  | ||||
|  | ||||
							
								
								
									
										144
									
								
								Libs/RiscV/NEORV32/sw/example/demo_freeRTOS/makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										144
									
								
								Libs/RiscV/NEORV32/sw/example/demo_freeRTOS/makefile
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,144 @@ | ||||
| ################################################################################################# | ||||
| # << NEORV32 - Application Makefile >>                                                          # | ||||
| # ********************************************************************************************* # | ||||
| # Make sure to add the RISC-V GCC compiler's bin folder to your PATH environment variable.      # | ||||
| # ********************************************************************************************* # | ||||
| # BSD 3-Clause License                                                                          # | ||||
| #                                                                                               # | ||||
| # Copyright (c) 2021, Stephan Nolting. All rights reserved.                                     # | ||||
| #                                                                                               # | ||||
| # Redistribution and use in source and binary forms, with or without modification, are          # | ||||
| # permitted provided that the following conditions are met:                                     # | ||||
| #                                                                                               # | ||||
| # 1. Redistributions of source code must retain the above copyright notice, this list of        # | ||||
| #    conditions and the following disclaimer.                                                   # | ||||
| #                                                                                               # | ||||
| # 2. Redistributions in binary form must reproduce the above copyright notice, this list of     # | ||||
| #    conditions and the following disclaimer in the documentation and/or other materials        # | ||||
| #    provided with the distribution.                                                            # | ||||
| #                                                                                               # | ||||
| # 3. Neither the name of the copyright holder nor the names of its contributors may be used to  # | ||||
| #    endorse or promote products derived from this software without specific prior written      # | ||||
| #    permission.                                                                                # | ||||
| #                                                                                               # | ||||
| # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS   # | ||||
| # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF               # | ||||
| # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE    # | ||||
| # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,     # | ||||
| # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE # | ||||
| # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED    # | ||||
| # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING     # | ||||
| # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED  # | ||||
| # OF THE POSSIBILITY OF SUCH DAMAGE.                                                            # | ||||
| # ********************************************************************************************* # | ||||
| # The NEORV32 Processor - https://github.com/stnolting/neorv32              (c) Stephan Nolting # | ||||
| ################################################################################################# | ||||
|  | ||||
|  | ||||
| # ***************************************************************************** | ||||
| # USER CONFIGURATION | ||||
| # ***************************************************************************** | ||||
| # User's application sources (*.c, *.cpp, *.s, *.S); add additional files here | ||||
| APP_SRC ?= $(wildcard ./*.c) $(wildcard ./*.s) $(wildcard ./*.cpp) $(wildcard ./*.S) | ||||
|  | ||||
| # User's application include folders (don't forget the '-I' before each entry) | ||||
| APP_INC ?= -I . | ||||
| # User's application include folders - for assembly files only (don't forget the '-I' before each entry) | ||||
| ASM_INC ?= -I . | ||||
|  | ||||
| # Optimization | ||||
| EFFORT ?= -Os | ||||
|  | ||||
| # Compiler toolchain | ||||
| RISCV_PREFIX ?= riscv32-unknown-elf- | ||||
|  | ||||
| # CPU architecture and ABI | ||||
| MARCH ?= rv32i | ||||
| MABI  ?= ilp32 | ||||
|  | ||||
| # User flags for additional configuration (will be added to compiler flags) | ||||
| USER_FLAGS ?= | ||||
|  | ||||
| # Relative or absolute path to the NEORV32 home folder | ||||
| NEORV32_HOME ?= ../../.. | ||||
| # ***************************************************************************** | ||||
|  | ||||
|  | ||||
|  | ||||
| # ----------------------------------------------------------------------------- | ||||
| # FreeRTOS | ||||
| # ----------------------------------------------------------------------------- | ||||
| ifneq (,$(findstring RUN_FREERTOS_DEMO,$(USER_FLAGS))) | ||||
| # FreeRTOS home folder (adapt this!) | ||||
| FREERTOS_HOME ?= /mnt/n/Projects/FreeRTOSv10.4.1 | ||||
|  | ||||
| # FreeRTOS RISC-V specific | ||||
| APP_SRC += $(wildcard $(FREERTOS_HOME)/FreeRTOS/Source/portable/GCC/RISC-V/*.c) | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS/Source/portable/GCC/RISC-V/portASM.S | ||||
|  | ||||
| APP_INC += -I $(FREERTOS_HOME)/FreeRTOS/Source/portable/GCC/RISC-V | ||||
|  | ||||
| # FreeRTOS core | ||||
| APP_SRC += $(wildcard $(FREERTOS_HOME)/FreeRTOS/Source/*.c) | ||||
| APP_SRC += $(wildcard $(FREERTOS_HOME)/FreeRTOS/Source/portable/MemMang/heap_4.c) | ||||
|  | ||||
| APP_INC += -I $(FREERTOS_HOME)/FreeRTOS/Source/include | ||||
|  | ||||
| # FreeRTOS sources for the full_demo | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS/Demo/Common/Minimal/blocktim.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS/Demo/Common/Minimal/dynamic.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS/Demo/Common/Minimal/EventGroupsDemo.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS/Demo/Common/Minimal/GenQTest.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS/Demo/Common/Minimal/recmutex.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS/Demo/Common/Minimal/TaskNotify.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS/Demo/Common/Minimal/TaskNotifyArray.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS/Demo/Common/Minimal/TimerDemo.c | ||||
|  | ||||
| APP_INC += -I $(FREERTOS_HOME)/FreeRTOS/Demo/Common/include | ||||
|  | ||||
| # NEORV32 specific | ||||
| ASM_INC += -DportasmHANDLE_INTERRUPT=SystemIrqHandler | ||||
|  | ||||
| APP_INC += -I chip_specific_extensions/neorv32 | ||||
|  | ||||
| ASM_INC += -I chip_specific_extensions/neorv32 | ||||
|  | ||||
| # Demo application | ||||
| APP_SRC += blinky_demo/main_blinky.c | ||||
| APP_SRC += full_demo/main_full.c | ||||
| APP_SRC += full_demo/RegTest.s | ||||
| endif | ||||
|  | ||||
| # ----------------- | ||||
| # FreeRTOS-Plus-CLI | ||||
| # ----------------- | ||||
| ifneq (,$(findstring FREERTOS_PLUS_CLI,$(USER_FLAGS))) | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-CLI/FreeRTOS_CLI.c | ||||
|  | ||||
| APP_INC += -I $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-CLI | ||||
| endif | ||||
|  | ||||
| # ----------------- | ||||
| # FreeRTOS-Plus-TCP | ||||
| # ----------------- | ||||
| ifneq (,$(findstring FREERTOS_PLUS_TCP,$(USER_FLAGS))) | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_ARP.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_DHCP.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_DNS.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_IP.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_Sockets.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_Stream_Buffer.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_IP.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_TCP_WIN.c | ||||
| APP_SRC += $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/FreeRTOS_UDP_IP.c | ||||
|  | ||||
| APP_INC += -I $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/include | ||||
| APP_INC += -I $(FREERTOS_HOME)/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/Compiler/GCC | ||||
| endif | ||||
|  | ||||
|  | ||||
|  | ||||
| # Modify this variable to fit your NEORV32 setup (neorv32 home folder) | ||||
| NEORV32_HOME ?= ../../.. | ||||
|  | ||||
| include $(NEORV32_HOME)/sw/common/common.mk | ||||
		Reference in New Issue
	
	Block a user