Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
af7eace
chore: S08.05 slice 1 plumb FatFs host TDD build
DavidCozens May 12, 2026
83f1f08
style: S08.05 slice 1 clang-format ffconf.h
DavidCozens May 12, 2026
6eaddc7
feat: S08.05 slice 2 SolidSyslogFatFsFile Create + Open/Close
DavidCozens May 12, 2026
83bddc3
feat: S08.05 slice 3 FatFsFile Read/Write/SeekTo/Size/Truncate
DavidCozens May 12, 2026
949835b
style: S08.05 slice 3 bracket comparison expressions in && per MISRA …
DavidCozens May 12, 2026
8281a8a
feat: S08.05 slice 4 FatFsFile Exists/Delete
DavidCozens May 12, 2026
74cc469
style: S08.05 clean code — Fp() helper and CHECK_*_PATH/MODE macros
DavidCozens May 12, 2026
b8a23ba
feat: S08.05 slice 5 QEMU semihosting diskio + FatFs store wiring
DavidCozens May 13, 2026
1f31606
feat: S08.05 slice 6 mount FatFs and run @store features on FreeRTOS
DavidCozens May 13, 2026
719bd22
chore: S08.05 slice 6 diagnostic patch for docker BDD failures
DavidCozens May 13, 2026
879b3f3
fix: revert stderr passthrough — behave wraps sys.stderr without file…
DavidCozens May 13, 2026
79d88bc
fix: S08.05 slice 6 — CodeRabbit fixes + FatFs end-to-end self-test
DavidCozens May 13, 2026
5c3de5f
fix: align executable include path to FATFS_STAGE_DIR (CodeRabbit major)
DavidCozens May 13, 2026
f72cc1a
fix: enable FF_FS_LOCK=4 — FileBlockDevice opens two FILs on the same…
DavidCozens May 13, 2026
7f40b6f
chore: pause S08.05 slice 6 at diagnostic state
DavidCozens May 13, 2026
3e7410d
fix: S08.05 slice 6 — collapse FreeRTOS FatFs wiring to single SolidS…
DavidCozens May 13, 2026
26df9ab
Revert "fix: enable FF_FS_LOCK=4 — FileBlockDevice opens two FILs on …
DavidCozens May 13, 2026
8a23ac6
chore: S08.05 slice 6 strip FatFs diagnostic prints
DavidCozens May 13, 2026
0c13734
fix: S08.05 slice 6 — bound FreeRTOS_connect with SO_RCVTIMEO
DavidCozens May 13, 2026
f0ddba9
feat: S08.05 slice 7a FatFsFile f_sync after each write
DavidCozens May 13, 2026
eaebf74
feat: S08.05 slice 7b graceful FatFs shutdown for power_cycle_replay
DavidCozens May 13, 2026
b217a38
chore: gitignore solidsyslog-disk.img FatFs semihosting artefact
DavidCozens May 13, 2026
36e822b
fix: S08.05 FatFsFake f_read reports actual bytes copied
DavidCozens May 13, 2026
0922349
chore: BDD before_scenario removes stale FatFs disk image
DavidCozens May 13, 2026
88cfe53
refactor: drop g_* Hungarian prefix in FreeRTOS BDD target
DavidCozens May 13, 2026
5d15667
refactor: S08.05 unify FreeRTOS BDD-target shutdown via TeardownAll
DavidCozens May 13, 2026
4cf1596
fix: S08.05 slice 7c ARP-prime FreeRTOS TCP connect
DavidCozens May 13, 2026
5b3487b
fix: BDD FreeRTOS extra_args guard checks known flags not hyphen prefix
DavidCozens May 13, 2026
2c00e41
fix: S08.05 SemihostingExit propagates status via SYS_EXIT_EXTENDED
DavidCozens May 13, 2026
1012666
test: S08.05 add BlockStore drain-ordering harness
DavidCozens May 13, 2026
a253006
test: S08.05 add Service-level [1,11,2..] reproducer (RED, IGNORE_TEST)
DavidCozens May 13, 2026
1af50d6
fix: S08.05 BlockStore Write rejection no longer bypasses to sender
DavidCozens May 13, 2026
5852ba3
fix: S08.05 drain-ordering test passes tidy / tunable-override
DavidCozens May 13, 2026
eb2d909
chore: address CodeRabbit + IWYU on PR #352 drain-ordering harness
DavidCozens May 13, 2026
e13d168
docs: S08.05 record FatFs/FreeRTOS in CLAUDE.md, DEVLOG, README + lin…
DavidCozens May 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ Bdd/output/*
Bdd/junit/*
!Bdd/junit/.gitkeep

# FatFs semihosting disk image — QEMU creates this at its cwd
# (the project root) per Bdd/Targets/FreeRtos/diskio.c::DISK_IMAGE_PATH.
# after_scenario removes it between scenarios, but an aborted run can
# leave the file behind; never commit it.
solidsyslog-disk.img

# OTel Collector binary downloaded by Bdd/otel/Install-OtelCollector.ps1
Bdd/otel/bin/

Expand Down
2 changes: 1 addition & 1 deletion Bdd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ once and run Behave from inside the container:
```bash
cmake --preset freertos-cross
cmake --build --preset freertos-cross --target SolidSyslogBddTarget
behave --tags='not @wip and not @freertoswip and not @rtc and @udp' Bdd/features/
behave --tags='not @wip and not @freertoswip and not @rtc and not @windows_wip and (@udp or @tcp)' Bdd/features/
```

`BDD_TARGET=freertos` and `EXAMPLE_BINARY=build/freertos-cross/...` are
Expand Down
41 changes: 41 additions & 0 deletions Bdd/Targets/FreeRtos/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,25 @@ if(NOT FREERTOS_PLUS_TCP_PATH)
"container, which sets this to /opt/freertos/plus-tcp.")
endif()

set(FATFS_PATH "$ENV{FATFS_PATH}")
if(NOT FATFS_PATH)
message(FATAL_ERROR
"FATFS_PATH not set. Use the cpputest-freertos-cross container, "
"which sets this to /opt/fatfs.")
endif()

# Stage the upstream FatFs source pack alongside our integrator ffconf.h in
# the build dir. FatFs's ff.h does `#include "ffconf.h"` and GCC's `""`
# include lookup checks the source file's own directory first, so the only
# way our integrator config wins over upstream's is to colocate them.
# configure_file(COPYONLY) sets up the CMake dependency so reconfigure
# triggers on changes to either side.
set(FATFS_STAGE_DIR "${CMAKE_CURRENT_BINARY_DIR}/fatfs")
configure_file(${FATFS_PATH}/source/ff.c ${FATFS_STAGE_DIR}/ff.c COPYONLY)
configure_file(${FATFS_PATH}/source/ff.h ${FATFS_STAGE_DIR}/ff.h COPYONLY)
configure_file(${FATFS_PATH}/source/diskio.h ${FATFS_STAGE_DIR}/diskio.h COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/ffconf.h ${FATFS_STAGE_DIR}/ffconf.h COPYONLY)

set(FREERTOS_PORT_DIR "${FREERTOS_KERNEL_PATH}/portable/GCC/ARM_CM3")

set(PLUS_TCP_SRC_DIR "${FREERTOS_PLUS_TCP_PATH}/source")
Expand Down Expand Up @@ -98,6 +117,17 @@ add_library(solid_syslog_freertos_upstream OBJECT
# MPS2_AN385 LAN9118 NetworkInterface + driver.
${PLUS_TCP_NIF_DIR}/NetworkInterface.c
${PLUS_TCP_NIF_DIR}/ether_lan9118/smsc9220_eth_drv.c
# FatFs upstream (R0.16, FFCONF_DEF 80386). ff.c trips the same
# sign-conversion / shadow / type-narrowing warnings the FreeRTOS
# kernel sources do, so it lives in the upstream OBJECT lib under the
# relaxed warning set. ffsystem.c is our integrator copy
# (Bdd/Targets/FreeRtos/) with OS_TYPE 3 (FreeRTOS) selected — it sits
# under the same relaxations because it includes ff.h and inherits
# FatFs's typedef-via-BYTE/UINT patterns. ff.c is staged into the
# build dir so its `#include "ff.h"` (and ff.h's "ffconf.h") resolve
# to our integrator config — see the configure_file calls above.
${FATFS_STAGE_DIR}/ff.c
${CMAKE_CURRENT_SOURCE_DIR}/ffsystem.c
)

target_compile_options(solid_syslog_freertos_upstream PRIVATE
Expand Down Expand Up @@ -128,6 +158,7 @@ target_include_directories(solid_syslog_freertos_upstream PRIVATE
${PLUS_TCP_PORT_GCC_DIR} # pack_struct_*.h
${PLUS_TCP_NIF_DIR} # NetworkInterface.h consumed locally
${PLUS_TCP_NIF_DIR}/ether_lan9118 # SMM_MPS2.h, smsc9220_*.h
${FATFS_STAGE_DIR} # ff.h, diskio.h, our ffconf.h colocated
)

# --- Executable ---------------------------------------------------------------
Expand All @@ -139,8 +170,10 @@ target_include_directories(solid_syslog_freertos_upstream PRIVATE
add_executable(SolidSyslogBddTarget
main.c
Startup.c
diskio.c
${CMAKE_CURRENT_SOURCE_DIR}/Common/CmsdkUart.c
${CMAKE_CURRENT_SOURCE_DIR}/Common/Syscalls.c
${CMAKE_SOURCE_DIR}/Platform/FatFs/Source/SolidSyslogFatFsFile.c
${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogAddress.c
${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosDatagram.c
${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source/SolidSyslogFreeRtosMutex.c
Expand Down Expand Up @@ -169,13 +202,21 @@ target_include_directories(SolidSyslogBddTarget PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/Common # CmsdkUart.h
${CMAKE_SOURCE_DIR}/Core/Interface # SolidSyslog*.h
${CMAKE_SOURCE_DIR}/Core/Source # SolidSyslogAddress.h (consumed by adapters)
${CMAKE_SOURCE_DIR}/Platform/FatFs/Interface # SolidSyslogFatFsFile.h
${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Interface # SolidSyslogFreeRtos*.h
${CMAKE_SOURCE_DIR}/Platform/FreeRtos/Source # SolidSyslogAddressInternal.h
${CMAKE_SOURCE_DIR}/Bdd/Targets/Common # BddTargetInteractive.h
${FREERTOS_KERNEL_PATH}/include
${FREERTOS_PORT_DIR} # portmacro.h
${PLUS_TCP_SRC_DIR}/include
${PLUS_TCP_PORT_GCC_DIR} # pack_struct_*.h
${FATFS_STAGE_DIR} # ff.h, diskio.h + integrator ffconf.h colocated — must match
# the OBJECT lib (above) so ff.c, main.c, diskio.c, and
# SolidSyslogFatFsFile.c all see the SAME ffconf.h. Pointing
# the executable at FATFS_PATH/source would resolve ff.h's
# `#include "ffconf.h"` to upstream's sample (same directory
# rule) and diverge FATFS / config-conditional layout between
# translation units.
)

target_link_libraries(SolidSyslogBddTarget PRIVATE
Expand Down
24 changes: 22 additions & 2 deletions Bdd/Targets/FreeRtos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,30 @@ emit N RFC 5424 messages with `send N`, exit cleanly with `quit`. See
[`Bdd/README.md`](../../Bdd/README.md) for how Behave pipes these
commands through `qemu-system-arm`'s stdio UART.

**Persistent store-and-forward** is wired via the ChaN FatFs adapter
(`SolidSyslogFatFsFile`) over a semihosting-backed `diskio.c` —
QEMU's BKPT 0xAB traps route FatFs's block I/O to a host-resident
`solidsyslog-disk.img` (cleared by Behave's `before_scenario` and
`after_scenario`), so writes survive a QEMU restart for the
`power_cycle_replay` scenario. `set store file` flips the live store
from `SolidSyslogNullStore` to a `SolidSyslogBlockStore` over the
FatFs file backend; `set max-blocks` / `set max-block-size` /
`set discard-policy` / `set halt-exit` parameterise the BlockStore
config before that rebuild. `set shutdown 1` performs a graceful
teardown — destroys our objects (which close the FatFs files),
`f_unmount`s, then `SemihostingExit`s — and is what the BDD
`the client is killed` step uses on FreeRTOS so the next session's
`f_mount` finds the directory entries up-to-date.

Production integrators ship their own `diskio.c` (flash / SD / eMMC)
plus, if `FF_FS_REENTRANT=1`, their own `ffsystem.c`. The semihosting
shape used here is BDD-target glue, not a reference port.

`Common/` carries the shared infrastructure (CMSDK UART driver, newlib
syscalls, mps2-an385 linker script, startup) and `cmake/` the
`arm-none-eabi.cmake` toolchain file. The `freertos-cross` CMake preset
and the `freertos-target` devcontainer service
`arm-none-eabi.cmake` toolchain file. `diskio.c` and `ffsystem.c` are
the FatFs ports specific to this BDD target. The `freertos-cross`
CMake preset and the `freertos-target` devcontainer service
([`docs/containers.md`](../../docs/containers.md)) carry everything
needed to build and run.

Expand Down
Loading
Loading