Re-org of RISC-V file structure and naming step 2.

This commit is contained in:
Richard Barry 2018-12-30 23:53:47 +00:00
parent 818eeccc0c
commit e2af102c80
8 changed files with 114 additions and 85 deletions

View file

@ -50,7 +50,7 @@
<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"/> <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"/>
<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"> <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">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/env}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/env}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/RISC-V-RV32/CLINT_no_extensions}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/RISC-V-RV32}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/include}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/env/freedom-e300-hifive1}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/env/freedom-e300-hifive1}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/drivers}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/freedom-e-sdk/drivers}&quot;"/>

View file

@ -99,7 +99,7 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths.1792818218" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths" useByScannerDiscovery="true" valueType="includePath"> <option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths.1792818218" name="Include paths (-I)" superClass="ilg.gnumcueclipse.managedbuild.cross.riscv.option.assembler.include.paths" useByScannerDiscovery="true" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/RISC-V-RV32/CLINT_no_extensions}&quot;"/> <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/FreeRTOS_Source/portable/GCC/RISC-V-RV32}&quot;"/>
</option> </option>

View file

@ -24,7 +24,7 @@
#endif #endif
.section .text.entry .section .text.entry
.extern vFreeRTOSPortTrapHandler .extern freertos_risc_v_trap_handler
.globl _start .globl _start
_start: _start:
@ -34,10 +34,10 @@ nmi_vector:
j nmi_vector j nmi_vector
trap_vector: trap_vector:
j vFreeRTOSPortTrapHandler j freertos_risc_v_trap_handler
handle_reset: handle_reset:
la t0, vFreeRTOSPortTrapHandler la t0, freertos_risc_v_trap_handler
csrw mtvec, t0 csrw mtvec, t0
csrwi mstatus, 0 csrwi mstatus, 0
csrwi mie, 0 csrwi mie, 0

View file

@ -32,29 +32,33 @@
* common across all currently supported RISC-V chips (implementations of the * common across all currently supported RISC-V chips (implementations of the
* RISC-V ISA), and code which tailors the port to a specific RISC-V chip: * RISC-V ISA), and code which tailors the port to a specific RISC-V chip:
* *
* + The code that is common to all RISC-V chips is implemented in * + FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S contains the code that
* FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S. There is only one * is common to all currently supported RISC-V chips. There is only one
* portASM.S file because the same file is used no matter which RISC-V chip is * portASM.S file because the same file is built for all RISC-V target chips.
* in use.
* *
* + The code that tailors the kernel's RISC-V port to a specific RISC-V * + Header files called freertos_risc_v_chip_specific_extensions.h contain the
* chip is implemented in freertos_risc_v_port_specific_extensions.h. There * code that tailors the FreeRTOS kernel's RISC-V port to a specific RISC-V
* is one freertos_risc_v_port_specific_extensions.h that can be used with any * chip. There are multiple freertos_risc_v_chip_specific_extensions.h files
* RISC-V chip that both includes a standard CLINT and does not add to the * as there are multiple RISC-V chip implementations.
* base set of RISC-V registers. There are additional
* freertos_risc_v_port_specific_extensions.h files for RISC-V implementations
* that do not include a standard CLINT or do add to the base set of RISC-V
* registers.
* *
* CARE MUST BE TAKEN TO INCLDUE THE CORRECT * !!!NOTE!!!
* freertos_risc_v_port_specific_extensions.h HEADER FILE FOR THE CHIP * CARE MUST BE TAKEN TO INCLUDE THE CORRECT
* IN USE. To include the correct freertos_risc_v_port_specific_extensions.h * freertos_risc_v_chip_specific_extensions.h HEADER FILE FOR THE CHIP IN USE.
* header file ensure the path to the correct header file is in the assembler's * If the chip in use includes a core local interrupter (CLINT) and does not
* include path. * include any chip specific register extensions then set the GNU assembler's
* include path such that the header file contained in the
* FreeRTOS\Source\portable\GCC\RISC-V-RV32 directory is the header file that is
* actually inlcuded. Otherwise set the assembler's include patch to the
* sub-directory off of the
* FreeRTOS\Source\portable\GCC\RISC-V-RV32\chip_specific_extensions directory
* that contains the freertos_risc_v_chip_specific_extensions.h specific to the
* target chip.
* *
* This freertos_risc_v_port_specific_extensions.h is for use with Pulpino Ri5cy */
/*
* This freertos_risc_v_chip_specific_extensions.h is for use with Pulpino Ri5cy
* devices, developed and tested using the Vega board RV32M1RM. * devices, developed and tested using the Vega board RV32M1RM.
*
*/ */
#ifndef __FREERTOS_RISC_V_EXTENSIONS_H__ #ifndef __FREERTOS_RISC_V_EXTENSIONS_H__

