cmake: all allyes target for better CI coverage

Currently only v6x-rt and SITL are supported
But targets with label allyes will try to enable all kconfig symbols
This commit is contained in:
Peter van der Perk 2024-03-31 21:32:17 +02:00 committed by Daniel Agar
parent 791d7894c8
commit a9ba0acb2a
5 changed files with 335 additions and 1 deletions

View File

@ -0,0 +1,126 @@
#!/usr/bin/env python3
# Copyright (c) 2018-2019, Ulf Magnusson
# SPDX-License-Identifier: ISC
"""
Writes a configuration file where as many symbols as possible are set to 'y'.
The default output filename is '.config'. A different filename can be passed
in the KCONFIG_CONFIG environment variable.
Usage for the Linux kernel:
$ make [ARCH=<arch>] scriptconfig SCRIPT=Kconfiglib/allyesconfig.py
"""
import kconfiglib
import os
exception_list = [
'DRIVERS_BOOTLOADERS', # Only used for bootloader target
'MODULES_PX4IOFIRMWARE', # Only needed for PX4IO firmware itself, maybe fix through dependencies
'BOARD_LTO', # Experimental
'BOARD_TESTING', # Don't build test suite
'BOARD_CONSTRAINED_FLASH', # only used to reduce flash size
'BOARD_NO_HELP', # only used to reduce flash size
'BOARD_CONSTRAINED_MEMORY', # only used to reduce flash size
'BOARD_EXTERNAL_METADATA', # only used to reduce flash size
'BOARD_CRYPTO', # Specialized use
'BOARD_PROTECTED', # Experimental for MPU use
'DRIVERS_LIGHTS_RGBLED_PWM', # Only on specific boards, needs dependency fixing
'DRIVERS_LIGHTS_NEOPIXEL', # Only on specific boards, needs dependency fixing
'DRIVERS_DISTANCE_SENSOR_LIGHTWARE_SF45_SERIAL', # Only on specific boards, needs dependency fixing
'PARAM_PRIMARY', # Plainly broken
'PARAM_REMOTE', # Plainly broken
'DRIVERS_ACTUATORS_VOXL_ESC', # Dependency need fixing, requires VOXL_ESC_DEFAULT_XXX
'DRIVERS_VOXL2_IO', # Dependency need fixing, requires VOXL2_IO_DEFAULT_XX
'DRIVERS_BAROMETER_TCBP001TA', # Requires hardcoded PX4_SPI_BUS_BARO mapping
'DRIVERS_DISTANCE_SENSOR_BROADCOM_AFBRS50', # Requires hardcoded PX4_SPI_BUS_BARO mapping
'DRIVERS_DISTANCE_SENSOR_SRF05', # Requires hardcoded GPIO_ULTRASOUND
'DRIVERS_PPS_CAPTURE', # Requires PPS GPIO config
'DRIVERS_PWM_INPUT', # Requires PWM config
'DRIVERS_TEST_PPM', # PIN config not portable
'DRIVERS_TATTU_CAN', # Broken needs fixing
'MODULES_REPLAY', # Fails on NuttX targets maybe force POSIX dependency?
'SYSTEMCMDS_HIST', # This module can only be used on boards that enable BOARD_ENABLE_LOG_HISTORY
'SYSTEMCMDS_GPIO', # PIN config not portable
'SYSTEMCMDS_SHUTDOWN', # Needs dependency checking
'EXAMPLES_DYN_HELLO', # NuttX doesn't support dynamic linking
'SYSTEMCMDS_DYN', # NuttX doesn't support dynamic linking
'DRIVERS_RPI_RC_IN', # RPI specific driver
'SYSTEMCMDS_I2C_LAUNCHER', # undefined reference to `system',
'MODULES_MUORB_APPS', # Weird QURT/Posix package doesn't work on x86 px4 sitl
'MODULES_SIMULATION_SIMULATOR_SIH', # Causes compile errors
]
exception_list_sitl = [
'DRIVERS_BAROMETER', # Fails I2C dependencies
'COMMON_BAROMETERS', # Fails I2C dependencies
'DRIVERS_ADC_BOARD_ADC', # Fails HW dependencies, I think this only works on NuttX
'DRIVERS_CAMERA_CAPTURE', # GPIO config failure
'DRIVERS_DSHOT', # No Posix driver, I think this only works on NuttX
'DRIVERS_PWM_OUT', # No Posix driver, I think this only works on NuttX
'COMMON', # Fails I2C dependencies
'DRIVERS', # Fails I2C dependencies
'SYSTEMCMDS_REBOOT', # Sitl can't reboot
'MODULES_BATTERY_STATUS', # Sitl doesn't provide a power brick
'SYSTEMCMDS_SERIAL_PASSTHRU', # Not supported in SITL
'SYSTEMCMDS_SERIAL_TEST', # Not supported in SITL
'SYSTEMCMDS_SD_STRESS', # Not supported in SITL
'SYSTEMCMDS_SD_BENCH', # Not supported in SITL
'SYSTEMCMDS_I2CDETECT', # Not supported in SITL
'SYSTEMCMDS_DMESG', # Not supported in SITL
'SYSTEMCMDS_USB_CONNECTED', # Not supported in SITL
]
def main():
kconf = kconfiglib.standard_kconfig(__doc__)
if 'BASE_DEFCONFIG' in os.environ:
kconf.load_config(os.environ['BASE_DEFCONFIG'])
if 'MODEL' in os.environ:
if os.environ['MODEL'] == 'sitl':
for sym in kconf.unique_defined_syms:
if sym.name.startswith(tuple(exception_list_sitl)):
exception_list.append(sym.name)
# See allnoconfig.py
kconf.warn = False
# Try to set all symbols to 'y'. Dependencies might truncate the value down
# later, but this will at least give the highest possible value.
#
# Assigning 0/1/2 to non-bool/tristate symbols has no effect (int/hex
# symbols still take a string, because they preserve formatting).
for sym in kconf.unique_defined_syms:
# Set choice symbols to 'm'. This value will be ignored for choices in
# 'y' mode (the "normal" mode), which will instead just get their
# default selection, but will set all symbols in m-mode choices to 'm',
# which is as high as they can go.
#
# Here's a convoluted example of how you might get an m-mode choice
# even during allyesconfig:
#
# choice
# tristate "weird choice"
# depends on m
if sym.name not in exception_list:
sym.set_value(1 if sym.choice else 2)
# Set all choices to the highest possible mode
for choice in kconf.unique_choices:
choice.set_value(2)
kconf.warn = True
kconf.load_allconfig("allyes.config")
print(kconf.write_config())
if __name__ == "__main__":
main()

