cmake_minimum_required( VERSION 3.5)



SET (TARGET_NAME test_project)


set(CGT_TOOLCHAIN_DIR  /home/lobov/ti/ccs1250/ccs/tools/compiler/ti-cgt-c2000_22.6.1.LTS)

SET(CL2000_LINK ${CGT_TOOLCHAIN_DIR}/bin/cl2000)
SET(CMAKE_CXX_COMPILER ${CL2000_LINK} )
SET(CMAKE_C_COMPILER ${CL2000_LINK} )
SET(CMAKE_CXX_LINK_EXECUTABLE ${CL2000_LINK})


project(cmake_test C CXX ASM)

SET (FLAGS -v28 -ml -mt --float_support=fpu32 -Ooff --opt_for_speed=5 
	--fp_mode=relaxed -advice:performance=all --define=_INLINE --define=bmin='0.397824735f' --define=amax='0.960433870f' 
	--float_operations_allowed=32 --printf_support=minimal 
    -g --diag_suppress=10063 --diag_warning=225 --issue_remarks --verbose_diagnostics --quiet 
	--preproc_with_compile --preproc_dependency=DSP2833x_usDelay.d_raw
)


include_directories( "${PROJECT_BINARY_DIR}")

add_executable(${TARGET_NAME} main.cpp
	./f2833x/common/source/DSP2833x_ADC_cal.asm
	./f2833x/common/source/DSP2833x_CodeStartBranch.asm
	./f2833x/common/source/DSP2833x_DefaultIsr.c
	./f2833x/headers/source/DSP2833x_GlobalVariableDefs.c
	./f2833x/common/source/DSP2833x_PieCtrl.c
	./f2833x/common/source/DSP2833x_PieVect.c
	./f2833x/common/source/DSP2833x_SysCtrl.c
	./f2833x/common/source/DSP2833x_usDelay.asm
)

set(INCLUDES
    ./f2833x
    ./f2833x/common/include
	./f2833x/headers/include
)
set (SUFFIX out)
target_compile_options (${TARGET_NAME} PRIVATE ${FLAGS}
)
set_target_properties(${TARGET_NAME}
	PROPERTIES
	SUFFIX ".out")	
target_include_directories(${TARGET_NAME} PRIVATE ${INCLUDES}
)
target_link_directories(${TARGET_NAME} PRIVATE
	#/home/lobov/workspace/ccs12.5/cmake_test/lib
)
target_link_options(${TARGET_NAME} PRIVATE 
	-v28 -ml -mt -m${TARGET_NAME}.map -z --stack=0x200 --reread_libs --rom_model --entry_point=code_start
	--float_support=fpu32 --diag_suppress=10063
	${CMAKE_CURRENT_SOURCE_DIR}/28335_RAM_lnk.cmd
	${CMAKE_CURRENT_SOURCE_DIR}/DSP2833x_Headers_nonBIOS.cmd
)
target_link_libraries(${TARGET_NAME} 
	${CMAKE_CURRENT_SOURCE_DIR}/lib/rts2800_fpu32_fast_supplement.lib
	${CMAKE_CURRENT_SOURCE_DIR}/lib/rts2800_fpu32_fast_supplement_coff.lib
	${CMAKE_CURRENT_SOURCE_DIR}/lib/rts2800_fpu32.lib
)