View file

@ -0,0 +1,28 @@
/*
* 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 which 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!!!
* CARE MUST BE TAKEN TO INCLUDE THE CORRECT
* freertos_risc_v_chip_specific_extensions.h HEADER FILE FOR THE CHIP IN USE.
* If the chip in use includes a core local interrupter (CLINT) and does not
* include any chip specific register extensions then set the GNU assembler's
* include path such that the header file contained in the
* FreeRTOS\Source\portable\GCC\RISC-V-RV32 directory is the header file that is
* actually inlcuded. Otherwise set the assembler's include patch to the
* sub-directory off of the
* FreeRTOS\Source\portable\GCC\RISC-V-RV32\chip_specific_extensions directory
* that contains the freertos_risc_v_chip_specific_extensions.h specific to the
* target chip.
*
*/

View file

@ -6,9 +6,7 @@
* this software and associated documentation files (the "Software"), to deal in * this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to * the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and t * the Software, and to permit persons to whom the Software is furnished to do so,
o permit persons to whom the Software is furnished to do so,
* subject to the following conditions: * subject to the following conditions:
* *
* The above copyright notice and this permission notice shall be included in all * The above copyright notice and this permission notice shall be included in all
@ -32,29 +30,27 @@
* common across all currently supported RISC-V chips (implementations of the * common across all currently supported RISC-V chips (implementations of the
* RISC-V ISA), and code which tailors the port to a specific RISC-V chip: * RISC-V ISA), and code which tailors the port to a specific RISC-V chip:
* *
* + The code that is common to all RISC-V chips is implemented in * + FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S contains the code that
* FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S. There is only one * is common to all currently supported RISC-V chips. There is only one
* portASM.S file because the same file is used no matter which RISC-V chip is * portASM.S file because the same file is built for all RISC-V target chips.
* in use.
* *
* + The code that tailors the kernel's RISC-V port to a specific RISC-V * + Header files called freertos_risc_v_chip_specific_extensions.h contain the
* chip is implemented in freertos_risc_v_port_specific_extensions.h. There * code that tailors the FreeRTOS kernel's RISC-V port to a specific RISC-V
* is one freertos_risc_v_port_specific_extensions.h that can be used with any * chip. There are multiple freertos_risc_v_chip_specific_extensions.h files
* RISC-V chip that both includes a standard CLINT and does not add to the * as there are multiple RISC-V chip implementations.
* base set of RISC-V registers. There are additional
* freertos_risc_v_port_specific_extensions.h files for RISC-V implementations
* that do not include a standard CLINT or do add to the base set of RISC-V
* registers.
* *
* CARE MUST BE TAKEN TO INCLDUE THE CORRECT * !!!NOTE!!!
* freertos_risc_v_port_specific_extensions.h HEADER FILE FOR THE CHIP * CARE MUST BE TAKEN TO INCLUDE THE CORRECT
* IN USE. To include the correct freertos_risc_v_port_specific_extensions.h * freertos_risc_v_chip_specific_extensions.h HEADER FILE FOR THE CHIP IN USE.
* header file ensure the path to the correct header file is in the assembler's * If the chip in use includes a core local interrupter (CLINT) and does not
* include path. * include any chip specific register extensions then set the GNU assembler's
* * include path such that the header file contained in the
* This freertos_risc_v_port_specific_extensions.h is for use on RISC-V chips * FreeRTOS\Source\portable\GCC\RISC-V-RV32 directory is the header file that is
* that include a standard CLINT and do not add to the base set of RISC-V * actually inlcuded. Otherwise set the assembler's include patch to the
* registers. * sub-directory off of the
* FreeRTOS\Source\portable\GCC\RISC-V-RV32\chip_specific_extensions directory
* that contains the freertos_risc_v_chip_specific_extensions.h specific to the
* target chip.
* *
*/ */

