From a9c48ed1db60f92543d881aeda63da6a474722b4 Mon Sep 17 00:00:00 2001 From: David Cozens Date: Sat, 15 Aug 2026 09:45:19 +0100 Subject: [PATCH] feat: bring SolidSyslog into the build, nothing wired yet MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SolidSyslog is linked into the application without any of it being called, which separates getting the build to accept the library from getting the device to use it. Flash +0 B RAM +0 B Three lines carry it. FetchContent nests the library under this build. SOLIDSYSLOG_PLATFORMS names the platforms rather than letting the library infer them from the environment — lwIP alone, because nothing at this stage reaches any other pack. Then one link line, for the core library and that pack. The library has no release tag yet, so the pin is a commit. --gc-sections discards what nothing calls, so a platform pack that is linked but unused does not reach the image. The License section names SolidSyslog for the first time. It is fetched at build time rather than redistributed here, and its own LICENSE.md sets out the three licences it is offered under. CI runs on every pull request, not only those targeting main. Co-Authored-By: Claude Opus 5 (1M context) --- .github/workflows/ci.yml | 1 - CMakeLists.txt | 15 ++++++++++++++- README.md | 25 ++++++++++++++++++++----- measurements/linked.csv | 4 ++-- measurements/stages.tsv | 3 ++- run-report.md | 16 ++++++++-------- 6 files changed, 46 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ee335cc..7fae685 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,7 +4,6 @@ on: push: branches: [ main ] pull_request: - branches: [ main ] permissions: contents: read diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d8c8bf..a13d066 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,19 @@ endif() set(FREERTOS_PORT_DIR "${FREERTOS_KERNEL_PATH}/portable/GCC/ARM_CM3") set(LWIP_CONTRIB_FREERTOS_DIR "${LWIP_DIR}/contrib/ports/freertos") +# --- SolidSyslog --------------------------------------------------------------- +# Naming the platforms is the whole of the selection; anything unnamed is off. +# https://docs.cososo.co.uk/solid-syslog/getting-started/#path-a--cmake-consumer +# Pinned to a commit until there is a release tag to pin to. +set(SOLIDSYSLOG_PLATFORMS "LwipRaw" CACHE STRING "" FORCE) + +include(FetchContent) +FetchContent_Declare(SolidSyslog + GIT_REPOSITORY https://github.com/cososo-ltd/solid-syslog.git + GIT_TAG a8d39793fc40a40987268bccccefbdc44f26f0b8 +) +FetchContent_MakeAvailable(SolidSyslog) + # --- stage FatFs so ff.h's `#include "ffconf.h"` resolves to our integrator config # GCC's "" lookup checks the including file's own directory first, so colocating # the upstream ff.c/ff.h/diskio.h with our ffconf.h is how our config wins. @@ -148,7 +161,7 @@ target_include_directories(baseline PRIVATE # library, or context struct sizes diverge between consumer and library. target_compile_definitions(baseline PRIVATE MBEDTLS_USER_CONFIG_FILE=${MBEDTLS_USER_CONFIG_HEADER}) -target_link_libraries(baseline PRIVATE mbedtls mbedx509 mbedcrypto) +target_link_libraries(baseline PRIVATE mbedtls mbedx509 mbedcrypto SolidSyslog SolidSyslog::LwipRaw) target_link_options(baseline PRIVATE -mcpu=cortex-m3 -mthumb diff --git a/README.md b/README.md index b4cf548..d3e5ea7 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,26 @@ It builds on a baseline that simulates the sort of device you might be adding th measures itself: see [docs/baseline.md](docs/baseline.md) for what the baseline is, how the figures are made, and how to run it. -## This stage — Baseline +## This stage — Linked -The device before any of this: networking up, a filesystem mounted, and a mutual-TLS session held -to its broker. Two application tasks sit idle, ready to be occupied. +SolidSyslog is linked into the application without any of it being called. The stage is broken out +for clarity: it separates getting the build to accept the library from getting the device to use +it, so anything that goes wrong here is a build problem and nothing else. -Nothing is logged and nothing is sent. This is the thing every later figure is measured against. +Three lines carry it. `FetchContent` nests the library under this build. `SOLIDSYSLOG_PLATFORMS` +names the platforms rather than letting the library infer them from the environment — lwIP alone, +because nothing at this stage reaches any other pack. Then one link line, for the core library and +that pack. + +`--gc-sections` discards what nothing calls, so a platform pack that is linked but unused does not +reach the image. + +For now you need only the core and a network platform. The library has no release tag yet, so the +pin is a commit. -This is the baseline itself: Flash 350,308 B, RAM 111,192 B. +**Cost above baseline: Flash +0 B, RAM +0 B.** @@ -33,6 +43,7 @@ committed as [`run-report.md`](run-report.md), and rewritten by every stage. | Stage | What it gives you | Flash | RAM | |---|---|---|---| | Baseline | a device that already networks, stores, and holds an mTLS session — before any syslog | — | — | +| Linked | the core library and lwIP raw-mode networking, linked but not yet called | +0 | +0 | *Deltas are bytes above the baseline, which is itself Flash 350,308 B, RAM 111,192 B.* @@ -45,3 +56,7 @@ This example's own code is [0BSD](LICENSE) — completely open, no conditions. Third-party code keeps its own license: the vendored Arm SMSC9220 driver (`app/net/smsc9220/`) is Apache-2.0 (see its `LICENSE`). FreeRTOS, lwIP, mbedTLS, and FatFs are consumed from the build container under their own upstream licenses and are not redistributed here. + +SolidSyslog is fetched at build time and is likewise not redistributed here. It is offered under +three alternative licenses, which its own +[LICENSE.md](https://github.com/cososo-ltd/solid-syslog/blob/main/LICENSE.md) sets out. diff --git a/measurements/linked.csv b/measurements/linked.csv index 5db96dd..62ff41a 100644 --- a/measurements/linked.csv +++ b/measurements/linked.csv @@ -4,8 +4,8 @@ flash_text,349992 flash_data,316 static_bss,110876 heap_used,4440 -mbedtls_peak,21324 -mbedtls_free,11444 +mbedtls_peak,21280 +mbedtls_free,11488 lwip_mem_free,7576 lwip_pbufs_free,13 stack_log,120 diff --git a/measurements/stages.tsv b/measurements/stages.tsv index 16e467e..ed70112 100644 --- a/measurements/stages.tsv +++ b/measurements/stages.tsv @@ -8,5 +8,6 @@ # out and says so rather than publishing a blank row. # # Slugs, not numbers: a stage inserted mid-history would renumber every file -# after it, and this history has already had one inserted. +# after it. Baseline Baseline a device that already networks, stores, and holds an mTLS session — before any syslog +linked Linked the core library and lwIP raw-mode networking, linked but not yet called diff --git a/run-report.md b/run-report.md index a38b084..896280f 100644 --- a/run-report.md +++ b/run-report.md @@ -1,4 +1,4 @@ -# solid-syslog-example — run (Baseline) +# solid-syslog-example — run (linked) ## Device (self-measured) @@ -13,10 +13,10 @@ [report] flash_data,316,316,0 [report] static_bss,110876,110876,0 [report] heap_used,4440,4440,0 -[report] mbedtls_peak,21340,21332,8 -[report] mbedtls_free,11428,11436,-8 +[report] mbedtls_peak,21232,21332,-100 +[report] mbedtls_free,11536,11436,100 [report] lwip_mem_free,7576,7576,0 -[report] lwip_pbufs_free,14,14,0 +[report] lwip_pbufs_free,13,14,-1 [report] stack_log,120,120,0 [report] stack_service,52,52,0 [report] stack_harness,2840,2840,0 @@ -49,17 +49,17 @@ (nothing — this device sends no records yet) ``` -## Self-check (vs measurements/Baseline.csv) +## Self-check (vs measurements/linked.csv) ```text OK flash_text: 349992 (expected 349992, Δ0) OK flash_data: 316 (expected 316, Δ0) OK static_bss: 110876 (expected 110876, Δ0) OK heap_used: 4440 (expected 4440, Δ0) - OK mbedtls_peak: 21340 (expected 21332, Δ8) - OK mbedtls_free: 11428 (expected 11436, Δ8) + OK mbedtls_peak: 21232 (expected 21280, Δ48) + OK mbedtls_free: 11536 (expected 11488, Δ48) OK lwip_mem_free: 7576 (expected 7576, Δ0) - OK lwip_pbufs_free: 14 (expected 14, Δ0) + OK lwip_pbufs_free: 13 (expected 13, Δ0) OK stack_log: 120 (expected 120, Δ0) OK stack_service: 52 (expected 52, Δ0) OK stack_harness: 2840 (expected 2840, Δ0)