mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
components: Correct the Python coding style
This commit is contained in:
@@ -7,27 +7,28 @@
|
||||
|
||||
from optparse import OptionParser
|
||||
|
||||
BASE_ADDR = 0x50000000;
|
||||
BASE_ADDR = 0x50000000
|
||||
|
||||
|
||||
def gen_ld_h_from_sym(f_sym, f_ld, f_h):
|
||||
f_ld.write("/* Variable definitions for ESP32ULP linker\n");
|
||||
f_ld.write(" * This file is generated automatically by esp32ulp_mapgen.py utility.\n");
|
||||
f_ld.write(" */\n\n");
|
||||
f_h.write("// Variable definitions for ESP32ULP\n");
|
||||
f_h.write("// This file is generated automatically by esp32ulp_mapgen.py utility\n\n");
|
||||
f_h.write("#pragma once\n\n");
|
||||
f_ld.write("/* Variable definitions for ESP32ULP linker\n")
|
||||
f_ld.write(" * This file is generated automatically by esp32ulp_mapgen.py utility.\n")
|
||||
f_ld.write(" */\n\n")
|
||||
f_h.write("// Variable definitions for ESP32ULP\n")
|
||||
f_h.write("// This file is generated automatically by esp32ulp_mapgen.py utility\n\n")
|
||||
f_h.write("#pragma once\n\n")
|
||||
|
||||
for line in f_sym:
|
||||
for line in f_sym:
|
||||
name, _, addr_str = line.split()
|
||||
addr = int(addr_str, 16) + BASE_ADDR;
|
||||
f_h.write("extern uint32_t ulp_{0};\n".format(name));
|
||||
addr = int(addr_str, 16) + BASE_ADDR
|
||||
f_h.write("extern uint32_t ulp_{0};\n".format(name))
|
||||
f_ld.write("PROVIDE ( ulp_{0} = 0x{1:08x} );\n".format(name, addr))
|
||||
|
||||
|
||||
def main():
|
||||
description = ( "This application generates .h and .ld files for symbols defined in input file. "
|
||||
"The input symbols file can be generated using nm utility like this: "
|
||||
"esp32-ulp-nm -g -f posix <elf_file> > <symbols_file>" );
|
||||
description = ("This application generates .h and .ld files for symbols defined in input file. "
|
||||
"The input symbols file can be generated using nm utility like this: "
|
||||
"esp32-ulp-nm -g -f posix <elf_file> > <symbols_file>")
|
||||
|
||||
parser = OptionParser(description=description)
|
||||
parser.add_option("-s", "--symfile", dest="symfile",
|
||||
@@ -44,11 +45,10 @@ def main():
|
||||
parser.print_help()
|
||||
return 1
|
||||
|
||||
with open(options.outputfile + ".h", 'w') as f_h, \
|
||||
open(options.outputfile + ".ld", 'w') as f_ld, \
|
||||
open(options.symfile) as f_sym: \
|
||||
with open(options.outputfile + ".h", 'w') as f_h, open(options.outputfile + ".ld", 'w') as f_ld, open(options.symfile) as f_sym:
|
||||
gen_ld_h_from_sym(f_sym, f_ld, f_h)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
exit(main());
|
||||
exit(main())
|
||||
|
Reference in New Issue
Block a user