diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 0f15dbfc3c9..dec4150c9ce 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -1,5 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 +add_subdirectory(crc) if(NOT CONFIG_EXTERNAL_LIBC) add_subdirectory(libc) add_subdirectory(posix) diff --git a/lib/Kconfig b/lib/Kconfig index 761b1393e57..97ee3f6002d 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -5,6 +5,8 @@ source "lib/libc/Kconfig" source "lib/cpp/Kconfig" +source "lib/crc/Kconfig" + menu "Additional libraries" source "lib/hash/Kconfig" diff --git a/lib/crc/CMakeLists.txt b/lib/crc/CMakeLists.txt new file mode 100644 index 00000000000..bf652ba4fcf --- /dev/null +++ b/lib/crc/CMakeLists.txt @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources_ifdef(CONFIG_CRC + crc32c_sw.c + crc32_sw.c + crc16_sw.c + crc8_sw.c + crc7_sw.c + ) +zephyr_sources_ifdef(CONFIG_CRC_SHELL crc_shell.c) diff --git a/lib/crc/Kconfig b/lib/crc/Kconfig new file mode 100644 index 00000000000..f0745f0aded --- /dev/null +++ b/lib/crc/Kconfig @@ -0,0 +1,16 @@ +# Copyright (c) 2016,2023 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 +# +config CRC + bool "Cyclic redundancy check (CRC) Support" + help + Enable use of CRC. + +if CRC +config CRC_SHELL + bool "CRC Shell" + depends on SHELL + select GETOPT + help + Enable CRC checking for memory regions from the shell. +endif # CRC diff --git a/lib/os/crc16_sw.c b/lib/crc/crc16_sw.c similarity index 100% rename from lib/os/crc16_sw.c rename to lib/crc/crc16_sw.c diff --git a/lib/os/crc32_sw.c b/lib/crc/crc32_sw.c similarity index 100% rename from lib/os/crc32_sw.c rename to lib/crc/crc32_sw.c diff --git a/lib/os/crc32c_sw.c b/lib/crc/crc32c_sw.c similarity index 100% rename from lib/os/crc32c_sw.c rename to lib/crc/crc32c_sw.c diff --git a/lib/os/crc7_sw.c b/lib/crc/crc7_sw.c similarity index 100% rename from lib/os/crc7_sw.c rename to lib/crc/crc7_sw.c diff --git a/lib/os/crc8_sw.c b/lib/crc/crc8_sw.c similarity index 100% rename from lib/os/crc8_sw.c rename to lib/crc/crc8_sw.c diff --git a/lib/os/crc_shell.c b/lib/crc/crc_shell.c similarity index 100% rename from lib/os/crc_shell.c rename to lib/crc/crc_shell.c diff --git a/lib/os/CMakeLists.txt b/lib/os/CMakeLists.txt index f92b0d6e98e..5ed076b47ab 100644 --- a/lib/os/CMakeLists.txt +++ b/lib/os/CMakeLists.txt @@ -24,14 +24,6 @@ zephyr_sources( zephyr_sources_ifdef(CONFIG_ONOFF onoff.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_CRC_SHELL crc_shell.c) zephyr_sources_ifdef(CONFIG_CBPRINTF_COMPLETE cbprintf_complete.c) zephyr_sources_ifdef(CONFIG_CBPRINTF_NANO cbprintf_nano.c) diff --git a/lib/os/Kconfig b/lib/os/Kconfig index 7b8af6272da..42465b24f60 100644 --- a/lib/os/Kconfig +++ b/lib/os/Kconfig @@ -26,20 +26,6 @@ config BASE64 help Enable base64 encoding and decoding functionality -config CRC - bool "Cyclic redundancy check (CRC) Support" - help - Enable use of CRC. - -if CRC -config CRC_SHELL - bool "CRC Shell" - depends on SHELL - select GETOPT - help - Enable CRC checking for memory regions from the shell. -endif # CRC - config PRINTK_SYNC bool "Serialize printk() calls" default y if SMP && MP_NUM_CPUS > 1 && !(EFI_CONSOLE && LOG)