Christophe Favergeon | 6b604eb | 2019-05-17 13:46:33 +0200 | [diff] [blame] | 1 | function(cortexm CORE) |
| 2 | target_sources(${PROJECT_NAME} PRIVATE ${ROOT}/Device/ARM/${CORE}/Source/ARM/startup_${CORE}.s) |
| 3 | target_sources(${PROJECT_NAME} PRIVATE ${ROOT}/Device/ARM/${CORE}/Source/system_${CORE}.c) |
| 4 | target_include_directories(${PROJECT_NAME} PRIVATE ${ROOT}/Device/ARM/${CORE}/Include) |
| 5 | target_include_directories(${PROJECT_NAME} PRIVATE ${ROOT}/CMSIS/Core/Include) |
| 6 | |
Christophe Favergeon | 04ed2f0 | 2019-05-29 09:54:37 +0200 | [diff] [blame] | 7 | if (TESTFRAMEWORK) |
| 8 | # Need bigger sections for test framework |
| 9 | # So we use the test framework scatter file |
| 10 | set(SCATTERFILE "${ROOT}/CMSIS/DSP/DSP_Lib_TestSuite/Common/platform/ARMCLANG/armcc6_arm.sct") |
| 11 | else() |
| 12 | set(SCATTERFILE "${ROOT}/Device/ARM/${CORE}/Source/ARM/${CORE}_ac6.sct") |
| 13 | endif() |
Christophe Favergeon | 6b604eb | 2019-05-17 13:46:33 +0200 | [diff] [blame] | 14 | |
| 15 | target_link_options(${PROJECT_NAME} PRIVATE "--info=sizes;--entry=Reset_Handler;--scatter=${SCATTERFILE}") |
| 16 | |
| 17 | endfunction() |
| 18 | |
| 19 | function(cortexa CORE) |
| 20 | target_sources(${PROJECT_NAME} PRIVATE ${ROOT}/Device/ARM/${CORE}/Source/mmu_${CORE}.c) |
| 21 | target_sources(${PROJECT_NAME} PRIVATE ${ROOT}/Device/ARM/${CORE}/Source/system_${CORE}.c) |
| 22 | target_sources(${PROJECT_NAME} PRIVATE ${ROOT}/CMSIS/Core_A/Source/irq_ctrl_gic.c) |
| 23 | |
| 24 | target_include_directories(${PROJECT_NAME} PRIVATE ${ROOT}/Device/ARM/${CORE}/Include) |
| 25 | target_include_directories(${PROJECT_NAME} PRIVATE ${ROOT}/Device/ARM/${CORE}/Config) |
| 26 | target_include_directories(${PROJECT_NAME} PRIVATE ${ROOT}/CMSIS/Core_A/Include) |
| 27 | |
| 28 | target_sources(${PROJECT_NAME} PRIVATE ${ROOT}/Device/ARM/${CORE}/Source/AC6/startup_${CORE}.c) |
Christophe Favergeon | 6b604eb | 2019-05-17 13:46:33 +0200 | [diff] [blame] | 29 | |
Christophe Favergeon | 04ed2f0 | 2019-05-29 09:54:37 +0200 | [diff] [blame] | 30 | if (TESTFRAMEWORK) |
| 31 | # Test scatter file is missing some sections required by startup file for |
| 32 | # cortex-a |
| 33 | #set(SCATTERFILE "${ROOT}/CMSIS/DSP/DSP_Lib_TestSuite/Common/platform/ARMCLANG/armcc6_arm.sct") |
| 34 | target_include_directories(${PROJECT_NAME} PRIVATE ../Examples/ARM/boot) |
| 35 | else() |
| 36 | target_include_directories(${PROJECT_NAME} PRIVATE ../boot) |
| 37 | endif() |
| 38 | |
| 39 | set(SCATTERFILE ${CMAKE_CURRENT_BINARY_DIR}/tempLink/${CORE}.sct) |
| 40 | |
Christophe Favergeon | 6b604eb | 2019-05-17 13:46:33 +0200 | [diff] [blame] | 41 | |
| 42 | # Copy the mem file to the build directory |
| 43 | # so that it can be find when preprocessing the scatter file |
| 44 | # since we cannot pass an include path to armlink |
| 45 | file(COPY ${ROOT}/Device/ARM/${CORE}/Config/mem_${CORE}.h DESTINATION tempLink) |
| 46 | file(COPY ${ROOT}/Device/ARM/${CORE}/Source/AC6/${CORE}.sct DESTINATION tempLink) |
| 47 | |
| 48 | target_compile_definitions(${PROJECT_NAME} PRIVATE -DCMSIS_device_header="${CORE}.h") |
| 49 | |
| 50 | target_link_options(${PROJECT_NAME} PRIVATE "--info=sizes;--entry=Vectors;--scatter=${SCATTERFILE}") |
| 51 | endfunction() |