Skip to content
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

Merged
merged 46 commits into from
Aug 1, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
1169dbf
Add: scripts to scan ghidra generated source
Yangff Jul 19, 2021
ba0d3ce
library to interactively generate SVD and C-header
Yangff Jul 19, 2021
79f076d
Add: Manually extracted reg defines for mdm and partially agc, based …
Yangff Jul 19, 2021
0b8f6ce
reg maps generated by the scripts
Yangff Jul 19, 2021
1e6cbfb
Parse CEVA style comment to generate reg map
Yangff Jul 19, 2021
8505639
Support for interruption
Yangff Jul 19, 2021
ac07f8d
add missing header from latest sdk
Yangff Jul 20, 2021
24b868f
add another missing header
Yangff Jul 20, 2021
4b1e950
add other registers
Yangff Jul 20, 2021
6aa398a
support Bouffalolab style comment
Yangff Jul 20, 2021
1c4c454
generate headers
Yangff Jul 20, 2021
ad259d9
add gain regs
Yangff Jul 20, 2021
07078da
add agc_config code for scan
Yangff Jul 21, 2021
5a49ad2
scan agc
Yangff Jul 21, 2021
d5db576
allow duplicate field for better scanning
Yangff Jul 21, 2021
6c6e5c7
should not mix @breif and @name for alios style and Bouffalolab
Yangff Jul 21, 2021
dd21c20
fix problem with different style header
Yangff Jul 21, 2021
da5ccc9
update agc.h result
Yangff Jul 21, 2021
ada7467
update header format
Yangff Jul 21, 2021
347e5c0
fix dup name
Yangff Jul 21, 2021
2414e04
return field after added
Yangff Jul 21, 2021
cdc3eb9
add more reg from phy_bl602.o
Yangff Jul 21, 2021
45e4118
update mdm.h with regs found in phy_bl602.o
Yangff Jul 21, 2021
42c4e98
add missing bit
Yangff Jul 21, 2021
f15b976
add bit
Yangff Jul 21, 2021
974fe26
add missing rxndpnstsmax
Yangff Jul 21, 2021
d18fd82
support parse bl svd file and find reg with addr and mask
Yangff Jul 22, 2021
5f58860
add bz_phyfunc
Yangff Jul 22, 2021
ec27cd6
add bz_phy.h
Yangff Jul 22, 2021
0dc58f2
add support for 0x
Yangff Jul 22, 2021
dc056a2
format fix
Yangff Jul 22, 2021
5f5e117
more stable name
Yangff Jul 23, 2021
833e83c
add extra information from DWARF
Yangff Jul 24, 2021
ca4abf8
add extra names
Yangff Jul 24, 2021
a3a7308
import other DWARF info and done
Yangff Jul 24, 2021
f2b7fc3
padding to 32
Yangff Jul 24, 2021
d992280
done
Yangff Jul 24, 2021
5cad578
put irqmacccatimeouten as field name
Yangff Jul 24, 2021
0d958c1
fix agc
Yangff Jul 24, 2021
b2ffe27
add scanner for new sources
Yangff Jul 26, 2021
a723f9d
add new sources
Yangff Jul 26, 2021
7898731
update scan result
Yangff Jul 26, 2021
fb1efea
add svd argument
Yangff Jul 26, 2021
ae66bdf
add generated svds
Yangff Jul 26, 2021
f1ea6bd
add scanner for rf
Yangff Jul 26, 2021
47933fa
add fixed svd file, fix reg name bug in svd2c
Yangff Jul 26, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add support for 0x
  • Loading branch information
Yangff committed Jul 22, 2021
commit 0dc58f269a61eb0db02e4534a82df28638148956
9 changes: 6 additions & 3 deletions script/manualext.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,12 @@


gid = 0
def scan_write(code):
def scan_write(code, dat="dat"):
global gid
write_pattern = r'write_volatile_4\(DAT_([0-9a-f]+),uVar\d( & 0x([0-9a-f]+))*( \| 0x([0-9a-f]+))*\);'
if dat == 'dat':
write_pattern = r'write_volatile_4\(DAT_([0-9a-f]+),uVar\d( & 0x([0-9a-f]+))*( \| 0x([0-9a-f]+))*\);'
else:
write_pattern = r'write_volatile_4\(0x([0-9a-f]+),uVar\d( & 0x([0-9a-f]+))*( \| 0x([0-9a-f]+))*\);'
for l in code:
import re
g = re.search(write_pattern, l)
Expand Down Expand Up @@ -326,7 +329,7 @@ def getregs(fname, pattern='name'):


peris['bz_phy'] = Peripheral(peripheral('bz_phy', 0x40002000, 0x1000))
scan_write(open('../blobs/bz_phy.c').readlines())
scan_write(open('../blobs/bz_phy.c').readlines(), '0x')


if __name__ == '__main__':
Expand Down
34 changes: 34 additions & 0 deletions src/include/phy/bz_phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,40 @@ typedef union {
uint32_t regs[0x400];
uint8_t pad[0x1000];
struct {
uint8_t pad0[0x808];
union {
uint32_t value;
struct {
uint32_t pad0 : 23;
uint32_t set_0x1_67 : 1; // @ 23 -- 23 # 0xff7fffff
uint32_t set_0x8_68 : 8; // @ 31 -- 24 # 0xffffff
};
} r0x2808; // @ 0x808
union {
uint32_t value;
struct {
uint32_t set_0x0_71 : 8; // @ 7 -- 0 # 0xffffff00
uint32_t pad0 : 15;
uint32_t set_0x1_69 : 1; // @ 23 -- 23 # 0xff7fffff
uint32_t set_0x4_70 : 8; // @ 31 -- 24 # 0xffffff
};
} r0x280c; // @ 0x80c
union {
uint32_t value;
struct {
uint32_t set_0x0_76 : 1; // @ 0 -- 0 # 0xfffffffe
};
} r0x2810; // @ 0x810
uint8_t pad1[0x40];
union {
uint32_t value;
struct {
uint32_t set_0x1e_75 : 8; // @ 7 -- 0 # 0xffffff00
uint32_t set_0x20_72 : 8; // @ 15 -- 8 # 0xffff00ff
uint32_t set_0xa_74 : 8; // @ 23 -- 16 # 0xff00ffff
uint32_t set_0x1e_73 : 8; // @ 31 -- 24 # 0xffffff
};
} r0x2854; // @ 0x854
};
} bz_phy_regs;
#define BZ_PHY_BASE 0x40002000
Expand Down