Merge branch 'bugfix/idfpy_erase_otadata' into 'master'

tools: set baudrate and port with otatool.

Closes IDFGH-6687

See merge request espressif/esp-idf!17386
pull/8564/head
Roland Dobai 2022-03-11 20:58:53 +08:00
commit 0f57ef942a
2 zmienionych plików z 41 dodań i 29 usunięć

Wyświetl plik

@ -455,28 +455,6 @@ def action_extensions(base_actions, project_path):
'order_dependencies': ['reconfigure'],
'options': global_options,
},
'erase_otadata': {
'callback': build_target,
'hidden': True,
'help': 'Erase otadata partition.',
'options': global_options,
},
'erase-otadata': {
'callback': build_target,
'help': 'Erase otadata partition. Deprecated alias: "erase_otadata".',
'options': global_options,
},
'read_otadata': {
'callback': build_target,
'hidden': True,
'help': 'Read otadata partition.',
'options': global_options,
},
'read-otadata': {
'callback': build_target,
'help': 'Read otadata partition. Deprecated alias: "read_otadata".',
'options': global_options,
},
'build-system-targets': {
'callback': list_build_system_targets,
'help': 'Print list of build system targets.',

Wyświetl plik

@ -172,6 +172,17 @@ def action_extensions(base_actions, project_path):
task.action_args['encrypted'] = True
break
def ota_targets(target_name, ctx, args):
"""
Execute the target build system to build target 'target_name'.
Additionally set global variables for baud and port.
Calls ensure_build_directory() which will run cmake to generate a build
directory (with the specified generator) as needed.
"""
args.port = args.port or _get_default_serial_port(args)
ensure_build_directory(args, ctx.info_name)
run_target(target_name, args, {'ESPBAUD': str(args.baud), 'ESPPORT': args.port})
baud_rate = {
'names': ['-b', '--baud'],
'help': 'Baud rate for flashing. It can imply monitor baud rate as well if it hasn\'t been defined locally.',
@ -188,19 +199,20 @@ def action_extensions(base_actions, project_path):
'default': None,
}
BAUD_AND_PORT = [baud_rate, port]
serial_actions = {
'global_action_callbacks': [global_callback],
'actions': {
'flash': {
'callback': flash,
'help': 'Flash the project.',
'options': global_options + [baud_rate, port],
'options': global_options + BAUD_AND_PORT,
'order_dependencies': ['all', 'erase-flash'],
},
'erase-flash': {
'callback': erase_flash,
'help': 'Erase entire flash chip. Deprecated alias: "erase_flash"',
'options': [baud_rate, port],
'options': BAUD_AND_PORT,
},
'erase_flash': {
'callback': erase_flash,
@ -210,7 +222,7 @@ def action_extensions(base_actions, project_path):
},
'hidden': True,
'help': 'Erase entire flash chip.',
'options': [baud_rate, port],
'options': BAUD_AND_PORT,
},
'monitor': {
'callback':
@ -272,26 +284,26 @@ def action_extensions(base_actions, project_path):
'partition-table-flash': {
'callback': flash,
'help': 'Flash partition table only. Deprecated alias: "partition_table-flash".',
'options': [baud_rate, port],
'options': BAUD_AND_PORT,
'order_dependencies': ['partition-table', 'erase-flash'],
},
'partition_table-flash': {
'callback': flash,
'hidden': True,
'help': 'Flash partition table only.',
'options': [baud_rate, port],
'options': BAUD_AND_PORT,
'order_dependencies': ['partition-table', 'erase-flash'],
},
'bootloader-flash': {
'callback': flash,
'help': 'Flash bootloader only.',
'options': [baud_rate, port],
'options': BAUD_AND_PORT,
'order_dependencies': ['bootloader', 'erase-flash'],
},
'app-flash': {
'callback': flash,
'help': 'Flash the app only.',
'options': [baud_rate, port],
'options': BAUD_AND_PORT,
'order_dependencies': ['app', 'erase-flash'],
},
'encrypted-app-flash': {
@ -304,6 +316,28 @@ def action_extensions(base_actions, project_path):
'help': 'Flash the encrypted project.',
'order_dependencies': ['all', 'erase-flash'],
},
'erase_otadata': {
'callback': ota_targets,
'hidden': True,
'help': 'Erase otadata partition.',
'options': global_options + BAUD_AND_PORT,
},
'erase-otadata': {
'callback': ota_targets,
'help': 'Erase otadata partition. Deprecated alias: "erase_otadata".',
'options': global_options + BAUD_AND_PORT,
},
'read_otadata': {
'callback': ota_targets,
'hidden': True,
'help': 'Read otadata partition.',
'options': global_options + BAUD_AND_PORT,
},
'read-otadata': {
'callback': ota_targets,
'help': 'Read otadata partition. Deprecated alias: "read_otadata".',
'options': global_options + BAUD_AND_PORT,
},
},
}