blob: ef818300b64dcaac85bedf3fbe94666c45fd6f5d [file] [log] [blame]
Christophe Favergeon6b604eb2019-05-17 13:46:33 +02001include(CMakePrintHelpers)
Christophe Favergeon6b604eb2019-05-17 13:46:33 +02002
Christophe Favergeon6b604eb2019-05-17 13:46:33 +02003
4
5get_filename_component(PROJECT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
6
7cmake_print_variables(PROJECT_NAME)
8
Christophe Favergeon6b604eb2019-05-17 13:46:33 +02009
Christophe Favergeon26c2f682019-09-06 14:43:32 +010010function(cortexm CORE PROJECT_NAME ROOT PLATFORMFOLDER CSTARTUP)
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020011
12 target_include_directories(${PROJECT_NAME} PRIVATE ${ROOT}/CMSIS/Core/Include)
13
14 target_sources(${PROJECT_NAME} PRIVATE ${PLATFORMFOLDER}/${CORE}/system_${CORE}.c)
15
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020016
Christophe Favergeon26c2f682019-09-06 14:43:32 +010017 toolchainSpecificLinkForCortexM(${PROJECT_NAME} ${ROOT} ${CORE} ${PLATFORMFOLDER} ${CSTARTUP})
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020018
19 configplatformForApp(${PROJECT_NAME} ${ROOT} ${CORE} ${PLATFORMFOLDER})
20 SET(PLATFORMID ${PLATFORMID} PARENT_SCOPE)
21
22endfunction()
23
24function(cortexa CORE PROJECT_NAME ROOT PLATFORMFOLDER)
25 target_include_directories(${PROJECT_NAME} PRIVATE ${ROOT}/CMSIS/Core_A/Include)
26
27 target_sources(${PROJECT_NAME} PRIVATE ${PLATFORMFOLDER}/${CORE}/irq_ctrl_gic.c)
28 target_sources(${PROJECT_NAME} PRIVATE ${PLATFORMFOLDER}/${CORE}/mmu_${CORE}.c)
29 target_sources(${PROJECT_NAME} PRIVATE ${PLATFORMFOLDER}/${CORE}/system_${CORE}.c)
30
31
32 target_compile_definitions(${PROJECT_NAME} PRIVATE -DCMSIS_device_header="${CORE}.h")
33
34 toolchainSpecificLinkForCortexA(${PROJECT_NAME} ${ROOT} ${CORE} ${PLATFORMFOLDER})
35
36 configplatformForApp(${PROJECT_NAME} ${ROOT} ${CORE} ${PLATFORMFOLDER})
37 SET(PLATFORMID ${PLATFORMID} PARENT_SCOPE)
38endfunction()
39
40function(configboot PROJECT_NAME ROOT PLATFORMFOLDER)
41
42 target_include_directories(${PROJECT_NAME} PRIVATE ${ROOT}/CMSIS/DSP/Include)
43 set_platform_core()
Christophe Favergeon26c2f682019-09-06 14:43:32 +010044
45 if(EXPERIMENTAL)
46 experimentalConfigboot(${PROJECT_NAME} ${ROOT} ${PLATFORMFOLDER})
47 if (ISCORTEXM)
48 cortexm(${CORE} ${PROJECT_NAME} ${ROOT} ${PLATFORMFOLDER} ${HASCSTARTUP})
49 else()
50 cortexa(${CORE} ${PROJECT_NAME} ${ROOT} ${PLATFORMFOLDER})
51 endif()
52 endif()
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020053 ###################
54 #
Christophe Favergeonc4c34802019-09-24 14:05:01 +020055 # Cortex M
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020056 #
Christophe Favergeonc4c34802019-09-24 14:05:01 +020057 if (ARM_CPU MATCHES "^[cC]ortex-[Mm].*$")
Christophe Favergeon26c2f682019-09-06 14:43:32 +010058 cortexm(${CORE} ${PROJECT_NAME} ${ROOT} ${PLATFORMFOLDER} OFF)
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020059
60 endif()
61
Christophe Favergeon6b604eb2019-05-17 13:46:33 +020062
63 ###################
64 #
65 # Cortex cortex-a5
66 #
Christophe Favergeonc4c34802019-09-24 14:05:01 +020067 if (ARM_CPU MATCHES "^[cC]ortex-[Aa].*")
Christophe Favergeon3b2a0ee2019-06-12 13:29:14 +020068 cortexa(${CORE} ${PROJECT_NAME} ${ROOT} ${PLATFORMFOLDER})
69
70 endif()
71
72 SET(PLATFORMID ${PLATFORMID} PARENT_SCOPE)
73
74endfunction()
75