SConscript 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_stm32f7xx.c')]
  10. # Map microcontroller units (MCUs) to their corresponding startup files
  11. mcu_startup_files = {
  12. 'STM32F722xx': 'startup_stm32f722xx.s',
  13. 'STM32F723xx': 'startup_stm32f723xx.s',
  14. 'STM32F730xx': 'startup_stm32f730xx.s',
  15. 'STM32F732xx': 'startup_stm32f732xx.s',
  16. 'STM32F733xx': 'startup_stm32f733xx.s',
  17. 'STM32F745xx': 'startup_stm32f745xx.s',
  18. 'STM32F746xx': 'startup_stm32f746xx.s',
  19. 'STM32F750xx': 'startup_stm32f750xx.s',
  20. 'STM32F756xx': 'startup_stm32f756xx.s',
  21. 'STM32F765xx': 'startup_stm32f765xx.s',
  22. 'STM32F767xx': 'startup_stm32f767xx.s',
  23. 'STM32F769xx': 'startup_stm32f769xx.s',
  24. 'STM32F777xx': 'startup_stm32f777xx.s',
  25. 'STM32F779xx': 'startup_stm32f779xx.s',
  26. }
  27. # Check each defined MCU, match the platform and append the appropriate startup file
  28. for mcu, startup_file in mcu_startup_files.items():
  29. if mcu in env.get('CPPDEFINES', []):
  30. if rtconfig.PLATFORM in ['gcc', 'llvm-arm']:
  31. src += [os.path.join(cwd, 'Source', 'Templates', 'gcc', startup_file)]
  32. elif rtconfig.PLATFORM in ['armcc', 'armclang']:
  33. src += [os.path.join(cwd, 'Source', 'Templates', 'arm', startup_file)]
  34. elif rtconfig.PLATFORM in ['iccarm']:
  35. src += [os.path.join(cwd, 'Source', 'Templates', 'iar', startup_file)]
  36. break
  37. # Define the build group
  38. group = DefineGroup('STM32F7-CMSIS', src, depend=['PKG_USING_STM32F7_CMSIS_DRIVER'], CPPPATH=path)
  39. # Return the build group
  40. Return('group')