cmake add bloaty helpers for nuttx and use in Jenkins

This commit is contained in:
Daniel Agar
2018-05-17 15:20:26 -04:00
parent f607ea5180
commit dc1e91137a
3 changed files with 64 additions and 22 deletions

39
Jenkinsfile vendored
View File

@@ -2,16 +2,6 @@ pipeline {
agent none
stages {
stage('Style Check') {
agent {
docker { image 'px4io/px4-dev-base:2018-03-30' }
}
steps {
sh 'make check_format'
}
}
stage('Build') {
steps {
script {
@@ -38,20 +28,19 @@ pipeline {
sh "make distclean"
sh "ccache -z"
sh "git fetch --tags"
sh "make px4io-v2_default"
sh "make nuttx_px4io-v2_default"
sh "make nuttx_px4io-v2_default bloaty_symbols"
sh "make nuttx_px4io-v2_default bloaty_compileunits"
sh "make nuttx_px4io-v2_default bloaty_compare_master"
sh "make nuttx_px4fmu-v2_default"
// bloaty output and compare with last successful master
sh "bloaty -d symbols -n 100 -s vm build/nuttx_px4fmu-v2_default/nuttx_px4fmu-v2_default.elf"
sh "bloaty -d compileunits -n 100 -s vm build/nuttx_px4fmu-v2_default/nuttx_px4fmu-v2_default.elf"
sh "wget --no-verbose -N https://s3.amazonaws.com/px4-travis/Firmware/master/nuttx_px4fmu-v2_default.elf"
sh "bloaty -d symbols -n 100 -C full -s file build/nuttx_px4fmu-v2_default/nuttx_px4fmu-v2_default.elf -- nuttx_px4fmu-v2_default.elf"
sh "make nuttx_px4fmu-v2_default bloaty_symbols"
sh "make nuttx_px4fmu-v2_default bloaty_compileunits"
sh "make nuttx_px4fmu-v2_default bloaty_inlines"
sh "make nuttx_px4fmu-v2_default bloaty_templates"
sh "make nuttx_px4fmu-v2_default bloaty_compare_master"
sh "make nuttx_px4fmu-v2_lpe"
sh "make nuttx_px4fmu-v2_test"
sh "make nuttx_px4fmu-v3_default"
sh "bloaty -d symbols -n 100 -s vm build/nuttx_px4fmu-v3_default/nuttx_px4fmu-v3_default.elf"
sh "bloaty -d compileunits -n 100 -s vm build/nuttx_px4fmu-v3_default/nuttx_px4fmu-v3_default.elf"
sh "wget --no-verbose -N https://s3.amazonaws.com/px4-travis/Firmware/master/nuttx_px4fmu-v3_default.elf"
sh "bloaty -d symbols -n 100 -C full -s vm build/nuttx_px4fmu-v3_default/nuttx_px4fmu-v3_default.elf -- nuttx_px4fmu-v3_default.elf"
sh "make nuttx_px4fmu-v3_rtps"
sh "make sizes"
sh "ccache -s"
@@ -130,6 +119,16 @@ pipeline {
stage('Test') {
parallel {
stage('Style Check') {
agent {
docker { image 'px4io/px4-dev-base:2018-03-30' }
}
steps {
sh 'make check_format'
}
}
stage('clang analyzer') {
agent {
docker {

View File

@@ -103,6 +103,8 @@ target_link_libraries(${FW_NAME} PRIVATE
-Wl,--start-group
${nuttx_libs}
-Wl,--end-group
m
)
target_link_libraries(${FW_NAME} PRIVATE ${module_libraries})
@@ -219,6 +221,47 @@ add_custom_target(stack_check
VERBATIM
)
find_program(BLOATY_PROGRAM bloaty)
if (BLOATY_PROGRAM)
# bloaty symbols
add_custom_target(bloaty_symbols
COMMAND ${BLOATY_PROGRAM} -d symbols -C full -n 50 -s vm $<TARGET_FILE:${FW_NAME}>
DEPENDS ${FW_NAME}
USES_TERMINAL
)
# bloaty compilation units
add_custom_target(bloaty_compileunits
COMMAND ${BLOATY_PROGRAM} -d compileunits -C full -n 50 -s vm $<TARGET_FILE:${FW_NAME}>
DEPENDS ${FW_NAME}
USES_TERMINAL
)
# bloaty templates
add_custom_target(bloaty_templates
COMMAND ${BLOATY_PROGRAM} -d shortsymbols,fullsymbols -n 50 $<TARGET_FILE:${FW_NAME}>
DEPENDS ${FW_NAME}
USES_TERMINAL
)
# bloaty inlines
add_custom_target(bloaty_inlines
COMMAND ${BLOATY_PROGRAM} -d inlines -C full -n 50 $<TARGET_FILE:${FW_NAME}>
DEPENDS ${FW_NAME}
USES_TERMINAL
)
# bloaty compare with last master build
add_custom_target(bloaty_compare_master
COMMAND wget --no-verbose https://s3.amazonaws.com/px4-travis/Firmware/master/${FW_NAME} -O master_${FW_NAME}
COMMAND ${BLOATY_PROGRAM} -d symbols -n 50 -C full -s vm $<TARGET_FILE:${FW_NAME}> -- master_${FW_NAME}
DEPENDS ${FW_NAME}
WORKING_DIRECTORY ${PX4_BINARY_DIR}
VERBATIM
USES_TERMINAL
)
endif()
# debugger helpers
configure_file(gdbinit.in .gdbinit)

View File

@@ -47,7 +47,7 @@ px4_add_module(
# include the px4io binary in ROMFS
message(STATUS "Building and including ${config_io_board}")
set(fw_io_exe "${PX4_SOURCE_DIR}/build/${config_io_board}_default/nuttx_${config_io_board}_default.elf")
set(fw_io_exe "${PX4_SOURCE_DIR}/build/nuttx_${config_io_board}_default/nuttx_${config_io_board}_default.elf")
set(fw_io_bin "${PX4_BINARY_DIR}/genromfs/${config_romfs_root}/extras/${config_io_board}.bin")
file(GLOB_RECURSE px4io_driver_files ${PX4_SOURCE_DIR}/src/drivers/boards/${config_io_board}/*)
@@ -55,7 +55,7 @@ file(GLOB_RECURSE px4io_config_files ${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/con
file(GLOB_RECURSE px4io_firmware_files ${PX4_SOURCE_DIR}/src/modules/px4iofirmware/*)
file(GLOB_RECURSE px4io_rc_files ${PX4_SOURCE_DIR}/src/lib/rc/*)
add_custom_command(OUTPUT ${fw_io_exe}
COMMAND make --no-print-directory ${config_io_board}_default
COMMAND make --no-print-directory nuttx_${config_io_board}_default
DEPENDS ${px4io_driver_files} ${px4io_config_files} ${px4io_firmware_files} ${px4io_rc_files}
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
COMMENT "Building ${config_io_board}"