SConstruct 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 = 'rt-thread.' + 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 rt-thread.map'])
  26. Export('RTT_ROOT')
  27. Export('rtconfig')
  28. # prepare building environment
  29. objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
  30. SDK_ROOT = os.path.abspath('./')
  31. # include drivers
  32. objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/STM32F7xx_HAL/SConscript'))
  33. # include libraries
  34. objs.extend(SConscript(os.path.dirname(SDK_ROOT) + '/libraries/HAL_Drivers/SConscript'))
  35. # make a building
  36. DoBuilding(TARGET, objs)