SConscript 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. from building import *
  2. import os
  3. # Import environment variables
  4. Import('env')
  5. # Get the current working directory
  6. cwd = GetCurrentDir()
  7. # Initialize include paths and source files list
  8. path = [os.path.join(cwd, 'Include')]
  9. src = [os.path.join(cwd, 'Source', 'Templates', 'system_stm32f2xx.c')]
  10. # Map microcontroller units (MCUs) to their corresponding startup files
  11. mcu_startup_files = {
  12. 'STM32F205xx': 'startup_stm32f205xx.s',
  13. 'STM32F207xx': 'startup_stm32f207xx.s',
  14. 'STM32F215xx': 'startup_stm32f215xx.s',
  15. 'STM32F217xx': 'startup_stm32f217xx.s',
  16. }
  17. # Check each defined MCU, match the platform and append the appropriate startup file
  18. for mcu, startup_file in mcu_startup_files.items():
  19. if mcu in env.get('CPPDEFINES', []):
  20. if rtconfig.PLATFORM in ['gcc', 'llvm-arm']:
  21. src += [os.path.join(cwd, 'Source', 'Templates', 'gcc', startup_file)]
  22. elif rtconfig.PLATFORM in ['armcc', 'armclang']:
  23. src += [os.path.join(cwd, 'Source', 'Templates', 'arm', startup_file)]
  24. elif rtconfig.PLATFORM in ['iccarm']:
  25. src += [os.path.join(cwd, 'Source', 'Templates', 'iar', startup_file)]
  26. break
  27. # Define the build group
  28. group = DefineGroup('STM32F2-CMSIS', src, depend=['PKG_USING_STM32F2_CMSIS_DRIVER'], CPPPATH=path)
  29. # Return the build group
  30. Return('group')