|
|
vor 5 Jahren | |
|---|---|---|
| base-station/software | vor 5 Jahren | |
| display | vor 5 Jahren | |
| documentation | vor 5 Jahren | |
| kicad-library | vor 5 Jahren | |
| weather-sensor | vor 5 Jahren | |
| .gitignore | vor 5 Jahren | |
| .gitmodules | vor 5 Jahren | |
| README.md | vor 5 Jahren | |
| cern_ohl_w_v2.txt | vor 5 Jahren | |
| gpl-3.0.md | vor 5 Jahren |
This repository contains the description of a number of smart home devices as well as the source code for the corresponding firmware.
Compiling the display firmware requires a rust toolchain for ARMv6m:
rustup target add thumbv6m-none-eabi
Compiling the base station software depends on the targeted board. The following steps can be used to cross-compile the software for an ARMv7 target running Armbian from a Fedora host:
Install the toolchain:
sudo dnf copr enable lantw44/arm-linux-gnueabi-toolchain
sudo dnf install arm-linux-gnueabi-gcc.x86_64
rustup target add arm-unknown-linux-gnueabi
Configure Rust to use the ARM GCC:
cat > ~/.cargo/config <<_EOF
[target.arm-unknown-linux-gnueabi]
linker = "arm-linux-gnueabi-gcc"
rustflags = ["-Clink-args=-Wl,--dynamic-linker=/lib/ld-linux-armhf.so.3"]
_EOF
Compile the software using the newly installed toolchain:
cargo build --target=arm-unknown-linux-gnueabi
For an Ubuntu host, the following steps can be used:
Install the toolchain:
sudo apt-get install gcc-arm-linux-gnueabihf
rustup target add arm-unknown-linux-gnueabihf
Configure Rust to use the ARM GCC:
cat > ~/.cargo/config <<_EOF
[target.arm-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
_EOF
Compile the software using the newly installed toolchain:
cargo build --target=arm-unknown-linux-gnueabihf
Packets are up to 32 bytes long. Most bytes are encrypted via XXTEA, except for one packet sent to the base station from a device to request a random number. The base station then replies with an encrypted packet containing a random salt value, and the device uses this salt for all further communication until the next reset, increasing the salt value by one for each packet sent. This scheme removes the need for the device to generate random numbers, as microcontrollers commonly are not capable of generation of high-quality ranodm numbers.
The packet sent from the device to the base station to request a salt consists of a single byte with the sender ID and is recognized by the base station by its length.
All encrypted packets follow the same scheme, with everything following after the salt being encrypted using a per-device XXTEA key hardcoded on the device and known to the base station. The packet fields are as follows, with multi-byte fields being encoded as little-endian:
The most significant bit of the salt value is 0 for packets from the device to the base station and 1 for packets from the base station to the device.
All fields from here on are encrypted with XXTEA, using the first 8 bytes of the packet as the salt.
The 5 least significant bits of the field encode the packet type, with the following possible values:
GetValues packet containing the requested information.The 3 most significant bits of the field encode the element count for packets which can holt multiple elements (as described below).
The payload field holds the packet content, with a variable format depending on the packet type:
The hardware contained in this repository is licensed under the CERN Open Hardware Licence Version 2 - Weakly Reciprocal, and the software is licensed under the GNU General Public License v3.