diff --git a/BUILD_WITH_CMAKE.md b/BUILD_WITH_CMAKE.md new file mode 100644 index 0000000..107467c --- /dev/null +++ b/BUILD_WITH_CMAKE.md @@ -0,0 +1,53 @@ + + +## Build the FSBL + +FSBL is the First Stage Boot Loader and prepares the CPU and FPGA configuration for booting up the Second Stage Bootloader and finally the flight software. + + +## Requirements [TBC]: +1. `cmake` +2. `arm-none-eabi-gcc` +3. `doxygen` +4. `graphviz` +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 . +``` + +## Steps + +## mission_rust + +1. 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 +``` + +## obsw + +##### Clone the submodules (FreeRTOS and lwIP): +```sh +git submodule init +git submodule update +``` + +##### To build the obsw, run the following command + +Once: +``` +mkdir -p build +cd build +```sh +After adding a +cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain .. +make -j 8" +``` + +The romeo-obsw binary can now be found in the `build` directory. \ No newline at end of file diff --git a/BUILD_WITH_DOCKER.md b/BUILD_WITH_DOCKER.md new file mode 100644 index 0000000..f447fc2 --- /dev/null +++ b/BUILD_WITH_DOCKER.md @@ -0,0 +1,74 @@ + + +## Prerequisits for build with Docker +##### Info +IRS wireguard VPN can cause network issues with docker. + +##### Install Docker +If you are using macOS or Windows, please use this tutorial: +- https://www.docker.com/get-started/ + +On Linux simply use your package manager to install ```docker``` and prepare everything using these commands, to avoid permission denied errors: + +```sh +sudo systemctl start docker +sudo groupadd docker +sudo usermod -aG docker $USER +sudo reboot +``` + + +## FSBL + +FSBL is the First Stage Boot Loader and prepares the CPU and FPGA configuration for booting up the Second Stage Bootloader and finally the flight software. + +##### Clone the repository and build the docker image: + +```sh +cd docker/compile_fsbl/ +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:/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: +```sh +cp embeddedsw/lib/sw_apps/zynq_fsbl/src/fsbl.elf . +``` + +## Steps +1. Configure doxygen: + +## mission_rust + +##### Build the docker image: +```sh +export DOT_PATH=/usr/local/bin +``` + + +## 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 . +``` + +##### 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" +``` + +The romeo-obsw binary can now be found in the `build_cli` directory. \ No newline at end of file diff --git a/DEBUG_ON_ZEDBOARD.md b/DEBUG_ON_ZEDBOARD.md new file mode 100644 index 0000000..885a1d3 --- /dev/null +++ b/DEBUG_ON_ZEDBOARD.md @@ -0,0 +1,53 @@ + +# Debugging on `zedboard` +`zedboard` is the `Xilinx Zynq-7000` development board. +## Requirements [TBC]: +- `OpenOCD` +- `arm-none-eabi-gdb` + +## Steps +TODO: discuss this with paul +1. Set Zedboard `boot mode` to JTAG and connect debugging PC to zedboard JTAG and UART USB port. +TODO: what is which port, use distinct name/add a graphic +2. On PC connected to zedboard JTAG USB port: +```sh +openocd -f board/digilent_zedboard.cfg +``` + +If you have one around, load bitstream at startup (go get a coffee, takes time with onboard JTAG, blue LED lights up when done): +```sh +openocd -f board/digilent_zedboard.cfg -c "init" -c "pld load 0 system.bit" +``` + +3. To use JTAG Boot for the OBSW, you first need to run the FSBL once. + +On build PC (adapt IP if different from debugging PC) in the folder where you build the FSBL as above: +```sh +arm-none-eabi-gdb fsbl.elf +>target extended-remote localhost:3333 +>load +>cont +>^C^D^D +``` + +### (Optional) Automate this run: +```sh +arm-none-eabi-gdb fsbl.elf -iex "target extended-remote localhost:3333" -ex "set pagination off" -ex "load" -ex "break FsblHandoffJtagExit" -ex "cont" -ex="set confirm off" -ex "exit" +``` + +It will exit after the Zynq is configured and ready to firmware. + +Then load the actual OBSW, in the build (`build_cli` in the example above) folder run: +```sh +arm-none-eabi-gdb romeo-obsw +>target extended-remote localhost:3333 +>load +>cont +``` + +Again, `Command Line Interface (CLI) commands` can be moved to the GNU Debugger (DGB) call. Also, a small function is used as marker to return from GDB if the mission code returns (should not happen in production but might be useful during testing). +```sh +arm-none-eabi-gdb romeo-obsw -iex "target extended-remote localhost:3333" -ex "set pagination off" -ex "load" -ex "break done" -ex "cont" -ex="set confirm off" -ex "exit" +``` + +UART USB port should output something at `115200baud`, (I use moserial to monitor). diff --git a/README.md b/README.md index 1ffd04b..efd6799 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ The Onboard Software (OBSW) is written in Rust for run-time stability. The imple ## How to Configure This Repository? TODO + # First Stage Bootloader (FSBL) FSBL code is at https://github.com/Xilinx/embeddedsw/ @@ -37,150 +38,11 @@ The current working steps are: - Communications Interfaces +## How to build the software? +Consider using Docker or setting up a local compile toolchain. +Please refer to [BUILD_WITH_DOCKER.md](.BUILD_WITH_DOCKER.md) or [BUILD_WITH_CMAKE.md](./BUILD_WITH_CMAKE.md). -## Prerequisits for build with Docker -##### Info -IRS wireguard VPN can cause network issues with docker. +## How to debug on hardware? -##### Install Docker -If you are using macOS or Windows, please use this tutorial: -- https://www.docker.com/get-started/ - -On Linux simply use your package manager to install ```docker``` and prepare everything using these commands, to avoid permission denied errors: - -```sh -sudo systemctl start docker -sudo groupadd docker -sudo usermod -aG docker $USER -sudo reboot -``` - - -## FSBL - -FSBL is the First Stage Boot Loader and prepares the CPU and FPGA configuration for booting up the Second Stage Bootloader and finally the flight software. - -##### Clone the repository and build the docker image: - -```sh -cd docker/compile_fsbl/ -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:/fsbl compile_fsbl /bin/bash -c "cd lib/sw_apps/zynq_fsbl/src && make BOARD=zed SHELL=/bin/bash" -``` - -## Requirements [TBC]: -1. `cmake` -2. `arm-none-eabi-gcc` -3. `doxygen` -4. `graphviz` -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 . -``` - -## Steps -1. Configure doxygen: - -## mission_rust - -##### Build the docker image: -```sh -export DOT_PATH=/usr/local/bin -``` -2. 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 -cd docker/compile_mission/ -docker build -t compile_mission . -``` - -3. Configure the ROMEO OBSW repository in `.../obsw/` -##### 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" -``` - - -## 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 . -``` - -##### 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" -``` - -The romeo-obsw binary can now be found in the `build_cli` directory. -# Debugging on `zedboard` -`zedboard` is the `Xilinx Zynq-7000` development board. -## Requirements [TBC]: -- `OpenOCD` -- `arm-none-eabi-gdb` - -## Steps -TODO: discuss this with paul -1. Set Zedboard `boot mode` to JTAG and connect debugging PC to zedboard JTAG and UART USB port. -TODO: what is which port, use distinct name/add a graphic -2. On PC connected to zedboard JTAG USB port: -```sh -openocd -f board/digilent_zedboard.cfg -``` - -If you have one around, load bitstream at startup (go get a coffee, takes time with onboard JTAG, blue LED lights up when done): -```sh -openocd -f board/digilent_zedboard.cfg -c "init" -c "pld load 0 system.bit" -``` - -3. To use JTAG Boot for the OBSW, you first need to run the FSBL once. - -On build PC (adapt IP if different from debugging PC) in the folder where you build the FSBL as above: -```sh -arm-none-eabi-gdb fsbl.elf ->target extended-remote localhost:3333 ->load ->cont ->^C^D^D -``` - -### (Optional) Automate this run: -```sh -arm-none-eabi-gdb fsbl.elf -iex "target extended-remote localhost:3333" -ex "set pagination off" -ex "load" -ex "break FsblHandoffJtagExit" -ex "cont" -ex="set confirm off" -ex "exit" -``` - -It will exit after the Zynq is configured and ready to firmware. - -Then load the actual OBSW, in the build (`build_cli` in the example above) folder run: -```sh -arm-none-eabi-gdb romeo-obsw ->target extended-remote localhost:3333 ->load ->cont -``` - -Again, `Command Line Interface (CLI) commands` can be moved to the GNU Debugger (DGB) call. Also, a small function is used as marker to return from GDB if the mission code returns (should not happen in production but might be useful during testing). -```sh -arm-none-eabi-gdb romeo-obsw -iex "target extended-remote localhost:3333" -ex "set pagination off" -ex "load" -ex "break done" -ex "cont" -ex="set confirm off" -ex "exit" -``` - -UART USB port should output something at `115200baud`, (I use moserial to monitor). +Please refer to [DEBUG_ON_ZEDBOARD.md](./DEBUG_ON_ZEDBOARD.md) \ No newline at end of file