From f3706c1a721310ca337f770783a95eb1ed2d7f36 Mon Sep 17 00:00:00 2001 From: philippd Date: Thu, 15 Feb 2024 00:50:18 +0100 Subject: [PATCH 1/6] experimental Dockerfile with VSCode devcontainer --- .devcontainer/devcontainer.json | 51 ++++++++++++++++++++++++++++++++ Dockerfile | 52 +++++++++++++++++++++++++++++++++ fsfw | 1 + 3 files changed, 104 insertions(+) create mode 100644 .devcontainer/devcontainer.json create mode 100644 Dockerfile create mode 160000 fsfw diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..0442382 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,51 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile +{ + "name": "Existing Dockerfile", + "build": { + // Sets the run context to one level up instead of the .devcontainer folder. + "context": "..", + // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. + "dockerfile": "../Dockerfile" + }, + +"customizations": { + "vscode": { + "extensions": [ + "rust-lang.rust-analyzer", + "tamasfe.even-better-toml", + "serayuzgur.crates", + "ms-vscode.cpptools", + "ms-vscode.cpptools-extension-pack", + "twxs.cmake", + "ms-vscode.cmake-tools", + "rogalmic.bash-debug", + "gruntfuggly.todo-tree", + "ms-python.python", + "eamodio.gitlens", + "mhutchie.git-graph", + "ms-azuretools.vscode-docker", + "formulahendry.code-runner", + "GitHub.copilot", + "GitHub.copilot-chat", + "hoovercj.vscode-settings-cycler", + "vadimcn.vscode-lldb" + ] + } +} + + // Features to add to the dev container. More info: https://containers.dev/features. + // "features": {}, + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + // "forwardPorts": [], + + // Uncomment the next line to run commands after the container is created. + // "postCreateCommand": "cat /etc/os-release", + + // Configure tool-specific properties. + // "customizations": {}, + + // Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. + // "remoteUser": "devcontainer" +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a569273 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,52 @@ +FROM debian:bookworm-slim + +# Install required packages +RUN apt-get update && apt-get install -y \ + build-essential \ + cmake \ + gcc \ + g++ \ + git \ + curl \ + wget \ + make \ + openocd \ + gdb-multiarch \ + gcc-arm-none-eabi \ + fish \ + && rm -rf /var/lib/apt/lists/* + + +# Install Rust toolchain +RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly +ENV PATH="/root/.cargo/bin:${PATH}" +RUN rustup target add armv7-unknown-linux-gnueabihf +RUN rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu +RUN rustup override set nightly + +# # Clone FSBL code from the Xilinx repository +# RUN git clone https://github.com/Xilinx/embeddedsw.git +# # Build the FSBL +# RUN cd embeddedsw/lib/sw_apps/zynq_fsbl/src/ && make BOARD=zed CFLAGS=-DFSBL_DEBUG_INFO + + +# RUN cd mission_rust +# RUN cargo update +# RUN cargo build -Z build-std + +# Set a working directory +# WORKDIR /workspace/mission_rust +# Assuming the Rust project is copied into the container +WORKDIR /workspace/ +COPY . . + +# Build commands can be added here if needed +# For example, to build the FSBL project: +# RUN cd embeddedsw/lib/sw_apps/zynq_fsbl/src/ && make BOARD=zed CFLAGS=-DFSBL_DEBUG_INFO + +# RUN mkdir build_cli +# RUN cd build_cli +# RUN cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain .. + +# Set the entrypoint to a shell +ENTRYPOINT ["/usr/bin/fish"] diff --git a/fsfw b/fsfw new file mode 160000 index 0000000..8b9a468 --- /dev/null +++ b/fsfw @@ -0,0 +1 @@ +Subproject commit 8b9a468893a49d100ad5a543656c3864e0be8203 From 30b8dd2abe54be4a75802009fae8e3aaae00fe10 Mon Sep 17 00:00:00 2001 From: Duesentrieb71 Date: Thu, 21 Mar 2024 17:47:01 +0100 Subject: [PATCH 2/6] compiling fsbl with docker works now! See README --- Dockerfile | 52 ---------------------------------- README.md | 20 ++++++++++--- docker/compile_fsbl/Dockerfile | 15 ++++++++++ 3 files changed, 31 insertions(+), 56 deletions(-) delete mode 100644 Dockerfile create mode 100644 docker/compile_fsbl/Dockerfile diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index a569273..0000000 --- a/Dockerfile +++ /dev/null @@ -1,52 +0,0 @@ -FROM debian:bookworm-slim - -# Install required packages -RUN apt-get update && apt-get install -y \ - build-essential \ - cmake \ - gcc \ - g++ \ - git \ - curl \ - wget \ - make \ - openocd \ - gdb-multiarch \ - gcc-arm-none-eabi \ - fish \ - && rm -rf /var/lib/apt/lists/* - - -# Install Rust toolchain -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain nightly -ENV PATH="/root/.cargo/bin:${PATH}" -RUN rustup target add armv7-unknown-linux-gnueabihf -RUN rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu -RUN rustup override set nightly - -# # Clone FSBL code from the Xilinx repository -# RUN git clone https://github.com/Xilinx/embeddedsw.git -# # Build the FSBL -# RUN cd embeddedsw/lib/sw_apps/zynq_fsbl/src/ && make BOARD=zed CFLAGS=-DFSBL_DEBUG_INFO - - -# RUN cd mission_rust -# RUN cargo update -# RUN cargo build -Z build-std - -# Set a working directory -# WORKDIR /workspace/mission_rust -# Assuming the Rust project is copied into the container -WORKDIR /workspace/ -COPY . . - -# Build commands can be added here if needed -# For example, to build the FSBL project: -# RUN cd embeddedsw/lib/sw_apps/zynq_fsbl/src/ && make BOARD=zed CFLAGS=-DFSBL_DEBUG_INFO - -# RUN mkdir build_cli -# RUN cd build_cli -# RUN cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain .. - -# Set the entrypoint to a shell -ENTRYPOINT ["/usr/bin/fish"] diff --git a/README.md b/README.md index d2c9129..35146b2 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,22 @@ # FSBL +## Build with Docker -FSBL code is at https://github.com/Xilinx/embeddedsw/ - -there: ```sh -cd lib/sw_apps/zynq_fsbl/src/ && make BOARD=zed CFLAGS=-DFSBL_DEBUG_INFO +cd docker/compile_fsbl/ +git clone https://github.com/Xilinx/embeddedsw/ +docker build -t compile_fsbl . +``` +docker build might fail because of firewall settings or the IRS wireguard VPN. + + +To build the FSBL, run the following command in the `docker/compile-fsbl` directory: +```sh +docker run -v ./embeddedsw:/project compile_fsbl /bin/bash -c "cd lib/sw_apps/zynq_fsbl/src && make BOARD=zed SHELL=/bin/bash" +``` + +If you want, copy the FSBL.elf to the docker/compile_fsbl directory for easier access: +```sh +cp embeddedsw/lib/sw_apps/zynq_fsbl/src/fsbl.elf . ``` # Building diff --git a/docker/compile_fsbl/Dockerfile b/docker/compile_fsbl/Dockerfile new file mode 100644 index 0000000..b61ce0d --- /dev/null +++ b/docker/compile_fsbl/Dockerfile @@ -0,0 +1,15 @@ +FROM debian:12.5 + +ENV DEBIAN_FRONTEND=noninteractive + +# Install required packages +RUN apt-get update && apt-get install -y \ + make \ + cmake \ + gcc-arm-none-eabi \ + && rm -rf /var/lib/apt/lists/* + # Remove the package lists to reduce the image size + + +WORKDIR /project/ + From 42430e9d6957f7798c7117daa0707a2d96081e95 Mon Sep 17 00:00:00 2001 From: Duesentrieb71 Date: Thu, 21 Mar 2024 19:14:32 +0100 Subject: [PATCH 3/6] compiling mission_rust seems to work now! See README --- .gitignore | 3 ++- README.md | 39 ++++++++++++++++++++----------- docker/compile_mission/Dockerfile | 26 +++++++++++++++++++++ 3 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 docker/compile_mission/Dockerfile diff --git a/.gitignore b/.gitignore index 02fe6db..8018673 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ /build* .vscode __pycache__/* -**/__pycache__/* \ No newline at end of file +**/__pycache__/* +*.elf \ No newline at end of file diff --git a/README.md b/README.md index 35146b2..6b28ae6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,12 @@ -# FSBL -## Build with Docker + +# Build with Docker + +##### Install Docker +https://www.docker.com/get-started/ + +### FSBL + +##### Clone the repository and build the docker image: ```sh cd docker/compile_fsbl/ @@ -9,7 +16,7 @@ docker build -t compile_fsbl . docker build might fail because of firewall settings or the IRS wireguard VPN. -To build the FSBL, run the following command in the `docker/compile-fsbl` directory: +##### To build the FSBL, run the following command in the `docker/compile-fsbl` directory: ```sh docker run -v ./embeddedsw:/project compile_fsbl /bin/bash -c "cd lib/sw_apps/zynq_fsbl/src && make BOARD=zed SHELL=/bin/bash" ``` @@ -19,7 +26,20 @@ If you want, copy the FSBL.elf to the docker/compile_fsbl directory for easier a cp embeddedsw/lib/sw_apps/zynq_fsbl/src/fsbl.elf . ``` -# Building +### mission_rust +```sh +cd docker/compile_mission/ +docker build -t compile_mission . +``` + +##### To build the mission_rust, run the following command in the `docker/compile_mission` directory: +```sh +docker run -v $(pwd)/../../mission_rust:/mission_rust compile_mission /bin/bash -c "cargo build -Z build-std" +``` + + +# Non-Docker suff + Requirements [TBC]: - cmake @@ -30,15 +50,6 @@ Requirements [TBC]: Configure doxygen: - export DOT_PATH=/usr/local/bin -satisfy Rust requirements -```sh -cd ../mission_rust -cargo update -rustup toolchain install nightly -rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu -rustup override set nightly -cargo build -Z build-std -``` In .../obsw/ ```sh @@ -47,7 +58,7 @@ git submodule update mkdir build_cli cd build_cli cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain .. -make -j 4 +make -j 4 // or as much threads as your CPU has ``` diff --git a/docker/compile_mission/Dockerfile b/docker/compile_mission/Dockerfile new file mode 100644 index 0000000..837a46d --- /dev/null +++ b/docker/compile_mission/Dockerfile @@ -0,0 +1,26 @@ +# Use Debian 12.5 as the base image +FROM debian:12.5 + +# Set environment variables to avoid any interactive dialogue +ENV DEBIAN_FRONTEND=noninteractive + +# Install dependencies required for Rust and rustup +RUN apt-get update && apt-get install -y curl gcc cmake && \ + # Clean up the apt cache to reduce image size + apt-get clean && rm -rf /var/lib/apt/lists/* + +# Install Rustup and select the nightly toolchain +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly && \ + . $HOME/.cargo/env + +# Add the Rust toolchain binaries to PATH +ENV PATH="/root/.cargo/bin:${PATH}" + +# Install the nightly Rust toolchain, the rust-src component, and set the override +RUN rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu + + +# Your project's specific setup steps here +# For example, setting the working directory and copying your project files into the container +WORKDIR /mission_rust/ + From 4aa1a65bc046e3e7574051d2a0a81605ffd37b99 Mon Sep 17 00:00:00 2001 From: philippd Date: Thu, 21 Mar 2024 19:16:51 +0100 Subject: [PATCH 4/6] clean up --- .devcontainer/devcontainer.json | 51 --------------------------------- docker/compile_fsbl/embeddedsw | 1 + 2 files changed, 1 insertion(+), 51 deletions(-) delete mode 100644 .devcontainer/devcontainer.json create mode 160000 docker/compile_fsbl/embeddedsw diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index 0442382..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,51 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the -// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile -{ - "name": "Existing Dockerfile", - "build": { - // Sets the run context to one level up instead of the .devcontainer folder. - "context": "..", - // Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename. - "dockerfile": "../Dockerfile" - }, - -"customizations": { - "vscode": { - "extensions": [ - "rust-lang.rust-analyzer", - "tamasfe.even-better-toml", - "serayuzgur.crates", - "ms-vscode.cpptools", - "ms-vscode.cpptools-extension-pack", - "twxs.cmake", - "ms-vscode.cmake-tools", - "rogalmic.bash-debug", - "gruntfuggly.todo-tree", - "ms-python.python", - "eamodio.gitlens", - "mhutchie.git-graph", - "ms-azuretools.vscode-docker", - "formulahendry.code-runner", - "GitHub.copilot", - "GitHub.copilot-chat", - "hoovercj.vscode-settings-cycler", - "vadimcn.vscode-lldb" - ] - } -} - - // Features to add to the dev container. More info: https://containers.dev/features. - // "features": {}, - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Uncomment the next line to run commands after the container is created. - // "postCreateCommand": "cat /etc/os-release", - - // Configure tool-specific properties. - // "customizations": {}, - - // Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "devcontainer" -} diff --git a/docker/compile_fsbl/embeddedsw b/docker/compile_fsbl/embeddedsw new file mode 160000 index 0000000..3728f54 --- /dev/null +++ b/docker/compile_fsbl/embeddedsw @@ -0,0 +1 @@ +Subproject commit 3728f546f178a1bcd91cf6efc9f8921447846cec From 6f6a331152f23f056e68eec03adea1173a77982a Mon Sep 17 00:00:00 2001 From: philippd Date: Thu, 21 Mar 2024 21:21:21 +0100 Subject: [PATCH 5/6] obsw docker compile not fully working yet --- README.md | 18 +++++++++++++----- docker/compile_fsbl/embeddedsw | 1 - docker/compile_obsw/Dockerfile | 15 +++++++++++++++ 3 files changed, 28 insertions(+), 6 deletions(-) delete mode 160000 docker/compile_fsbl/embeddedsw create mode 100644 docker/compile_obsw/Dockerfile diff --git a/README.md b/README.md index 6b28ae6..f06a96b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ # Build with Docker +##### Info +IRS wireguard VPN can cause network issues with docker. ##### Install Docker https://www.docker.com/get-started/ -### FSBL +## FSBL ##### Clone the repository and build the docker image: @@ -13,7 +15,6 @@ cd docker/compile_fsbl/ git clone https://github.com/Xilinx/embeddedsw/ docker build -t compile_fsbl . ``` -docker build might fail because of firewall settings or the IRS wireguard VPN. ##### To build the FSBL, run the following command in the `docker/compile-fsbl` directory: @@ -26,7 +27,7 @@ If you want, copy the FSBL.elf to the docker/compile_fsbl directory for easier a cp embeddedsw/lib/sw_apps/zynq_fsbl/src/fsbl.elf . ``` -### mission_rust +## mission_rust (not yet working) ```sh cd docker/compile_mission/ docker build -t compile_mission . @@ -36,7 +37,16 @@ docker build -t compile_mission . ```sh docker run -v $(pwd)/../../mission_rust:/mission_rust compile_mission /bin/bash -c "cargo build -Z build-std" ``` +## obsw +```sh +cd docker/compile_obsw/ +docker build -t compile_obsw . +``` +##### To build the obsw, run the following command in the `docker/compile_obsw` directory: +```sh +docker run -v $(pwd)/../../:/obsw compile_obsw /bin/bash -c "mkdir -p build_cli && cd build_cli && cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain . && make -j 8" +``` # Non-Docker suff @@ -61,8 +71,6 @@ cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain .. make -j 4 // or as much threads as your CPU has ``` - - # Debugging on zedboard Requirements [TBC]: diff --git a/docker/compile_fsbl/embeddedsw b/docker/compile_fsbl/embeddedsw deleted file mode 160000 index 3728f54..0000000 --- a/docker/compile_fsbl/embeddedsw +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3728f546f178a1bcd91cf6efc9f8921447846cec diff --git a/docker/compile_obsw/Dockerfile b/docker/compile_obsw/Dockerfile new file mode 100644 index 0000000..c8105a6 --- /dev/null +++ b/docker/compile_obsw/Dockerfile @@ -0,0 +1,15 @@ +FROM debian:12.5 + +ENV DEBIAN_FRONTEND=noninteractive + +# Install required packages +RUN apt-get update && apt-get install -y \ + make \ + cmake \ + gcc-arm-none-eabi \ + && rm -rf /var/lib/apt/lists/* + # Remove the package lists to reduce the image size + + +WORKDIR /obsw/ + From c6c9fd692625d4af68c18caf76d2db34f3a45586 Mon Sep 17 00:00:00 2001 From: Duesentrieb71 Date: Thu, 21 Mar 2024 21:57:53 +0100 Subject: [PATCH 6/6] Every compile step now works with docker! See README --- README.md | 44 +++++++++++++++------------------- docker/compile_fsbl/Dockerfile | 2 +- docker/compile_obsw/Dockerfile | 14 +++++++++++ 3 files changed, 34 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index f06a96b..da3ffc0 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ IRS wireguard VPN can cause network issues with docker. ##### Install Docker https://www.docker.com/get-started/ + ## FSBL ##### Clone the repository and build the docker image: @@ -16,18 +17,20 @@ git clone https://github.com/Xilinx/embeddedsw/ docker build -t compile_fsbl . ``` - ##### To build the FSBL, run the following command in the `docker/compile-fsbl` directory: ```sh -docker run -v ./embeddedsw:/project compile_fsbl /bin/bash -c "cd lib/sw_apps/zynq_fsbl/src && make BOARD=zed SHELL=/bin/bash" +docker run -v ./embeddedsw:/fsbl compile_fsbl /bin/bash -c "cd lib/sw_apps/zynq_fsbl/src && make BOARD=zed SHELL=/bin/bash" ``` -If you want, copy the FSBL.elf to the docker/compile_fsbl directory for easier access: +If you want, copy the fsbl.elf to the docker/compile_fsbl directory for easier access: ```sh cp embeddedsw/lib/sw_apps/zynq_fsbl/src/fsbl.elf . ``` -## mission_rust (not yet working) + +## mission_rust + +##### Build the docker image: ```sh cd docker/compile_mission/ docker build -t compile_mission . @@ -37,7 +40,17 @@ docker build -t compile_mission . ```sh docker run -v $(pwd)/../../mission_rust:/mission_rust compile_mission /bin/bash -c "cargo build -Z build-std" ``` + + ## obsw + +##### Clone the submodules (FreeRTOS and lwIP): +```sh +git submodule init +git submodule update +``` + +##### Build the docker image: ```sh cd docker/compile_obsw/ docker build -t compile_obsw . @@ -45,31 +58,12 @@ docker build -t compile_obsw . ##### To build the obsw, run the following command in the `docker/compile_obsw` directory: ```sh -docker run -v $(pwd)/../../:/obsw compile_obsw /bin/bash -c "mkdir -p build_cli && cd build_cli && cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain . && make -j 8" +docker run -v $(pwd)/../..:/obsw compile_obsw /bin/bash -c "mkdir -p build_cli && cd build_cli && cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain .. && make -j 8" ``` -# Non-Docker suff +The romeo-obsw binary can now be found in the `build_cli` directory. -Requirements [TBC]: -- cmake -- arm-none-eabi-gcc -- doxygen -- graphviz - -Configure doxygen: -- export DOT_PATH=/usr/local/bin - - -In .../obsw/ -```sh -git submodule init -git submodule update -mkdir build_cli -cd build_cli -cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain .. -make -j 4 // or as much threads as your CPU has -``` # Debugging on zedboard diff --git a/docker/compile_fsbl/Dockerfile b/docker/compile_fsbl/Dockerfile index b61ce0d..b1e1582 100644 --- a/docker/compile_fsbl/Dockerfile +++ b/docker/compile_fsbl/Dockerfile @@ -11,5 +11,5 @@ RUN apt-get update && apt-get install -y \ # Remove the package lists to reduce the image size -WORKDIR /project/ +WORKDIR /fsbl/ diff --git a/docker/compile_obsw/Dockerfile b/docker/compile_obsw/Dockerfile index c8105a6..0da1195 100644 --- a/docker/compile_obsw/Dockerfile +++ b/docker/compile_obsw/Dockerfile @@ -6,10 +6,24 @@ ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y \ make \ cmake \ + gcc \ + curl \ gcc-arm-none-eabi \ + doxygen \ + graphviz \ && rm -rf /var/lib/apt/lists/* # Remove the package lists to reduce the image size +# Install Rustup and select the nightly toolchain +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly && \ + . $HOME/.cargo/env + +# Add the Rust toolchain binaries to PATH +ENV PATH="/root/.cargo/bin:${PATH}" + +# Install the nightly Rust toolchain, the rust-src component, and set the override +RUN rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu WORKDIR /obsw/ +# ENV DOT_PATH=/usr/local/bin # Works without this in debian @paul \ No newline at end of file