Skip to content

guowei0105/bluetooth-firmware-touch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OneKey Touch Bluetooth Firmware

This repo contains bluetooth firmware for OneKey Touch

The firmware is based on NRF5 SDK 16.0.0, and build with Makefile

How to build

# make sure you have cmake, Python 3, amd aarm-none-eabi toolchain available in PATH

# export your OWN key for firmware signing
export BT_SIG_PK=$(cat <<EOF
-----BEGIN EC PRIVATE KEY-----
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-----END EC PRIVATE KEY-----
EOF
)

# build binaries first
./make_binaries.sh

# then convert binaries to images with signature
./make_images.sh

How to verify firmware hash

Install Python 3.x

Download latest ota.bin, open a terminal in the same folder, invoke python, then run following code

import struct, hashlib

with open("ota.bin", mode="br") as f:
    f.seek(0x0C)
    codelen = struct.unpack("i", f.read(4))[0] - 512
    f.seek(0x600)
    print("".join(format(x, "02x") for x in hashlib.sha256(f.read(codelen)).digest()))

Single line version

exec("""\nimport struct, hashlib\nwith open("ota.bin", mode="br") as f:\n    f.seek(0x0C)\n    codelen = struct.unpack("i", f.read(4))[0] - 512\n    f.seek(0x600)\n    print("".join(format(x, "02x") for x in hashlib.sha256(f.read(codelen)).digest()))\n""")

License

Please check License.md for details

About

BLE firmware used by OneKey hardware devices.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 98.2%
  • Assembly 1.7%
  • Makefile 0.1%
  • CSS 0.0%
  • Python 0.0%
  • HTML 0.0%