Skip to content

Instantly share code, notes, and snippets.

View sunflower2333's full-sized avatar
πŸ“š
Studying.

Kancy Joe sunflower2333

πŸ“š
Studying.
View GitHub Profile
@sunflower2333
sunflower2333 / mpgv2.py
Last active May 5, 2025 13:41
A new memory map generator for QC's new platforms (>8450)
# The new qc platforms uses XBL Device Tree as its memory map source instead
# if using uefi.cfg.
# A dtb file is also easy to be parsed with libufdt.
from pyfdt.pyfdt import FdtBlobParse, FdtNode, FdtProperty
SIZE_2GB = 0x80000000
SIZE_4GB = 2 * SIZE_2GB
RT_LIST = ["SYS_MEM", "MMAP_IO",
"IO", "FIRMWARE_DEV",
@sunflower2333
sunflower2333 / csv2define.c
Last active July 25, 2024 11:30
Transform EasyEDA ESP32 fanout csv output to C header
import csv
csv_file_path = 'Fan_Out_Netlabel_P1_2024-07-19.csv'
txt_file_path = 'o.txt'
with open(csv_file_path, encoding='utf-16le') as csvfile:
sr = csv.DictReader(csvfile, delimiter='\t', quotechar='|')
with open(txt_file_path, 'w', encoding='utf-16le') as txt_file:
for row in sr:
netname = row['netname']
# Global Settings
DoubleIC = False
GenSpb = True
GenC = False
GEN_COMMENT = False
FirstReg = 0x25
SecondReg = 0x4d
TraceFileName = "tracefile.txt"
OutputFileNameC = "spb.c"
OutputFileNameSpbScript = "spb.txt"
@sunflower2333
sunflower2333 / Disassembler.c
Last active August 24, 2024 08:29
ProtocolsFinder
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
//#define DEBUG
uint32_t swap_uint32(uint32_t x) {
@sunflower2333
sunflower2333 / MemoryMapGenerator.py
Last active November 30, 2025 08:19
This program help your parse your uefiplat to C code.
from pyfdt.pyfdt import FdtBlobParse
# NOTICE, you need to install pyfdt package first :)
# pip install pyfdt
SIZE_2GB = 0x80000000
class MemoryDescriptor:
# base = 0