[platformio] default_envs = default build_cache_dir = .cache extra_configs = platformio.local.ini [crosspoint] version = 1.6.5 [base] platform = https://github.com/pioarduino/platform-espressif32/releases/download/55.03.311/platform-espressif32.zip board = esp32-c3-devkitm-1 framework = arduino monitor_speed = 115200 upload_speed = 921600 check_tool = cppcheck ; missingInclude (project headers) is suppressed alongside missingIncludeSystem: on a ; fresh CI checkout cppcheck has no resolved include paths, so it reports every ; project header as missing (~400 information-level lines) and fails the job. check_flags = --enable=all --check-level=exhaustive --suppress=missingIncludeSystem --suppress=missingInclude --suppress=unusedFunction --suppress=unmatchedSuppression --suppress=*:*/.pio/* ; The SDK is maintained separately; keep this check scoped to reader-owned code. --suppress=*:*/freeink-sdk/* ; Analyzer status output is not a source-code defect. --suppress=checkersReport --inline-suppr check_skip_packages = yes board_upload.flash_size = 16MB board_upload.maximum_size = 16777216 board_upload.offset_address = 0x10000 build_flags = -DARDUINO_USB_MODE=1 -DARDUINO_USB_CDC_ON_BOOT=1 -DEINK_DISPLAY_SINGLE_BUFFER_MODE=1 -DDISABLE_FS_H_WARNING=1 -DDESTRUCTOR_CLOSES_FILE=1 # https://libexpat.github.io/doc/api/latest/#XML_GE -DXML_GE=0 -DXML_CONTEXT_BYTES=1024 -std=gnu++2a # Enable UTF-8 long file names in SdFat -DUSE_UTF8_LONG_NAMES=1 # SdFat transfers SPI a byte at a time on ESP32: SdFatConfig.h defaults # USE_SPI_ARRAY_TRANSFER to 0 for every target but RP2040 and the UNO R4, and each # Arduino transfer(uint8_t) writes the data register, starts the transfer and spins. # 1 routes through transfer(buf, count) -> transferBytes() -> spiTransferBytesNL(), # which batches into the SPI FIFO: ~3x on SD reads, at the cost of a 512-byte stack # buffer on the send path. Inert on SDMMC boards, which bypass SdFat's SPI driver. -DUSE_SPI_ARRAY_TRANSFER=1 # Increase PNG scanline buffer to support up to 2048px wide images # Default is (320*4+1)*2=2562, we need more for larger images -DPNG_MAX_BUFFERED_PIXELS=16416 # FreeInkFont optional FreeType modules. The auto-hinter (~50KB text, PSRAM # boards only via the vector-font gate) is REQUIRED by the BW-aware 2-bit # quantizer in TtfEpdFont: with the ink threshold at 50% coverage, unhinted # thin strokes that straddle pixel columns drop below threshold and break up; # Light hinting snaps stems to full-coverage pixels so they survive. (An # earlier "no improvement" A/B was confounded by the old always-ink quantizer # flooding the differences.) Still OFF: the B/W raster (_MONOCHROME, ~5KB) is # dead while every TtfEpdFont::load() is 2-bit; psnames (_PSNAMES, ~64KB) # only serves glyph-NAME lookups a codepoint-driven renderer never makes; # gzip (_GZIP, ~13KB) only decompresses .gz/WOFF, and the registry accepts # .ttf/.otf/.ttc. -DFREEINK_FONT_ENABLE_AUTOHINT=1 -DFREEINK_NET_WOLFSSL=1 -DWOLFSSL_USER_SETTINGS -DWOLFSSL_OPTIONS_H -DWOLFSSL_CLIENT_EXAMPLE -DWOLFSSL_TLS13 # MEMFIX-PORT: single-precision ECC (sp_c32.c). Without it every P-256 operation # (TLS 1.3 key_share keygen, ECDHE, ECDSA cert verify) runs on fast-math bignums # that WOLFSSL_SMALL_STACK heap-allocates at FP_MAX_BITS size -- tens of KB of # temporaries, which OOMs (MP_MEM) at the ~50KB free heap a reading session # leaves. SP uses fixed 256-bit arrays: a few KB, and several times faster. # SP_SMALL trades the large precomputed point tables for smaller flash. -DWOLFSSL_HAVE_SP_ECC -DWOLFSSL_SP_SMALL # Arduino-wolfSSL's user_settings.h enables TLS extensions, supported curves, # HKDF, and RSA-PSS when WOLFSSL_TLS13 is set. Do not repeat those defines here: # GCC reports every library translation unit as a macro redefinition. -DHAVE_FFDHE_2048 -DHAVE_CURVE25519 -DHAVE_SNI # RFC 6066 max_fragment_length: SecureClient asks the peer for 2KB TLS records # so the receive path never needs the default ~17KB contiguous buffer -- the # MEMORY_E mid-download failure at the ~20KB free heap font downloads leave. # Servers that ignore the extension keep 16KB records and behave as before. -DHAVE_MAX_FRAGMENT -Wno-bidi-chars -Wl,--wrap=panic_print_backtrace,--wrap=panic_abort,--wrap=bootloader_common_check_efuse_blk_validity -fno-exceptions build_unflags = -std=gnu++11 -fexceptions ; Board configuration board_build.flash_mode = dio board_build.flash_size = 16MB board_build.partitions = partitions.csv ; UI languages compiled into the firmware, as comma-separated codes from lib/I18n/translations ; (e.g. "en,de,fr"). English is always included. Languages left out are not offered in the ; language picker; a device whose saved language is not built in falls back to English. custom_i18n_builtin_langs = all extra_scripts = pre:scripts/patch_pioarduino_cache.py pre:scripts/patch_wolfssl.py pre:scripts/build_html.py pre:scripts/gen_i18n.py pre:scripts/git_branch.py pre:scripts/patch_jpegdec.py post:scripts/register_unit_tests_target.py post:scripts/patch_arduino_rom_libc.py ; Libraries lib_deps = BatteryMonitor=symlink://freeink-sdk/libs/hardware/BatteryMonitor InputManager=symlink://freeink-sdk/libs/hardware/InputManager EInkDisplay=symlink://freeink-sdk/libs/display/FreeInkDisplay SDCardManager=symlink://freeink-sdk/libs/hardware/SDCardManager UsbMassStorage=symlink://freeink-sdk/libs/hardware/UsbMassStorage BoardConfig=symlink://freeink-sdk/libs/hardware/BoardConfig XteinkDetect=symlink://freeink-sdk/libs/hardware/XteinkDetect PowerManager=symlink://freeink-sdk/libs/hardware/PowerManager MemoryManager=symlink://freeink-sdk/libs/hardware/MemoryManager FrontlightManager=symlink://freeink-sdk/libs/hardware/FrontlightManager Rtc=symlink://freeink-sdk/libs/hardware/Rtc Imu=symlink://freeink-sdk/libs/hardware/Imu SecureNet=symlink://freeink-sdk/libs/network/SecureNet FreeInkUI=symlink://freeink-sdk/libs/ui/FreeInkUI Icons=symlink://freeink-sdk/libs/assets/Icons ; Standalone FreeType/stb TTF engine backing lib/EpdFont/TtfEpdFont (runtime ; .ttf/.otf rendering). Vendors only stb_truetype + FreeType (no expat), so it ; does not hit the FreeInkBook duplicate-XML_* symbol problem. FreeInkFont=symlink://freeink-sdk/libs/font/FreeInkFont bblanchon/ArduinoJson @ 7.4.2 ricmoo/QRCode @ 0.0.1 bitbank2/PNGdec @ 1.1.6 https://github.com/bitbank2/JPEGDEC.git#86282979224c8a32fd51e091ed5a35b0c699a52b links2004/WebSockets @ 2.7.3 wolfssl/Arduino-wolfSSL @ 5.7.2 lib_ignore = BLE ; The standard firmware profiles reclaim heap by rebuilding the Arduino core. ; USB-OTG (FREEINK_CAP_USB_MSC) profiles like the X4 Pro and Paper Mono ; intentionally do not inherit this section: they need PioArduino's complete ; prebuilt TinyUSB component graph, which the custom core rebuild omits. [firmware_tuned] ; MEMFIX-PORT: custom_sdkconfig heap reclamation (~32-37 KB). Rebuilds the ; Arduino core libs on first build (slower once, cached after; needs the CMake ; pin in platformio.local.ini on macOS). ; ; If an interrupted rebuild fails with "multiple definition of 'app_main'" ; (stale generated scaffold), clean it up with: ; rm -rf .dummy CMakeLists.txt sdkconfig.default sdkconfig.defaults .pio/build/default ; Do NOT use `git clean -fdX` — it deletes platformio.local.ini. custom_sdkconfig = ; Task stack right-sizing from measured high-water marks (heap block map + ; per-task stack audit, July 2026): esp_timer used ~0.8 KB of 8 KB across ; every capture; the FreeRTOS timer service used ~0.5 KB ; of 4 KB. Neither runs TLS or app code. ~7 KB back to the heap. CONFIG_ESP_TIMER_TASK_STACK_SIZE=4096 CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2560 ; Move the WiFi stack's non-critical hot paths out of IRAM into flash. ; On the C3, IRAM and DRAM share one SRAM pool, so the ~25-30 KB this ; frees lands directly in the heap — paid for with lower WiFi throughput ; during transfers (occasional sync/OTA use, not streaming: acceptable). ; IRAM cost is static, so the heap gain applies even with WiFi off. CONFIG_ESP_WIFI_IRAM_OPT=n CONFIG_ESP_WIFI_RX_IRAM_OPT=n ; Keep the Arduino wrappers for the removed cloud components (below) out of ; the core source list; all other bundled libraries default to enabled. CONFIG_ARDUINO_SELECTIVE_COMPILATION=y CONFIG_ARDUINO_SELECTIVE_RainMaker=n CONFIG_ARDUINO_SELECTIVE_Insights=n ; ESP_SR (speech recognition) only exists in the S3 core; its wrapper includes ; ESP_I2S.h, which the isolated core rebuild can't resolve. Unused here anyway, ; so drop it or the sticky env fails to build. CONFIG_ARDUINO_SELECTIVE_ESP_SR=n ; esp-modbus requires its API blocking limit to cover the response timeout. CONFIG_FMB_MASTER_MAX_API_BLOCKING_TIME_MS=10000 ; Drop unused cloud components from the core rebuild. esp_insights/rainmaker ; require embedded server certs the lib builder can't generate ; ("https_server.crt.S not found"); this firmware uses none of them. custom_component_remove = espressif/esp_insights espressif/esp_rainmaker espressif/esp_diagnostics espressif/esp_diag_data_store espressif/esp_schedule espressif/esp_rcp_update espressif/esp_secure_cert_mgr espressif/cbor ; Keep C3-specific defaults separate from the S3 firmware profiles. [firmware_tuned_c3] extends = firmware_tuned custom_sdkconfig = ${firmware_tuned.custom_sdkconfig} ; Use ROM libc routines to preserve the C3's shared instruction/data RAM. CONFIG_LIBC_OPTIMIZED_MISALIGNED_ACCESS=n ; Match the configurable defaults from the Arduino 3.3.7 build. CONFIG_BT_NIMBLE_CRYPTO_STACK_MBEDTLS=y CONFIG_BT_NIMBLE_EXT_SCAN=y CONFIG_ESP_IPC_TASK_STACK_SIZE=1024 CONFIG_ESP_RMAKER_WORK_QUEUE_TASK_STACK=4096 CONFIG_ESP_WIFI_GCMP_SUPPORT=n CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=3000 CONFIG_FMB_QUEUE_LENGTH=20 CONFIG_FMB_TCP_CONNECTION_TOUT_SEC=20 [env:default] extends = base, firmware_tuned_c3 build_flags = ${base.build_flags} ; CROSSPOINT_VERSION is set by scripts/git_branch.py (includes branch + short SHA) -DFREEINK_DEVICE_X4=1 -DFREEINK_DEVICE_X3=1 -DENABLE_SERIAL_LOG -DCROSSPOINT_WAIT_FOR_USB_SERIAL -DLOG_LEVEL=2 ; Set log level to debug for development builds [env:gh_release] extends = base, firmware_tuned_c3 build_flags = ${base.build_flags} -DFREEINK_DEVICE_X4=1 -DFREEINK_DEVICE_X3=1 -DCROSSPOINT_VERSION=\"${crosspoint.version}\" -DENABLE_SERIAL_LOG -DLOG_LEVEL=1 ; Set log level to info for release builds [env:gh_release_rc] extends = base, firmware_tuned_c3 build_flags = ${base.build_flags} -DFREEINK_DEVICE_X4=1 -DFREEINK_DEVICE_X3=1 -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" -DENABLE_SERIAL_LOG -DLOG_LEVEL=1 ; Set log level to info for release candidate builds [env:slim] extends = base, firmware_tuned_c3 build_flags = ${base.build_flags} -DFREEINK_DEVICE_X4=1 -DFREEINK_DEVICE_X3=1 -DCROSSPOINT_VERSION=\"${crosspoint.version}-slim\" ; serial output is disabled in slim builds to save space -UENABLE_SERIAL_LOG ; --- Seeed Sticky — ESP32-S3R8, 3.97" 800x480 SSD1677 + GT911 touch ----------- ; Different MCU family than the C3 envs (one binary per family). The SDK ; auto-enables CAP_TOUCH (GT911) and the BQ27220 gauge for this device. The ; N16R8 board definition enables octal PSRAM. ; pio run -e sticky -t upload [env:sticky] extends = base, firmware_tuned board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 build_flags = ${base.build_flags} -DFREEINK_DEVICE_STICKY=1 -DENABLE_SERIAL_LOG -DCROSSPOINT_WAIT_FOR_USB_SERIAL -DLOG_LEVEL=2 [env:sticky-gh_release] extends = base, firmware_tuned board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 build_flags = ${base.build_flags} -DFREEINK_DEVICE_STICKY=1 -DCROSSPOINT_VERSION=\"${crosspoint.version}\" -DENABLE_SERIAL_LOG -DLOG_LEVEL=1 ; Set log level to info for release builds [env:sticky-gh_release_rc] extends = base, firmware_tuned board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 build_flags = ${base.build_flags} -DFREEINK_DEVICE_STICKY=1 -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" -DENABLE_SERIAL_LOG -DLOG_LEVEL=1 ; Set log level to info for release candidate builds ; --- Xteink X4 Pro — ESP32-S3, 16MB flash / 8MB PSRAM, SSD1677 + GT911 -------- ; The SDK profile supplies the X4 Pro pinout, display, touch controller, and ; capacitive Home key. USB Serial/JTAG is the normal USB personality so ; PlatformIO can monitor and flash the reader. USB Drive starts MSC only for ; that File Transfer activity, then reboots back to this default on exit. ; pio run -e x4pro -t upload [env:x4pro] extends = base board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 board_build.arduino.memory_type = dio_opi ; Use the prebuilt dio_opi Arduino variant: its TinyUSB component is enabled ; for CDC and MSC. This profile deliberately extends base rather than ; firmware_tuned, whose custom SDK rebuild omits that component. build_flags = ${base.build_flags} -DFREEINK_DEVICE_X4PRO=1 -DFREEINK_CAP_USB_MSC=1 -DBOARD_HAS_PSRAM -DUSB_PRODUCT=\"CrossPoint_X4_Pro\" -DUSB_MANUFACTURER=\"CrossPoint\" -DCROSSPOINT_VERSION=\"${crosspoint.version}-x4pro\" -DENABLE_SERIAL_LOG -DCROSSPOINT_WAIT_FOR_USB_SERIAL -DLOG_LEVEL=2 ; X4 Pro SD is native SDMMC (1-bit), mounted through SdFat's block-device API. -DUSE_BLOCK_DEVICE_INTERFACE=1 ; --- Xteink X4 Classic (X4C) --------------------------------------------------- ; Same ESP32-S3 board and display stack as the X4 Pro (SSD1677/UC8179/UC8279 auto- ; detected at boot) but buttons-only: no touchscreen and no frontlight, so the ; freed pins become four extra front buttons (two side page-turn keys + four bottom ; keys). Native 1-bit SDMMC + USB-MSC file transfer as on the X4 Pro; drops the ; frontlight flag. See freeink-sdk/docs/xteink-x4c-support.md. ; pio run -e x4c -t upload [env:x4c] extends = base board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 board_build.arduino.memory_type = dio_opi build_flags = ${base.build_flags} -DFREEINK_DEVICE_X4CLASSIC=1 -DFREEINK_CAP_USB_MSC=1 -DBOARD_HAS_PSRAM -DUSB_PRODUCT=\"CrossPoint_X4_Classic\" -DUSB_MANUFACTURER=\"CrossPoint\" -DCROSSPOINT_VERSION=\"${crosspoint.version}-x4c\" -DENABLE_SERIAL_LOG -DCROSSPOINT_WAIT_FOR_USB_SERIAL -DLOG_LEVEL=2 ; X4C SD is native SDMMC (1-bit), mounted through SdFat's block-device API. -DUSE_BLOCK_DEVICE_INTERFACE=1 [env:x4c-gh_release] extends = base board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 board_build.arduino.memory_type = dio_opi build_flags = ${base.build_flags} -DFREEINK_DEVICE_X4CLASSIC=1 -DFREEINK_CAP_USB_MSC=1 -DBOARD_HAS_PSRAM -DUSB_PRODUCT=\"CrossPoint_X4_Classic\" -DUSB_MANUFACTURER=\"CrossPoint\" -DCROSSPOINT_VERSION=\"${crosspoint.version}\" -DENABLE_SERIAL_LOG -DLOG_LEVEL=1 ; Set log level to info for release builds -DUSE_BLOCK_DEVICE_INTERFACE=1 [env:x4c-gh_release_rc] extends = base board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 board_build.arduino.memory_type = dio_opi build_flags = ${base.build_flags} -DFREEINK_DEVICE_X4CLASSIC=1 -DFREEINK_CAP_USB_MSC=1 -DBOARD_HAS_PSRAM -DUSB_PRODUCT=\"CrossPoint_X4_Classic\" -DUSB_MANUFACTURER=\"CrossPoint\" -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" -DENABLE_SERIAL_LOG -DLOG_LEVEL=1 ; Set log level to info for release candidate builds -DUSE_BLOCK_DEVICE_INTERFACE=1 [env:x4pro-gh_release] extends = base board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 board_build.arduino.memory_type = dio_opi build_flags = ${base.build_flags} -DFREEINK_DEVICE_X4PRO=1 -DFREEINK_CAP_USB_MSC=1 -DBOARD_HAS_PSRAM -DUSB_PRODUCT=\"CrossPoint_X4_Pro\" -DUSB_MANUFACTURER=\"CrossPoint\" -DCROSSPOINT_VERSION=\"${crosspoint.version}\" -DENABLE_SERIAL_LOG -DLOG_LEVEL=1 ; Set log level to info for release builds -DUSE_BLOCK_DEVICE_INTERFACE=1 [env:x4pro-gh_release_rc] extends = base board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 board_build.arduino.memory_type = dio_opi build_flags = ${base.build_flags} -DFREEINK_DEVICE_X4PRO=1 -DFREEINK_CAP_USB_MSC=1 -DBOARD_HAS_PSRAM -DUSB_PRODUCT=\"CrossPoint_X4_Pro\" -DUSB_MANUFACTURER=\"CrossPoint\" -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" -DENABLE_SERIAL_LOG -DLOG_LEVEL=1 ; Set log level to info for release candidate builds -DUSE_BLOCK_DEVICE_INTERFACE=1 ; --- M5Stack Paper Mono — ESP32-S3, SSD1683 800x480 + FT6336 touch + frontlight ; Power/reset plumbing runs through the M5PM1 PMIC and M5IOE1 expander; the SDK ; sequences them itself. Touch, frontlight, RTC, and other capabilities are ; selected by the Paper Mono BoardConfig profile. ; Extends base (not firmware_tuned): USB Drive needs the prebuilt dio_opi ; Arduino variant, whose TinyUSB component is enabled for CDC and MSC. ; pio run -e papermono -t upload [env:papermono] extends = base board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 board_build.arduino.memory_type = dio_opi build_flags = ${base.build_flags} -DFREEINK_DEVICE_PAPERMONO=1 -DFREEINK_CAP_USB_MSC=1 ; The SSD1683 grayscale target planes are batched in PSRAM. -DBOARD_HAS_PSRAM -DUSB_PRODUCT=\"CrossPoint_Paper_Mono\" -DUSB_MANUFACTURER=\"CrossPoint\" -DCROSSPOINT_VERSION=\"${crosspoint.version}-papermono\" -DENABLE_SERIAL_LOG -DCROSSPOINT_WAIT_FOR_USB_SERIAL -DLOG_LEVEL=2 ; Native 1-bit SDMMC is mounted through SdFat's block-device interface. -DUSE_BLOCK_DEVICE_INTERFACE=1 [env:papermono-gh_release] extends = base board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 board_build.arduino.memory_type = dio_opi build_flags = ${base.build_flags} -DFREEINK_DEVICE_PAPERMONO=1 -DFREEINK_CAP_USB_MSC=1 -DBOARD_HAS_PSRAM -DUSB_PRODUCT=\"CrossPoint_Paper_Mono\" -DUSB_MANUFACTURER=\"CrossPoint\" -DCROSSPOINT_VERSION=\"${crosspoint.version}\" -DENABLE_SERIAL_LOG -DLOG_LEVEL=1 ; Set log level to info for release builds -DUSE_BLOCK_DEVICE_INTERFACE=1 [env:papermono-gh_release_rc] extends = base board = esp32-s3-devkitc1-n16r8 board_build.mcu = esp32s3 board_build.arduino.memory_type = dio_opi build_flags = ${base.build_flags} -DFREEINK_DEVICE_PAPERMONO=1 -DFREEINK_CAP_USB_MSC=1 -DBOARD_HAS_PSRAM -DUSB_PRODUCT=\"CrossPoint_Paper_Mono\" -DUSB_MANUFACTURER=\"CrossPoint\" -DCROSSPOINT_VERSION=\"${crosspoint.version}-rc+${sysenv.CROSSPOINT_RC_HASH}\" -DENABLE_SERIAL_LOG -DLOG_LEVEL=1 ; Set log level to info for release candidate builds -DUSE_BLOCK_DEVICE_INTERFACE=1