__main__.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. # Copyright 2024 Google LLC
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. import argparse
  15. import logging
  16. from . import flash
  17. def main(args=None):
  18. if args is None:
  19. parser = argparse.ArgumentParser(description='A tool for flashing a bigboard via FTDI+SWD')
  20. parser.add_argument('hex_files', type=str, nargs='+',
  21. help='Path to one or more hex files to flash')
  22. parser.add_argument('--board', action='store', choices=['robert_bb2', 'silk_bb'], required=True,
  23. help='Which board is being programmed')
  24. parser.add_argument('--verbose', action='store_true',
  25. help='Output lots of debugging info to the console.')
  26. args = parser.parse_args()
  27. logging.basicConfig(level=(logging.DEBUG if args.verbose else logging.INFO))
  28. flash(args.board, args.hex_files)
  29. if __name__ == '__main__':
  30. main()