View File

@ -0,0 +1 @@
CONFIG_BOARD_LINKER_PREFIX="allyes"

View File

@ -0,0 +1,197 @@
/****************************************************************************
* boards/px4/fmu-v6xrt/nuttx-config/scripts/script.ld
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
/* Specify the memory areas */
/* Reallocate
* Final Configuration is
* No DTCM
* 512k OCRAM M7 (FlexRAM) (2038:0000-203f:ffff)
* 128k OCRAMM7 FlexRAM ECC (2036:0000-2037:ffff)
* 64k OCRAM2 ECC parity (2035:0000-2035:ffff)
* 64k OCRAM1 ECC parity (2034:0000-2034:ffff)
* 512k FlexRAM OCRAM2 (202C:0000-2033:ffff)
* 512k FlexRAM OCRAM1 (2024:0000-202B:ffff)
* 256k System OCRAM M4 (2020:0000-2023:ffff)
*/
MEMORY
{
flash (rx) : ORIGIN = 0x30020000, LENGTH = 4M-128K /* We have 64M but we do not want to wait to program it all */
sram (rwx) : ORIGIN = 0x20240000, LENGTH = 2M-256k-512k
itcm (rwx) : ORIGIN = 0x00000000, LENGTH = 256K /* TODO FlexRAM partition */
dtcm (rwx) : ORIGIN = 0x20000000, LENGTH = 256K
}
OUTPUT_ARCH(arm)
EXTERN(_vectors)
EXTERN(g_flash_config)
EXTERN(g_image_vector_table)
EXTERN(g_boot_data)
EXTERN(board_get_manifest)
EXTERN(_bootdelay_signature)
EXTERN(imxrt_flexspi_initialize)
ENTRY(__start)
SECTIONS
{
/* Image Vector Table and Boot Data for booting from external flash */
.boot_hdr : ALIGN(4)
{
FILL(0xff)
. = 0x400 ;
__boot_hdr_start__ = ABSOLUTE(.) ;
KEEP(*(.boot_hdr.conf))
. = 0x1000 ;
KEEP(*(.boot_hdr.ivt))
. = 0x1020 ;
KEEP(*(.boot_hdr.boot_data))
. = 0x1030 ;
KEEP(*(.boot_hdr.dcd_data))
__boot_hdr_end__ = ABSOLUTE(.) ;
. = 0x2000 ;
} >flash
.vectors :
{
KEEP(*(.vectors))
*(.text .text.__start)
} >flash
.itcmfunc :
{
. = ALIGN(8);
_sitcmfuncs = ABSOLUTE(.);
FILL(0xFF)
. = 0x40 ;
INCLUDE "itcm_static_functions.ld"
. = ALIGN(8);
_eitcmfuncs = ABSOLUTE(.);
} > itcm AT > flash
_fitcmfuncs = LOADADDR(.itcmfunc);
/* The RAM vector table (if present) should lie at the beginning of SRAM */
.ram_vectors (COPY) : {
*(.ram_vectors)
} > dtcm
.text : ALIGN(4)
{
_stext = ABSOLUTE(.);
*(.vectors)
. = ALIGN(32);
/*
This signature provides the bootloader with a way to delay booting
*/
_bootdelay_signature = ABSOLUTE(.);
FILL(0xffecc2925d7d05c5)
. += 8;
*(.text .text.*)
*(.fixup)
*(.gnu.warning)
*(.gnu.linkonce.t.*)
*(.glue_7)
*(.glue_7t)
*(.got)
*(.gcc_except_table)
*(.gnu.linkonce.r.*)
. = ALIGN(4096);
_etext = ABSOLUTE(.);
_srodata = ABSOLUTE(.);
*(.rodata .rodata.*)
. = ALIGN(4096);
_erodata = ABSOLUTE(.);
} > flash
.init_section :
{
_sinit = ABSOLUTE(.);
KEEP(*(.init_array .init_array.*))
_einit = ABSOLUTE(.);
} > flash
.ARM.extab :
{
*(.ARM.extab*)
} > flash
.ARM.exidx :
{
__exidx_start = ABSOLUTE(.);
*(.ARM.exidx*)
__exidx_end = ABSOLUTE(.);
} > flash
_eronly = ABSOLUTE(.);
.data :
{
_sdata = ABSOLUTE(.);
*(.data .data.*)
*(.gnu.linkonce.d.*)
CONSTRUCTORS
. = ALIGN(4);
_edata = ABSOLUTE(.);
} > sram AT > flash
.ramfunc ALIGN(4):
{
_sramfuncs = ABSOLUTE(.);
*(.ramfunc .ramfunc.*)
_eramfuncs = ABSOLUTE(.);
} > sram AT > flash
_framfuncs = LOADADDR(.ramfunc);
.bss :
{
_sbss = ABSOLUTE(.);
*(.bss .bss.*)
*(.gnu.linkonce.b.*)
*(COMMON)
. = ALIGN(4);
_ebss = ABSOLUTE(.);
} > sram
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_info 0 : { *(.debug_info) }
.debug_line 0 : { *(.debug_line) }
.debug_pubnames 0 : { *(.debug_pubnames) }
.debug_aranges 0 : { *(.debug_aranges) }
_boot_loadaddr = ORIGIN(flash);
_boot_size = LENGTH(flash);
_ram_size = LENGTH(sram);
_sdtcm = ORIGIN(dtcm);
_edtcm = ORIGIN(dtcm) + LENGTH(dtcm);
}

