Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runner name deprecation + deprecate 'misc-flasher' to prefer 'misc' #61243

Commits on Aug 15, 2023

  1. runners: fix logging set up location

    The do_run_common_image() function responsible for calling west flash,
    debug, etc. is doing runner-related work before setting up the logging
    for the runners module. This means messages aren't formatted properly.
    Fix it.
    
    Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
    mbolivar-ampere committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    9e27efe View commit details
    Browse the repository at this point in the history
  2. runners: remove dead code

    The 'if' statement was added in commit
    8408af6
    ("scripts: west commands to support --domain"),
    because do_run_common_image() was called once per
    domain as a result of this commit.
    
    The 'if' is no longer necessary now that this code
    has been moved back into do_run_common(), which should
    only be called once per 'west <flash|debug|...>' process.
    
    Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
    mbolivar-ampere committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    3890dc4 View commit details
    Browse the repository at this point in the history
  3. runners: clean up an internal helper

    The dump_runner_option_help() function is breaking an argparse
    abstraction in a way that is not working properly. The attempt to
    remove the 'REMOVE ME' string mentioned in the function is not
    working for the 'misc-flasher' runner, which has additional positional
    argument groups that this function did not contemplate.
    
    (The function was implemented before the misc-flasher runner, so probably
    this regression has existed since misc-flasher was introduced.)
    
    Fix it by replacing it with an implementation that sticks to
    argparse abstractions. With this patch, 'west flash -H -r misc-flasher'
    results look like:
    
      misc-flasher options:
        usage: [--elf-file FILE] [--hex-file FILE] [--bin-file FILE] cmd ...
    
        positional arguments:
          cmd              command to run; it will be passed the build
                           directory as its first argument
          args             additional arguments to pass after the build
                           directory
    
        options:
          --elf-file FILE  path to zephyr.elf
          --hex-file FILE  path to zephyr.hex
          --bin-file FILE  path to zephyr.bin
    
    Instead of how they appear now:
    
      misc-flasher options:
        cmd              command to run; it will be passed the build
                         directory as its first argument
        args             additional arguments to pass after the build
                         directory
    
      REMOVE ME:
        --elf-file FILE  path to zephyr.elf
        --hex-file FILE  path to zephyr.hex
        --bin-file FILE  path to zephyr.bin
    
    Output for other runners is similar. For instance, (abbreviated) jlink
    output looks like this now:
    
      jlink options:
        usage:  [-i DEV_ID] [--dt-flash {Y,y,N,n,yes,no,YES,NO}] [...]
    
        options:
          -i DEV_ID, --dev-id DEV_ID
                                Device identifier. Use it to select the
                                J-Link Serial Number of the device
                                connected over USB.
          --dt-flash {Y,y,N,n,yes,no,YES,NO}
                                If 'yes', try to use flash address
                                information from devicetree when flash
                                addresses are unknown (e.g. when flashing
                                a .bin)
          [...]
    
    Including the usage is arguably better anyway.
    
    Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
    mbolivar-ampere committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    99115c3 View commit details
    Browse the repository at this point in the history
  4. runners: fix an error message

    The location of the runners.yaml file is a hard-coded implementation
    detail. Its path is also still present in the cmake cache, but we
    don't look for it there.
    
    Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
    mbolivar-ampere committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    a56197f View commit details
    Browse the repository at this point in the history
  5. runners: --context: avoid loading runners.yaml twice

    The only caller of dump_all_runner_context() already has
    the path to runners.yaml, so pass it down to the function
    instead of recomputing it. Additionally, the content of
    that file is already loaded, so do not load it again.
    
    This avoids unnecessary work.
    
    Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
    mbolivar-ampere committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    c05ff88 View commit details
    Browse the repository at this point in the history
  6. runners: introduce deprecation framework for runner names

    Over time, we may want to deprecate and phase out old runner names.
    There is currently no way to do this. Add one by allowing
    ZephyrBinaryRunner subclasses to override a new deprecated_names()
    classmethod. Subclasses can move their current name into the return
    value of this list and return their new names from the name()
    classmethod.
    
    Make the framework support this by falling back on deprecated names.
    
    Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
    mbolivar-ampere committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    d14dc4e View commit details
    Browse the repository at this point in the history
  7. runners: misc-flasher: rename to 'misc'

    Make this runner name match the file names used to refer to it
    (e.g. misc.board.cmake and misc.py). Use the new name deprecation
    framework to avoid compatibility breaks.
    
    Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
    mbolivar-ampere committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    9658efa View commit details
    Browse the repository at this point in the history
  8. treewide: update deprecated 'misc-flasher' runner names

    The preferred name is 'misc' and 'misc-flasher' has been deprecated.
    
    The current board files and related documentation still work, but they
    generate warnings. Use the new preferred name to avoid the warnings.
    
    Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
    mbolivar-ampere committed Aug 15, 2023
    Configuration menu
    Copy the full SHA
    6ff9efb View commit details
    Browse the repository at this point in the history