From 7edd186f98e051282b4b681d7d73675ac31cdbd9 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Nov 2020 14:24:26 +0100 Subject: [PATCH 1/6] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 508f31a3..b441f524 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 508f31a359bd7cb5652f5e260bcd7ead6cb78e9a +Subproject commit b441f5242fd4084042b5ae5bf4a9b6ef08b993f0 From 5ad7def39b5043b4e496cb01677260369073c415 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Nov 2020 17:02:53 +0100 Subject: [PATCH 2/6] removing submodule --- .gitmodules | 3 --- fsfw | 1 - 2 files changed, 4 deletions(-) delete mode 160000 fsfw diff --git a/.gitmodules b/.gitmodules index 8b5921a8..7a6ce7cf 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,3 @@ [submodule "arduino"] path = arduino url = https://egit.irs.uni-stuttgart.de/eive/eive_arduino_interface.git -[submodule "fsfw"] - path = fsfw - url = https://egit.irs.uni-stuttgart.de/eive/fsfw.git diff --git a/fsfw b/fsfw deleted file mode 160000 index 7d83767c..00000000 --- a/fsfw +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 7d83767c2b408a05c95424f818457d0e57060eeb From f1781f435d94077ccd81715721892eee9a5dabe2 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Nov 2020 17:05:05 +0100 Subject: [PATCH 3/6] added fork properly --- .gitmodules | 3 +++ fsfw | 1 + 2 files changed, 4 insertions(+) create mode 160000 fsfw diff --git a/.gitmodules b/.gitmodules index 7a6ce7cf..8b5921a8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "arduino"] path = arduino url = https://egit.irs.uni-stuttgart.de/eive/eive_arduino_interface.git +[submodule "fsfw"] + path = fsfw + url = https://egit.irs.uni-stuttgart.de/eive/fsfw.git diff --git a/fsfw b/fsfw new file mode 160000 index 00000000..11a351a2 --- /dev/null +++ b/fsfw @@ -0,0 +1 @@ +Subproject commit 11a351a202464990641c4840569d2beff33a7b8c From b34264fa93ebefb21dff3608c988f6076c4131c4 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Mon, 2 Nov 2020 17:22:01 +0100 Subject: [PATCH 4/6] fsfw pointing to devel now --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 11a351a2..edecb788 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 11a351a202464990641c4840569d2beff33a7b8c +Subproject commit edecb7882b1d2bc444da17dec94a1a03501f1164 From d56d10b75d81c2090aad526a19b183dfc473a518 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Sat, 7 Nov 2020 16:48:30 +0100 Subject: [PATCH 5/6] compiled for q7s, q7s readme parts --- Makefile | 24 +++++++- README.md | 108 +++++++++++++++++++++++++++------ bsp_linux/main.cpp | 2 - mission/core/ObjectFactory.cpp | 10 +-- tmtc | 2 +- 5 files changed, 111 insertions(+), 35 deletions(-) diff --git a/Makefile b/Makefile index 1e089c5e..df94de6f 100644 --- a/Makefile +++ b/Makefile @@ -70,8 +70,20 @@ CLEANBIN2 = $(BUILDPATH)/$(OUTPUT_FOLDER)/devel #------------------------------------------------------------------------------- # Tool suffix when cross-compiling -CROSS_COMPILE = +CROSS_COMPILE = arm-linux-gnueabihf- +ifdef WINDOWS +# C Compiler +CC = $(CROSS_COMPILE)gcc.exe + +# C++ compiler +CXX = $(CROSS_COMPILE)g++.exe + +# Additional Tools +SIZE = $(CROSS_COMPILE)size.exe +STRIP = $(CROSS_COMPILE)strip.exe +CP = $(CROSS_COMPILE)objcopy.exe +else # C Compiler CC = $(CROSS_COMPILE)gcc @@ -82,6 +94,7 @@ CXX = $(CROSS_COMPILE)g++ SIZE = $(CROSS_COMPILE)size STRIP = $(CROSS_COMPILE)strip CP = $(CROSS_COMPILE)objcopy +endif HEXCOPY = $(CP) -O ihex BINCOPY = $(CP) -O binary @@ -250,6 +263,7 @@ hardclean: # Only clean files for current build clean: + @echo $(DEPFILES) -rm -rf $(CLEANOBJ) -rm -rf $(CLEANBIN) -rm -rf $(CLEANDEP) @@ -322,6 +336,7 @@ endif $(OBJDIR)/%.o: %.cpp $(OBJDIR)/%.o: %.cpp $(DEPENDDIR)/%.d | $(DEPENDDIR) + @echo $(I_INCLUDES) @echo @echo $(MSG_COMPILING) $< @mkdir -p $(@D) @@ -343,6 +358,7 @@ else @$(CC) $(CXXFLAGS) $(CFLAGS) -c -o $@ $< endif + #------------------------------------------------------------------------------- # Dependency Handling #------------------------------------------------------------------------------- @@ -357,8 +373,10 @@ DEPFILES = $(addprefix $(DEPENDDIR)/, $(DEPENDENCY_RELATIVE)) # Create subdirectories for dependencies $(DEPFILES): @mkdir -p $(@D) + + # Include all dependencies -include $(wildcard $(DEPFILES)) +include $(wildcard $(DEPFILES)) # .PHONY tells make that these targets aren't files -.PHONY: clean sdramCfg release debug all hardclean +.PHONY: clean sdramCfg release debug all hardclean diff --git a/README.md b/README.md index 370542a3..a2d23e82 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,38 @@ # EIVE On-Board Software -## Linux -These steps were tested for Ubuntu 20.04. -If not done yet, install the full C++ build chain: -```sh -sudo apt-get install build-essential -``` +## General information +* OBC + * Xiphos Q7S + * Based on Zynq-7020 SoC (xc7z020clg484-2) + * Dual-core ARM Cortex-A9 + * 766 MHz + * Artix-7 FPGA (85K pogrammable logic cells) + * Datasheet at https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S&fileid=340648 +* Linux OS + * Build with Yocto 2.5 + * Linux Kernel https://github.com/XiphosSystemsCorp/linux-xlnx.git + -Linux has a limit to message queue message. Please see the section -to set up UNIX environment for more information. -Sometimes, special steps are necessary so the real-time functionalities can be used -without root privileges. Instructions are contained in the setup section -for UNIX as well. +## Setting up development environment +* Install Vivado 2018.2 and Xilinx SDK from https://www.xilinx.com/support/download/index.html/content/xilinx/en/downloadNav/vivado-design-tools/archive.html +* For supported OS refer to https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug973-vivado-release-notes-install-license.pdf +* Add path of linux cross-compiler to environment variables SDK\2018.2\gnu\aarch32\nt\gcc-arm-linux-gnueabi\bin +* Install make (only on windows, SDK on Linux can use the make installed with the SDK) + 1. Install NodeJS LTS + 2. Install xpm + ```` + npm install --global xpm + ```` + 3. Install Windows build tools (after installation also linux commands like mkdir can be used from windows) + ```` + xpm install --global @xpack-dev-tools/windows-build-tools@latest + ```` ### Building the software 1. Clone the repository with ```sh -git clone https://egit.irs.uni-stuttgart.de/fsfw/fsfw_example.git +git clone https://egit.irs.uni-stuttgart.de/eive/eive_obsw.git ``` 2. Update all the submodules @@ -27,15 +42,68 @@ git submodule sync git submodule update ``` -3. After that, the linux binary can be built with: -```sh -make -j all -``` -to compile for Linux. All will build the debug version, -which can also be built with the target `debug`. The optimized -release version can be built with the target `release`. +4. Open Xilinx SDK 2018.2 +5. Import project + * File → Import → C/C++ → Existing Code as Makefile Project +6. Set build command + * When on Linux right click project → Properties → C/C++ Build → Set build command to make -j + * -j causes the compiler to use all available cores + * On windows create a make target (Windows → Show View → Make Target) + * Right click eive_obsw → New → + * Target name: all + * Uncheck "Same as the target name" + * Uncheck "Use builder settings" + * As build command type: \make -j all WINDOWS=1 +7. Run build command (double click the generated target) -4. Run the binary located inside the `_bin` folder. +### Debugging the software +1. Assign static IP address to Q7S + * Open serial console of Q7S (Accessible via the micro-USB of the PIM, see also Q7S user maunal chapter 10.3) + * Baudrate 115200 + * Login to Q7S: + * user: root + * pw: root + * Set IP address and netmask with + ```` + ifconfig eth0 192.168.133.10 + ifconfig eth0 255.255.255.0 + ```` +2. Connect Q7S to workstation via ethernet +3. Make sure the netmask of the ehternet interface of the workstation matches the netmask of the Q7S + * When IP address is set to 192.168.133.10 and the netmask is 255.255.255.0, an example IP address for the workstation + is 192.168.133.2 +4. Run tcf-agent on Q7S + * Tcf-agent is not yet integrated in the rootfs of the Q7S. Therefore build tcf-agent manually + ```` + git clone git://git.eclipse.org/gitroot/tcf/org.eclipse.tcf.agent.git + cd org.eclipse.tcf.agent/agent + make CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-ld MACHINE=arm NO_SSL=1 NO_UUID=1 + ```` + * Transfer executable agent from org.eclipse.tcf.agent/agent/obj/GNU/Linux/arm/Debug to /tmp of Q7S + ```` + cd obj/GNU/Linux/arm/Debug + scp agent root@192.168.133.10:/tmp + ```` + * On Q7S + ```` + cd /tmp + chmod +x agent + ```` + * Run agent + ```` + ./agent + ```` +5. In Xilinx SDK 2018.2 right click on project → Debug As → Debug Configurations +6. Right click Xilinx C/C++ applicaton (System Debugger) → New → +7. Set Debug Type to Linux Application Debug and Connectin to Linux Agent +8. Click New +9. Give connection a name +10. Set Host to static IP address of Q7S. e.g. 192.168.133.10 +11. Test connection (This ensures the TCF Agent is running on the Q7S) +12. Select Application tab + * Project Name: eive_obsw + * Local File Path: Path to eiveobsw-linux.elf (in _bin\linux\devel) + * Remote File Path: /tmp/eive_obsw.elf ### Setting up UNIX environment for real-time functionalities Please note that on most UNIX environments (e.g. Ubuntu), the real time functionalities diff --git a/bsp_linux/main.cpp b/bsp_linux/main.cpp index 98198838..a2bd4fbf 100644 --- a/bsp_linux/main.cpp +++ b/bsp_linux/main.cpp @@ -9,8 +9,6 @@ #include #include - - /** * @brief This is the main program for the hosted build. It can be run for * Linux and Windows. diff --git a/mission/core/ObjectFactory.cpp b/mission/core/ObjectFactory.cpp index 3561a4b7..b5a43fb4 100644 --- a/mission/core/ObjectFactory.cpp +++ b/mission/core/ObjectFactory.cpp @@ -99,19 +99,11 @@ void ObjectFactory::produce(){ /* TMTC Reception via UDP socket */ new TmFunnel(objects::TM_FUNNEL); -#ifdef LINUX + new TmTcUnixUdpBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE); new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); -#elif WIN32 - new TmTcWinUdpBridge(objects::UDP_BRIDGE, - objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, - objects::TC_STORE); - new TcWinUdpPollingTask(objects::UDP_POLLING_TASK, - objects::UDP_BRIDGE); -#endif - /* PUS stack */ new Service1TelecommandVerification(objects::PUS_SERVICE_1_VERIFICATION, diff --git a/tmtc b/tmtc index 480b0a16..ee295fa8 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit 480b0a16456ff09dfdfdd85b945926a73d19c09c +Subproject commit ee295fa849ec7af33204f437d60742d173ac5c4b From e25fd2f9b98272ff77febc7b1b8128ab84b789f0 Mon Sep 17 00:00:00 2001 From: "Jakob.Meier" Date: Sun, 15 Nov 2020 10:53:23 +0100 Subject: [PATCH 6/6] updated readme for flatsat debugging --- README.md | 96 ++++++++++++++++++++++++++++++++-- fsfw | 2 +- mission/core/ObjectFactory.cpp | 1 + tmtc | 2 +- 4 files changed, 95 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a2d23e82..f4e6f2e9 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,9 @@ * 766 MHz * Artix-7 FPGA (85K pogrammable logic cells) * Datasheet at https://eive-cloud.irs.uni-stuttgart.de/index.php/apps/files/?dir=/EIVE_IRS/Arbeitsdaten/08_Used%20Components/Q7S&fileid=340648 + * Also a lot of informatin about the Q7S can be found on the xiphos trac platform: https://trac.xiphos.com/trac/eive-q7/wiki/Q7RevB * Linux OS - * Build with Yocto 2.5 + * Built with Yocto 2.5 * Linux Kernel https://github.com/XiphosSystemsCorp/linux-xlnx.git @@ -49,14 +50,14 @@ git submodule update * When on Linux right click project → Properties → C/C++ Build → Set build command to make -j * -j causes the compiler to use all available cores * On windows create a make target (Windows → Show View → Make Target) - * Right click eive_obsw → New → + * Right click eive_obsw → New * Target name: all * Uncheck "Same as the target name" * Uncheck "Use builder settings" * As build command type: \make -j all WINDOWS=1 7. Run build command (double click the generated target) -### Debugging the software +### Debugging the software (when workstation is directly conncected to Q7S) 1. Assign static IP address to Q7S * Open serial console of Q7S (Accessible via the micro-USB of the PIM, see also Q7S user maunal chapter 10.3) * Baudrate 115200 @@ -66,7 +67,7 @@ git submodule update * Set IP address and netmask with ```` ifconfig eth0 192.168.133.10 - ifconfig eth0 255.255.255.0 + ifconfig eth0 netmask 255.255.255.0 ```` 2. Connect Q7S to workstation via ethernet 3. Make sure the netmask of the ehternet interface of the workstation matches the netmask of the Q7S @@ -105,6 +106,93 @@ git submodule update * Local File Path: Path to eiveobsw-linux.elf (in _bin\linux\devel) * Remote File Path: /tmp/eive_obsw.elf +### Debugging the software via Flatsat PC +Open SSH connection to flatsat PC: +```` +ssh eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 +```` +To access the console of the Q7S run the following: +```` +sudo picocom -b 115200 /dev/ttyUSB0 +```` +To debug an application, first make sure a static IP address is assigned to the Q7S. Run ifconfig on the Q7S serial console. +```` +ifconfig +```` +Set IP address and netmask with +```` +ifconfig eth0 192.168.133.10 +ifconfig eth0 netmask 255.255.255.0 +```` +To launch application from Xilinx SDK setup port fowarding on the localhost. +```` +ssh -L 1534:192.168.133.10:1534 eive@2001:7c0:2018:1099:babe:0:e1fe:f1a5 +```` +This forwards any requests to localhost:1534 to the port 1534 of the Q7S with the IP address 192.168.133.10. + +Note: When now setting up a debug session in the Xilinx SDK, the host must be set to localhost instead of the IP address + of the Q7S. + + +### Launching an application after boot +Load the root partiton from the flash memory (there are to nor-flash memories and each flash holds two xdi images). +Note: It is not possible to modify the current loaded root partition. +1. Disable write protection of the desired root partition +```` +writeprotect 0 0 0 # unlocks nominal image on nor-flash 0 +```` +2. Mount the root partition +```` +xsc_mount_copy 0 0 # Mounts the nominal image from nor-flash 0 +```` +3. Copy the executable to /bin/usr +4. Make sure the permissions to execute the application are set +```` +chmod +x application +```` +5. Create systemd service in /lib/systemd/system. The following shows an example service. +```` +cat > example.service +[Unit] +Description=Example Service +StartLimitIntervalSec=0 + +[Service] +Type=simple +Restart=always +RestartSec=1 +User=root +ExecStart=/usr/bin/application + +[Install] +WantedBy=multi-user.target +```` +6. Enable the service. This is normally done with systemctl enable. However, this is not possible when the service is + created for a mounted root partition. Therefore create a symlink as follows. +```` +ln -s '/tmp/the-mounted-xdi-image/lib/systemd/system/example.service' '/tmp/the-mounted-xdi-image/etc/systemd/system/multi-user.target.wants/example.service' +```` +7. The modified root partition is written back when the partion is locked again. +```` +writeprotect 0 0 1 +```` +8. Now verify the application start by booting from the modified image +```` +xsc_boot_copy 0 0 +```` +9. After booting verify if the service is running +```` +systemctl status example +```` +More detailed information about the used q7s commands can be found in the Q7S user manual. + + + +### Update file in rootfs +```` +writeprotect 0 0 0 # qspi0 nom unlock (see also Q7S user manual) +```` + ### Setting up UNIX environment for real-time functionalities Please note that on most UNIX environments (e.g. Ubuntu), the real time functionalities used by the UNIX pthread module are restricted, which will lead to permission errors when creating these tasks diff --git a/fsfw b/fsfw index edecb788..113397c6 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit edecb7882b1d2bc444da17dec94a1a03501f1164 +Subproject commit 113397c6c6ae4c46341f4880710e4e4d9b6e7630 diff --git a/mission/core/ObjectFactory.cpp b/mission/core/ObjectFactory.cpp index b5a43fb4..898a2b51 100644 --- a/mission/core/ObjectFactory.cpp +++ b/mission/core/ObjectFactory.cpp @@ -103,6 +103,7 @@ void ObjectFactory::produce(){ new TmTcUnixUdpBridge(objects::UDP_BRIDGE, objects::CCSDS_PACKET_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE); + new TcUnixUdpPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); /* PUS stack */ diff --git a/tmtc b/tmtc index ee295fa8..3fc71f90 160000 --- a/tmtc +++ b/tmtc @@ -1 +1 @@ -Subproject commit ee295fa849ec7af33204f437d60742d173ac5c4b +Subproject commit 3fc71f9094e8fb670942f0c29a9dea0b6e03d17f