I am trying to use Cmake+NinJa instead of IDE to generate executable files. The development board is S32K344, and the compiler is ghs/comp_ 202114/ccarmxe. Currently, I have successfully generated the elf file, but when debugging with PEmicro, its performance did not meet expectations. Who is familiar with the GHS compiler and can you give me some help?
Here is the CMake project configuration I am using
CompileCfg.cmake:
# Basic Settings
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR ARM)
# Set up compiler
set(CMAKE_ASM_COMPILER "D:/D/tools/ghs/comp_202114/ccarm.exe")
set(CMAKE_C_COMPILER "D:/D/tools/ghs/comp_202114/ccarm.exe")
set(CMAKE_LINKER "D:/D/tools/ghs/comp_202114/ccarm.exe")
set(CMAKE_AR "D:/D/tools/ghs/comp_202114/ccarm.exe")
# Set compilation link options
set(C_OPTIONS "-preprocess_assembly_files -c99 --gnu_asm -g -dwarf2 -Onone -DSTART_FROM_FLASH -DS32K3XX -DENABLE_FPU -DLTC_ISOFT_CUSTOM -DINIT_STDBY_RAM -DARMCM7_SP -D__ITCM_INIT -D__DTCM_INIT -D__ghs__ -DGEELY_SPECIFICATION_USED=1 -DDISABLE_MCAL_INTERMODULE_ASR_CHECK -DBTB_ENABLE -DUSING_OS_AUTOSAROS -DS32K344 -DGHS -cpu=cortexm7 -fsingle -thumb -MD")
set(ASM_OPTIONS ${C_OPTIONS})
set(LD_OPTIONS "--gnu_asm -g -dwarf2 -nostartfiles -cpu=cortexm7 -thumb")
set(CMAKE_C_FLAGS ${C_OPTIONS})
set(CMAKE_ASM_FLAGS ${ASM_OPTIONS})
set(CMAKE_EXE_LINKER_FLAGS ${LD_OPTIONS})
set(CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_C_FLAGS CMAKE_ASM_FLAGS)
set(CMAKE_FIND_ROOT_PATH ${BINUTILS_PATH})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
CMakeLists.txt:
set(target_name "S32K344")
# Contains compile link configuration/lookup function cmake file
include(./CompileCfg.cmake)
include(./Function.cmake)
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
# Set project name and language
project(${target_name}_prj LANGUAGES C ASM)
# Set C language standard
set(CMAKE_C_STANDARD 99) # C99标准
set(CMAKE_C_EXTENSIONS ON) # 开启扩展,开启编译器特有扩展
set(CMAKE_C_STANDARD_REQUIRED ON) #强制指定标准
# Set engineering/OS src path
set(OS_SRC_DIR "${CA_DIR}/01_ProductCode/RTOS")
set(PRJ_SRC_DIR "${CA_DIR}/02_ProjectCode/00_OS_Project/${target_name}_CMake/src")
# Set link script file
set(LINK_SCRIPTS
--gnu_asm
-g
-dwarf2
-T "../src/McalLib/Mcal_lib/Platform_TS_T40D34M10I0R0/build_files/ghs/linker_flash_s32k344.ld"
-e Reset_Handler
-nostartfiles
-cpu=cortexm7
-thumb
)
# Set CommmonInclude header file directory
set(PRJ_COMMMONINCLUDE_INCS "${PRJ_SRC_DIR}/CommmonInclude")
# Contains cmake files corresponding to each module
include(${OS_SRC_DIR}/Os.cmake)
include(${PRJ_SRC_DIR}/McalLib/Mcal.cmake)
include(${PRJ_SRC_DIR}/Generate/Generate.cmake)
# Project Add Header File Dependency
include_directories(${PRJ_COMMMONINCLUDE_INCS} ${PRJ_GENERATE_INCS} ${BSW_OS_INCS} ${PRJ_SOURCE_INCS})
# get_property(dirs DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
# message(">>> include_dirs=${dirs}")
# Set output file
set(EXECUTABLE ${target_name}.elf CACHE INTERNAL "TARGET")
# Obtain user files and build them
file(GLOB PRJ_MAIN_SRCS "${PRJ_SRC_DIR}/*.c")
add_executable(${EXECUTABLE} ${PRJ_MAIN_SRCS})
# Introduce subdirectories and build them
target_sources(${EXECUTABLE} PUBLIC ${PRJ_MCAL_SRCS})
target_sources(${EXECUTABLE} PUBLIC ${PRJ_GENERATE_SRCS})
target_sources(${EXECUTABLE} PUBLIC ${BSW_OS_SRCS})
# Special processing of assembly files
list(APPEND CMAKE_ASM_SOURCE_FILE_EXTENSIONS S asm inc)
set(MCAL_ASM_PATH "${PRJ_SRC_DIR}/McalLib/Mcal_lib/Platform_TS_T40D34M10I0R0/startup/src/m7/ghs")
set(SAM_OBJ "${OS_SRC_DIR}/Platform/S32K3/S32K344/Arch_PendSV.s" "${MCAL_ASM_PATH}/startup_cm7.s" "${MCAL_ASM_PATH}/Vector_Table.s")
SET_SOURCE_FILES_PROPERTIES(${SAM_OBJ} PROPERTIES LANGUAGE ASM)
target_sources(${EXECUTABLE} PUBLIC ${SAM_OBJ})
# Link Options
target_link_options(${EXECUTABLE} PRIVATE ${LINK_SCRIPTS})
How to use IDE debugging correctly,
Kind Regards.
I also posted this issue on S32DS:I also posted this issue on S32DS