SConscript 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import os
  2. import sys
  3. import rtconfig
  4. from building import *
  5. def get_source(ic_model, file_path, system_path, base_path):
  6. source_path = []
  7. files_list = []
  8. readafter = 0
  9. if not os.path.isfile(file_path):
  10. return
  11. with open(file_path, 'r') as file:
  12. # content = file.read()
  13. for line in file:
  14. if readafter == 2 and line.find('>') != -1:
  15. break
  16. if readafter == 2:
  17. files_list.append(line.strip())
  18. if line.find(ic_model) != -1:
  19. readafter = 1
  20. if readafter == 1 and line.find('<') != -1:
  21. readafter = 2
  22. for line in files_list:
  23. if line.find('system') != -1:
  24. source_path.append(os.path.join(system_path, line.strip()))
  25. else:
  26. source_path.append(os.path.join(base_path, line.strip()))
  27. return source_path
  28. Import('rtconfig')
  29. tools_path = os.path.normpath(os.getcwd() + '../../..' + '/tools')
  30. sys.path.append(tools_path)
  31. source_file_path = os.path.join(os.getcwd(), 'Source_file')
  32. base_path = 'library/HT32F5xxxx_Driver/src/'
  33. system_path = 'library/Device/Holtek/HT32F5xxxx/Source/'
  34. source_path = []
  35. ic_list = [
  36. 'HT32F0006',
  37. 'HT32F0008',
  38. 'HT32F52367',
  39. 'HT50F3200S',
  40. 'HT50F3200T',
  41. 'HF5032',
  42. 'HT32F5828',
  43. 'HT50F32002',
  44. 'HT50F32003',
  45. 'HT32F50030',
  46. 'HT32F50230',
  47. 'HT32F50241',
  48. 'HT32F50343',
  49. 'HT32F50441',
  50. 'HT32F50452',
  51. 'HT32F52142',
  52. 'HT32F52230',
  53. 'HT32F52241',
  54. 'HT32F52244',
  55. 'HT32F52253',
  56. 'HT32F52341',
  57. 'HT32F52352',
  58. 'HT32F52354',
  59. 'HT32F52367',
  60. 'HT32F53241',
  61. 'HT32F53252',
  62. 'HT32F54241',
  63. 'HT32F54253',
  64. 'HT32F57341',
  65. 'HT32F57352',
  66. 'HT32F59041',
  67. 'HT32F59741',
  68. 'HT32F61141',
  69. 'HT32F61245',
  70. 'HT32F61352',
  71. 'HT32F61355',
  72. 'HT32F61356',
  73. 'HT32F61357',
  74. 'HT32F61630',
  75. 'HT32F61641',
  76. 'HT32F65232',
  77. 'HT32F65240',
  78. 'HT32F67051',
  79. 'HT32F67232',
  80. 'HT32F67233',
  81. 'HT32F67741'
  82. ]
  83. cwd = GetCurrentDir()
  84. src = []
  85. for ic_name in ic_list:
  86. if GetDepend(['SOC_' + ic_name]):
  87. source_path = get_source(ic_name,source_file_path,system_path,base_path)
  88. src = Split(source_path)
  89. path = [
  90. cwd + '/library/HT32F5xxxx_Driver/inc',
  91. cwd + '/library/CMSIS/Include',
  92. cwd + '/library/Device/Holtek/HT32F5xxxx/Include'
  93. ]
  94. CPPDEFINES = ['USE_HT32_DRIVER']
  95. group = DefineGroup('Libraries', src, depend = [''], CPPPATH = path, CPPDEFINES = CPPDEFINES)
  96. Return('group')