crc: Make the build of crc function dependent on a Kconfig

Add CONFIG_CRC for building CRC related routines.
CRC routines are now being built for each application, whether used or
not and are add in the build system unconditionally.

Keep CONFIG_CRC enabled by default for now and until all users have
converted to use the new option.

Partial fix for #50654

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2022-09-26 12:13:43 -04:00 committed by Carles Cufí
parent cf91f1873b
commit cffe98d9de
26 changed files with 37 additions and 5 deletions

View file

@ -12,6 +12,7 @@ config ADC_LMP90XXX
DT_HAS_TI_LMP90099_ENABLED || DT_HAS_TI_LMP90100_ENABLED DT_HAS_TI_LMP90099_ENABLED || DT_HAS_TI_LMP90100_ENABLED
select SPI select SPI
select ADC_CONFIGURABLE_INPUTS select ADC_CONFIGURABLE_INPUTS
select CRC
help help
Enable LMP90xxx ADC driver. Enable LMP90xxx ADC driver.

View file

@ -3,6 +3,7 @@
config GSM_MUX config GSM_MUX
bool "GSM 07.10 muxing protocol" bool "GSM 07.10 muxing protocol"
select CRC
help help
Enable GSM 07.10 muxing protocol defined in Enable GSM 07.10 muxing protocol defined in
https://www.etsi.org/deliver/etsi_ts/101300_101399/101369/07.01.00_60/ts_101369v070100p.pdf https://www.etsi.org/deliver/etsi_ts/101300_101399/101369/07.01.00_60/ts_101369v070100p.pdf

View file

@ -5,6 +5,7 @@
menuconfig IEEE802154_CC13XX_CC26XX menuconfig IEEE802154_CC13XX_CC26XX
bool "TI CC13xx / CC26xx IEEE 802.15.4 driver support" bool "TI CC13xx / CC26xx IEEE 802.15.4 driver support"
select CRC
default y default y
depends on DT_HAS_TI_CC13XX_CC26XX_IEEE802154_ENABLED depends on DT_HAS_TI_CC13XX_CC26XX_IEEE802154_ENABLED

View file

@ -14,6 +14,7 @@ menuconfig NET_PPP
depends on NET_L2_PPP depends on NET_L2_PPP
depends on NET_NATIVE depends on NET_NATIVE
select RING_BUFFER select RING_BUFFER
select CRC
select UART_MUX if GSM_MUX select UART_MUX if GSM_MUX
if NET_PPP if NET_PPP

View file

@ -6,6 +6,7 @@ config SPI_SDHC
default y default y
depends on DT_HAS_ZEPHYR_SDHC_SPI_SLOT_ENABLED depends on DT_HAS_ZEPHYR_SDHC_SPI_SLOT_ENABLED
select SPI select SPI
select CRC
select SDHC_SUPPORTS_SPI_MODE select SDHC_SUPPORTS_SPI_MODE
help help
Enable the SPI SD host controller driver Enable the SPI SD host controller driver

View file

@ -8,5 +8,6 @@ config SGP40
default y default y
depends on DT_HAS_SENSIRION_SGP40_ENABLED depends on DT_HAS_SENSIRION_SGP40_ENABLED
select I2C select I2C
select CRC
help help
Enable driver for SGP40 Multipixel Gas Sensor. Enable driver for SGP40 Multipixel Gas Sensor.

View file

@ -8,6 +8,7 @@ menuconfig SHT3XD
default y default y
depends on DT_HAS_SENSIRION_SHT3XD_ENABLED depends on DT_HAS_SENSIRION_SHT3XD_ENABLED
select I2C select I2C
select CRC
help help
Enable driver for SHT3xD temperature and humidity sensors. Enable driver for SHT3xD temperature and humidity sensors.

View file

@ -8,5 +8,6 @@ config SHT4X
default y default y
depends on DT_HAS_SENSIRION_SHT4X_ENABLED depends on DT_HAS_SENSIRION_SHT4X_ENABLED
select I2C select I2C
select CRC
help help
Enable driver for SHT4x temperature and humidity sensors. Enable driver for SHT4x temperature and humidity sensors.

View file

@ -8,5 +8,6 @@ config SHTCX
default y default y
depends on DT_HAS_SENSIRION_SHTCX_ENABLED depends on DT_HAS_SENSIRION_SHTCX_ENABLED
select I2C select I2C
select CRC
help help
Enable driver for SHTC1 and SHTC3 temperature and humidity sensors. Enable driver for SHTC1 and SHTC3 temperature and humidity sensors.

View file

@ -7,6 +7,7 @@ menuconfig SI7055
default y default y
depends on DT_HAS_SILABS_SI7055_ENABLED depends on DT_HAS_SILABS_SI7055_ENABLED
select I2C select I2C
select CRC
help help
Enable I2C-based driver for Si7055 Temperature Sensor. Enable I2C-based driver for Si7055 Temperature Sensor.

View file

@ -6,6 +6,7 @@
menuconfig W1 menuconfig W1
bool bool
prompt "1-Wire Drivers" prompt "1-Wire Drivers"
select CRC
help help
Enable 1-Wire Drivers Enable 1-Wire Drivers

View file

