Skip to content

FreeRTOS-Plus-TCP setup

FreeRTOS-Plus-TCP platform

Wiring the networking adapters. FreeRTOS-Plus-TCP covers what they fill and what they leave to you; the config fields are documented on the structs themselves.

The stack is configured by a header you own, so the adapters compile inside your target against your FreeRTOSIPConfig.h. This platform fills the network role only, so select it alongside whichever platform supplies your mutex and uptime - the capability matrix shows which platforms fill those:

set(SOLIDSYSLOG_PLATFORMS "PlusTcp;<OsPrimitives>")
target_link_libraries(my_app PRIVATE SolidSyslog SolidSyslog::PlusTcp)

<OsPrimitives> is whichever platform the capability matrix says fills the OS primitives on your target - see naming your platforms for how the list is read.

Bring the stack up and let it acquire an address before creating any sender.

Resolving the collector needs DNS compiled into the stack (ipconfigUSE_DNS=1) even when you give it a numeric address: the pack's only resolver goes through FreeRTOS_getaddrinfo, which answers a numeric address without a lookup. A numeric address is still the more predictable choice where the network cannot be trusted.

Wiring a sender

struct SolidSyslogResolver* resolver = SolidSyslogPlusTcpResolver_Create();
struct SolidSyslogAddress*  address  = SolidSyslogPlusTcpAddress_Create();
struct SolidSyslogStream*   stream   = SolidSyslogPlusTcpTcpStream_Create(NULL);

static struct SolidSyslogStreamSenderConfig senderConfig;
senderConfig = (struct SolidSyslogStreamSenderConfig) {0};
senderConfig.Resolver = resolver;
senderConfig.Stream   = stream;
senderConfig.Address  = address;
senderConfig.Endpoint = MyEndpoint;
struct SolidSyslogSender* sender = SolidSyslogStreamSender_Create(&senderConfig);

For UDP, build a SolidSyslogPlusTcpDatagram and a SolidSyslogUdpSender instead. Passing NULL to the TCP stream takes the default connect budget.

Sizing

The stack's socket and buffer limits are yours to set, and they have to cover what this library creates alongside everything else using the network. Under-sizing shows up as a failure to send rather than as a crash, so it is worth counting the instances you create rather than discovering the limit in the field.

When it does not work

Install an error handler before you start; error severity says what each level is telling you.