From 45da230c5c20c71701b1e3c516f6015f8e473a5e Mon Sep 17 00:00:00 2001 From: Felix Marezki Date: Tue, 6 Apr 2021 20:10:04 +0200 Subject: [PATCH] feature: Remote Containers --- .devcontainer/Dockerfile | 39 +++++++++++++++++++++++++++++++++ .devcontainer/devcontainer.json | 25 +++++++++++++++++++++ README.md | 25 +++++++++++++++++++++ 3 files changed, 89 insertions(+) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 000000000..4851b72a1 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,39 @@ +FROM ubuntu:20.04 + +ARG USER + +ARG TOOL_FOLDER + +ENV TOOL_FOLDER ${TOOL_FOLDER:-/home/${USER}/sifive-tools} + +RUN apt update +RUN export DEBIAN_FRONTEND=noninteractive && apt install -y locales sudo screen + +ENV ENV LC_ALL en_US.UTF-8 +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US.UTF-8 + +RUN export DEBIAN_FRONTEND=noninteractive \ + && apt install -y nano git bash-completion bc curl python3 python3-pip python3-venv + +RUN useradd -m -s /bin/bash ${USER} \ + && passwd -d ${USER} \ + && usermod -aG sudo ${USER} + +USER ${USER} + +RUN mkdir ${TOOL_FOLDER} + +RUN curl https://static.dev.sifive.com/dev-tools/riscv-openocd-0.10.0-2020.04.6-x86_64-linux-ubuntu14.tar.gz -o ${TOOL_FOLDER}/openocd.tar.gz \ + && tar -zxvf ${TOOL_FOLDER}/openocd.tar.gz -C ${TOOL_FOLDER} --one-top-level=openocd --strip-components=1 + +RUN curl https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2020.04.0-x86_64-linux-ubuntu14.tar.gz -o ${TOOL_FOLDER}/gnu-tools.tar.gz \ + && tar -zxvf ${TOOL_FOLDER}/gnu-tools.tar.gz -C ${TOOL_FOLDER} --one-top-level=gnu-tools --strip-components=1 + +RUN curl https://static.dev.sifive.com/dev-tools/freedom-tools/v2020.08/riscv-qemu-5.1.0-2020.08.1-x86_64-linux-ubuntu14.tar.gz -o ${TOOL_FOLDER}/riscv-qemu.tar.gz \ + && tar -zxvf ${TOOL_FOLDER}/riscv-qemu.tar.gz -C ${TOOL_FOLDER} --one-top-level=riscv-qemu --strip-components=1 + +ENV RISCV_OPENOCD_PATH ${TOOL_FOLDER}/openocd +ENV RISCV_PATH ${TOOL_FOLDER}/gnu-tools + +ENV PATH=$PATH:RISCV_OPENOCD_PATH/bin:${RISCV_PATH}/bin:${TOOL_FOLDER}/riscv-qemu/bin \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 000000000..c4dfdf522 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,25 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: +// https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/ubuntu +{ + "name": "Ubuntu", + "build": { + "dockerfile": "Dockerfile", + "args": { + "USER": "${localEnv:USER}" + } + }, + + "runArgs": ["--privileged", "-v/dev/bus/usb:/dev/bus/usb"], + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "ms-vscode.cpptools" + ], + + "remoteUser": "${localEnv:USER}" +} \ No newline at end of file diff --git a/README.md b/README.md index c094f5144..a017068b5 100644 --- a/README.md +++ b/README.md @@ -355,6 +355,31 @@ make [PROGRAM=hello] [TARGET=sifive-hifive1] [INCLUDE_METAL_SOURCES=1] STANDALON Run `make help` for more commands. +### Remote Container + +You can use the remote container to do your programming your board. + +The Remote Container would have all the required Software installed except the Segger Jlink Software (needed for sifive-revb). + +You would have to get it from here: https://www.segger.com/downloads/jlink/JLink_Linux_x86_64.deb (Link is for debian based systems) + +### Connect to Segger JLink devices using JLinkEXE ### + +Run JlinkExe +``` +JLinkExe +``` + +connect via USB: +``` +usb +``` + +select device: +``` +device [FE310] +``` + ### For More Information ### Documentation, Forums, and much more available at