SConscript 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import rtconfig
  2. from building import *
  3. import os
  4. # Import environment variables
  5. Import('env')
  6. # get current directory
  7. cwd = GetCurrentDir()
  8. # The set of source files associated with this SConscript file.
  9. src = Split('''
  10. GD/GD32F3x0/Source/system_gd32f3x0.c
  11. ''')
  12. path = [
  13. cwd + '/GD/GD32F3x0/Include',
  14. cwd,]
  15. # Map microcontroller units (MCUs) to their corresponding startup files
  16. mcu_startup_files = {
  17. 'GD32F310': 'startup_gd32f3x0.s',
  18. 'GD32F330': 'startup_gd32f3x0.s',
  19. 'GD32F350': 'startup_gd32f3x0.s',
  20. 'GD32F355': 'startup_gd32f3x0.s',
  21. 'GD32F370': 'startup_gd32f3x0.s',
  22. }
  23. # Check each defined MCU, match the platform and append the appropriate startup file
  24. for mcu, startup_file in mcu_startup_files.items():
  25. if mcu in env.get('CPPDEFINES', []):
  26. if rtconfig.PLATFORM in ['gcc']:
  27. src += [os.path.join(cwd, 'GD', 'GD32F3x0', 'Source', 'GCC', startup_file)]
  28. elif rtconfig.PLATFORM in ['armcc', 'armclang']:
  29. src += [os.path.join(cwd, 'GD', 'GD32F3x0', 'Source', 'ARM', startup_file)]
  30. elif rtconfig.PLATFORM in ['iccarm']:
  31. src += [os.path.join(cwd, 'GD', 'GD32F3x0', 'Source', 'IAR', startup_file)]
  32. break
  33. CPPDEFINES = ['USE_STDPERIPH_DRIVER']
  34. group = DefineGroup('Libraries', src, depend = ['SOC_SERIES_GD32F3x0'], CPPPATH = path, CPPDEFINES = CPPDEFINES)
  35. Return('group')