Skip to content

Firmware Code Book Blue

andy diller edited this page Jun 25, 2024 · 3 revisions

FujiNet Firmware Diving

We will start at the beginning with

main.cpp

Here's a summary of its key components:

  1. Platform-specific conditional compilation:

    • Differentiates between ESP platform (likely ESP32) and other platforms (Windows, Linux, macOS).
  2. Includes various headers for different functionalities:

    • Debug, bus, device, WiFi, filesystem, HTTP service, Bluetooth (if supported), and more.
  3. Main setup function:

    • Initializes hardware, loads configuration, sets up file systems.
    • Creates and configures various devices based on the target platform (e.g., printers, modems).
    • Sets up different bus systems (SIO, IEC, ComLynx, RS232, etc.) depending on the build target.
  4. Main service loop:

    • Handles continuous operations like servicing the active bus system.
    • Manages WiFi or Bluetooth connections.
    • On non-ESP platforms, it also handles HTTP service and task management.
  5. Platform-specific main entry points:

    • For ESP platform: app_main() function that creates a high-priority task for the main loop.
    • For other platforms: Standard main() function that calls setup and enters the service loop.
  6. Shutdown and reboot handling:

    • Includes functions to handle graceful shutdown and reboot scenarios.

The code is designed to be highly modular and adaptable to different hardware platforms and configurations, with extensive use of conditional compilation to include or exclude features based on the target system.

Clone this wiki locally