Skip to content

Commit

Permalink
CPCd Release: 4.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
silabsbot committed Dec 17, 2024
1 parent c704b40 commit da3b127
Show file tree
Hide file tree
Showing 27 changed files with 1,427 additions and 55 deletions.
39 changes: 28 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@
cmake_minimum_required(VERSION 3.10)

project(cpc-daemon
VERSION "4.5.2.0"
VERSION "4.6.0.0"
LANGUAGES C)

if(DEFINED ENV{NIX_CFLAGS_COMPILE})
unset(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES)
endif()

option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(BUILD_TESTING "Build tests" OFF)

Expand All @@ -19,6 +23,7 @@ option(ENABLE_ENCRYPTION "Enable the encryption of the CPC link using MbedTLS" O
option(COMPILE_LTTNG "Enable LTTng tracing" OFF)
option(ENABLE_VALGRIND "Enable Valgrind in tests" OFF)
option(TARGET_TESTING "Enable target testing" OFF)
option(ENABLE_SOCKET_DRIVER "Enable socket driver for internal testing" OFF)
set(CPC_LIBRARY_API_VERSION "3")
set(CPC_PROTOCOL_VERSION "5")
set(CPC_SOCKET_DIR "/dev/shm" CACHE STRING "CPC socket directory")
Expand Down Expand Up @@ -76,6 +81,15 @@ if(TARGET backtrace)
set(HAVE_BACKTRACE ON)
endif()

# https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html#index-gcov
# > Unless a strict ISO C dialect option is in effect, fork calls are detected
# > and correctly handled without double counting.
if(CMAKE_C_FLAGS MATCHES "--coverage")
set(COVERAGE_ENABLED YES)
else()
set(COVERAGE_ENABLED NO)
endif()

get_git_head_revision(GIT_REFSPEC GIT_SHA1 ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR)
configure_file("./misc/config.h.in" "config.h" @ONLY)
configure_file("./libcpc.pc.in" "libcpc.pc" @ONLY)
Expand All @@ -86,7 +100,7 @@ add_library(cpc)
set_target_properties(cpc PROPERTIES
VERSION ${PROJECT_VERSION} SOVERSION ${CPC_LIBRARY_API_VERSION})
set_target_properties(cpc PROPERTIES
C_STANDARD 99 C_STANDARD_REQUIRED YES C_EXTENSIONS NO)
C_STANDARD 99 C_STANDARD_REQUIRED YES C_EXTENSIONS ${COVERAGE_ENABLED})
target_compile_definitions(cpc PRIVATE _POSIX_C_SOURCE=200809L)
target_include_directories(cpc PRIVATE "${PROJECT_BINARY_DIR}")
target_include_directories(cpc PRIVATE "./include")
Expand All @@ -102,11 +116,12 @@ set(CPCD_SOURCES
"${PROJECT_SOURCE_DIR}/driver/driver_ezsp.c"
"${PROJECT_SOURCE_DIR}/driver/driver_kill.c"
"${PROJECT_SOURCE_DIR}/driver/driver_spi.c"
"${PROJECT_SOURCE_DIR}/driver/driver_sdio.c"
"${PROJECT_SOURCE_DIR}/driver/driver_uart.c"
"${PROJECT_SOURCE_DIR}/driver/driver_xmodem.c"
"${PROJECT_SOURCE_DIR}/driver/netlink/nl_sdio_interface.c"
"${PROJECT_SOURCE_DIR}/driver/netlink/nl_socket.c"
"${PROJECT_SOURCE_DIR}/misc/board_controller.c"
"${PROJECT_SOURCE_DIR}/misc/config.c"
"${PROJECT_SOURCE_DIR}/misc/exit.c"
"${PROJECT_SOURCE_DIR}/misc/logging.c"
"${PROJECT_SOURCE_DIR}/misc/sl_slist.c"
"${PROJECT_SOURCE_DIR}/misc/sleep.c"
Expand Down Expand Up @@ -140,14 +155,21 @@ if(ENABLE_ENCRYPTION)
"${PROJECT_SOURCE_DIR}/security/private/thread/security_thread.c"
"${PROJECT_SOURCE_DIR}/security/security.c")
endif()
if(ENABLE_SOCKET_DRIVER)
list(APPEND CPCD_SOURCES
"${PROJECT_SOURCE_DIR}/driver/driver_socket.c")
endif()

