# This plugin works in conjuncture with the tools_def\r
#\r
# Copyright (c) Microsoft Corporation\r
+# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>\r
# SPDX-License-Identifier: BSD-2-Clause-Patent\r
##\r
import os\r
self.Logger.critical("Failed in check arm")\r
return ret\r
\r
+ # Check RISCV64 compiler\r
+ ret = self._check_riscv64()\r
+ if ret != 0:\r
+ self.Logger.critical("Failed in check riscv64")\r
+ return ret\r
+\r
return 0\r
\r
def _check_arm(self):\r
return -2\r
\r
return 0\r
+\r
+ def _check_riscv64(self):\r
+ # now check for install dir. If set then set the Prefix\r
+ install_path = shell_environment.GetEnvironment(\r
+ ).get_shell_var("GCC5_RISCV64_INSTALL")\r
+ if install_path is None:\r
+ return 0\r
+\r
+ # check to see if full path already configured\r
+ if shell_environment.GetEnvironment().get_shell_var("GCC5_RISCV64_PREFIX") is not None:\r
+ self.Logger.info("GCC5_RISCV64_PREFIX is already set.")\r
+\r
+ else:\r
+ # make GCC5_RISCV64_PREFIX to align with tools_def.txt\r
+ prefix = os.path.join(install_path, "bin", "riscv64-unknown-elf-")\r
+ shell_environment.GetEnvironment().set_shell_var("GCC5_RISCV64_PREFIX", prefix)\r
+\r
+ # now confirm it exists\r
+ if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("GCC5_RISCV64_PREFIX") + "gcc"):\r
+ self.Logger.error(\r
+ "Path for GCC5_RISCV64_PREFIX toolchain is invalid")\r
+ return -2\r
+\r
+ # Check if LD_LIBRARY_PATH is set for the libraries of RISC-V GCC toolchain\r
+ if shell_environment.GetEnvironment().get_shell_var("LD_LIBRARY_PATH") is not None:\r
+ self.Logger.info("LD_LIBRARY_PATH is already set.")\r
+\r
+ prefix = os.path.join(install_path, "lib")\r
+ shell_environment.GetEnvironment().set_shell_var("LD_LIBRARY_PATH", prefix)\r
+\r
+ return 0\r