View file

@ -45,46 +45,46 @@
* in use. * in use.
* *
* + The code that tailors the kernel's RISC-V port to a specific RISC-V * + The code that tailors the kernel's RISC-V port to a specific RISC-V
* chip is implemented in freertos_risc_v_port_specific_extensions.h. There * chip is implemented in freertos_risc_v_chip_specific_extensions.h. There
* is one freertos_risc_v_port_specific_extensions.h that can be used with any * is one freertos_risc_v_chip_specific_extensions.h that can be used with any
* RISC-V chip that both includes a standard CLINT and does not add to the * RISC-V chip that both includes a standard CLINT and does not add to the
* base set of RISC-V registers. There are additional * base set of RISC-V registers. There are additional
* freertos_risc_v_port_specific_extensions.h files for RISC-V implementations * freertos_risc_v_chip_specific_extensions.h files for RISC-V implementations
* that do not include a standard CLINT or do add to the base set of RISC-V * that do not include a standard CLINT or do add to the base set of RISC-V
* registers. * registers.
* *
* CARE MUST BE TAKEN TO INCLDUE THE CORRECT * CARE MUST BE TAKEN TO INCLDUE THE CORRECT
* freertos_risc_v_port_specific_extensions.h HEADER FILE FOR THE CHIP * freertos_risc_v_chip_specific_extensions.h HEADER FILE FOR THE CHIP
* IN USE. To include the correct freertos_risc_v_port_specific_extensions.h * IN USE. To include the correct freertos_risc_v_chip_specific_extensions.h
* header file ensure the path to the correct header file is in the assembler's * header file ensure the path to the correct header file is in the assembler's
* include path. * include path.
* *
* This freertos_risc_v_port_specific_extensions.h is for use on RISC-V chips * This freertos_risc_v_chip_specific_extensions.h is for use on RISC-V chips
* that include a standard CLINT and do not add to the base set of RISC-V * that include a standard CLINT and do not add to the base set of RISC-V
* registers. * registers.
* *
*/ */
#include "freertos_risc_v_port_specific_extensions.h" #include "freertos_risc_v_chip_specific_extensions.h"
/* Check the freertos_risc_v_port_specific_extensions.h and/or command line /* Check the freertos_risc_v_chip_specific_extensions.h and/or command line
definitions. */ definitions. */
#ifndef portasmHAS_CLINT #ifndef portasmHAS_CLINT
#error freertos_risc_v_port_specific_extensions.h must define portasmHAS_CLINT to either 1 (CLINT present) or 0 (clint not present). #error freertos_risc_v_chip_specific_extensions.h must define portasmHAS_CLINT to either 1 (CLINT present) or 0 (clint not present).
#endif #endif
#ifndef portasmHANDLE_INTERRUPT #ifndef portasmHANDLE_INTERRUPT
#error portasmHANDLE_INTERRUPT must be defined to the function to be called to handle external/peripheral interrupts. portasmHANDLE_INTERRUPT can be defined on the assmbler command line or in the appropriate freertos_risc_v_port_specific_extensions.h header file. #error portasmHANDLE_INTERRUPT must be defined to the function to be called to handle external/peripheral interrupts. portasmHANDLE_INTERRUPT can be defined on the assmbler command line or in the appropriate freertos_risc_v_chip_specific_extensions.h header file.
#endif #endif
/* Only the standard core registers are stored by default. Any additional /* Only the standard core registers are stored by default. Any additional
registers must be saved by the portasmSAVE_ADDITIONAL_REGISTERS and registers must be saved by the portasmSAVE_ADDITIONAL_REGISTERS and
portasmRESTORE_ADDITIONAL_REGISTERS macros - which can be defined in a chip portasmRESTORE_ADDITIONAL_REGISTERS macros - which can be defined in a chip
specific version of freertos_risc_v_port_specific_extensions.h. See the notes specific version of freertos_risc_v_chip_specific_extensions.h. See the notes
at the top of this file. */ at the top of this file. */
#define portCONTEXT_SIZE ( 30 * portWORD_SIZE ) #define portCONTEXT_SIZE ( 30 * portWORD_SIZE )
.global xPortStartFirstTask .global xPortStartFirstTask
.global vFreeRTOSPortTrapHandler .global freertos_risc_v_trap_handler
.global pxPortInitialiseStack .global pxPortInitialiseStack
.extern pxCurrentTCB .extern pxCurrentTCB
.extern ulPortTrapHandler .extern ulPortTrapHandler
@ -99,7 +99,7 @@ at the top of this file. */
.align 8 .align 8
.func .func
vFreeRTOSPortTrapHandler: freertos_risc_v_trap_handler:
addi sp, sp, -portCONTEXT_SIZE addi sp, sp, -portCONTEXT_SIZE
sw x1, 1 * portWORD_SIZE( sp ) sw x1, 1 * portWORD_SIZE( sp )
sw x5, 2 * portWORD_SIZE( sp ) sw x5, 2 * portWORD_SIZE( sp )
@ -133,7 +133,7 @@ vFreeRTOSPortTrapHandler:
csrr t0, mstatus /* Required for MPIE bit. */ csrr t0, mstatus /* Required for MPIE bit. */
sw t0, 29 * portWORD_SIZE( sp ) sw t0, 29 * portWORD_SIZE( sp )
portasmSAVE_ADDITIONAL_REGISTERS /* Defined in freertos_risc_v_port_specific_extensions.h to save any registers unique to the RISC-V implementation. */ portasmSAVE_ADDITIONAL_REGISTERS /* Defined in freertos_risc_v_chip_specific_extensions.h to save any registers unique to the RISC-V implementation. */
lw t0, pxCurrentTCB /* Load pxCurrentTCB. */ lw t0, pxCurrentTCB /* Load pxCurrentTCB. */
sw sp, 0( t0 ) /* Write sp to first TCB member. */ sw sp, 0( t0 ) /* Write sp to first TCB member. */
@ -210,7 +210,7 @@ processed_source:
lw t0, 0( sp ) lw t0, 0( sp )
csrw mepc, t0 csrw mepc, t0
portasmRESTORE_ADDITIONAL_REGISTERS /* Defined in freertos_risc_v_port_specific_extensions.h to restore any registers unique to the RISC-V implementation. */ portasmRESTORE_ADDITIONAL_REGISTERS /* Defined in freertos_risc_v_chip_specific_extensions.h to restore any registers unique to the RISC-V implementation. */
/* Load mstatus with the interrupt enable bits used by the task. */ /* Load mstatus with the interrupt enable bits used by the task. */
lw t0, 29 * portWORD_SIZE( sp ) lw t0, 29 * portWORD_SIZE( sp )
@ -258,7 +258,7 @@ xPortStartFirstTask:
/* If there is a clint then interrupts can branch directly to the FreeRTOS /* If there is a clint then interrupts can branch directly to the FreeRTOS
trap handler. Otherwise the interrupt controller will need to be configured trap handler. Otherwise the interrupt controller will need to be configured
outside of this file. */ outside of this file. */
la t0, vFreeRTOSPortTrapHandler la t0, freertos_risc_v_trap_handler
csrw mtvec, t0 csrw mtvec, t0
#endif /* portasmHAS_CLILNT */ #endif /* portasmHAS_CLILNT */
@ -267,7 +267,7 @@ xPortStartFirstTask:
lw x1, 0( sp ) /* Note for starting the scheduler the exception return address is used as the function return address. */ lw x1, 0( sp ) /* Note for starting the scheduler the exception return address is used as the function return address. */
portasmRESTORE_ADDITIONAL_REGISTERS /* Defined in freertos_risc_v_port_specific_extensions.h to restore any registers unique to the RISC-V implementation. */ portasmRESTORE_ADDITIONAL_REGISTERS /* Defined in freertos_risc_v_chip_specific_extensions.h to restore any registers unique to the RISC-V implementation. */
lw t0, 29 * portWORD_SIZE( sp ) /* mstatus */ lw t0, 29 * portWORD_SIZE( sp ) /* mstatus */
csrrw x0, mstatus, t0 /* Interrupts enabled from here! */ csrrw x0, mstatus, t0 /* Interrupts enabled from here! */

