SConscript 1.2 KB

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