add_executable(cpcd "./main.c")
set_target_properties(cpcd PROPERTIES
C_STANDARD 99 C_STANDARD_REQUIRED YES C_EXTENSIONS NO)
C_STANDARD 99 C_STANDARD_REQUIRED YES C_EXTENSIONS ${COVERAGE_ENABLED})
target_compile_definitions(cpcd PRIVATE _GNU_SOURCE)
if(ENABLE_SOCKET_DRIVER)
target_compile_definitions(cpcd PRIVATE ENABLE_SOCKET_DRIVER)
endif()
target_include_directories(cpcd PRIVATE "${PROJECT_BINARY_DIR}")
target_include_directories(cpcd PRIVATE "./include" ".")
target_sources(cpcd PRIVATE ${CPCD_SOURCES})
target_sources(cpcd PRIVATE ${CPCD_SOURCES} "${PROJECT_SOURCE_DIR}/misc/config.c" "${PROJECT_SOURCE_DIR}/misc/exit.c")
target_link_libraries(cpcd PRIVATE Threads::Threads cpc)
if(TARGET MbedTLS::mbedcrypto)
target_link_libraries(cpcd PRIVATE MbedTLS::mbedcrypto)
Expand All @@ -156,22 +178,17 @@ if(TARGET backtrace)
target_link_libraries(cpcd PRIVATE backtrace)
endif()

###

if(BUILD_TESTING AND (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME))
message(STATUS "Enabling tests (${BUILD_TESTING})")
add_subdirectory("./test")
endif()

###

install(TARGETS cpc
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
install(
FILES "${PROJECT_BINARY_DIR}/libcpc.pc"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")

install(TARGETS cpcd
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
install(FILES "./cpcd.conf" DESTINATION "${CMAKE_INSTALL_FULL_SYSCONFDIR}")
2 changes: 1 addition & 1 deletion cpcd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ instance_name: cpcd_0

# Bus type selection
# Mandatory
# Allowed values : UART or SPI
# Allowed values : UART or SPI or NETLINK_SDIO
bus_type: UART

# SPI device file
Expand Down
12 changes: 3 additions & 9 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
cpc-daemon (4.5.2) unstable; urgency=medium
cpc-daemon (4.6.0) unstable; urgency=medium

* See https://github.com/SiliconLabs/cpc-daemon/releases/tag/v4.5.2
* See https://github.com/SiliconLabs/cpc-daemon/releases/tag/v4.6.0

-- Alexandre Autotte <[email protected]> Thu, 5 Sep 2024 8:53:00 -0400

cpc-daemon (4.5.1) unstable; urgency=medium

* See https://github.com/SiliconLabs/cpc-daemon/releases/tag/v4.5.1

-- Alexandre Autotte <[email protected]> Thu, 11 Jul 2024 16:45:00 -0400
-- Issam Maghni <[email protected]> Fri, 22 Nov 2024 16:17:00 -0400

cpc-daemon (4.5.0) unstable; urgency=medium

Expand Down
48 changes: 48 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
stdenv,
lib,
nix-gitignore,
cmake,
pkg-config,
protobuf,
mbedtls,
unitySrc ? null,
libprotobufMutatorSrc ? null,
}:
stdenv.mkDerivation rec {
pname = "cpc-daemon";
version = "4.6.0";

src = nix-gitignore.gitignoreSource [ ] ./.;
doCheck = (unitySrc != null) && (libprotobufMutatorSrc != null);
separateDebugInfo = doCheck;

nativeBuildInputs = [
cmake
pkg-config
];
nativeCheckInputs = [ protobuf ];
buildInputs = [ mbedtls ];
checkInputs = [ protobuf ];

cmakeBuildType = "RelWithDebInfo";
cmakeFlags =
with lib.strings;
[
(cmakeBool "CMAKE_COMPILE_WARNING_AS_ERROR" doCheck)
(cmakeBool "BUILD_TESTING" doCheck)
]
++ lib.optionals doCheck [
(cmakeOptionType "path" "UNITY_DIR" unitySrc.outPath)
(cmakeOptionType "path" "LIBPROTOBUF_MUTATOR_DIR" libprotobufMutatorSrc.outPath)
];

meta = with lib; {
description = "CPC daemon";
homepage = "https://github.com/SiliconLabs/cpc-daemon";
license = "MSLA";
maintainers = [ "iemaghni" ];
platform = platforms.linux;
mainProgram = "cpcd";
};
}
9 changes: 8 additions & 1 deletion doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ value of `instance_name` is `cpcd_0`.
### Bus Type

The bus used to connect the host to the secondary. The bus_type parameter is
mandatory. The allowed values are `UART` and `SPI`.
mandatory. The allowed values are `UART`, `SPI` and `NETLINK_SDIO`.
Depending on the bus type selected, certain configuration parameters that follow
are either required, optional, or ignored.

Expand All @@ -49,6 +49,13 @@ is 1000000.

spi_device_bitrate: 1000000

### SDIO Reset Sequence

Setting reset sequence to `false` would typically imply that the sequence should continue without being resetting the secondary.

reset_sequence: false


### UART Device File

Required when the bus type is `UART`. The location on sysfs of the secondary
Expand Down
48 changes: 48 additions & 0 deletions doc/img/Netlink-SDIO.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit da3b127

Please sign in to comment.