uf2_ext.py 981 B

1234567891011121314151617181920212223242526272829
  1. # SPDX-FileCopyrightText: 2022 Espressif Systems (Shanghai) CO LTD
  2. # SPDX-License-Identifier: Apache-2.0
  3. from typing import Dict, List
  4. from click.core import Context
  5. from idf_py_actions.tools import PropertyDict, ensure_build_directory, run_target
  6. def action_extensions(base_actions: Dict, project_path: List) -> Dict:
  7. def uf2_target(target_name: str, ctx: Context, args: PropertyDict) -> None:
  8. ensure_build_directory(args, ctx.info_name)
  9. run_target(target_name, args)
  10. uf2_actions = {
  11. 'actions': {
  12. 'uf2': {
  13. 'callback': uf2_target,
  14. 'short_help': 'Generate the UF2 binary with all the binaries included',
  15. 'dependencies': ['all'],
  16. },
  17. 'uf2-app': {
  18. 'callback': uf2_target,
  19. 'short_help': 'Generate an UF2 binary for the application only',
  20. 'dependencies': ['all'],
  21. },
  22. }
  23. }
  24. return uf2_actions