2022-05-23 13:30:13 +00:00
|
|
|
# SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2022-06-03 12:46:56 +00:00
|
|
|
from typing import Dict, List
|
2020-12-11 15:28:11 +00:00
|
|
|
|
2022-06-03 12:46:56 +00:00
|
|
|
from click.core import Context
|
|
|
|
from idf_py_actions.tools import PropertyDict, ensure_build_directory, run_target
|
2020-12-11 15:28:11 +00:00
|
|
|
|
2022-06-03 12:46:56 +00:00
|
|
|
|
|
|
|
def action_extensions(base_actions: Dict, project_path: List) -> Dict:
|
|
|
|
def uf2_target(target_name: str, ctx: Context, args: PropertyDict) -> None:
|
2020-12-11 15:28:11 +00:00
|
|
|
ensure_build_directory(args, ctx.info_name)
|
|
|
|
run_target(target_name, args)
|
|
|
|
|
|
|
|
uf2_actions = {
|
2021-01-26 02:49:01 +00:00
|
|
|
'actions': {
|
|
|
|
'uf2': {
|
|
|
|
'callback': uf2_target,
|
|
|
|
'short_help': 'Generate the UF2 binary with all the binaries included',
|
|
|
|
'dependencies': ['all'],
|
2020-12-11 15:28:11 +00:00
|
|
|
},
|
2021-01-26 02:49:01 +00:00
|
|
|
'uf2-app': {
|
|
|
|
'callback': uf2_target,
|
|
|
|
'short_help': 'Generate an UF2 binary for the application only',
|
|
|
|
'dependencies': ['all'],
|
2020-12-11 15:28:11 +00:00
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return uf2_actions
|