Updated dependencies.

This commit is contained in:
Joe Kearney 2026-02-07 16:06:20 -06:00
parent d86c494d45
commit 58748fcef1
101 changed files with 5845 additions and 2391 deletions

View file

@ -1,9 +1,8 @@
#!/usr/bin/env python3
#
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
# SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
# SPDX-License-Identifier: Apache-2.0
import argparse
import csv
import os
@ -19,18 +18,19 @@ espidf_missing_function_info = True
class sdkconfig_c:
def __init__(self, path):
lines = open(path).read().splitlines()
config = dict()
with open(path) as f:
lines = f.read().splitlines()
config = {}
for l in lines:
if len(l) > OPT_MIN_LEN and l[0] != '#':
mo = re.match( r'(.*)=(.*)', l, re.M|re.I)
mo = re.match(r'(.*)=(.*)', l, re.M | re.I)
if mo:
config[mo.group(1)]=mo.group(2).replace('"', '')
config[mo.group(1)] = mo.group(2).replace('"', '')
self.config = config
def index(self, i):
return self.config[i]
def index(self, key):
return self.config[key]
def check(self, options):
options = options.replace(' ', '')
if '&&' in options:
@ -54,52 +54,69 @@ class sdkconfig_c:
return True
class object_c:
def read_dump_info(self, pathes):
def read_dump_info(self, paths):
new_env = os.environ.copy()
new_env['LC_ALL'] = 'C'
dumps = list()
print('pathes:', pathes)
for path in pathes:
dumps = []
print('paths:', paths)
for path in paths:
try:
dump = StringIO(subprocess.check_output([espidf_objdump, '-t', path], env=new_env).decode())
dumps.append(dump.readlines())
dump_output = subprocess.check_output([espidf_objdump, '-t', path], env=new_env).decode()
dumps.append(StringIO(dump_output).readlines())
except subprocess.CalledProcessError as e:
raise RuntimeError('cmd:%s result:%s'%(e.cmd, e.returncode))
raise RuntimeError(f"Command '{e.cmd}' failed with exit code {e.returncode}")
return dumps
def get_func_section(self, dumps, func):
for dump in dumps:
for l in dump:
if ' %s'%(func) in l and '*UND*' not in l:
m = re.match(r'(\S*)\s*([glw])\s*([F|O])\s*(\S*)\s*(\S*)\s*(\S*)\s*', l, re.M|re.I)
for line in dump:
if f' {func}' in line and '*UND*' not in line:
m = re.match(r'(\S*)\s*([glw])\s*([F|O])\s*(\S*)\s*(\S*)\s*(\S*)\s*', line, re.M | re.I)
if m and m[6] == func:
return m[4].replace('.text.', '')
return m.group(4).replace('.text.', '')
if espidf_missing_function_info:
print('%s failed to find section'%(func))
print(f'{func} failed to find section')
return None
else:
raise RuntimeError('%s failed to find section'%(func))
raise RuntimeError(f'{func} failed to find section')
def __init__(self, name, pathes, libray):
def __init__(self, name, paths, library):
self.name = name
self.libray = libray
self.funcs = dict()
self.pathes = pathes
self.dumps = self.read_dump_info(pathes)
self.library = library
self.funcs = {}
self.paths = paths
self.dumps = self.read_dump_info(paths)
self.section_all = False
def append(self, func):
section = self.get_func_section(self.dumps, func)
if section != None:
section = None
if func == '.text.*':
section = '.literal .literal.* .text .text.*'
self.section_all = True
elif func == '.iram1.*':
section = '.iram1 .iram1.*'
self.section_all = True
elif func == '.wifi0iram.*':
section = '.wifi0iram .wifi0iram.*'
self.section_all = True
elif func == '.wifirxiram.*':
section = '.wifirxiram .wifirxiram.*'
self.section_all = True
else:
section = self.get_func_section(self.dumps, func)
if section is not None:
self.funcs[func] = section
def functions(self):
nlist = list()
nlist = []
for i in self.funcs:
nlist.append(i)
return nlist
def sections(self):
nlist = list()
nlist = []
for i in self.funcs:
nlist.append(self.funcs[i])
return nlist
@ -108,7 +125,7 @@ class library_c:
def __init__(self, name, path):
self.name = name
self.path = path
self.objs = dict()
self.objs = {}
def append(self, obj, path, func):
if obj not in self.objs:
@ -117,40 +134,40 @@ class library_c:
class libraries_c:
def __init__(self):
self.libs = dict()
self.libs = {}
def append(self, lib, lib_path, obj, obj_path, func):
if lib not in self.libs:
self.libs[lib] = library_c(lib, lib_path)
self.libs[lib].append(obj, obj_path, func)
def dump(self):
for libname in self.libs:
lib = self.libs[libname]
for objname in lib.objs:
obj = lib.objs[objname]
print('%s, %s, %s, %s'%(libname, objname, obj.path, obj.funcs))
print(f'{libname}, {objname}, {obj.path}, {obj.funcs}')
class paths_c:
def __init__(self):
self.paths = dict()
self.paths = {}
def append(self, lib, obj, path):
if '$IDF_PATH' in path:
path = path.replace('$IDF_PATH', os.environ['IDF_PATH'])
if lib not in self.paths:
self.paths[lib] = dict()
self.paths[lib] = {}
if obj not in self.paths[lib]:
self.paths[lib][obj] = list()
self.paths[lib][obj] = []
self.paths[lib][obj].append(path)
def index(self, lib, obj):
if lib not in self.paths:
return None
if '*' in self.paths[lib]:
obj = '*'
return self.paths[lib][obj]
return self.paths[lib].get(obj)
def generator(library_file, object_file, function_file, sdkconfig_file, missing_function_info, objdump='riscv32-esp-elf-objdump'):
global espidf_objdump, espidf_missing_function_info
@ -160,23 +177,29 @@ def generator(library_file, object_file, function_file, sdkconfig_file, missing_
sdkconfig = sdkconfig_c(sdkconfig_file)
lib_paths = paths_c()
for p in csv.DictReader(open(library_file, 'r')):
lib_paths.append(p['library'], '*', p['path'])
with open(library_file, newline='') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
lib_paths.append(row['library'], '*', row['path'])
obj_paths = paths_c()
for p in csv.DictReader(open(object_file, 'r')):
obj_paths.append(p['library'], p['object'], p['path'])
with open(object_file, newline='') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
obj_paths.append(row['library'], row['object'], row['path'])
libraries = libraries_c()
for d in csv.DictReader(open(function_file, 'r')):
if d['option'] and sdkconfig.check(d['option']) == False:
print('skip %s(%s)'%(d['function'], d['option']))
continue
lib_path = lib_paths.index(d['library'], '*')
obj_path = obj_paths.index(d['library'], d['object'])
if not obj_path:
obj_path = lib_path
libraries.append(d['library'], lib_path[0], d['object'], obj_path, d['function'])
with open(function_file, newline='') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
if row['option'] and not sdkconfig.check(row['option']):
print(f'skip {row["function"]}({row["option"]})')
continue
lib_path = lib_paths.index(row['library'], '*')
obj_path = obj_paths.index(row['library'], row['object'])
if not obj_path:
obj_path = lib_path
libraries.append(row['library'], lib_path[0], row['object'], obj_path, row['function'])
return libraries
def main():
@ -185,26 +208,30 @@ def main():
argparser.add_argument(
'--library', '-l',
help='Library description file',
type=str)
type=str,
required=True)
argparser.add_argument(
'--object', '-b',
help='Object description file',
type=str)
type=str,
required=True)
argparser.add_argument(
'--function', '-f',
help='Function description file',
type=str)
type=str,
required=True)
argparser.add_argument(
'--sdkconfig', '-s',
help='sdkconfig file',
type=str)
type=str,
required=True)
args = argparser.parse_args()
libraries = generator(args.library, args.object, args.function, args.sdkconfig)
libraries = generator(args.library, args.object, args.function, args.sdkconfig, espidf_missing_function_info)
# libraries.dump()
if __name__ == '__main__':