Let CMake do more autoconfiguration.
This commit is contained in:
parent
c4c1d0a2b8
commit
cfea1de2e8
@ -36,6 +36,9 @@ message( "${COMPILER_FAMILY}" )
|
|||||||
#| Load the compiler family specific configurations
|
#| Load the compiler family specific configurations
|
||||||
include( ${COMPILER_FAMILY}.cmake )
|
include( ${COMPILER_FAMILY}.cmake )
|
||||||
|
|
||||||
|
#| Binutils not set by CMake
|
||||||
|
set( CMAKE_SIZE "${_CMAKE_TOOLCHAIN_PREFIX}size" )
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
@ -114,7 +117,7 @@ set_target_properties( ${TARGET_ELF} PROPERTIES
|
|||||||
#| Convert the .ELF into a .HEX to load onto the Teensy
|
#| Convert the .ELF into a .HEX to load onto the Teensy
|
||||||
set( TARGET_HEX ${TARGET}.hex )
|
set( TARGET_HEX ${TARGET}.hex )
|
||||||
add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
|
add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
|
||||||
COMMAND ${OBJCOPY} ${HEX_FLAGS} ${TARGET_ELF} ${TARGET_HEX}
|
COMMAND ${CMAKE_OBJCOPY} ${HEX_FLAGS} ${TARGET_ELF} ${TARGET_HEX}
|
||||||
COMMENT "Creating load file for Flash: ${TARGET_HEX}"
|
COMMENT "Creating load file for Flash: ${TARGET_HEX}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -122,7 +125,7 @@ add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
|
|||||||
#| Generate the Extended .LSS
|
#| Generate the Extended .LSS
|
||||||
set( TARGET_LSS ${TARGET}.lss )
|
set( TARGET_LSS ${TARGET}.lss )
|
||||||
add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
|
add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
|
||||||
COMMAND ${OBJDUMP} ${LSS_FLAGS} ${TARGET_ELF} > ${TARGET_LSS}
|
COMMAND ${CMAKE_OBJDUMP} ${LSS_FLAGS} ${TARGET_ELF} > ${TARGET_LSS}
|
||||||
COMMENT "Creating Extended Listing: ${TARGET_LSS}"
|
COMMENT "Creating Extended Listing: ${TARGET_LSS}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -130,7 +133,7 @@ add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
|
|||||||
#| Generate the Symbol Table .SYM
|
#| Generate the Symbol Table .SYM
|
||||||
set( TARGET_SYM ${TARGET}.sym )
|
set( TARGET_SYM ${TARGET}.sym )
|
||||||
add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
|
add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
|
||||||
COMMAND ${NM} -n ${TARGET_ELF} > ${TARGET_SYM}
|
COMMAND ${CMAKE_NM} -n ${TARGET_ELF} > ${TARGET_SYM}
|
||||||
COMMENT "Creating Symbol Table: ${TARGET_SYM}"
|
COMMENT "Creating Symbol Table: ${TARGET_SYM}"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -143,7 +146,7 @@ add_custom_command( TARGET ${TARGET_ELF} POST_BUILD
|
|||||||
#| After Changes Size Information
|
#| After Changes Size Information
|
||||||
#| TODO Do lookup on Flash and RAM sizes and do % used
|
#| TODO Do lookup on Flash and RAM sizes and do % used
|
||||||
add_custom_target( SizeAfter ALL
|
add_custom_target( SizeAfter ALL
|
||||||
COMMAND ${SIZE} --target=${FORMAT} ${TARGET_HEX} ${TARGET_ELF}
|
COMMAND ${CMAKE_SIZE} --target=${FORMAT} ${TARGET_HEX} ${TARGET_ELF}
|
||||||
DEPENDS ${TARGET_ELF}
|
DEPENDS ${TARGET_ELF}
|
||||||
COMMENT "Size after generation\n\tFlash Usage: data (hex)\n\t RAM Usage: data (elf)"
|
COMMENT "Size after generation\n\tFlash Usage: data (hex)\n\t RAM Usage: data (elf)"
|
||||||
)
|
)
|
||||||
|
12
arm.cmake
12
arm.cmake
@ -13,15 +13,9 @@
|
|||||||
|
|
||||||
#| Set the Compilers (must be set first)
|
#| Set the Compilers (must be set first)
|
||||||
include( CMakeForceCompiler )
|
include( CMakeForceCompiler )
|
||||||
cmake_force_c_compiler ( arm-none-eabi-gcc AVRCCompiler )
|
cmake_force_c_compiler ( arm-none-eabi-gcc ARMCCompiler )
|
||||||
cmake_force_cxx_compiler( arm-none-eabi-g++ AVRCxxCompiler )
|
cmake_force_cxx_compiler( arm-none-eabi-g++ ARMCxxCompiler )
|
||||||
|
set( _CMAKE_TOOLCHAIN_PREFIX arm-none-eabi- )
|
||||||
|
|
||||||
#| Compiler Binaries
|
|
||||||
set( OBJCOPY "arm-none-eabi-objcopy" )
|
|
||||||
set( OBJDUMP "arm-none-eabi-objdump" )
|
|
||||||
set( NM "arm-none-eabi-nm" )
|
|
||||||
set( SIZE "arm-none-eabi-size" )
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,13 +15,7 @@
|
|||||||
include( CMakeForceCompiler )
|
include( CMakeForceCompiler )
|
||||||
cmake_force_c_compiler ( avr-gcc AVRCCompiler )
|
cmake_force_c_compiler ( avr-gcc AVRCCompiler )
|
||||||
cmake_force_cxx_compiler( avr-g++ AVRCxxCompiler )
|
cmake_force_cxx_compiler( avr-g++ AVRCxxCompiler )
|
||||||
|
set( _CMAKE_TOOLCHAIN_PREFIX avr- )
|
||||||
|
|
||||||
#| Compiler Binaries
|
|
||||||
set( OBJCOPY "avr-objcopy" )
|
|
||||||
set( OBJDUMP "avr-objdump" )
|
|
||||||
set( NM "avr-nm" )
|
|
||||||
set( SIZE "avr-size" )
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user