configPlatform.cmake 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. option(SEMIHOSTING "Test trace using printf" ON)
  2. if (PLATFORM STREQUAL "FVP")
  3. SET(PLATFORMFOLDER ${ROOT}/CMSIS/DSP/Platforms/FVP)
  4. SET(PLATFORMID "FVP")
  5. list(APPEND CMAKE_MODULE_PATH ${ROOT}/CMSIS/DSP/Platforms/FVP)
  6. endif()
  7. if (PLATFORM STREQUAL "MPS3")
  8. SET(PLATFORMFOLDER ${ROOT}/CMSIS/DSP/Platforms/MPS3)
  9. SET(PLATFORMID "MPS3")
  10. list(APPEND CMAKE_MODULE_PATH ${ROOT}/CMSIS/DSP/Platforms/MPS3)
  11. endif()
  12. if (PLATFORM STREQUAL "SDSIM")
  13. SET(PLATFORMFOLDER ${SDSIMROOT})
  14. SET(PLATFORMID "SDSIM")
  15. list(APPEND CMAKE_MODULE_PATH ${SDSIMROOT})
  16. endif()
  17. SET(CORE ARMCM7)
  18. include(platform)
  19. function(set_platform_core)
  20. if(EXPERIMENTAL)
  21. experimental_set_platform_core()
  22. SET(CORE ${CORE} PARENT_SCOPE)
  23. endif()
  24. ###################
  25. #
  26. # Cortex cortex-m7
  27. #
  28. if (ARM_CPU MATCHES "^[cC]ortex-[mM]7([^0-9].*)?$")
  29. SET(CORE ARMCM7 PARENT_SCOPE)
  30. endif()
  31. ###################
  32. #
  33. # Cortex cortex-m4
  34. #
  35. if (ARM_CPU MATCHES "^[cC]ortex-[mM]4([^0-9].*)?$")
  36. SET(CORE ARMCM4 PARENT_SCOPE)
  37. endif()
  38. ###################
  39. #
  40. # Cortex cortex-m35p
  41. #
  42. if (ARM_CPU MATCHES "^[cC]ortex-[mM]35([^0-9].*)?$")
  43. SET(CORE ARMCM35P PARENT_SCOPE)
  44. endif()
  45. ###################
  46. #
  47. # Cortex cortex-m33
  48. #
  49. if (ARM_CPU MATCHES "^[cC]ortex-[mM]33([^0-9].*)?$")
  50. SET(CORE ARMCM33 PARENT_SCOPE)
  51. endif()
  52. ###################
  53. #
  54. # Cortex cortex-m55
  55. #
  56. if (ARM_CPU MATCHES "^[cC]ortex-[mM]55([^0-9].*)?$")
  57. SET(CORE ARMv81MML PARENT_SCOPE)
  58. endif()
  59. ###################
  60. #
  61. # Cortex cortex-m23
  62. #
  63. if (ARM_CPU MATCHES "^[cC]ortex-[mM]23([^0-9].*)?$")
  64. SET(CORE ARMCM23 PARENT_SCOPE)
  65. endif()
  66. ###################
  67. #
  68. # Cortex cortex-m0+
  69. #
  70. if (ARM_CPU MATCHES "^[cC]ortex-[mM]0p([^0-9].*)?$")
  71. SET(CORE ARMCM0plus PARENT_SCOPE)
  72. endif()
  73. ###################
  74. #
  75. # Cortex cortex-m0
  76. #
  77. if (ARM_CPU MATCHES "^[cC]ortex-[mM]0([^0-9].*)?$")
  78. SET(CORE ARMCM0 PARENT_SCOPE)
  79. endif()
  80. ###################
  81. #
  82. # Cortex cortex-a5
  83. #
  84. if (ARM_CPU MATCHES "^[cC]ortex-[aA]5([^0-9].*)?$")
  85. SET(CORE ARMCA5 PARENT_SCOPE)
  86. endif()
  87. ###################
  88. #
  89. # Cortex cortex-a7
  90. #
  91. if (ARM_CPU MATCHES "^[cC]ortex-[aA]7([^0-9].*)?$")
  92. SET(CORE ARMCA7 PARENT_SCOPE)
  93. endif()
  94. ###################
  95. #
  96. # Cortex cortex-a9
  97. #
  98. if (ARM_CPU MATCHES "^[cC]ortex-[aA]9([^0-9].*)?$")
  99. SET(CORE ARMCA9 PARENT_SCOPE)
  100. endif()
  101. ###################
  102. #
  103. # Cortex cortex-a15
  104. #
  105. if (ARM_CPU MATCHES "^[cC]ortex-[aA]15([^0-9].*)?$")
  106. SET(CORE ARMCA15 PARENT_SCOPE)
  107. endif()
  108. endfunction()
  109. function(core_includes PROJECTNAME)
  110. target_include_directories(${PROJECTNAME} PRIVATE ${PLATFORMFOLDER}/${CORE}/Include)
  111. endfunction()
  112. function (configplatformForLib PROJECTNAME ROOT)
  113. if (SEMIHOSTING)
  114. target_compile_definitions(${PROJECTNAME} PRIVATE SEMIHOSTING)
  115. endif()
  116. if (CORTEXM)
  117. compilerSpecificPlatformConfigLibForM(${PROJECTNAME} ${ROOT} )
  118. else()
  119. compilerSpecificPlatformConfigLibForA(${PROJECTNAME} ${ROOT} )
  120. endif()
  121. endfunction()
  122. function (configplatformForApp PROJECTNAME ROOT CORE PLATFORMFOLDER)
  123. if (SEMIHOSTING)
  124. target_compile_definitions(${PROJECTNAME} PRIVATE SEMIHOSTING)
  125. endif()
  126. configure_platform(${PROJECTNAME} ${ROOT} ${CORE} ${PLATFORMFOLDER})
  127. SET(PLATFORMID ${PLATFORMID} PARENT_SCOPE)
  128. if (CORTEXM)
  129. compilerSpecificPlatformConfigAppForM(${PROJECTNAME} ${ROOT} )
  130. else()
  131. compilerSpecificPlatformConfigAppForA(${PROJECTNAME} ${ROOT} )
  132. endif()
  133. endfunction()