From 68653db30aca6ba33f6a24f88be5285282c7a363 Mon Sep 17 00:00:00 2001 From: ainyan03 <205502311+ainyan03@users.noreply.github.com> Date: Fri, 2 Oct 2026 06:07:48 +0000 Subject: [PATCH] Split the v1 implementation into functional translation units 0.2.30 built the whole v1 implementation as one translation unit (lgfx_v1.cpp included every *.inl file). With the esp-2021r2 toolchain (GCC 8.4 / binutils 2.35, used by arduino-esp32 2.0.x and the PlatformIO espressif32 6.x / 7.x platforms) unused panel and touch code and its data tables were no longer removed by --gc-sections on RISC-V targets such as the ESP32-C3, which added several hundred kilobytes to a firmware that uses a single SPI panel. The older RISC-V assembler appends the CFI relocations of .rela.eh_frame after the FDE header relocations, so they are not in offset order. When the linker marks the FDE of a live function, it walks relocations from that FDE up to its end offset without a lower bound, so the last FDE of an object also picks up the out-of-order relocations of earlier functions and keeps them. Within one object this pulled in nearly the whole library. Keep the shared header parsing of the single translation unit, but split the implementation by function: lgfx_v1.cpp (sprite, button, misc), lgfx_v1_panel.cpp, lgfx_v1_touch.cpp and lgfx_v1_platforms.cpp include the *.inl files of their group, and LGFXBase.cpp, lgfx_fonts.cpp and panel/Panel_M5HDMI.cpp (FPGA bitstream) build on their own. The ESP-IDF CMake and make lists take the new files. The source check accepts several hubs and standalone sources, and rejects an *.inl reached from two hubs. The direct includes of esp_private/periph_ctrl.h get the same -Wliteral-suffix suppression as spi_common_internal.h: as one translation unit, the latter always included it first, but the platform hub now reaches esp32/common.inl before Bus_SPI.hpp. --- .github/scripts/check_inl_sources.py | 108 +++++++++++------- .github/workflows/SourceCheck.yml | 22 +++- CMakeLists.txt | 10 +- component.mk | 2 +- src/lgfx/v1/{LGFXBase.inl => LGFXBase.cpp} | 3 - .../v1/{lgfx_fonts.inl => lgfx_fonts.cpp} | 3 - src/lgfx/v1/lgfx_v1.cpp | 98 ++++------------ src/lgfx/v1/lgfx_v1_panel.cpp | 20 ++++ src/lgfx/v1/lgfx_v1_platforms.cpp | 28 +++++ src/lgfx/v1/lgfx_v1_touch.cpp | 10 ++ .../{Panel_M5HDMI.inl => Panel_M5HDMI.cpp} | 3 - src/lgfx/v1/platforms/esp32/Bus_SPI.inl | 5 + src/lgfx/v1/platforms/esp32/Panel_CVBS.inl | 5 + src/lgfx/v1/platforms/esp32/common.inl | 5 + 14 files changed, 190 insertions(+), 132 deletions(-) rename src/lgfx/v1/{LGFXBase.inl => LGFXBase.cpp} (99%) rename src/lgfx/v1/{lgfx_fonts.inl => lgfx_fonts.cpp} (99%) create mode 100644 src/lgfx/v1/lgfx_v1_panel.cpp create mode 100644 src/lgfx/v1/lgfx_v1_platforms.cpp create mode 100644 src/lgfx/v1/lgfx_v1_touch.cpp rename src/lgfx/v1/panel/{Panel_M5HDMI.inl => Panel_M5HDMI.cpp} (99%) diff --git a/.github/scripts/check_inl_sources.py b/.github/scripts/check_inl_sources.py index 48e80034..83284ffb 100644 --- a/.github/scripts/check_inl_sources.py +++ b/.github/scripts/check_inl_sources.py @@ -1,36 +1,35 @@ #!/usr/bin/env python3 -"""Consistency checks for a library built as a single translation unit. - -The implementation lives in *.inl files that a single hub *.cpp includes, -directly or through other *.inl files. This script checks that the hub and -the *.inl files agree: - - 1. every *.inl include reachable from the hub names an existing file under - the source root, no file includes the same *.inl twice, and *.inl files - are included with the quoted form only - 2. every *.inl under the source root is reachable from the hub - 3. every *.inl starts with #ifndef / #error / #endif so it cannot - be included by user code on its own - 4. no *.c / *.cpp other than the hub exists under the source root (a stray - one would compile as a separate translation unit and defeat the purpose) - 5. (--compile) every *.inl the hub includes directly compiles on its own with - only the guard macro defined, so no file silently depends on what an - earlier include brought in (files included by other *.inl files are - fragments of those and are not compiled separately) +"""Consistency checks for functional hubs and standalone translation units. + +Each hub *.cpp includes implementation *.inl files, directly or through other +*.inl files. Large implementations can instead be standalone *.cpp files. +This script checks that the source tree and its declared translation units agree: + + 1. every reachable *.inl include names an existing file under the source root, + no file includes the same *.inl twice, and includes use the quoted form + 2. every *.inl under the source root is reachable from a hub + 3. every *.inl starts with #ifndef / #error / #endif + 4. no *.c / *.cpp other than the declared hubs and standalone sources exists + under the source root + 5. (--compile) every *.inl directly included by a hub compiles on its own with + only the guard macro defined; nested fragments are not compiled separately + 6. no *.inl is reachable from more than one hub The checks are lexical: comments, string literals and line splices are -handled like the preprocessor does, but #if conditions are not evaluated, so -an include inside a disabled #if block still counts as reachable, a file -included from several places (the platform directories each include the -same bit-bang helpers, under mutually exclusive conditions) is not reported -as a duplicate, and a platform file that compiles to nothing on the host -still passes the compile check. The script guards against mistakes, not -against code written to evade it. +handled like the preprocessor does, but #if conditions are not evaluated. +An include inside a disabled #if still counts as reachable. Multiple paths +within one hub (such as mutually exclusive platform bit-bang helpers) are +allowed; paths from different hubs are rejected. A platform file that +compiles to nothing on the host still passes the compile check. The script +guards against mistakes, not against code written to evade it. Usage: - check_inl_sources.py --hub src/lgfx/v1/lgfx_v1.cpp --root src/lgfx/v1 \ - --macro LGFX_V1_IMPLEMENTATION [--compile CXX -std=c++17 -DLGFX_SDL -Isrc ...] + check_inl_sources.py --hub src/lgfx/v1/lgfx_v1.cpp \ + --hub src/lgfx/v1/lgfx_v1_panel.cpp --source src/lgfx/v1/LGFXBase.cpp \ + --root src/lgfx/v1 --macro LGFX_V1_IMPLEMENTATION \ + [--compile CXX -std=c++17 -DLGFX_SDL -Isrc ...] +Repeat --hub and --source for every translation unit under --root. Everything after --compile is the compiler command line; the script appends -fsyntax-only -x c++ -D and the file. """ @@ -221,9 +220,6 @@ def visit(src, chain): visit(path, chain + (real,)) visit(hub, (os.path.realpath(hub),)) - for inl in walk(root, {'.inl'}): - if inl not in reachable: - problems.append(f'{rel(inl, root)}: not reachable from the hub') return direct, reachable @@ -239,10 +235,11 @@ def check_guards(root, macro, problems): problems.append(f'{rel(inl, root)}: does not start with "#ifndef {macro}" / "#error" / "#endif"') -def check_stray_sources(root, hub, problems): +def check_stray_sources(root, sources, problems): + allowed = {os.path.realpath(src) for src in sources} for src in walk(root, {'.c', '.cpp'}): - if os.path.abspath(src) != os.path.abspath(hub): - problems.append(f'{rel(src, root)}: source file outside the hub (add it as *.inl to the hub instead)') + if os.path.realpath(src) not in allowed: + problems.append(f'{rel(src, root)}: undeclared source file (add it to a hub as *.inl or declare it with --source)') def compile_one(cmd, macro, path): @@ -272,22 +269,49 @@ def main(): if not compile_cmd: sys.exit('--compile needs a compiler command line') ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) - ap.add_argument('--hub', required=True, help='the *.cpp that includes the *.inl files') - ap.add_argument('--root', required=True, help='directory whose *.inl files must all be reachable from the hub') - ap.add_argument('--macro', required=True, help='guard macro the hub defines around its includes') + ap.add_argument('--hub', required=True, action='append', help='hub *.cpp (repeat for each hub)') + ap.add_argument('--source', action='append', default=[], help='standalone *.c / *.cpp (repeat for each source)') + ap.add_argument('--root', required=True, help='directory whose *.inl files must all be reachable from the hubs') + ap.add_argument('--macro', required=True, help='guard macro each hub defines around its includes') args = ap.parse_args(argv) - hub = os.path.normpath(os.path.abspath(args.hub)) - root = os.path.normpath(os.path.abspath(args.root)) + hubs = [os.path.abspath(p) for p in args.hub] + sources = [os.path.abspath(p) for p in args.source] + root = os.path.abspath(args.root) problems = [] + seen = set() + for src in hubs + sources: + real = os.path.realpath(src) + if real in seen: + ap.error(f'duplicate translation unit: {src}') + seen.add(real) + if not os.path.isfile(src) or not is_under(src, root): + ap.error(f'translation unit must be an existing file under --root: {src}') + if os.path.splitext(src)[1] not in {'.c', '.cpp'}: + ap.error(f'translation unit must be a *.c / *.cpp file: {src}') - direct, reachable = check_reachability(hub, root, problems) + direct = [] + owners = {} + for hub in hubs: + hub_direct, reachable = check_reachability(hub, root, problems) + direct.extend(hub_direct) + for inl in sorted(reachable): + real = os.path.realpath(inl) + previous = owners.get(real) + if previous is not None and previous != hub: + problems.append(f'{rel(inl, root)}: reachable from multiple hubs: ' + f'{rel(previous, root)}, {rel(hub, root)}') + owners[real] = hub + print(f'{rel(hub, root)}: {len(hub_direct)} files included directly, {len(reachable)} reachable') + for inl in walk(root, {'.inl'}): + if os.path.realpath(inl) not in owners: + problems.append(f'{rel(inl, root)}: not reachable from any hub') check_guards(root, args.macro, problems) - check_stray_sources(root, hub, problems) + check_stray_sources(root, hubs + sources, problems) if compile_cmd: - check_compile(direct, root, args.macro, compile_cmd, problems) + check_compile(list(dict.fromkeys(direct)), root, args.macro, compile_cmd, problems) - print(f'{rel(hub, root)}: {len(direct)} files included directly, {len(reachable)} reachable, ' + print(f'{len(hubs)} hubs, {len(sources)} standalone sources, ' f'{sum(1 for _ in walk(root, {".inl"}))} *.inl under {rel(root, os.getcwd())}' + (f', compiled with: {" ".join(compile_cmd)}' if compile_cmd else '')) if problems: diff --git a/.github/workflows/SourceCheck.yml b/.github/workflows/SourceCheck.yml index 1c8f1375..3f9c2ff0 100644 --- a/.github/workflows/SourceCheck.yml +++ b/.github/workflows/SourceCheck.yml @@ -15,7 +15,7 @@ jobs: inl-sources: - name: single translation unit consistency + name: translation unit consistency runs-on: ubuntu-latest @@ -28,14 +28,28 @@ jobs: sudo apt-get update sudo apt-get install -y libsdl2-dev - - name: Check the hub and the *.inl files (SDL back end) + - name: Check the hubs and the *.inl files (SDL back end) run: | python3 .github/scripts/check_inl_sources.py \ - --hub src/lgfx/v1/lgfx_v1.cpp --root src/lgfx/v1 --macro LGFX_V1_IMPLEMENTATION \ + --hub src/lgfx/v1/lgfx_v1.cpp \ + --hub src/lgfx/v1/lgfx_v1_panel.cpp \ + --hub src/lgfx/v1/lgfx_v1_touch.cpp \ + --hub src/lgfx/v1/lgfx_v1_platforms.cpp \ + --source src/lgfx/v1/LGFXBase.cpp \ + --source src/lgfx/v1/lgfx_fonts.cpp \ + --source src/lgfx/v1/panel/Panel_M5HDMI.cpp \ + --root src/lgfx/v1 --macro LGFX_V1_IMPLEMENTATION \ --compile g++ -std=c++17 -DLGFX_SDL -Isrc $(sdl2-config --cflags) - name: Check the *.inl files (Linux framebuffer back end) run: | python3 .github/scripts/check_inl_sources.py \ - --hub src/lgfx/v1/lgfx_v1.cpp --root src/lgfx/v1 --macro LGFX_V1_IMPLEMENTATION \ + --hub src/lgfx/v1/lgfx_v1.cpp \ + --hub src/lgfx/v1/lgfx_v1_panel.cpp \ + --hub src/lgfx/v1/lgfx_v1_touch.cpp \ + --hub src/lgfx/v1/lgfx_v1_platforms.cpp \ + --source src/lgfx/v1/LGFXBase.cpp \ + --source src/lgfx/v1/lgfx_fonts.cpp \ + --source src/lgfx/v1/panel/Panel_M5HDMI.cpp \ + --root src/lgfx/v1 --macro LGFX_V1_IMPLEMENTATION \ --compile g++ -std=c++17 -DLGFX_LINUX_FB -Isrc diff --git a/CMakeLists.txt b/CMakeLists.txt index eeee1282..ec8aa85c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,17 @@ set(COMPONENT_ADD_INCLUDEDIRS src ) -# The build set is fixed: src/lgfx/v1/lgfx_v1.cpp includes every implementation file (*.inl), -# the font tables and the C decoders are separate translation units on purpose. +# Functional hubs share header parsing; large implementations and data tables stay +# in separate translation units so unused groups can be discarded by the linker. set(SRCS src/M5GFX.cpp src/lgfx/v1/lgfx_v1.cpp + src/lgfx/v1/lgfx_v1_panel.cpp + src/lgfx/v1/lgfx_v1_touch.cpp + src/lgfx/v1/lgfx_v1_platforms.cpp + src/lgfx/v1/LGFXBase.cpp + src/lgfx/v1/lgfx_fonts.cpp + src/lgfx/v1/panel/Panel_M5HDMI.cpp src/lgfx/Fonts/efont/lgfx_efont_cn.c src/lgfx/Fonts/efont/lgfx_efont_ja.c src/lgfx/Fonts/efont/lgfx_efont_kr.c diff --git a/component.mk b/component.mk index ef0f9bf1..8ea31f49 100644 --- a/component.mk +++ b/component.mk @@ -3,5 +3,5 @@ # # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.) -COMPONENT_SRCDIRS := src src/lgfx/v1 src/lgfx/utility src/lgfx/Fonts/efont src/lgfx/Fonts/IPA +COMPONENT_SRCDIRS := src src/lgfx/v1 src/lgfx/v1/panel src/lgfx/utility src/lgfx/Fonts/efont src/lgfx/Fonts/IPA COMPONENT_ADD_INCLUDEDIRS := src diff --git a/src/lgfx/v1/LGFXBase.inl b/src/lgfx/v1/LGFXBase.cpp similarity index 99% rename from src/lgfx/v1/LGFXBase.inl rename to src/lgfx/v1/LGFXBase.cpp index bbb1f251..cb896267 100644 --- a/src/lgfx/v1/LGFXBase.inl +++ b/src/lgfx/v1/LGFXBase.cpp @@ -16,9 +16,6 @@ Original Source: [tobozo](https://github.com/tobozo) /----------------------------------------------------------------------------*/ -#ifndef LGFX_V1_IMPLEMENTATION -#error "LGFXBase.inl is part of lgfx_v1.cpp and is not meant to be included on its own" -#endif #include "LGFXBase.hpp" #include "../internal/limits.h" diff --git a/src/lgfx/v1/lgfx_fonts.inl b/src/lgfx/v1/lgfx_fonts.cpp similarity index 99% rename from src/lgfx/v1/lgfx_fonts.inl rename to src/lgfx/v1/lgfx_fonts.cpp index 53f06686..be74a4f1 100644 --- a/src/lgfx/v1/lgfx_fonts.inl +++ b/src/lgfx/v1/lgfx_fonts.cpp @@ -1,6 +1,3 @@ -#ifndef LGFX_V1_IMPLEMENTATION -#error "lgfx_fonts.inl is part of lgfx_v1.cpp and is not meant to be included on its own" -#endif #include "lgfx_fonts.hpp" #include "platforms/common.hpp" diff --git a/src/lgfx/v1/lgfx_v1.cpp b/src/lgfx/v1/lgfx_v1.cpp index 3c6342a2..c939407a 100644 --- a/src/lgfx/v1/lgfx_v1.cpp +++ b/src/lgfx/v1/lgfx_v1.cpp @@ -1,87 +1,37 @@ -// LovyanGFX v1 is built as a single translation unit: this file includes every -// implementation file (*.inl) under src/lgfx/v1, and those are not compiled on their own. -// -// Why: every implementation file pulls in the same framework headers, and parsing them -// once instead of once per file cuts the library build time several-fold (the Arduino -// build also pre-scans each source file for includes, which doubled that cost). +// LovyanGFX v1 uses functional hubs for *.inl implementations and standalone *.cpp +// files for LGFXBase, fonts, and implementations with large data tables. +// Older RISC-V toolchains (assembler and linker) can retain unused code throughout +// a translation unit when its last function is used. Keeping functional groups and large tables in separate +// translation units limits this effect while sharing header parsing within each hub. // // Maintenance notes: -// - Adding an implementation file: create it as *.inl and add an #include below. Do not -// add *.cpp files under src/lgfx/v1. LovyanGFX and M5GFX share this source tree but keep -// their own copy of this file, because their panel sets differ; update both. -// - File-local names are visible to every file that follows: static functions and -// constants, macros, and anonymous namespaces do not isolate files here. Use a name that -// identifies the file (or a class member), and #undef helper macros at the end of the -// file that defines them. -// - Platform directories are self-guarded, so only the active platform contributes code; -// the desktop back ends (sdl / opencv / framebuffer) follow the selection made in -// platforms/common.hpp (LGFX_PLATFORM_*). -// - Two files provide helpers for the ones that follow and are marked "must precede". -// - The C decoders in src/lgfx/utility and the font tables in src/lgfx/Fonts stay separate -// translation units on purpose (third-party file-local names collide; the font tables -// would make a single 100+ MB translation unit). -// - .github/scripts/check_inl_sources.py checks these rules (every *.inl is reachable from -// this file, directly or through another *.inl, starts with the guard below, and the ones -// included here compile on their own); CI runs it, and it can be run locally with the -// command line in .github/workflows/SourceCheck.yml. - +// - Add a small implementation as *.inl to the matching hub: lgfx_v1.cpp for sprites, +// buttons and misc, lgfx_v1_panel.cpp for panels, lgfx_v1_touch.cpp for touch, or +// lgfx_v1_platforms.cpp for platform back ends. Keep implementations with large +// tables in standalone *.cpp files, and update the CMake source lists and SourceCheck. +// - LovyanGFX and M5GFX share this source tree but keep their own hub include lists +// because their supported panels and platforms differ; update both. +// - File-local names are visible to later includes within the same hub. Use names +// identifying the file (or class members), and #undef helper macros at the end. +// Dependencies across translation units need declarations in shared headers. +// - Platform directories are self-guarded. Desktop back ends follow the selection +// in platforms/common.hpp (LGFX_PLATFORM_*). Keep the platform hub's "must precede" +// includes in order: FrameBufferBase provides cache helpers and esp32/common +// provides reg() / writereg(). +// - C decoders in src/lgfx/utility and font tables in src/lgfx/Fonts stay separate +// translation units (third-party file-local names collide; the font tables would +// make a single 100+ MB translation unit). +// - .github/scripts/check_inl_sources.py checks reachability, guards, allowed sources, +// and ownership by exactly one hub. It also compiles each direct *.inl include on +// its own; run the commands in .github/workflows/SourceCheck.yml locally. #define LGFX_V1_IMPLEMENTATION -#include "LGFXBase.inl" #include "LGFX_Sprite.inl" #include "LGFX_Button.inl" -#include "lgfx_fonts.inl" - #include "misc/DividedFrameBuffer.inl" #include "misc/SpriteBuffer.inl" #include "misc/common_function.inl" #include "misc/pixelcopy.inl" -#include "panel/Panel_AMOLED.inl" -#include "panel/Panel_Device.inl" -#include "panel/Panel_ED2208.inl" -#include "panel/Panel_EPDiy.inl" -#include "panel/Panel_FrameBufferBase.inl" // must precede platforms/esp32/Panel_EPD.inl (provides cacheWriteBack / Cache_WriteBack_Addr) -#include "panel/Panel_GDEW0154D67.inl" -#include "panel/Panel_GDEW0154M09.inl" -#include "panel/Panel_HasBuffer.inl" -#include "panel/Panel_IT8951.inl" -#include "panel/Panel_LCD.inl" -#include "panel/Panel_M5HDMI.inl" -#include "panel/Panel_M5UnitGLASS.inl" -#include "panel/Panel_M5UnitLCD.inl" -#include "panel/Panel_SSD1306.inl" -#include "panel/Panel_SSD1677.inl" -#include "panel/Panel_TM1680.inl" - -#include "touch/Touch_CHSC6540.inl" -#include "touch/Touch_CSTxxx.inl" -#include "touch/Touch_FT5x06.inl" -#include "touch/Touch_GT911.inl" - -#include "platforms/esp32/common.inl" // must precede the other esp32* files (provides reg() / writereg()) -#include "platforms/esp32/Bus_EPD.inl" -#include "platforms/esp32/Bus_I2C.inl" -#include "platforms/esp32/Bus_Parallel8.inl" -#include "platforms/esp32/Bus_SPI.inl" -#include "platforms/esp32/Light_PWM.inl" -#include "platforms/esp32/Panel_CVBS.inl" -#include "platforms/esp32/Panel_EPD.inl" - -#include "platforms/esp32c3/Bus_Parallel8.inl" -#include "platforms/esp32p4/Bus_DSI.inl" -#include "platforms/esp32p4/Panel_DSI.inl" -#include "platforms/esp32p4/Panel_LT8912B.inl" -#include "platforms/esp32p4/Touch_ST7123.inl" -#include "platforms/esp32s2/Bus_Parallel16.inl" -#include "platforms/esp32s2/Bus_Parallel8.inl" -#include "platforms/esp32s3/Bus_Parallel16.inl" -#include "platforms/esp32s3/Bus_Parallel8.inl" - -#include "platforms/framebuffer/Panel_fb.inl" -#include "platforms/framebuffer/common.inl" -#include "platforms/sdl/Panel_sdl.inl" -#include "platforms/sdl/common.inl" - #undef LGFX_V1_IMPLEMENTATION diff --git a/src/lgfx/v1/lgfx_v1_panel.cpp b/src/lgfx/v1/lgfx_v1_panel.cpp new file mode 100644 index 00000000..018b16c1 --- /dev/null +++ b/src/lgfx/v1/lgfx_v1_panel.cpp @@ -0,0 +1,20 @@ +// See lgfx_v1.cpp for the translation unit layout and maintenance notes. + +#define LGFX_V1_IMPLEMENTATION + +#include "panel/Panel_AMOLED.inl" +#include "panel/Panel_Device.inl" +#include "panel/Panel_ED2208.inl" +#include "panel/Panel_EPDiy.inl" +#include "panel/Panel_GDEW0154D67.inl" +#include "panel/Panel_GDEW0154M09.inl" +#include "panel/Panel_HasBuffer.inl" +#include "panel/Panel_IT8951.inl" +#include "panel/Panel_LCD.inl" +#include "panel/Panel_M5UnitGLASS.inl" +#include "panel/Panel_M5UnitLCD.inl" +#include "panel/Panel_SSD1306.inl" +#include "panel/Panel_SSD1677.inl" +#include "panel/Panel_TM1680.inl" + +#undef LGFX_V1_IMPLEMENTATION diff --git a/src/lgfx/v1/lgfx_v1_platforms.cpp b/src/lgfx/v1/lgfx_v1_platforms.cpp new file mode 100644 index 00000000..b17bb801 --- /dev/null +++ b/src/lgfx/v1/lgfx_v1_platforms.cpp @@ -0,0 +1,28 @@ +// See lgfx_v1.cpp for the translation unit layout and maintenance notes. + +#define LGFX_V1_IMPLEMENTATION + +#include "panel/Panel_FrameBufferBase.inl" // must precede platforms/esp32/Panel_EPD.inl (provides cacheWriteBack / Cache_WriteBack_Addr) +#include "platforms/esp32/common.inl" // must precede the other esp32* files (provides reg() / writereg()) +#include "platforms/esp32/Bus_EPD.inl" +#include "platforms/esp32/Bus_I2C.inl" +#include "platforms/esp32/Bus_Parallel8.inl" +#include "platforms/esp32/Bus_SPI.inl" +#include "platforms/esp32/Light_PWM.inl" +#include "platforms/esp32/Panel_CVBS.inl" +#include "platforms/esp32/Panel_EPD.inl" +#include "platforms/esp32c3/Bus_Parallel8.inl" +#include "platforms/esp32p4/Bus_DSI.inl" +#include "platforms/esp32p4/Panel_DSI.inl" +#include "platforms/esp32p4/Panel_LT8912B.inl" +#include "platforms/esp32p4/Touch_ST7123.inl" +#include "platforms/esp32s2/Bus_Parallel16.inl" +#include "platforms/esp32s2/Bus_Parallel8.inl" +#include "platforms/esp32s3/Bus_Parallel16.inl" +#include "platforms/esp32s3/Bus_Parallel8.inl" +#include "platforms/framebuffer/Panel_fb.inl" +#include "platforms/framebuffer/common.inl" +#include "platforms/sdl/Panel_sdl.inl" +#include "platforms/sdl/common.inl" + +#undef LGFX_V1_IMPLEMENTATION diff --git a/src/lgfx/v1/lgfx_v1_touch.cpp b/src/lgfx/v1/lgfx_v1_touch.cpp new file mode 100644 index 00000000..cce0d3df --- /dev/null +++ b/src/lgfx/v1/lgfx_v1_touch.cpp @@ -0,0 +1,10 @@ +// See lgfx_v1.cpp for the translation unit layout and maintenance notes. + +#define LGFX_V1_IMPLEMENTATION + +#include "touch/Touch_CHSC6540.inl" +#include "touch/Touch_CSTxxx.inl" +#include "touch/Touch_FT5x06.inl" +#include "touch/Touch_GT911.inl" + +#undef LGFX_V1_IMPLEMENTATION diff --git a/src/lgfx/v1/panel/Panel_M5HDMI.inl b/src/lgfx/v1/panel/Panel_M5HDMI.cpp similarity index 99% rename from src/lgfx/v1/panel/Panel_M5HDMI.inl rename to src/lgfx/v1/panel/Panel_M5HDMI.cpp index 715003d5..70f3a9ee 100644 --- a/src/lgfx/v1/panel/Panel_M5HDMI.inl +++ b/src/lgfx/v1/panel/Panel_M5HDMI.cpp @@ -15,9 +15,6 @@ Original Source: [mongonta0716](https://github.com/mongonta0716) [tobozo](https://github.com/tobozo) /----------------------------------------------------------------------------*/ -#ifndef LGFX_V1_IMPLEMENTATION -#error "Panel_M5HDMI.inl is part of lgfx_v1.cpp and is not meant to be included on its own" -#endif #if defined (ESP_PLATFORM) #include diff --git a/src/lgfx/v1/platforms/esp32/Bus_SPI.inl b/src/lgfx/v1/platforms/esp32/Bus_SPI.inl index 69089094..18fb31f0 100644 --- a/src/lgfx/v1/platforms/esp32/Bus_SPI.inl +++ b/src/lgfx/v1/platforms/esp32/Bus_SPI.inl @@ -54,7 +54,12 @@ Contributors: #endif #if __has_include () + #pragma GCC diagnostic push + #if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic ignored "-Wliteral-suffix" + #endif #include + #pragma GCC diagnostic pop #else #include #endif diff --git a/src/lgfx/v1/platforms/esp32/Panel_CVBS.inl b/src/lgfx/v1/platforms/esp32/Panel_CVBS.inl index 63bb075d..1d440eed 100644 --- a/src/lgfx/v1/platforms/esp32/Panel_CVBS.inl +++ b/src/lgfx/v1/platforms/esp32/Panel_CVBS.inl @@ -62,7 +62,12 @@ Inspiration Sources: #if __has_include() // ESP-IDF v5 + #pragma GCC diagnostic push + #if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic ignored "-Wliteral-suffix" + #endif #include + #pragma GCC diagnostic pop #endif #include diff --git a/src/lgfx/v1/platforms/esp32/common.inl b/src/lgfx/v1/platforms/esp32/common.inl index bd1286da..2d9d9e95 100644 --- a/src/lgfx/v1/platforms/esp32/common.inl +++ b/src/lgfx/v1/platforms/esp32/common.inl @@ -93,7 +93,12 @@ Contributors: #endif #if __has_include () + #pragma GCC diagnostic push + #if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic ignored "-Wliteral-suffix" + #endif #include + #pragma GCC diagnostic pop #else #include #endif