-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script for generating SVD and C-headers #25
Conversation
Hi @Yangff Also, I can give you an access to nutcracker repositories, so you can push things directly. Thanks, |
I'm still adding some extra symbols. Will replay when finish |
it should contain all possible symbols for now, not sure if it's correct but I think it can merge now. I will try replacing existed objects to get some lower level rewrite code. But I'm not sure what to do about higher level like 80211 or even IPs.. |
found some extra header in https://github.com/jixinintelligence/bl602-604/tree/37f2d7b36b4c2ba6f073029d351551c33f9610f3/components/bl602/bl602_wifi/plf/refip/src/driver/phy/bl602_phy_rf/reg and include them.. that should be all sources.. |
@Yangff thanks! |
Hi, I create a simple script to generate SVD and headers for all peripherals under 0x44XXXXXX based on all currently knowledges.
I havn't try compile it and it may contain errors for both offset, naming and generated code.
SVD can be imported into ghidra to produce a little more readable code, although mask the real address might cause problem. Or maybe used for svd2rust. I only generated
<peripheral>
but you only need to merge it with original bl602 svd.But, I cannot guarantte the correctness of these code..
It contains some research notes from This Documents.
And, mac_pl is from alios, based on my observation, it should be the same including the offset. While mac_core and ipc is from here.
and here.
Others are mainly my guess.
Beside that, it should be pretty simple to add more generate for markdown or other uses.
Usage
extarct related functions
This step allow you to isolate interested function that access certain addresses for you to analyse.
Place the ghidra decompiled C code into
./blobs/bl602_demo_wifi.ghidra.c
, ensure that NO SVD is imported.Make sure you have
ctags
installed.And you can now open
somefile.c
to see the result.Update it with your research and generate the result
Open
manualext.py
, modify it in a way you prefer and run it.It's straightforward.
Peripheral(peripheral('name', address, size))
to define a new peripheral.Reg(name, address)
to define a regField(name, mask)
to define a field where the bits of that field is zero in the maskFieldBit(name, bit, len=1)
to define a field withlsb=bit
andmsb = bit+len-1
Buf(name, beginaddress, endaddress, nBytes=4)
to define an array at[beginaddress, endaddress]
, both side included.nBytes
is the sizeof each item.GenSVD()
to generate SVD for current peripheral.GenHeader
to generate C header for cuurent peripheral.