View File

View File

@ -25,6 +25,7 @@ set(COMMON_KCONFIG_ENV_SETTINGS
TOOLCHAIN=${CMAKE_TOOLCHAIN_FILE} TOOLCHAIN=${CMAKE_TOOLCHAIN_FILE}
ARCHITECTURE=${CMAKE_SYSTEM_PROCESSOR} ARCHITECTURE=${CMAKE_SYSTEM_PROCESSOR}
ROMFSROOT=${config_romfs_root} ROMFSROOT=${config_romfs_root}
BASE_DEFCONFIG=${BOARD_CONFIG}
) )
set(config_user_list) set(config_user_list)
@ -52,6 +53,15 @@ if(EXISTS ${BOARD_DEFCONFIG})
) )
endif() endif()
if(${LABEL} MATCHES "allyes")
message(AUTHOR_WARNING "allyes build: allyes is for CI coverage and not for use in production")
execute_process(
COMMAND ${CMAKE_COMMAND} -E env ${COMMON_KCONFIG_ENV_SETTINGS}
${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/kconfig/allyesconfig.py
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
)
endif()
# Generate header file for C/C++ preprocessor # Generate header file for C/C++ preprocessor
execute_process( execute_process(
COMMAND ${CMAKE_COMMAND} -E env ${COMMON_KCONFIG_ENV_SETTINGS} COMMAND ${CMAKE_COMMAND} -E env ${COMMON_KCONFIG_ENV_SETTINGS}
@ -438,7 +448,7 @@ if(${LABEL} MATCHES "default" OR ${LABEL} MATCHES "bootloader" OR ${LABEL} MATCH
COMMAND_EXPAND_LISTS COMMAND_EXPAND_LISTS
) )
else() elseif(NOT ${LABEL} MATCHES "allyes") # All other configs except allyes which isn't configurable
add_custom_target(boardconfig add_custom_target(boardconfig
${CMAKE_COMMAND} -E env ${COMMON_KCONFIG_ENV_SETTINGS} ${MENUCONFIG_PATH} Kconfig ${CMAKE_COMMAND} -E env ${COMMON_KCONFIG_ENV_SETTINGS} ${MENUCONFIG_PATH} Kconfig
COMMAND ${CMAKE_COMMAND} -E env ${COMMON_KCONFIG_ENV_SETTINGS} ${SAVEDEFCONFIG_PATH} COMMAND ${CMAKE_COMMAND} -E env ${COMMON_KCONFIG_ENV_SETTINGS} ${SAVEDEFCONFIG_PATH}