SConstruct 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import os
  2. import sys
  3. import rtconfig
  4. if os.getenv('RTT_ROOT'):
  5. RTT_ROOT = os.getenv('RTT_ROOT')
  6. else:
  7. RTT_ROOT = os.path.normpath(os.getcwd() + '/../..')
  8. # if not os.getenv("RTT_ROOT"):
  9. # RTT_ROOT="rt-thread"
  10. sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
  11. try:
  12. from building import *
  13. except:
  14. print('Cannot found RT-Thread root directory, please check RTT_ROOT')
  15. print(RTT_ROOT)
  16. exit(-1)
  17. TARGET = 'rt-thread.' + rtconfig.TARGET_EXT
  18. DefaultEnvironment(tools=[])
  19. env = Environment(tools = ['mingw'],
  20. AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
  21. CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
  22. AR = rtconfig.AR, ARFLAGS = '-rc',
  23. CXX = rtconfig.CXX, CXXFLAGS = rtconfig.CXXFLAGS,
  24. LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
  25. env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
  26. if rtconfig.PLATFORM in ['iccarm']:
  27. env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
  28. env.Replace(ARFLAGS = [''])
  29. env.Replace(LINKCOM = env["LINKCOM"] + ' --map rt-thread.map')
  30. Export('RTT_ROOT')
  31. Export('rtconfig')
  32. SDK_ROOT = os.path.abspath('./')
  33. if os.path.exists(SDK_ROOT + '/libraries'):
  34. libraries_path_prefix = SDK_ROOT + '/libraries'
  35. else:
  36. libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
  37. SDK_LIB = libraries_path_prefix
  38. Export('SDK_LIB')
  39. # prepare building environment
  40. objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
  41. msp432e401y_library = 'msp432e4'
  42. rtconfig.BSP_LIBRARY_TYPE = msp432e401y_library
  43. # include libraries
  44. objs.extend(SConscript(os.path.join(libraries_path_prefix, msp432e401y_library, 'SConscript')))
  45. # include drivers
  46. objs.extend(SConscript(os.path.join(libraries_path_prefix, 'Drivers', 'SConscript')))
  47. # make a building
  48. DoBuilding(TARGET, objs)