View file

@ -1,27 +1,28 @@
/*
* The FreeRTOS kernel's RISC-V port is split between the the code that is * 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 * common across all currently supported RISC-V chips (implementations of the
* RISC-V ISA), and code which tailors the port to a specific RISC-V chip: * RISC-V ISA), and code which tailors the port to a specific RISC-V chip:
* *
* + The code that is common to all RISC-V chips is implemented in * + FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S contains the code that
* FreeRTOS\Source\portable\GCC\RISC-V-RV32\portASM.S. There is only one * is common to all currently supported RISC-V chips. There is only one
* portASM.S file because the same file is used no matter which RISC-V chip is * portASM.S file because the same file is built for all RISC-V target chips.
* in use.
* *
* + The code that tailors the kernel's RISC-V port to a specific RISC-V * + Header files called freertos_risc_v_chip_specific_extensions.h contain the
* chip is implemented in freertos_risc_v_port_specific_extensions.h. There * code that tailors the FreeRTOS kernel's RISC-V port to a specific RISC-V
* is one freertos_risc_v_port_specific_extensions.h that can be used with any * chip. There are multiple freertos_risc_v_chip_specific_extensions.h files
* RISC-V chip that both includes a standard CLINT and does not add to the * as there are multiple RISC-V chip implementations.
* base set of RISC-V registers. There are additional
* freertos_risc_v_port_specific_extensions.h files for RISC-V implementations
* that do not include a standard CLINT or do add to the base set of RISC-V
* registers.
* *
* CARE MUST BE TAKEN TO INCLDUE THE CORRECT * !!!NOTE!!!
* freertos_risc_v_port_specific_extensions.h HEADER FILE FOR THE CHIP * CARE MUST BE TAKEN TO INCLUDE THE CORRECT
* IN USE. To include the correct freertos_risc_v_port_specific_extensions.h * freertos_risc_v_chip_specific_extensions.h HEADER FILE FOR THE CHIP IN USE.
* header file ensure the path to the correct header file is in the assembler's * If the chip in use includes a core local interrupter (CLINT) and does not
* include path. * include any chip specific register extensions then set the GNU assembler's
* include path such that the header file contained in the
* FreeRTOS\Source\portable\GCC\RISC-V-RV32 directory is the header file that is
* actually inlcuded. Otherwise set the assembler's include patch to the
* sub-directory off of the
* FreeRTOS\Source\portable\GCC\RISC-V-RV32\chip_specific_extensions directory
* that contains the freertos_risc_v_chip_specific_extensions.h specific to the
* target chip.
* *
* This freertos_risc_v_port_specific_extensions.h is for use on RISC-V chips */
* that include a standard CLINT and do not add to the base set of RISC-V
* registers.