SConstruct 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
  9. try:
  10. from building import *
  11. except:
  12. print('Cannot found RT-Thread root directory, please check RTT_ROOT')
  13. print(RTT_ROOT)
  14. exit(-1)
  15. TARGET = 'rtthread.' + rtconfig.TARGET_EXT
  16. DefaultEnvironment(tools=[])
  17. env = Environment(tools = ['mingw'],
  18. AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
  19. CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
  20. AR = rtconfig.AR, ARFLAGS = '-rc',
  21. LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
  22. env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
  23. if rtconfig.PLATFORM in ['iccarm']:
  24. env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
  25. env.Replace(ARFLAGS = [''])
  26. env.Replace(LINKCOM = env["LINKCOM"] + ' --map project.map')
  27. Export('RTT_ROOT')
  28. Export('rtconfig')
  29. ESSEMI_ROOT = os.path.abspath('./')
  30. es32f36xx_lib_path_prefix = os.path.dirname(ESSEMI_ROOT) + '/es32f369x'
  31. ES32F36XX_DRV_ROOT = es32f36xx_lib_path_prefix + '/drivers'
  32. Export('ES32F36XX_DRV_ROOT')
  33. # prepare building environment
  34. objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
  35. es32f36xx_library = 'libraries'
  36. rtconfig.BSP_LIBRARY_TYPE = es32f36xx_library
  37. # include libraries
  38. objs.extend(SConscript(os.path.join(es32f36xx_lib_path_prefix, es32f36xx_library, 'SConscript')))
  39. # make a building
  40. DoBuilding(TARGET, objs)