configPlatform.cmake 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. option(SEMIHOSTING "Test trace using printf" OFF)
  2. set(PLATFORMS "${CMSISDSP}/Testing/Platforms")
  3. if (PLATFORM STREQUAL "FVP")
  4. SET(PLATFORMFOLDER ${PLATFORMS}/FVP)
  5. SET(PLATFORMID "FVP")
  6. SET(PLATFORMOPT "-DFVP")
  7. list(APPEND CMAKE_MODULE_PATH ${PLATFORMS}/FVP)
  8. endif()
  9. if (PLATFORM STREQUAL "NORMALFVP")
  10. SET(PLATFORMFOLDER ${PLATFORMS}/NORMALFVP)
  11. SET(PLATFORMID "NORMALFVP")
  12. SET(PLATFORMOPT "-DNORMALFVP")
  13. list(APPEND CMAKE_MODULE_PATH ${PLATFORMS}/NORMALFVP)
  14. endif()
  15. if (PLATFORM STREQUAL "MPS3")
  16. SET(PLATFORMFOLDER ${PLATFORMS}/MPS3)
  17. SET(PLATFORMID "MPS3")
  18. list(APPEND CMAKE_MODULE_PATH ${PLATFORMS}/MPS3)
  19. endif()
  20. if (PLATFORM STREQUAL "SDSIM")
  21. SET(PLATFORMFOLDER ${SDSIMROOT})
  22. SET(PLATFORMID "SDSIM")
  23. list(APPEND CMAKE_MODULE_PATH ${SDSIMROOT})
  24. endif()
  25. if (PLATFORM STREQUAL "IPSS")
  26. SET(PLATFORMFOLDER ${PLATFORMS}/IPSS)
  27. SET(PLATFORMID "IPSS")
  28. list(APPEND CMAKE_MODULE_PATH ${PLATFORMS}/IPSS)
  29. endif()
  30. SET(CORE ARMCM7)
  31. include(platform)
  32. function(set_platform_core)
  33. if(EXPERIMENTAL)
  34. experimental_set_platform_core()
  35. SET(CORE ${CORE} PARENT_SCOPE)
  36. endif()
  37. ###################
  38. #
  39. # Cortex cortex-m7
  40. #
  41. if (ARM_CPU MATCHES "^[cC]ortex-[mM]7([^0-9].*)?$")
  42. SET(CORE ARMCM7 PARENT_SCOPE)
  43. endif()
  44. ###################
  45. #
  46. # Cortex cortex-m4
  47. #
  48. if (ARM_CPU MATCHES "^[cC]ortex-[mM]4([^0-9].*)?$")
  49. SET(CORE ARMCM4 PARENT_SCOPE)
  50. endif()
  51. ###################
  52. #
  53. # Cortex cortex-m35p
  54. #
  55. if (ARM_CPU MATCHES "^[cC]ortex-[mM]35([^0-9].*)?$")
  56. SET(CORE ARMCM35P PARENT_SCOPE)
  57. endif()
  58. ###################
  59. #
  60. # Cortex cortex-m33
  61. #
  62. if (ARM_CPU MATCHES "^[cC]ortex-[mM]33([^0-9].*)?$")
  63. SET(CORE ARMCM33 PARENT_SCOPE)
  64. endif()
  65. ###################
  66. #
  67. # Cortex cortex-m55
  68. #
  69. if (ARM_CPU MATCHES "^[cC]ortex-[mM]55([^0-9].*)?$")
  70. SET(CORE ARMv81MML PARENT_SCOPE)
  71. endif()
  72. ###################
  73. #
  74. # Cortex cortex-m23
  75. #
  76. if (ARM_CPU MATCHES "^[cC]ortex-[mM]23([^0-9].*)?$")
  77. SET(CORE ARMCM23 PARENT_SCOPE)
  78. endif()
  79. ###################
  80. #
  81. # Cortex cortex-m0+
  82. #
  83. if (ARM_CPU MATCHES "^[cC]ortex-[mM]0p([^0-9].*)?$")
  84. SET(CORE ARMCM0plus PARENT_SCOPE)
  85. endif()
  86. ###################
  87. #
  88. # Cortex cortex-m0
  89. #
  90. if (ARM_CPU MATCHES "^[cC]ortex-[mM]0([^0-9].*)?$")
  91. SET(CORE ARMCM0 PARENT_SCOPE)
  92. endif()
  93. ###################
  94. #
  95. # Cortex cortex-a32
  96. #
  97. if (ARM_CPU MATCHES "^[cC]ortex-[aA]32([^0-9].*)?$")
  98. SET(CORE ARMCA32 PARENT_SCOPE)
  99. endif()
  100. ###################
  101. #
  102. # Cortex cortex-a5
  103. #
  104. if (ARM_CPU MATCHES "^[cC]ortex-[aA]5([^0-9].*)?$")
  105. SET(CORE ARMCA5 PARENT_SCOPE)
  106. endif()
  107. ###################
  108. #
  109. # Cortex cortex-a7
  110. #
  111. if (ARM_CPU MATCHES "^[cC]ortex-[aA]7([^0-9].*)?$")
  112. SET(CORE ARMCA7 PARENT_SCOPE)
  113. endif()
  114. ###################
  115. #
  116. # Cortex cortex-a9
  117. #
  118. if (ARM_CPU MATCHES "^[cC]ortex-[aA]9([^0-9].*)?$")
  119. SET(CORE ARMCA9 PARENT_SCOPE)
  120. endif()
  121. ###################
  122. #
  123. # Cortex cortex-a15
  124. #
  125. if (ARM_CPU MATCHES "^[cC]ortex-[aA]15([^0-9].*)?$")
  126. SET(CORE ARMCA15 PARENT_SCOPE)
  127. endif()
  128. ###################
  129. #
  130. # Cortex cortex-r5
  131. #
  132. if (ARM_CPU MATCHES "^[cC]ortex-[rR]5([^0-9].*)?$")
  133. SET(CORE ARMCR5 PARENT_SCOPE)
  134. endif()
  135. ###################
  136. #
  137. # Cortex cortex-r8
  138. #
  139. if (ARM_CPU MATCHES "^[cC]ortex-[rR]8([^0-9].*)?$")
  140. SET(CORE ARMCR8 PARENT_SCOPE)
  141. endif()
  142. ###################
  143. #
  144. # Cortex cortex-r52
  145. #
  146. if (ARM_CPU MATCHES "^[cC]ortex-[rR]52([^0-9].*)?$")
  147. SET(CORE ARMCR52 PARENT_SCOPE)
  148. endif()
  149. endfunction()
  150. function(core_includes PROJECTNAME)
  151. if (CORTEXR)
  152. target_include_directories(${PROJECTNAME} PRIVATE ${CORER}/Include)
  153. else()
  154. target_include_directories(${PROJECTNAME} PRIVATE ${PLATFORMFOLDER}/${CORE}/Include)
  155. #target_compile_options(${PROJECTNAME} PRIVATE ${PLATFORMOPT})
  156. endif()
  157. endfunction()
  158. function (configplatformForLib PROJECTNAME)
  159. if (SEMIHOSTING)
  160. target_compile_definitions(${PROJECTNAME} PRIVATE SEMIHOSTING)
  161. endif()
  162. if (CORTEXM)
  163. compilerSpecificPlatformConfigLibForM(${PROJECTNAME} )
  164. elseif(CORTEXA)
  165. compilerSpecificPlatformConfigLibForA(${PROJECTNAME} )
  166. else()
  167. compilerSpecificPlatformConfigLibForR(${PROJECTNAME} )
  168. endif()
  169. endfunction()
  170. function (configplatformForApp PROJECTNAME CORE PLATFORMFOLDER)
  171. if (SEMIHOSTING)
  172. target_compile_definitions(${PROJECTNAME} PRIVATE SEMIHOSTING)
  173. endif()
  174. configure_platform(${PROJECTNAME} ${CORE} ${PLATFORMFOLDER})
  175. SET(PLATFORMID ${PLATFORMID} PARENT_SCOPE)
  176. if (CORTEXM)
  177. compilerSpecificPlatformConfigAppForM(${PROJECTNAME} )
  178. elseif(CORTEXA)
  179. compilerSpecificPlatformConfigAppForA(${PROJECTNAME} )
  180. else()
  181. compilerSpecificPlatformConfigAppForR(${PROJECTNAME} )
  182. endif()
  183. endfunction()