SConstruct 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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-stm32f42x.' + rtconfig.TARGET_EXT
  16. env = Environment(tools = ['mingw'],
  17. AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
  18. CC = rtconfig.CC, CCFLAGS = rtconfig.CFLAGS,
  19. AR = rtconfig.AR, ARFLAGS = '-rc',
  20. LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
  21. env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
  22. if rtconfig.PLATFORM == 'iar':
  23. env.Replace(CCCOM = ['$CC $CCFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
  24. env.Replace(ARFLAGS = [''])
  25. env.Replace(LINKCOM = ['$LINK $SOURCES $LINKFLAGS -o $TARGET --map project.map'])
  26. Export('RTT_ROOT')
  27. Export('rtconfig')
  28. # prepare building environment
  29. objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
  30. # make a building
  31. DoBuilding(TARGET, objs)