Skip to content

Commit 769bf30

Browse files
committed
Add scripts to build serialnumber UF2 file
Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 22f2257 commit 769bf30

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

scripts/serial.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env python3
2+
import zlib
3+
4+
ledmatrix_1 = b'FRAKDEAM1100000000' # POC 1
5+
ledmatrix_2 = b'FRAKDEBZ4100000000' # EVT 1, config 1
6+
ledmatrix_3 = b'FRAKDEBZ4200000000' # EVT 1, config 2 (27k resistor)
7+
8+
# This section is for modifying
9+
selected = ledmatrix_2
10+
year = b'3' # 2023
11+
week = b'01'
12+
day = b'1'
13+
part_sn = b'0001'
14+
15+
config = selected[8:10]
16+
serial_rev = b'\x01'
17+
snum = selected
18+
print(serial_rev + snum)
19+
snum = snum[0:8] + config + year + week + day + part_sn
20+
21+
checksum = zlib.crc32(serial_rev + snum)
22+
print(serial_rev + snum)
23+
24+
print('Checksum:', hex(zlib.crc32(snum)))
25+
print('Digest: ', hex(checksum))
26+
with open('serial.bin', 'wb') as f:
27+
f.write(serial_rev)
28+
f.write(snum)
29+
f.write(checksum.to_bytes(4, 'little'))

scripts/serial.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/sh
2+
./serial.py
3+
../qmk_firmware/util/uf2conv.py serial.bin -o serial.uf2 -b 0x100ff000 -f rp2040 --convert

0 commit comments

Comments
 (0)