-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add comrv code * remove output directory and *.pyc * remove .sconsign.dblite * support build from riscv repo, and from infra repo * Update README.md Co-authored-by: ofer shinaar <ofer.shinaar@wdc.com> Co-authored-by: oferShinaar <40337637+oferShinaar@users.noreply.github.com>
- Loading branch information
1 parent
e2f5872
commit edfcbef
Showing
16 changed files
with
3,795 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
# Overlay Run-Time engine code | ||
|
||
This directory includes the RT-Engine source code, implemented according to the [HLD](https://github.com/riscv/riscv-overlay/blob/master/docs/overlay-hld.adoc) | ||
Following are instructions for building it. | ||
|
||
|
||
# Prerequisites | ||
|
||
- Install scons build system (for Debian OS) | ||
``` | ||
$ sudo apt-get install scons | ||
``` | ||
- Toolchain | ||
- You can download the latest LLVM toolchain (executables) here: [LLVM-Debian download link](https://wdc.box.com/s/hqign6gmlzojoxevbzv5xi62li3igple) | ||
- The toolchain build includes `binutils-gdb` changes needed for the Overlay engine build/link and support. | ||
- Alternatively you can build it yourself, please check section [Build overlay toolchain](#Build-overlay-toolchain) | ||
# Configure comrv build | ||
Comrv has compile-switch flags to disable/enable features in the RT engine. | ||
To change these flags open the file ```./build/SConstruct``` and comment/uncomment relevant comrv features under ```Env['PUBLIC_DEF']``` | ||
# Build comrv library | ||
$ cd build | ||
$ scons llvmpath=<path-to-overlay-llvm-installed-directory> gccpath=<path-to-overlay-gcc-installed-directory> | ||
# Build overlay toolchain | ||
- The active development repo can be found in this link [llvm-project](https://github.com/westerndigitalcorporation/llvm-project/tree/comrv) | ||
Follow instructions to build llvm with Overlay support. | ||
- You will need to build `binutils-gdb` as well to be used for link and debug. | ||
It's advised to build the entry GNU toolchain from this link [riscv-gnu-toolchain](https://github.com/westerndigitalcorporation/riscv-gnu-toolchain/tree/comrv-devel) | ||
Build description: | ||
``` | ||
url=https://github.com/westerndigitalcorporation/riscv-gnu-toolchain.git | ||
branch=comrv-devel | ||
hash=f456f6d03fe702d6190a63d035566a935fba95db | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright 2019-2021 Western Digital Corporation or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http:*www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* @file comrv_api.h | ||
* @author Ronen Haen | ||
* @date 11.06.2019 | ||
* @brief The file defines the COM-RV interfaces | ||
*/ | ||
#ifndef __COMRV_TASK_API_H__ | ||
#define __COMRV_TASK_API_H__ | ||
|
||
#ifndef __clang__ | ||
#error comrv can compile only with llvm | ||
#endif // #ifndef __clang__ | ||
|
||
/** | ||
* include files | ||
*/ | ||
#include "comrv_types.h" | ||
|
||
/** | ||
* definitions | ||
*/ | ||
|
||
/** | ||
* macros | ||
*/ | ||
|
||
/** | ||
* types | ||
*/ | ||
|
||
/** | ||
* local prototypes | ||
*/ | ||
|
||
/** | ||
* external prototypes | ||
*/ | ||
|
||
/** | ||
* global variables | ||
*/ | ||
|
||
/** | ||
* APIs | ||
*/ | ||
void comrvEnable(void); | ||
void comrvDisable(void); | ||
void comrvLoadTables(void); | ||
const comrvCB_t* comrvGetDatabase(void); | ||
void comrvDataOverlayRelease(const void* pToken); | ||
void comrvReset(comrvResetType_t eResetType); | ||
void comrvInit(comrvInitArgs_t* pInitParams); | ||
void comrvConfigureLoadOperation(u08_t ucEnable); | ||
void comrvGetStatus(comrvStatus_t* pComrvStatus); | ||
D_COMRV_NO_INLINE u32_t comrvInitApplicationStack(void); | ||
const void* comrvDataOverlayAllocation(const void* pToken); | ||
u32_t comrvLockUnlockOverlayGroupByFunction(const void* pAddress, comrvLockState_t eLockState); | ||
#ifdef D_COMRV_RTOS_SUPPORT | ||
u32_t* comrvSaveContextSwitch(volatile u32_t* pMepc, volatile u32_t* pRegisterT3, | ||
comrvTaskStackRegsVal_t** pComrvTaskStackRegs); | ||
#endif /* D_COMRV_RTOS_SUPPORT */ | ||
|
||
#endif /* __COMRV_TASK_API_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright 2019-2021 Western Digital Corporation or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http:*www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* @file comrv_defines.h | ||
* @author Ronen Haen | ||
* @date 11.06.2019 | ||
* @brief This file provides COM-RV defines | ||
* | ||
*/ | ||
#ifndef __COMRV_BASE_TYPES__ | ||
#define __COMRV_BASE_TYPES__ | ||
|
||
/** | ||
* include files | ||
*/ | ||
|
||
/** | ||
* types | ||
*/ | ||
typedef signed char s08_t; | ||
typedef signed short s16_t; | ||
typedef signed int s32_t; | ||
typedef signed long long s64_t; | ||
typedef unsigned char u08_t; | ||
typedef unsigned short u16_t; | ||
typedef unsigned int u32_t; | ||
typedef unsigned long long u64_t; | ||
|
||
#endif /* __COMRV_BASE_TYPES__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright 2019-2021 Western Digital Corporation or its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http:*www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* @file comrv_config.h | ||
* @author Ronen Haen | ||
* @date 11.06.2019 | ||
* @brief The file defines the COM-RV configuration | ||
*/ | ||
#ifndef __COMRV_CONFIG_H__ | ||
#define __COMRV_CONFIG_H__ | ||
|
||
/** | ||
* include files | ||
*/ | ||
|
||
/** | ||
* definitions | ||
*/ | ||
/* specify eviction policy */ | ||
//#define D_COMRV_EVICTION_POLICY=1 | ||
|
||
/* enable multi-group support */ | ||
#ifdef D_COMRV_ENABLE_MULTI_GROUP_SUPPORT | ||
#define D_COMRV_MULTI_GROUP_SUPPORT | ||
/* this will use upto 2^8 -1 multi groups; if not defined, | ||
the maximum number of groups will be used (2^16 - 1) */ | ||
#ifdef D_COMRV_ENABLE_MIN_NUM_OF_MULTI_GROUP_SUPPORT | ||
#define D_COMRV_MIN_NUM_OF_MULTI_GROUPS | ||
#endif /* D_COMRV_ENABLE_MAX_MULTI_GROUP_SIZE_SUPPORT */ | ||
#endif /* D_COMRV_USE_MULTI_GROUP_SUPPORT */ | ||
|
||
/* enable instrumentation */ | ||
#ifdef D_COMRV_ENABLE_FW_INSTRUMENTATION_SUPPORT | ||
#define D_COMRV_FW_INSTRUMENTATION | ||
#endif /* D_COMRV_ENABLE_FW_INSTRUMENTATION_SUPPORT */ | ||
|
||
#ifdef D_COMRV_ALLOW_CALLS_AFTER_SEARCH_LOAD_SUPPORT | ||
/* Mark we allow non comrv function calls after search and load | ||
indication - applies only for rtos support to handle | ||
cases where we get a context switch during calls to such functions */ | ||
#define D_COMRV_ALLOW_CALLS_AFTER_SEARCH_LOAD | ||
#endif /* D_COMRV_ENABLE_FW_INSTRUMENTATION_NON_ATOMIC_SUPPORT */ | ||
|
||
/* enable init vars run time validation */ | ||
#ifdef D_COMRV_ENABLE_VERIFY_INIT_ARGS_SUPPORT | ||
#define D_COMRV_VERIFY_INIT_ARGS | ||
#endif /* D_COMRV_ENABLE_VERIFY_INIT_ARGS_SUPPORT */ | ||
|
||
/* enable overlay data usage */ | ||
#ifdef D_COMRV_ENABLE_OVL_DATA_SUPPORT | ||
#define D_COMRV_OVL_DATA_SUPPORT | ||
#endif /* D_COMRV_ENABLE_OVL_DATA_SUPPORT */ | ||
|
||
/* enable CRC */ | ||
#ifdef D_COMRV_ENABLE_CRC_SUPPORT | ||
#define D_COMRV_CRC | ||
#endif /* D_COMRV_ENABLE_CRC_SUPPORT */ | ||
|
||
#ifdef D_COMRV_ENABLE_DEBUG_SUPPORT | ||
#define D_COMRV_DEBUG | ||
#endif /* D_COMRV_ENABLE_DEBUG_SUPPORT */ | ||
|
||
/* enable the ability to enable/disable comrv */ | ||
#ifdef D_COMRV_ENABLE_CONTROL_SUPPORT | ||
#define D_COMRV_CONTROL_SUPPORT | ||
#endif /* D_COMRV_ENABLE_CONTROL_SUPPORT */ | ||
|
||
/* enable comrv error notifications */ | ||
#ifdef D_COMRV_ENABLE_ERROR_NOTIFICATIONS | ||
#define D_COMRV_ERROR_NOTIFICATIONS | ||
#endif /* M_COMRV_ENABLE_ERROR_NOTIFICATIONS */ | ||
|
||
/* enable rtos support */ | ||
#ifdef D_COMRV_ENABLE_RTOS_SUPPORT | ||
#define D_COMRV_RTOS_SUPPORT | ||
#endif /* D_COMRV_ENABLE_RTOS_SUPPORT */ | ||
|
||
/* enable comrv asserts */ | ||
#ifdef D_COMRV_ENABLE_ASSERT_SUPPORT | ||
#define D_COMRV_ASSERT_ENABLED | ||
#endif /* D_COMRV_ENABLE_ASSERT_SUPPORT */ | ||
|
||
/* minimum size of an overlay group */ | ||
#if D_COMRV_MIN_GROUP_SIZE_IN_BYTES > 0 | ||
#if D_COMRV_MIN_GROUP_SIZE_IN_BYTES < 512 | ||
#error "unsupported size D_COMRV_MIN_GROUP_SIZE_IN_BYTES provided" | ||
#endif /* D_COMRV_MIN_GROUP_SIZE_IN_BYTES < 512 */ | ||
#define D_COMRV_OVL_GROUP_SIZE_MIN D_COMRV_MIN_GROUP_SIZE_IN_BYTES | ||
#else | ||
#define D_COMRV_OVL_GROUP_SIZE_MIN 512 | ||
#endif /* D_COMRV_MIN_GROUP_SIZE_IN_BYTES */ | ||
|
||
/* maximum size of an overlay group */ | ||
#if D_COMRV_MAX_GROUP_SIZE_IN_BYTES > 0 | ||
#if D_COMRV_MAX_GROUP_SIZE_IN_BYTES > 4096 | ||
#error "unsupported size D_COMRV_MAX_GROUP_SIZE_IN_BYTES provided" | ||
#endif /* D_COMRV_MAX_GROUP_SIZE_IN_BYTES > 4096 */ | ||
#define D_COMRV_OVL_GROUP_SIZE_MAX D_COMRV_MAX_GROUP_SIZE_IN_BYTES | ||
#else | ||
#define D_COMRV_OVL_GROUP_SIZE_MAX 4096 | ||
#endif /* D_COMRV_MAX_GROUP_SIZE_IN_BYTES */ | ||
|
||
/* maximum number of overlay calls depth within the | ||
entire application; if the application contains several tasks | ||
this define must cover the max number at any given time */ | ||
#if D_COMRV_MAX_CALL_STACK_DEPTH > 0 | ||
#define D_COMRV_CALL_STACK_DEPTH D_COMRV_MAX_CALL_STACK_DEPTH | ||
#else | ||
#define D_COMRV_CALL_STACK_DEPTH 10 | ||
#endif /* D_COMRV_MAX_CALL_STACK_DEPTH */ | ||
|
||
/* size of the overlay cache - the size of the RAM provided | ||
for loading and executing the overlay groups; granularity | ||
expressed in bytes */ | ||
#if D_COMRV_MAX_OVL_CACHE_SIZE_IN_BYTES > 0 | ||
#define D_COMRV_OVL_CACHE_SIZE_IN_BYTES D_COMRV_MAX_OVL_CACHE_SIZE_IN_BYTES | ||
#else | ||
#define D_COMRV_OVL_CACHE_SIZE_IN_BYTES 1536 | ||
#endif /* D_COMRV_MAX_OVL_CACHE_SIZE_IN_BYTES */ | ||
|
||
/* eviction algorithm definition */ | ||
#if (D_COMRV_EVICTION_POLICY == 0) | ||
#ifndef D_COMRV_EVICTION_POLICY | ||
/* can be that D_COMRV_EVICTION_POLICY wasn't defined - same as if it was | ||
set to 0 so set it to 1 - 0 and 1 are the same - lru */ | ||
#define D_COMRV_EVICTION_POLICY 1 | ||
#endif /* D_COMRV_EVICTION_POLICY */ | ||
#define D_COMRV_EVICTION_LRU | ||
#elif (D_COMRV_EVICTION_POLICY == 1) | ||
#define D_COMRV_EVICTION_LRU | ||
#elif (D_COMRV_EVICTION_POLICY == 2) | ||
#define D_COMRV_EVICTION_LFU | ||
#elif (D_COMRV_EVICTION_POLICY == 3) | ||
#define D_COMRV_EVICTION_MIX_LRU_LFU | ||
#endif /* */ | ||
|
||
#ifdef D_COMRV_ENABLE_LOAD_CONFIG_SUPPORT | ||
#define D_COMRV_LOAD_CONFIG_SUPPORT | ||
#endif /* D_COMRV_ENABLE_LOAD_CONFIG_SUPPORT */ | ||
|
||
|
||
#ifdef D_COMRV_ENABLE_OVL_DATA_SUPPORT | ||
#define D_COMRV_OVL_DATA_SUPPORT | ||
#endif /* D_COMRV_ENABLE_LOAD_CONFIG_SUPPORT */ | ||
|
||
#ifdef D_COMRV_ENABLE_CODE_SIZE | ||
#define D_COMRV_CODE_SIZE_SUPPORT | ||
#endif /* D_COMRV_ENABLE_CODE_SIZE */ | ||
|
||
#endif /* __COMRV_CONFIG_H__ */ | ||
|
Oops, something went wrong.