Skip to content

Commit

Permalink
updating readme with Cosmos example instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jbsco authored Jan 25, 2024
1 parent 2161171 commit 852a704
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions src/assembly/linux/main/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ OpenC3 Cosmos runs inside of its own Docker containers. The Cosmos example proje
$ ./openc3.sh cli generate plugin LINUX_EXAMPLE
```

This create a new directory called `openc3-cosmos-linux-example`. Navigate to this directory and run:
This creates a new directory called `openc3-cosmos-linux-example`. Navigate to this directory and run:

```
$ ./../openc3.sh cli generate target LINUX_EXAMPLE
Expand Down Expand Up @@ -88,19 +88,10 @@ $ cp adamant_example/src/assembly/linux/build/plugin/Config/linux_example_ccsds_
$ cp adamant_example/src/assembly/linux/build/plugin/Config/linux_example_ccsds_plugin.txt cosmos-project/openc3-cosmos-linux-example/plugin.txt
```

The Cosmos plugin uses a default CRC protocol provided by Cosmos, but needs a modifification to apply the Adamant example's command packet checksum correctly. Navigate to the `cosmos-project/openc3-cosmos-linux-example/targets/LINUX_EXAMPLE/lib` directory, then run:
The Cosmos plugin uses a default CRC protocol provided by Cosmos, but needs a custom protocol to apply Adamant' command packet checksum correctly. Copy the protocol ruby file from `adamant/gnd/cosmos/` to the `cosmos-project/openc3-cosmos-linux-example/targets/LINUX_EXAMPLE/lib` directory:

```
$ wget https://github.com/OpenC3/cosmos/raw/main/openc3/lib/openc3/interfaces/protocols/crc_protocol.rb -O crc_8bc_protocol.rb
```

Modify the following lines of this file by running:

```
$ sed -i 's+CrcProtocol < Protocol+Crc8bcProtocol < CrcProtocol+g' crc_8bc_protocol.rb
$ sed -i 's+write_packet(packet)+write_packet(packet, seed = 0xFF)+g' crc_8bc_protocol.rb
$ sed -i 's+end_range = packet.get_item(@write_item_name).bit_offset / 8+crc = packet.buffer.bytes.reduce(seed, :^)+g' crc_8bc_protocol.rb
$ sed -i 's+crc = @crc.calc(packet.buffer(false)\[0...end_range\])++g' crc_8bc_protocol.rb
$ cp adamant/gnd/cosmos/cmd_checksum.rb cosmos-project/openc3-cosmos-linux-example/targets/LINUX_EXAMPLE/lib/cmd_checksum.rb
```

The plugin can now be compiled. Navigate to the plugin directory at `openc3-cosmos-linux-example` and run:
Expand Down

0 comments on commit 852a704

Please sign in to comment.