documentation

This commit is contained in:
Ulrich Mohr 2024-10-17 14:56:32 +02:00
parent 35b951597a
commit 7e0d346962
3 changed files with 33 additions and 66 deletions

View File

@ -28,7 +28,7 @@ FSBL is the First Stage Boot Loader and prepares the CPU and FPGA configuration
Before building, the correct `ps7_init.[c;h]` and some other configuration files need to be copied into the misc folder of the FSBL. The FSBL will run without this step, but some interfaces might not work as expected.
These files are specific to the actual hardware used and located in the `bsp_z7/ps7_init` folder. The following examples assumes the zedboard.
These files are specific to the actual hardware used and located in the `bsp_z7/ps7_init` folder. The following examples assume the zedboard.
```sh
cd lib/sw_apps/zynq_fsbl/src
@ -52,29 +52,24 @@ cp embeddedsw/lib/sw_apps/zynq_fsbl/src/fsbl.elf .
##### Clone the submodules (FreeRTOS and lwIP):
```sh
git submodule init
git submodule update
git submodule update --init --recursive
```
##### To build the obsw, run the following command
Once:
Configure and generate using cmake:
```sh
mkdir -p build
cd build
mkdir build_z7
cd build_z7
cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain ..
```
After adding a new .c file:
Compile (`-j` count your discretion):
```sh
cmake -DCMAKE_TOOLCHAIN_FILE=../bsp_z7/cmake/arm-none-eabi.toolchain ..
make -j 8
```
Every time
```sh
make -j 8"
```
The romeo-obsw binary can now be found in the `build` directory. The next step to deploy it is here: [DEBUG_ON_ZEDBOARD.md](./DEBUG_ON_ZEDBOARD.md).
The romeo-obsw binary can now be found in the `build_z7` directory. The next step to deploy it is here: [DEBUG_ON_ZEDBOARD.md](./DEBUG_ON_ZEDBOARD.md).
## Linux
@ -82,22 +77,24 @@ The obsw can also be compiled and run on linux using the gcc-posix port of FreeR
### build
Once:
Configure and generate using cmake:
```sh
mkdir -p build
cd build
mkdir build_linux
cd build_linux
cmake ..
```
Every time
Compile (`-j` count your discretion):
```sh
make -j 8"
```
### run
Run the binary
Run the binary:
```sh
./romeo-obsw
```
```
The linux binary is supposed to be run against a simulator listening on UDP Ports. Command line options configure this connection (`./romeo-obsw --help`). A lightweight test simulator is at https://egit.irs.uni-stuttgart.de/ROMEO/obsw_dev_sim.

View File

@ -15,7 +15,7 @@ The Onboard Software (OBSW) is written in Rust for run-time stability. The imple
# First Stage Bootloader (FSBL)
FSBL code is at https://github.com/Xilinx/embeddedsw/
FSBL code is at https://github.com/Xilinx/embeddedsw/tree/xilinx_v2024.1/lib/sw_apps/zynq_fsbl
## Scope
This is the central repository for the flight software of the ROMEO satellite.

View File

@ -44,40 +44,6 @@ int hw_device_open(const char *path, size_t path_len) {
return -1;
}
// struct sockaddr_in6 sin6;
// memset(&sin6, 0, sizeof(sin6));
// sin6.sin6_family = AF_INET6;
// sin6.sin6_port = htons(port_number);
// struct sockaddr_in sin4;
// memset(&sin4, 0, sizeof(sin4));
// sin4.sin_family = AF_INET;
// sin4.sin_port = htons(port_number);
// int result = inet_pton(AF_INET, sim_ip, &sin4.sin_addr);
// int sock;
// const struct sockaddr *addr = NULL;
// socklen_t addrlen = 0;
// if (result == 1) {
// if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
// perror("hw_device_open, creating socket failed");
// exit(-1);
// }
// addr = (struct sockaddr *)&sin4;
// addrlen = sizeof(sin4);
// }
// result = inet_pton(AF_INET6, sim_ip, &sin6.sin6_addr);
// if ((result == 1) && (addr == NULL)) {
// if ((sock = socket(AF_INET6, SOCK_DGRAM, 0)) < 0) {
// perror("hw_device_open, creating socket failed");
// exit(-1);
// }
// addr = (struct sockaddr *)&sin6;
// addrlen = sizeof(sin6);
// }
struct addrinfo addrinfo_hint;
addrinfo_hint.ai_flags = AI_ADDRCONFIG;
addrinfo_hint.ai_family = ai_family;
@ -102,20 +68,24 @@ int hw_device_open(const char *path, size_t path_len) {
for (current_candidate = addr_candidates; current_candidate != NULL;
current_candidate = current_candidate->ai_next) {
sock = socket(current_candidate->ai_family, current_candidate->ai_socktype,
current_candidate->ai_protocol);
if (sock == -1)
continue;
current_candidate->ai_protocol);
if (sock == -1) {
continue;
}
if (connect(sock, current_candidate->ai_addr, current_candidate->ai_addrlen) != -1)
break; /* Success */
if (connect(sock, current_candidate->ai_addr,
current_candidate->ai_addrlen) != -1) {
break; /* Success */
}
close(sock);
// Connect failed, close socket
close(sock);
}
if (current_candidate == NULL) { /* No address succeeded */
fprintf(stderr, "hw_device_open, invalid sim address\n");
exit(EXIT_FAILURE);
}
if (current_candidate == NULL) { /* No address succeeded */
fprintf(stderr, "hw_device_open, invalid sim address\n");
exit(EXIT_FAILURE);
}
return sock;
}