@ -4,11 +4,6 @@ zephyr_sources_ifdef(CONFIG_BASE64 base64.c)
zephyr_sources( zephyr_sources(
cbprintf_packaged.c cbprintf_packaged.c
crc32c_sw.c
crc32_sw.c
crc16_sw.c
crc8_sw.c
crc7_sw.c
dec.c dec.c
fdtable.c fdtable.c
hex.c hex.c
@ -25,6 +20,13 @@ zephyr_sources(
zephyr_sources_ifdef(CONFIG_ONOFF onoff.c) zephyr_sources_ifdef(CONFIG_ONOFF onoff.c)
zephyr_sources_ifdef(CONFIG_NOTIFY notify.c) zephyr_sources_ifdef(CONFIG_NOTIFY notify.c)
zephyr_sources_ifdef(CONFIG_CRC
crc32c_sw.c
crc32_sw.c
crc16_sw.c
crc8_sw.c
crc7_sw.c
)
zephyr_sources_ifdef(CONFIG_CBPRINTF_COMPLETE cbprintf_complete.c) zephyr_sources_ifdef(CONFIG_CBPRINTF_COMPLETE cbprintf_complete.c)
zephyr_sources_ifdef(CONFIG_CBPRINTF_NANO cbprintf_nano.c) zephyr_sources_ifdef(CONFIG_CBPRINTF_NANO cbprintf_nano.c)

View file

@ -26,6 +26,12 @@ config BASE64
help help
Enable base64 encoding and decoding functionality Enable base64 encoding and decoding functionality
config CRC
bool "Cyclic redundancy check (CRC) Support"
default y
help
Enable use of CRC.
config PRINTK_SYNC config PRINTK_SYNC
bool "Serialize printk() calls" bool "Serialize printk() calls"
default y if SMP && MP_NUM_CPUS > 1 && !(EFI_CONSOLE && LOG) default y if SMP && MP_NUM_CPUS > 1 && !(EFI_CONSOLE && LOG)

View file

@ -8,6 +8,7 @@ config ZEPHYR_CANOPENNODE_MODULE
config CANOPENNODE config CANOPENNODE
bool "CANopenNode support" bool "CANopenNode support"
select CRC
depends on CAN && !CAN_FD_MODE depends on CAN && !CAN_FD_MODE
help help
This option enables the CANopenNode library. This option enables the CANopenNode library.

View file

@ -5,3 +5,4 @@ CONFIG_TEST_RANDOM_GENERATOR=y
# Enable SMP # Enable SMP
CONFIG_SMP=y CONFIG_SMP=y
CONFIG_CRC=y

View file

@ -4,3 +4,4 @@ CONFIG_PM_DEVICE=y
CONFIG_GPIO=y CONFIG_GPIO=y
# Optional select RAM retention (nRF52 only) # Optional select RAM retention (nRF52 only)
#CONFIG_APP_RETENTION=y #CONFIG_APP_RETENTION=y
CONFIG_CRC=y

View file

@ -10,5 +10,6 @@
config FCB config FCB
bool "Flash Circular Buffer support" bool "Flash Circular Buffer support"
depends on FLASH_MAP depends on FLASH_MAP
select CRC
help help
Enable support of Flash Circular Buffer. Enable support of Flash Circular Buffer.

View file

@ -5,6 +5,7 @@
config NVS config NVS
bool "Non-volatile Storage" bool "Non-volatile Storage"
select CRC
help help
Enable support of Non-volatile Storage. Enable support of Non-volatile Storage.

View file

@ -6,6 +6,7 @@ menuconfig MCUMGR
bool "mcumgr Support" bool "mcumgr Support"
select NET_BUF select NET_BUF
select ZCBOR select ZCBOR
select CRC
help help
This option enables the mcumgr management library. This option enables the mcumgr management library.

View file

@ -9,6 +9,7 @@ menuconfig OSDP
select RING_BUFFER select RING_BUFFER
imply SERIAL_SUPPORT_INTERRUPT imply SERIAL_SUPPORT_INTERRUPT
imply UART_INTERRUPT_DRIVEN imply UART_INTERRUPT_DRIVEN
select CRC
help help
Add support for Open Supervised Device Protocol (OSDP) Add support for Open Supervised Device Protocol (OSDP)

View file

@ -3,6 +3,7 @@
menuconfig MODBUS menuconfig MODBUS
bool "Modbus support" bool "Modbus support"
select CRC
if MODBUS if MODBUS

View file

@ -4,6 +4,7 @@
config DNS_RESOLVER config DNS_RESOLVER
bool "DNS resolver" bool "DNS resolver"
depends on NET_NATIVE depends on NET_NATIVE
select CRC
help help
This option enables the DNS client side support for Zephyr This option enables the DNS client side support for Zephyr

View file

@ -14,3 +14,4 @@ CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y CONFIG_ZTEST_NEW_API=y
CONFIG_MAIN_STACK_SIZE=1280 CONFIG_MAIN_STACK_SIZE=1280
CONFIG_CRC=y

View file

@ -26,3 +26,4 @@ CONFIG_NET_CONFIG_AUTO_INIT=n
CONFIG_ZTEST=y CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y CONFIG_ZTEST_NEW_API=y
#CONFIG_NET_PPP_LOG_LEVEL_DBG=y #CONFIG_NET_PPP_LOG_LEVEL_DBG=y
CONFIG_CRC=y

View file

@ -4,3 +4,4 @@ CONFIG_ZTEST=y
CONFIG_ZTEST_STACK_SIZE=2048 CONFIG_ZTEST_STACK_SIZE=2048
CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=128 CONFIG_MINIMAL_LIBC_MALLOC_ARENA_SIZE=128
CONFIG_ZTEST_NEW_API=y CONFIG_ZTEST_NEW_API=y
CONFIG_CRC=y

View file

@ -1 +1,2 @@
CONFIG_ZTEST_NEW_API=y CONFIG_ZTEST_NEW_API=y
CONFIG_CRC=y