Skip to content

Commit

Permalink
cmake add bloaty helpers for nuttx and use in Jenkins
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed May 17, 2018
1 parent f607ea5 commit dc1e911
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 22 deletions.
39 changes: 19 additions & 20 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down
43 changes: 43 additions & 0 deletions platforms/nuttx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions src/drivers/px4io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ 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}/*)
file(GLOB_RECURSE px4io_config_files ${PX4_SOURCE_DIR}/platforms/nuttx/NuttX/configs/${config_io_board}/*)
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}"
Expand Down

0 comments on commit dc1e911

Please sign in to comment.