Skip to content

Commit

Permalink
lib: flatten all loose components into one lib
Browse files Browse the repository at this point in the history
lib/ was starting to get messy and inconsitent. Files being either
dumped in the root or in sub-directories without a clear plan.
Move all library components into one single folder and call it 'os'.

Signed-off-by: Anas Nashif <[email protected]>
  • Loading branch information
nashif committed Jan 22, 2019
1 parent 885aaf2 commit db92e5c
Show file tree
Hide file tree
Showing 23 changed files with 54 additions and 39 deletions.
9 changes: 1 addition & 8 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
zephyr_sources(thread_entry.c work_q.c)
zephyr_sources(fdtable.c)
add_subdirectory(crc)
add_subdirectory_ifdef(CONFIG_JSON_LIBRARY json)
if(NOT CONFIG_NATIVE_APPLICATION)
add_subdirectory(libc)
endif()
add_subdirectory_if_kconfig(ring_buffer)
add_subdirectory_if_kconfig(base64)
add_subdirectory(mempool)
add_subdirectory_ifdef(CONFIG_POSIX_API posix)
add_subdirectory_ifdef(CONFIG_CMSIS_RTOS_V1 cmsis_rtos_v1)
add_subdirectory_ifdef(CONFIG_CMSIS_RTOS_V2 cmsis_rtos_v2)
add_subdirectory(rbtree)
add_subdirectory(gui)
add_subdirectory(os)
25 changes: 5 additions & 20 deletions lib/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,14 @@ source "lib/libc/Kconfig"

menu "Additional libraries"

config JSON_LIBRARY
bool "Build JSON library"
help
Build a minimal JSON parsing/encoding library. Used by sample
applications such as the NATS client.

config RING_BUFFER
bool "Enable ring buffers"
help
Enable usage of ring buffers. This is similar to kernel FIFOs but ring
buffers manage their own buffer memory and can store arbitrary data.
For optimal performance, use buffer sizes that are a power of 2.

config BASE64
bool "Enable base64 encoding and decoding"
help
Enable base64 encoding and decoding functionality

source "lib/posix/Kconfig"

source "lib/cmsis_rtos_v1/Kconfig"

source "lib/cmsis_rtos_v2/Kconfig"

source "lib/gui/Kconfig"

source "lib/os/Kconfig"

source "lib/posix/Kconfig"

endmenu
1 change: 0 additions & 1 deletion lib/base64/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion lib/crc/CMakeLists.txt

This file was deleted.

2 changes: 0 additions & 2 deletions lib/json/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion lib/mempool/CMakeLists.txt

This file was deleted.

17 changes: 17 additions & 0 deletions lib/os/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
zephyr_sources_if_kconfig(base64.c)

zephyr_sources(
crc32_sw.c
crc16_sw.c
crc8_sw.c
crc7_sw.c
fdtable.c
mempool.c
rb.c
thread_entry.c
work_q.c
)

zephyr_sources_ifdef(CONFIG_JSON_LIBRARY json.c)

zephyr_sources_if_kconfig(ring_buffer.c)
27 changes: 27 additions & 0 deletions lib/os/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Copyright (c) 2016 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
#

menu "OS Support Library"

config JSON_LIBRARY
bool "Build JSON library"
help
Build a minimal JSON parsing/encoding library. Used by sample
applications such as the NATS client.

config RING_BUFFER
bool "Enable ring buffers"
help
Enable usage of ring buffers. This is similar to kernel FIFOs but ring
buffers manage their own buffer memory and can store arbitrary data.
For optimal performance, use buffer sizes that are a power of 2.

config BASE64
bool "Enable base64 encoding and decoding"
help
Enable base64 encoding and decoding functionality

endmenu
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion lib/rbtree/CMakeLists.txt

This file was deleted.

1 change: 0 additions & 1 deletion lib/ring_buffer/CMakeLists.txt

This file was deleted.

8 changes: 4 additions & 4 deletions tests/unit/lib/crc/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

#include <ztest.h>

#include <lib/crc/crc32_sw.c>
#include <lib/crc/crc16_sw.c>
#include <lib/crc/crc8_sw.c>
#include <lib/crc/crc7_sw.c>
#include <lib/os/crc32_sw.c>
#include <lib/os/crc16_sw.c>
#include <lib/os/crc8_sw.c>
#include <lib/os/crc7_sw.c>

void test_crc32_ieee(void)
{
Expand Down

0 comments on commit db92e5c

Please sign in to comment.