|
MC Protocol Serial C++ 0.2.3
MC protocol serial library for MCU-oriented environments
|
Version 0.2.3 trims the registry tarball to the library-facing files while keeping the PlatformIO packaging metadata and simpler host-side entrypoints.
platformio.inilibrary.jsonlibrary.propertiesinclude/mcprotocol_serial.hppnative-examplerpipico-arduino-exampleesp32-c3-devkitm-1-examplerpipico-arduino-uart-exampleesp32-c3-devkitm-1-uart-examplemega2560-arduino-uart-examplemega2560-arduino-uart-example-ultra-minimalnative-example-ultra-minimalrpipico-arduino-example-ultra-minimalesp32-c3-devkitm-1-example-ultra-minimalRun them with:
The normal PlatformIO examples already use a reduced-footprint profile. That profile keeps batch read/write, cpu-model, and loopback, compiles out the other command families, and also compiles the codec down to 4C + ASCII only.
MelsecSerialClient: about 18,984 bytes -> 2,168 bytesESP32-C3 RAM: 36,740 bytes -> 15,868 bytesESP32-C3 Flash: 289,914 bytes -> 264,024 bytesMega 2560 RAM: 7,717 bytes -> 6,695 bytesMega 2560 Flash: 25,420 bytes -> 20,806 bytesThe ultra-minimal environments are for cases where you only want small batch read/write. They also compile out cpu-model and loopback, and shrink the fixed frame/data buffers to 256 / 256 / 128 bytes. Like the reduced profile, they keep only 4C + ASCII in the codec.
MelsecSerialClient: about 18,984 bytes -> 792 bytesESP32-C3 RAM: 36,740 bytes -> 14,508 bytesESP32-C3 Flash: 289,914 bytes -> 261,046 bytesMega 2560 RAM: 5,961 bytes -> 4,983 bytesMega 2560 Flash: 23,632 bytes -> 18,716 bytesRP2040 RAM: 41,512 bytesRP2040 Flash: 4,850 bytesWhat can be compiled out:
MCPROTOCOL_BUILD_HOST_SUPPORT=OFF removes host_sync plus the host serial backend, and MCPROTOCOL_BUILD_CLI=OFF removes mcprotocol_cliCapacity tuning:
MCPROTOCOL_SERIAL_MAX_REQUEST_FRAME_BYTESMCPROTOCOL_SERIAL_MAX_RESPONSE_FRAME_BYTESMCPROTOCOL_SERIAL_MAX_REQUEST_DATA_BYTESMCPROTOCOL_SERIAL_MAX_RANDOM_ACCESS_ITEMSMCPROTOCOL_SERIAL_MAX_MULTI_BLOCK_COUNTMCPROTOCOL_SERIAL_MAX_MONITOR_ITEMSMCPROTOCOL_SERIAL_MAX_LOOPBACK_BYTESFeature switches:
MCPROTOCOL_SERIAL_ENABLE_RANDOM_COMMANDSMCPROTOCOL_SERIAL_ENABLE_MULTI_BLOCK_COMMANDSMCPROTOCOL_SERIAL_ENABLE_MONITOR_COMMANDSMCPROTOCOL_SERIAL_ENABLE_HOST_BUFFER_COMMANDSMCPROTOCOL_SERIAL_ENABLE_MODULE_BUFFER_COMMANDSMCPROTOCOL_SERIAL_ENABLE_CPU_MODEL_COMMANDSMCPROTOCOL_SERIAL_ENABLE_LOOPBACK_COMMANDSCodec switches:
MCPROTOCOL_SERIAL_ENABLE_ASCII_MODEMCPROTOCOL_SERIAL_ENABLE_BINARY_MODEMCPROTOCOL_SERIAL_ENABLE_FRAME_C4MCPROTOCOL_SERIAL_ENABLE_FRAME_C3MCPROTOCOL_SERIAL_ENABLE_FRAME_C2MCPROTOCOL_SERIAL_ENABLE_FRAME_C1MCPROTOCOL_SERIAL_ENABLE_FRAME_E1Practical examples:
MCPROTOCOL_SERIAL_ENABLE_RANDOM_COMMANDS=0 removes the whole random-read / random-write familyMCPROTOCOL_SERIAL_ENABLE_MONITOR_COMMANDS=0 removes 0801/0802 monitor as one familyMCPROTOCOL_SERIAL_ENABLE_BINARY_MODE=0 removes all binary codec branches at onceMCPROTOCOL_SERIAL_ENABLE_FRAME_C1=0 removes the whole 1C frame family at onceMCPROTOCOL_SERIAL_ENABLE_FRAME_C4=1 with the other frame macros =0 keeps only 4CThe CMake build exposes the same footprint presets:
Profile behavior:
full: complete host-oriented build, including host sync and CLIreduced: core-only build, smaller buffers, no random/multi-block/monitor/host-buffer/module-buffer, and codec limited to 4C + ASCIIultra: reduced profile plus no cpu-model, no loopback, and the same 4C + ASCII codec limitNon-full profiles are treated as core-only by CMake, so host sync and CLI are turned off automatically. If BUILD_TESTING is left ON, CMake also disables it automatically for these profiles.