#!/usr/bin/env python3 """Slice named functions out of the RK3588 DDR v1.19 conservative blob.""" import os BLOB = os.path.expanduser('~/projects/AMPere/rkbin/bin/rk35/rk3588_ddr_lp4_1848MHz_lp5_2112MHz_v1.19.bin') BASE = os.path.expanduser('~/projects/AMPere/benchmark') functions = [ ('01_memset', 0x0aac, 0x1c, 'byte memset'), ('02_memcpy32', 0x1200, 0x24, 'word-aligned memcpy32'), ('03_magic_memset', 0x0da4, 0x28, 'magic-check + tail-call to memset'), ] blob = open(BLOB, 'rb').read() for name, off, sz, desc in functions: d = os.path.join(BASE, name) os.makedirs(d, exist_ok=True) with open(os.path.join(d, 'func.bin'), 'wb') as f: f.write(blob[off:off+sz]) print(f"{name}: {sz} bytes @ 0x{off:x} — {desc}")