get_toolchain.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Copyright (c) 2022, RT-Thread Development Team
  5. #
  6. # SPDX-License-Identifier: GPL-2.0
  7. #
  8. # Change Logs:
  9. # Date Author Notes
  10. # 2022-02-1 Bernard The first version
  11. #
  12. import os
  13. import sys
  14. import platform
  15. from ci import CI
  16. toolchains_config = {
  17. 'arm':
  18. {
  19. 'Linux': 'arm-linux-musleabi_for_x86_64-pc-linux-gnu_latest.tar.bz2',
  20. 'Windows': 'arm-linux-musleabi_for_i686-w64-mingw32_latest.zip'
  21. },
  22. 'aarch64':
  23. {
  24. 'Linux' : 'aarch64-linux-musleabi_for_x86_64-pc-linux-gnu_latest.tar.bz2',
  25. 'Windows' : 'aarch64-linux-musleabi_for_i686-w64-mingw32_latest.zip'
  26. },
  27. 'riscv64':
  28. {
  29. 'Linux': 'riscv64-linux-musleabi_for_x86_64-pc-linux-gnu_latest.tar.bz2',
  30. 'Windows': 'riscv64-linux-musleabi_for_i686-w64-mingw32_latest.zip'
  31. }
  32. }
  33. if __name__ == '__main__':
  34. # download toolchain
  35. if len(sys.argv) > 1:
  36. target = sys.argv[1]
  37. else:
  38. target = 'arm'
  39. ci = CI()
  40. toolchain_path = os.path.join(os.path.abspath('.'), 'gnu_gcc')
  41. platform = platform.system()
  42. try:
  43. zfile = toolchains_config[target][platform]
  44. URL = 'http://117.143.63.254:9012/www/rt-smart/' + zfile
  45. except:
  46. print('not found target')
  47. exit(0)
  48. ci.downloadFile(zfile, URL)
  49. ci.extractZipFile(zfile, toolchain_path)
  50. ci.delFile(zfile)