-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from FrameworkComputer/serialnum-crc
- Loading branch information
Showing
9 changed files
with
137 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Flash Layout | ||
|
||
The flash is 1MB large and consists of 256 4K blocks. | ||
The last block is used to store the serial number. | ||
|
||
###### LED Matrix | ||
|
||
| Start | End | Size | Name | | ||
|----------|----------|---------------|--------------------| | ||
| 0x000000 | Dynamic | Roughly 40K | Firmware | | ||
| TBD | 0x0FF000 | TBD | Persistent Storage | | ||
| 0x0FF000 | 0x100000 | 0x1000 (4K) | Serial Number | | ||
|
||
###### QMK Keyboards | ||
|
||
| Start | End | Size | Name | | ||
|----------|----------|---------------|--------------------| | ||
| 0x000000 | Dynamic | Roughly 60K | Firmware | | ||
| 0xef000 | 0x0FF000 | 0x10000 (16K) | Persistent Storage | | ||
| 0x0FF000 | 0x100000 | 0x01000 (4K) | Serial Number | | ||
|
||
## Serial Number | ||
|
||
- 1 byte serial number revision (== 1) | ||
- 18 bytes serial number | ||
- 1 byte hardware revision | ||
- 4 byte CRC checksum over serial number (CRC32B, same as Python's `zlib.crc32()`) | ||
|
||
Hardware Revisions: | ||
|
||
- B1 Display | ||
- 1 First Prototype, very early prototype | ||
- LED Matrix | ||
- 1 First Prototype (ATC) | ||
- 2 Second Prototype (BizLink) | ||
- 3 Third Prototype, 27k Resistor | ||
- Keyboard, Numpad, Macropad | ||
- 1 First Prototype |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env python3 | ||
import zlib | ||
|
||
ledmatrix_1 = b'FRAKDEAM1100000000' # POC 1 | ||
ledmatrix_2 = b'FRAKDEBZ4100000000' # EVT 1, config 1 | ||
ledmatrix_3 = b'FRAKDEBZ4200000000' # EVT 1, config 2 (27k resistor) | ||
ansi_keyboard = b'FRAKDWEN4100000000' # EVT 1, config 1 (US ANSI) | ||
rgb_keyboard = b'FRAKDKEN4100000000' # EVT 1, config 1 (US ANSI) | ||
iso_keyboard = b'FRAKDWEN4200000000' # EVT 1, config 2 (UK ISO) | ||
jis_keyboard = b'FRAKDWEN4J00000000' # EVT 1, config J (JIS) | ||
numpad = b'FRAKDMEN4100000000' # EVT 1, config 1 | ||
macropad = b'FRAKDNEN4100000000' # EVT 1, config 1 | ||
|
||
# This section is for modifying | ||
selected = ledmatrix_2 | ||
year = b'3' # 2023 | ||
week = b'01' | ||
day = b'1' | ||
part_sn = b'0001' | ||
|
||
config = selected[8:10] | ||
serial_rev = b'\x01' | ||
snum = selected | ||
print(serial_rev + snum) | ||
snum = snum[0:8] + config + year + week + day + part_sn | ||
|
||
checksum = zlib.crc32(serial_rev + snum) | ||
print(serial_rev + snum) | ||
|
||
print('Checksum:', hex(zlib.crc32(snum))) | ||
print('Digest: ', hex(checksum)) | ||
with open('serial.bin', 'wb') as f: | ||
f.write(serial_rev) | ||
f.write(snum) | ||
f.write(checksum.to_bytes(4, 'little')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
./serial.py | ||
../qmk_firmware/util/uf2conv.py serial.bin -o serial.uf2 -b 0x100ff000 -f rp2040 --convert |