kopia lustrzana https://github.com/SP8EBC/ParaTNC
stack analysis stuff
rodzic
b642c3c540
commit
228a64e5b7
|
@ -352,6 +352,7 @@
|
|||
<listOptionValue builtIn="false" value="PARATNC_HWREV_B"/>
|
||||
<listOptionValue builtIn="false" value="PARATNC_HWREV_C"/>
|
||||
</option>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other.994195951" name="Other compiler flags" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.other" useByScannerDiscovery="true" value="-fstack-usage -fdump-rtl-dfinish" valueType="string"/>
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.29354374" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1656265940" name="Cross ARM C++ Compiler" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler">
|
||||
|
@ -415,7 +416,7 @@
|
|||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.useprintffloat.1654419641" name="Use float with nano printf (-u _printf_float)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.useprintffloat" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.cref.1892757950" name="Cross reference (-Xlinker --cref)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.cref" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnosys.1858899549" name="Do not use syscalls (--specs=nosys.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnosys" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.printmap.826060236" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.printmap" value="false" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.printmap.826060236" name="Print link map (-Xlinker --print-map)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.printmap" value="false" valueType="boolean"/>
|
||||
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input.1803255576" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.input">
|
||||
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
|
||||
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
|
||||
|
@ -493,7 +494,7 @@
|
|||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.useprintffloat.1403039114" name="Use float with nano printf (-u _printf_float)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.useprintffloat" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.cref.139846170" name="Cross reference (-Xlinker --cref)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.cref" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnosys.1761390492" name="Do not use syscalls (--specs=nosys.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnosys" value="true" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printmap.1092992084" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printmap" value="false" valueType="boolean"/>
|
||||
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printmap.1092992084" name="Print link map (-Xlinker --print-map)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.printmap" value="false" valueType="boolean"/>
|
||||
</tool>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.1243003593" name="Cross ARM C++ Linker" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.linker.233822233"/>
|
||||
<tool id="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.2101502496" name="Cross ARM GNU Archiver" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.archiver.753718364"/>
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="854345066964168583" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="819814870235430554" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
|
|
@ -0,0 +1,430 @@
|
|||
# pylint: disable = invalid-name, too-few-public-methods
|
||||
|
||||
import re
|
||||
import pprint
|
||||
import os
|
||||
import sys
|
||||
from typing import List, Tuple, Dict, Any
|
||||
from subprocess import check_output
|
||||
|
||||
# Constants
|
||||
rtl_ext_end = ".dfinish"
|
||||
su_ext = '.su'
|
||||
obj_ext = '.o'
|
||||
manual_ext = '.msu'
|
||||
read_elf_path = os.getenv("CROSS_COMPILE", "") + "readelf"
|
||||
stdout_encoding = "utf-8" # System dependant
|
||||
|
||||
|
||||
class Printable:
|
||||
def __repr__(self) -> str:
|
||||
return "<" + type(self).__name__ + "> " + pprint.pformat(vars(self), indent=4, width=1)
|
||||
|
||||
|
||||
class Symbol(Printable):
|
||||
# value: int = -1
|
||||
# size: int = -1
|
||||
type: str = "uninitialized"
|
||||
binding: str = "uninitialized"
|
||||
name: str = "uninitialized"
|
||||
|
||||
|
||||
CallNode = Dict[str, Any]
|
||||
|
||||
|
||||
def calc_wcs(fxn_dict2: CallNode, parents: List[CallNode]) -> None:
|
||||
"""
|
||||
Calculates the worst case stack for a fxn that is declared (or called from) in a given file.
|
||||
:param parents: This function gets called recursively through the call graph. If a function has recursion the
|
||||
tuple file, fxn will be in the parents stack and everything between the top of the stack and the matching entry
|
||||
has recursion.
|
||||
:return:
|
||||
"""
|
||||
|
||||
# If the wcs is already known, then nothing to do
|
||||
if 'wcs' in fxn_dict2:
|
||||
return
|
||||
|
||||
# Check for pointer calls
|
||||
if fxn_dict2['has_ptr_call']:
|
||||
fxn_dict2['wcs'] = 'unbounded'
|
||||
return
|
||||
|
||||
# Check for recursion
|
||||
if fxn_dict2 in parents:
|
||||
fxn_dict2['wcs'] = 'unbounded'
|
||||
return
|
||||
|
||||
# Calculate WCS
|
||||
call_max = 0
|
||||
for call_dict in fxn_dict2['r_calls']:
|
||||
|
||||
# Calculate the WCS for the called function
|
||||
calc_wcs(call_dict, parents + [fxn_dict2])
|
||||
|
||||
# If the called function is unbounded, so is this function
|
||||
if call_dict['wcs'] == 'unbounded':
|
||||
fxn_dict2['wcs'] = 'unbounded'
|
||||
return
|
||||
|
||||
# Keep track of the call with the largest stack use
|
||||
call_max = max(call_max, call_dict['wcs'])
|
||||
|
||||
# Propagate Unresolved Calls
|
||||
for unresolved_call in call_dict['unresolved_calls']:
|
||||
fxn_dict2['unresolved_calls'].add(unresolved_call)
|
||||
|
||||
fxn_dict2['wcs'] = call_max + fxn_dict2['local_stack']
|
||||
|
||||
|
||||
class CallGraph:
|
||||
globals: Dict[str, CallNode] = {}
|
||||
locals: Dict[str, Dict[str, CallNode]] = {}
|
||||
weak: Dict[str, CallNode] = {}
|
||||
|
||||
def read_obj(self, tu: str) -> None:
|
||||
"""
|
||||
Reads the file tu.o and gets the binding (global or local) for each function
|
||||
:param self: a object used to store information about each function, results go here
|
||||
:param tu: name of the translation unit (e.g. for main.c, this would be 'main')
|
||||
"""
|
||||
|
||||
for s in read_symbols(tu[0:tu.rindex(".")] + obj_ext):
|
||||
|
||||
if s.type == 'FUNC':
|
||||
if s.binding == 'GLOBAL':
|
||||
# Check for multiple declarations
|
||||
if s.name in self.globals or s.name in self.locals:
|
||||
raise Exception(f'Multiple declarations of {s.name}')
|
||||
self.globals[s.name] = {'tu': tu, 'name': s.name, 'binding': s.binding}
|
||||
elif s.binding == 'LOCAL':
|
||||
# Check for multiple declarations
|
||||
if s.name in self.locals and tu in self.locals[s.name]:
|
||||
raise Exception(f'Multiple declarations of {s.name}')
|
||||
|
||||
if s.name not in self.locals:
|
||||
self.locals[s.name] = {}
|
||||
|
||||
self.locals[s.name][tu] = {'tu': tu, 'name': s.name, 'binding': s.binding}
|
||||
elif s.binding == 'WEAK':
|
||||
if s.name in self.weak:
|
||||
raise Exception(f'Multiple declarations of {s.name}')
|
||||
self.weak[s.name] = {'tu': tu, 'name': s.name, 'binding': s.binding}
|
||||
else:
|
||||
raise Exception(f'Error Unknown Binding "{s.binding}" for symbol: {s.name}')
|
||||
|
||||
def find_fxn(self, tu: str, fxn: str):
|
||||
"""
|
||||
Looks up the dictionary associated with the function.
|
||||
:param self: a object used to store information about each function
|
||||
:param tu: The translation unit in which to look for locals functions
|
||||
:param fxn: The function name
|
||||
:return: the dictionary for the given function or None
|
||||
"""
|
||||
|
||||
if fxn in self.globals:
|
||||
return self.globals[fxn]
|
||||
try:
|
||||
return self.locals[fxn][tu]
|
||||
except KeyError:
|
||||
return None
|
||||
|
||||
def find_demangled_fxn(self, tu: str, fxn: str):
|
||||
"""
|
||||
Looks up the dictionary associated with the function.
|
||||
:param self: a object used to store information about each function
|
||||
:param tu: The translation unit in which to look for locals functions
|
||||
:param fxn: The function name
|
||||
:return: the dictionary for the given function or None
|
||||
"""
|
||||
for f in self.globals.values():
|
||||
if 'demangledName' in f:
|
||||
if f['demangledName'] == fxn:
|
||||
return f
|
||||
for f in self.locals.values():
|
||||
if tu in f:
|
||||
if 'demangledName' in f[tu]:
|
||||
if f[tu]['demangledName'] == fxn:
|
||||
return f[tu]
|
||||
return None
|
||||
|
||||
def read_rtl(self, tu: str, rtl_ext: str) -> None:
|
||||
"""
|
||||
Read an RTL file and finds callees for each function and if there are calls via function pointer.
|
||||
:param self: a object used to store information about each function, results go here
|
||||
:param tu: the translation unit
|
||||
"""
|
||||
|
||||
# Construct A Call Graph
|
||||
function = re.compile(r'^;; Function (.*) \((\S+), funcdef_no=\d+(, [a-z_]+=\d+)*\)( \([a-z ]+\))?$')
|
||||
static_call = re.compile(r'^.*\(call.*"(.*)".*$')
|
||||
other_call = re.compile(r'^.*call .*$')
|
||||
|
||||
with open(tu + rtl_ext, "rt", encoding="latin_1") as file_:
|
||||
for line_ in file_:
|
||||
m = function.match(line_)
|
||||
if m:
|
||||
fxn_name = m.group(2)
|
||||
fxn_dict2 = self.find_fxn(tu, fxn_name)
|
||||
if not fxn_dict2:
|
||||
pprint.pprint(self)
|
||||
raise Exception(f"Error locating function {fxn_name} in {tu}")
|
||||
|
||||
fxn_dict2['demangledName'] = m.group(1)
|
||||
fxn_dict2['calls'] = set()
|
||||
fxn_dict2['has_ptr_call'] = False
|
||||
continue
|
||||
|
||||
m = static_call.match(line_)
|
||||
if m:
|
||||
fxn_dict2['calls'].add(m.group(1))
|
||||
# print("Call: {0} -> {1}".format(current_fxn, m.group(1)))
|
||||
continue
|
||||
|
||||
m = other_call.match(line_)
|
||||
if m:
|
||||
fxn_dict2['has_ptr_call'] = True
|
||||
continue
|
||||
|
||||
def read_su(self, tu: str) -> None:
|
||||
"""
|
||||
Reads the 'local_stack' for each function. Local stack ignores stack used by callees.
|
||||
:param self: a object used to store information about each function, results go here
|
||||
:param tu: the translation unit
|
||||
:return:
|
||||
"""
|
||||
# Needs to be able to handle both cases, i.e.:
|
||||
# c:\\userlibs\\gcc\\arm-none-eabi\\include\\assert.h:41:6:__assert_func 16 static
|
||||
# main.c:113:6:vAssertCalled 8 static
|
||||
# Now Matches six groups https://regex101.com/r/Imi0sq/1
|
||||
|
||||
su_line = re.compile(r'^(.+):(\d+):(\d+):(.+)\t(\d+)\t(\S+)$')
|
||||
i = 1
|
||||
|
||||
with open(tu[0:tu.rindex(".")] + su_ext, "rt", encoding="latin_1") as file_:
|
||||
for line in file_:
|
||||
m = su_line.match(line)
|
||||
if m:
|
||||
fxn = m.group(4)
|
||||
fxn_dict2 = self.find_demangled_fxn(tu, fxn)
|
||||
fxn_dict2['local_stack'] = int(m.group(5))
|
||||
else:
|
||||
print(f"error parsing line {i} in file {tu}")
|
||||
i += 1
|
||||
|
||||
def read_manual(self, file: str) -> None:
|
||||
"""
|
||||
reads the manual stack useage files.
|
||||
:param self: a object used to store information about each function, results go here
|
||||
:param file: the file name
|
||||
"""
|
||||
|
||||
with open(file, "rt", encoding="latin_1") as file_:
|
||||
for line in file_:
|
||||
fxn, stack_sz = line.split()
|
||||
if fxn in self.globals:
|
||||
raise Exception(f"Redeclared Function {fxn}")
|
||||
self.globals[fxn] = {'wcs': int(stack_sz),
|
||||
'calls': set(),
|
||||
'has_ptr_call': False,
|
||||
'local_stack': int(stack_sz),
|
||||
'is_manual': True,
|
||||
'name': fxn,
|
||||
'demangledName': fxn,
|
||||
'tu': '#MANUAL',
|
||||
'binding': 'GLOBAL'}
|
||||
|
||||
def validate_all_data(self) -> None:
|
||||
"""
|
||||
Check that every entry in the call graph has the following fields:
|
||||
.calls, .has_ptr_call, .local_stack, .scope, .src_line
|
||||
"""
|
||||
|
||||
def validate_dict(d):
|
||||
if not ('calls' in d and 'has_ptr_call' in d and 'local_stack' in d
|
||||
and 'name' in d and 'tu' in d):
|
||||
print(f"Error data is missing in fxn dictionary {d}")
|
||||
|
||||
# Loop through every global and local function
|
||||
# and resolve each call, save results in r_calls
|
||||
for fxn_dict2 in self.globals.values():
|
||||
validate_dict(fxn_dict2)
|
||||
|
||||
for l_dict in self.locals.values():
|
||||
for fxn_dict2 in l_dict.values():
|
||||
validate_dict(fxn_dict2)
|
||||
|
||||
def resolve_all_calls(self) -> None:
|
||||
def resolve_calls(fxn_dict2: CallNode) -> None:
|
||||
fxn_dict2['r_calls'] = []
|
||||
fxn_dict2['unresolved_calls'] = set()
|
||||
|
||||
for call in fxn_dict2['calls']:
|
||||
call_dict = self.find_fxn(fxn_dict2['tu'], call)
|
||||
if call_dict:
|
||||
fxn_dict2['r_calls'].append(call_dict)
|
||||
else:
|
||||
fxn_dict2['unresolved_calls'].add(call)
|
||||
|
||||
# Loop through every global and local function
|
||||
# and resolve each call, save results in r_calls
|
||||
for fxn_dict in self.globals.values():
|
||||
resolve_calls(fxn_dict)
|
||||
|
||||
for l_dict in self.locals.values():
|
||||
for fxn_dict in l_dict.values():
|
||||
resolve_calls(fxn_dict)
|
||||
|
||||
def calc_all_wcs(self) -> None:
|
||||
# Loop through every global and local function
|
||||
# and resolve each call, save results in r_calls
|
||||
for fxn_dict in self.globals.values():
|
||||
calc_wcs(fxn_dict, [])
|
||||
|
||||
for l_dict in self.locals.values():
|
||||
for fxn_dict in l_dict.values():
|
||||
calc_wcs(fxn_dict, [])
|
||||
|
||||
def print_all_fxns(self) -> None:
|
||||
|
||||
def print_fxn(row_format: str, fxn_dict2: CallNode) -> None:
|
||||
unresolved = fxn_dict2['unresolved_calls']
|
||||
stack = str(fxn_dict2['wcs'])
|
||||
if unresolved:
|
||||
unresolved_str = f"({' ,'.join(unresolved)})"
|
||||
if stack != 'unbounded':
|
||||
stack = "unbounded:" + stack
|
||||
else:
|
||||
unresolved_str = ''
|
||||
|
||||
print(row_format.format(fxn_dict2['tu'], fxn_dict2['demangledName'], stack, unresolved_str))
|
||||
|
||||
def get_order(val) -> int:
|
||||
return 1 if val == 'unbounded' else -val
|
||||
|
||||
# Loop through every global and local function
|
||||
# and resolve each call, save results in r_calls
|
||||
d_list = []
|
||||
for fxn_dict in self.globals.values():
|
||||
d_list.append(fxn_dict)
|
||||
|
||||
for l_dict in self.locals.values():
|
||||
for fxn_dict in l_dict.values():
|
||||
d_list.append(fxn_dict)
|
||||
|
||||
d_list.sort(key=lambda item: get_order(item['wcs']))
|
||||
|
||||
# Calculate table width
|
||||
tu_width = max(max(len(d['tu']) for d in d_list), 16)
|
||||
name_width = max(max(len(d['name']) for d in d_list), 13)
|
||||
row_format = "{:<" + str(tu_width + 2) + "} {:<" + str(name_width + 2) + "} {:>14} {:<17}"
|
||||
|
||||
# Print out the table
|
||||
print("")
|
||||
print(row_format.format('Translation Unit', 'Function Name', 'Stack', 'Unresolved Dependencies'))
|
||||
for d in d_list:
|
||||
print_fxn(row_format, d)
|
||||
|
||||
|
||||
def read_symbols(file: str) -> List[Symbol]:
|
||||
|
||||
def to_symbol(read_elf_line: str) -> Symbol:
|
||||
v = read_elf_line.split()
|
||||
|
||||
s2 = Symbol()
|
||||
# s2.value = int(v[1], 16)
|
||||
# if ('x' in v[2]):
|
||||
# #raise Exception(f'Mixed symbol sizes in \'{v}\' ')
|
||||
# s2.size=int(v[2].split('x')[1],16)
|
||||
# else:
|
||||
# s2.size = int(v[2])
|
||||
s2.type = v[3]
|
||||
s2.binding = v[4]
|
||||
s2.name = v[7] if len(v) >= 8 else ""
|
||||
|
||||
return s2
|
||||
output = check_output([read_elf_path, "-s", "-W", file]).decode(stdout_encoding)
|
||||
lines = output.splitlines()[3:]
|
||||
return [to_symbol(line) for line in lines]
|
||||
|
||||
|
||||
def find_rtl_ext() -> str:
|
||||
# Find the rtl_extension
|
||||
|
||||
for _, _, filenames in os.walk('.'):
|
||||
for f in filenames:
|
||||
if f.endswith(rtl_ext_end):
|
||||
rtl_ext = f[f[:-len(rtl_ext_end)].rindex("."):]
|
||||
print("rtl_ext = " + rtl_ext)
|
||||
return rtl_ext
|
||||
|
||||
print("Could not find any files ending with '.dfinish'. Check that the script is being run from the correct "
|
||||
"directory. Check that the code was compiled with the correct flags")
|
||||
sys.exit(-1)
|
||||
|
||||
|
||||
def find_files(rtl_ext: str) -> Tuple[List[str], List[str]]:
|
||||
tu: List[str] = []
|
||||
manual: List[str] = []
|
||||
all_files: List[str] = []
|
||||
for root, _, filenames in os.walk('.'):
|
||||
for filename in filenames:
|
||||
all_files.append(os.path.join(root, filename))
|
||||
for f in [f for f in all_files if os.path.isfile(f) and f.endswith(rtl_ext)]:
|
||||
base = f[0:-len(rtl_ext)]
|
||||
short_base = base[0:base.rindex(".")]
|
||||
if short_base + su_ext in all_files and short_base + obj_ext in all_files:
|
||||
tu.append(base)
|
||||
print(f'Reading: {base}{rtl_ext}, {short_base}{su_ext}, {short_base}{obj_ext}')
|
||||
|
||||
for f in [f for f in all_files if os.path.isfile(f) and f.endswith(manual_ext)]:
|
||||
manual.append(f)
|
||||
print(f'Reading: {f}')
|
||||
|
||||
# Print some diagnostic messages
|
||||
if not tu:
|
||||
print("Could not find any translation units to analyse")
|
||||
sys.exit(-1)
|
||||
|
||||
return tu, manual
|
||||
|
||||
|
||||
def main() -> None:
|
||||
# Find the appropriate RTL extension
|
||||
rtl_ext = find_rtl_ext()
|
||||
|
||||
# Find all input files
|
||||
call_graph: CallGraph = CallGraph()
|
||||
tu_list, manual_list = find_files(rtl_ext)
|
||||
|
||||
# Read the input files
|
||||
for tu in tu_list:
|
||||
call_graph.read_obj(tu) # This must be first
|
||||
|
||||
for fxn in call_graph.weak.values():
|
||||
if fxn['name'] not in call_graph.globals:
|
||||
call_graph.globals[fxn['name']] = fxn
|
||||
|
||||
for tu in tu_list:
|
||||
call_graph.read_rtl(tu, rtl_ext)
|
||||
for tu in tu_list:
|
||||
call_graph.read_su(tu)
|
||||
|
||||
# Read manual files
|
||||
for m in manual_list:
|
||||
call_graph.read_manual(m)
|
||||
|
||||
# Validate Data
|
||||
call_graph.validate_all_data()
|
||||
|
||||
# Resolve All Function Calls
|
||||
call_graph.resolve_all_calls()
|
||||
|
||||
# Calculate Worst Case Stack For Each Function
|
||||
call_graph.calc_all_wcs()
|
||||
|
||||
# Print A Nice Message With Each Function and the WCS
|
||||
call_graph.print_all_fxns()
|
||||
|
||||
|
||||
main()
|
|
@ -0,0 +1,251 @@
|
|||
#!/usr/bin/perl -w
|
||||
# avstack.pl: AVR stack checker
|
||||
# Copyright (C) 2013 Daniel Beer <dlbeer@gmail.com>
|
||||
#
|
||||
# Permission to use, copy, modify, and/or distribute this software for
|
||||
# any purpose with or without fee is hereby granted, provided that the
|
||||
# above copyright notice and this permission notice appear in all
|
||||
# copies.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||
# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
|
||||
# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
# PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
# Usage
|
||||
# -----
|
||||
#
|
||||
# This script requires that you compile your code with -fstack-usage.
|
||||
# This results in GCC generating a .su file for each .o file. Once you
|
||||
# have these, do:
|
||||
#
|
||||
# ./avstack.pl <object files>
|
||||
#
|
||||
# This will disassemble .o files to construct a call graph, and read
|
||||
# frame size information from .su. The call graph is traced to find, for
|
||||
# each function:
|
||||
#
|
||||
# - Call height: the maximum call height of any callee, plus 1
|
||||
# (defined to be 1 for any function which has no callees).
|
||||
#
|
||||
# - Inherited frame: the maximum *inherited* frame of any callee, plus
|
||||
# the GCC-calculated frame size of the function in question.
|
||||
#
|
||||
# Using these two pieces of information, we calculate a cost (estimated
|
||||
# peak stack usage) for calling the function. Functions are then listed
|
||||
# on stdout in decreasing order of cost.
|
||||
#
|
||||
# Functions which are recursive are marked with an 'R' to the left of
|
||||
# them. Their cost is calculated for a single level of recursion.
|
||||
#
|
||||
# The peak stack usage of your entire program can usually be estimated
|
||||
# as the stack cost of "main", plus the maximum stack cost of any
|
||||
# interrupt handler which might execute.
|
||||
|
||||
use strict;
|
||||
|
||||
# Configuration: set these as appropriate for your architecture/project.
|
||||
|
||||
my $objdump = "/usr/local/bin/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-objdump";
|
||||
my $call_cost = 12;
|
||||
|
||||
# First, we need to read all object and corresponding .su files. We're
|
||||
# gathering a mapping of functions to callees and functions to frame
|
||||
# sizes. We're just parsing at this stage -- callee name resolution
|
||||
# comes later.
|
||||
|
||||
my %frame_size; # "func@file" -> size
|
||||
my %call_graph; # "func@file" -> {callees}
|
||||
my %addresses; # "addr@file" -> "func@file"
|
||||
|
||||
my %global_name; # "func" -> "func@file"
|
||||
my %ambiguous; # "func" -> 1
|
||||
|
||||
foreach (@ARGV) {
|
||||
# Disassemble this object file to obtain a callees. Sources in the
|
||||
# call graph are named "func@file". Targets in the call graph are
|
||||
# named either "offset@file" or "funcname". We also keep a list of
|
||||
# the addresses and names of each function we encounter.
|
||||
my $objfile = $_;
|
||||
my $source;
|
||||
|
||||
open(DISASSEMBLY, "$objdump -dr $objfile|") ||
|
||||
die "Can't disassemble $objfile";
|
||||
while (<DISASSEMBLY>) {
|
||||
chomp;
|
||||
|
||||
if (/^([0-9a-fA-F]+) <(.*)>:/) {
|
||||
my $a = $1;
|
||||
my $name = $2;
|
||||
|
||||
$source = "$name\@$objfile";
|
||||
$call_graph{$source} = {};
|
||||
$ambiguous{$name} = 1 if defined($global_name{$name});
|
||||
$global_name{$name} = "$name\@$objfile";
|
||||
|
||||
$a =~ s/^0*//;
|
||||
$addresses{"$a\@$objfile"} = "$name\@$objfile";
|
||||
}
|
||||
|
||||
if (/: R_[A-Za-z0-9_]+_CALL[ \t]+(.*)/) {
|
||||
my $t = $1;
|
||||
|
||||
if ($t eq ".text") {
|
||||
$t = "\@$objfile";
|
||||
} elsif ($t =~ /^\.text\+0x(.*)$/) {
|
||||
$t = "$1\@$objfile";
|
||||
}
|
||||
|
||||
$call_graph{$source}->{$t} = 1;
|
||||
}
|
||||
}
|
||||
close(DISASSEMBLY);
|
||||
|
||||
# Extract frame sizes from the corresponding .su file.
|
||||
if ($objfile =~ /^(.*).o$/) {
|
||||
my $sufile = "$1.su";
|
||||
|
||||
open(SUFILE, "<$sufile") || die "Can't open $sufile";
|
||||
while (<SUFILE>) {
|
||||
$frame_size{"$1\@$objfile"} = $2 + $call_cost
|
||||
if /^.*:([^\t ]+)[ \t]+([0-9]+)/;
|
||||
}
|
||||
close(SUFILE);
|
||||
}
|
||||
}
|
||||
|
||||
# In this step, we enumerate each list of callees in the call graph and
|
||||
# try to resolve the symbols. We omit ones we can't resolve, but keep a
|
||||
# set of them anyway.
|
||||
|
||||
my %unresolved;
|
||||
|
||||
foreach (keys %call_graph) {
|
||||
my $from = $_;
|
||||
my $callees = $call_graph{$from};
|
||||
my %resolved;
|
||||
|
||||
foreach (keys %$callees) {
|
||||
my $t = $_;
|
||||
|
||||
if (defined($addresses{$t})) {
|
||||
$resolved{$addresses{$t}} = 1;
|
||||
} elsif (defined($global_name{$t})) {
|
||||
$resolved{$global_name{$t}} = 1;
|
||||
warn "Ambiguous resolution: $t" if defined ($ambiguous{$t});
|
||||
} elsif (defined($call_graph{$t})) {
|
||||
$resolved{$t} = 1;
|
||||
} else {
|
||||
$unresolved{$t} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$call_graph{$from} = \%resolved;
|
||||
}
|
||||
|
||||
# Create fake edges and nodes to account for dynamic behaviour.
|
||||
$call_graph{"INTERRUPT"} = {};
|
||||
|
||||
foreach (keys %call_graph) {
|
||||
$call_graph{"INTERRUPT"}->{$_} = 1 if /^__vector_/;
|
||||
}
|
||||
|
||||
# Trace the call graph and calculate, for each function:
|
||||
#
|
||||
# - inherited frames: maximum inherited frame of callees, plus own
|
||||
# frame size.
|
||||
# - height: maximum height of callees, plus one.
|
||||
# - recursion: is the function called recursively (including indirect
|
||||
# recursion)?
|
||||
|
||||
my %has_caller;
|
||||
my %visited;
|
||||
my %total_cost;
|
||||
my %call_depth;
|
||||
|
||||
sub trace {
|
||||
my $f = shift;
|
||||
|
||||
if ($visited{$f}) {
|
||||
$visited{$f} = "R" if $visited{$f} eq "?";
|
||||
return;
|
||||
}
|
||||
|
||||
$visited{$f} = "?";
|
||||
|
||||
my $max_depth = 0;
|
||||
my $max_frame = 0;
|
||||
|
||||
my $targets = $call_graph{$f} || die "Unknown function: $f";
|
||||
if (defined($targets)) {
|
||||
foreach (keys %$targets) {
|
||||
my $t = $_;
|
||||
|
||||
$has_caller{$t} = 1;
|
||||
trace($t);
|
||||
|
||||
my $is = $total_cost{$t};
|
||||
my $d = $call_depth{$t};
|
||||
|
||||
$max_frame = $is if $is > $max_frame;
|
||||
$max_depth = $d if $d > $max_depth;
|
||||
}
|
||||
}
|
||||
|
||||
$call_depth{$f} = $max_depth + 1;
|
||||
$total_cost{$f} = $max_frame + ($frame_size{$f} || 0);
|
||||
$visited{$f} = " " if $visited{$f} eq "?";
|
||||
}
|
||||
|
||||
foreach (keys %call_graph) { trace $_; }
|
||||
|
||||
# Now, print results in a nice table.
|
||||
printf " %-30s %8s %8s %8s\n",
|
||||
"Func", "Cost", "Frame", "Height";
|
||||
print "------------------------------------";
|
||||
print "------------------------------------\n";
|
||||
|
||||
my $max_iv = 0;
|
||||
my $main = 0;
|
||||
|
||||
foreach (sort { $total_cost{$b} <=> $total_cost{$a} } keys %visited) {
|
||||
my $name = $_;
|
||||
|
||||
if (/^(.*)@(.*)$/) {
|
||||
$name = $1 unless $ambiguous{$name};
|
||||
}
|
||||
|
||||
my $tag = $visited{$_};
|
||||
my $cost = $total_cost{$_};
|
||||
|
||||
$name = $_ if $ambiguous{$name};
|
||||
$tag = ">" unless $has_caller{$_};
|
||||
|
||||
if (/^__vector_/) {
|
||||
$max_iv = $cost if $cost > $max_iv;
|
||||
} elsif (/^main@/) {
|
||||
$main = $cost;
|
||||
}
|
||||
|
||||
if ($ambiguous{$name}) { $name = $_; }
|
||||
|
||||
printf "%s %-30s %8d %8d %8d\n", $tag, $name, $cost,
|
||||
$frame_size{$_} || 0, $call_depth{$_};
|
||||
}
|
||||
|
||||
print "\n";
|
||||
|
||||
print "Peak execution estimate (main + worst-case IV):\n";
|
||||
printf " main = %d, worst IV = %d, total = %d\n",
|
||||
$total_cost{$global_name{"main"}},
|
||||
$total_cost{"INTERRUPT"},
|
||||
$total_cost{$global_name{"main"}} + $total_cost{"INTERRUPT"};
|
||||
|
||||
print "\n";
|
||||
|
||||
print "The following functions were not resolved:\n";
|
||||
foreach (keys %unresolved) { print " $_\n"; }
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/bash
|
||||
|
||||
rm __stackanalysis/*
|
||||
#cp WCS.py __stackanalysis/WCS.py
|
||||
cp avstack.pl __stackanalysis/avstack.pl
|
||||
|
||||
find . -maxdepth 5 -type f -name "*.su" -exec bash -c 'filename=$(basename -- {}); echo $filename; cp {} __stackanalysis/$filename' \;
|
||||
|
||||
find . -maxdepth 5 -type f -name "*.dfinish" -exec bash -c 'filename=$(basename -- {}); echo $filename; cp {} __stackanalysis/$filename' \;
|
||||
|
||||
find . -maxdepth 5 -type f -name "*.o" -exec bash -c 'filename=$(basename -- {}); echo $filename; cp {} __stackanalysis/$filename' \;
|
||||
|
||||
cd ./__stackanalysis/
|
||||
rm startup_stm32l471xx.*
|
||||
perl avstack.pl *.o > ../stack_analysis.report
|
||||
#python3.10 WCS.py
|
|
@ -98,7 +98,7 @@ C_DEPS += \
|
|||
src/%.o: ../src/%.c src/subdir.mk
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: Cross ARM C Compiler'
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -fstack-usage -fdump-rtl-dfinish -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ C_DEPS += \
|
|||
system/src/aprs/%.o: ../system/src/aprs/%.c system/src/aprs/subdir.mk
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: Cross ARM C Compiler'
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -fstack-usage -fdump-rtl-dfinish -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ system/src/cmsis/stm32l4xx/%.o: ../system/src/cmsis/stm32l4xx/%.S system/src/cms
|
|||
system/src/cmsis/stm32l4xx/%.o: ../system/src/cmsis/stm32l4xx/%.c system/src/cmsis/stm32l4xx/subdir.mk
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: Cross ARM C Compiler'
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -fstack-usage -fdump-rtl-dfinish -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ C_DEPS += \
|
|||
system/src/davis_vantage/%.o: ../system/src/davis_vantage/%.c system/src/davis_vantage/subdir.mk
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: Cross ARM C Compiler'
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -fstack-usage -fdump-rtl-dfinish -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ C_DEPS += \
|
|||
system/src/diag/%.o: ../system/src/diag/%.c system/src/diag/subdir.mk
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: Cross ARM C Compiler'
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -fstack-usage -fdump-rtl-dfinish -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ C_DEPS += \
|
|||
system/src/drivers/l4/%.o: ../system/src/drivers/l4/%.c system/src/drivers/l4/subdir.mk
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: Cross ARM C Compiler'
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -fstack-usage -fdump-rtl-dfinish -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ C_DEPS += \
|
|||
system/src/drivers/%.o: ../system/src/drivers/%.c system/src/drivers/subdir.mk
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: Cross ARM C Compiler'
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -fstack-usage -fdump-rtl-dfinish -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ C_DEPS += \
|
|||
system/src/modbus_rtu/%.o: ../system/src/modbus_rtu/%.c system/src/modbus_rtu/subdir.mk
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: Cross ARM C Compiler'
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -fstack-usage -fdump-rtl-dfinish -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -329,7 +329,7 @@ C_DEPS += \
|
|||
system/src/stm32l4-hal-driver/%.o: ../system/src/stm32l4-hal-driver/%.c system/src/stm32l4-hal-driver/subdir.mk
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: Cross ARM C Compiler'
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -fstack-usage -fdump-rtl-dfinish -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ C_DEPS += \
|
|||
system/src/umb_master/%.o: ../system/src/umb_master/%.c system/src/umb_master/subdir.mk
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: Cross ARM C Compiler'
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -fstack-usage -fdump-rtl-dfinish -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ C_DEPS += \
|
|||
system/src/ve_direct_protocol/%.o: ../system/src/ve_direct_protocol/%.c system/src/ve_direct_protocol/subdir.mk
|
||||
@echo 'Building file: $<'
|
||||
@echo 'Invoking: Cross ARM C Compiler'
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
arm-none-eabi-gcc -mcpu=cortex-m4 -mthumb -mfloat-abi=hard -mfpu=fpv4-sp-d16 -Og -fmessage-length=0 -fsigned-char -ffunction-sections -fdata-sections -ffreestanding -fno-move-loop-invariants -g3 -DDEBUG -DUSE_FULL_LL_DRIVER -DSTM32L471xx -DPARAMETEO -USTM32F10X_MD_VL -UPARATNC_HWREV_A -UPARATNC_HWREV_B -UPARATNC_HWREV_C -I"../include" -I"../include/configuration_nvm" -I"../include/etc" -I"../system/include/tiny-aes" -I"../system/include/aprs" -I"../system/include" -I"../system/include/cmsis/stm32l4xx" -I"../system/include/cmsis/stm32l4xx/device" -I"../system/include/stm32l4-hal-driver" -I"../system/include/stm32l4-hal-driver/Legacy" -std=gnu11 -Wunused-function -Wall -Wa,-adhlns="$@.lst" -fstack-usage -fdump-rtl-dfinish -MMD -MP -MF"$(@:%.o=%.d)" -MT"$@" -c -o "$@" "$<"
|
||||
@echo 'Finished building: $<'
|
||||
@echo ' '
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue