Skip to content

Add support for TrimUI Smart Pro S (tg5050)#116

Merged
nchapman merged 8 commits into
developfrom
feature/trimuismartpro
Jan 5, 2026
Merged

Add support for TrimUI Smart Pro S (tg5050)#116
nchapman merged 8 commits into
developfrom
feature/trimuismartpro

Conversation

@nchapman
Copy link
Copy Markdown
Collaborator

@nchapman nchapman commented Jan 5, 2026

No description provided.

New platform for the Allwinner A523-based Smart Pro S device. Key
differences from TG5040: sysfs backlight control, DAC Volume mixer, GPIO
236 rumble, dual-cluster CPU with schedutil governor.

Includes platform implementation, libmsettings, boot scripts, init
configuration, and tool pak support.
Use cached emulator lookups in hasRoms() instead of filesystem exists()
calls.
SDL_ttf 2.0.18's NORMAL hinting mode has a major performance regression
in TTF_SizeUTF8 (~5x slower than 2.0.15). This caused 11+ second boot
delays on tg5050 during option initialization.

Changes:
- Set TTF_HINTING_NONE for all fonts (restores performance)
- Optimize GFX_truncateText with binary search (O(log n) vs O(n))
- Optimize GFX_wrapText with word-based measurement
- Add character-precise partial word fitting for small screens
- Add millisecond-precision timestamps to log.c for debugging
- Add comprehensive tests for text wrapping optimizations

Result: tg5050 boot time reduced from 11.2s to 195ms (57x faster).
Enhanced clean target to remove platform-specific build artifacts:
- All .o and .elf files in workspace
- Platform-specific third-party binaries (DinguxCommander, 351files)
- Added .so files to .gitignore for libmsettings builds

Fixes issue where 615+ object files were left after clean, causing
toolchain version conflicts when switching compilers.
Changed from = to += to allow platform-specific flags to be appended
rather than overridden. Enables platforms to add EXTRA_CFLAGS without
losing base compilation flags.

Also fixed buffer size in launcher.c (auto_path, m3u_path) to use
MAX_PATH constant instead of hardcoded 256.
Platform configuration:
- Allwinner A523 SoC (8x Cortex-A55 dual-cluster, ARM64)
- 1280x720 display with Mali GPU (OpenGL ES 3.2)
- Optimized build flags: -mcpu=cortex-a55 -O3 -Ofast -flto
- OpenGL ES 2.0 rendering support
- Uses custom GCC 10.3 ARM64 toolchain (linux/arm64)
Copilot AI review requested due to automatic review settings January 5, 2026 05:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds comprehensive support for the TrimUI Smart Pro S (tg5050), a new handheld gaming device based on the Allwinner A523 SoC. Despite sharing the same form factor as the Smart Pro (tg5040), the Smart Pro S uses completely different hardware requiring platform-specific implementations for backlight, audio, rumble, and CPU management.

Key changes:

  • New tg5050 platform implementation with hardware abstraction layer for A523 SoC
  • Optimizations to common code including binary search for text truncation and word-based text wrapping for improved performance
  • Enhanced logging with millisecond-precision timestamps and detailed SDL initialization debug logging

Reviewed changes

Copilot reviewed 45 out of 54 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
workspace/tg5050/show/show.c Boot splash screen display utility using SDL2 with rotation support for install/update screens
workspace/tg5050/platform/platform.h Hardware definitions including button mappings, GPIO pins, display specs, and joystick axis assignments
workspace/tg5050/platform/platform.c Platform implementation for video, input, power, audio, and LED control using shared SDL2 backend
workspace/tg5050/libmsettings/msettings.c Settings library with A523-specific controls for volume (tinyalsa), backlight (sysfs), and speaker mute
workspace/tg5050/install/boot.sh Boot/install/update handler with schedutil governor configuration for dual-cluster CPU
workspace/tg5050/install/update.sh Post-install script for updating system files
workspace/tg5050/Makefile Platform build orchestration
workspace/all/paks/LessUI/platforms/tg5050/init.sh Platform initialization script with GPIO setup, audio unmuting, and daemon startup
workspace/all/common/log.c Enhanced timestamp format with milliseconds (HH:MM:SS.mmm)
workspace/all/common/gfx_text.c Performance optimizations using binary search for truncation and word-based wrapping
workspace/all/common/api.c Additional SDL initialization debug logging and font hinting configuration
workspace/all/player/player.c Debug logging additions for core loading and initialization tracking
workspace/all/launcher/launcher.c Optimized ROM detection using cached emulator lookup instead of repeated filesystem checks
workspace/all/paks/Tools/*/pak.json Added tg5050 to supported platforms for WiFi, Input, Clock, and Bootlogo tools
skeleton/SYSTEM/tg5050/* System configuration files, binaries, and directory structure
toolchains.json Toolchain configuration for tg5050 (uses linux/arm64 platform)
Makefile Added tg5050 to default platform list and enhanced clean targets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread workspace/tg5050/platform/platform.c
Comment thread workspace/tg5050/platform/platform.c Outdated
Comment thread workspace/tg5050/libmsettings/msettings.c Outdated
Comment thread workspace/tg5050/show/show.c Outdated
Comment thread workspace/tg5050/libmsettings/msettings.c
Comment thread workspace/tg5050/libmsettings/msettings.c
Comment thread workspace/tg5050/install/boot.sh Outdated
Comment thread workspace/tg5050/Makefile
- Fix rumble off-by-one: max strength (0xFFFF) now works correctly
- Add error handling for shm_open/mmap failures in msettings
- Add getenv NULL check with fallback path for USERDATA_PATH
- Fix show.c rotation rectangle for portrait displays
- Quote command substitution in boot.sh
@nchapman nchapman merged commit ad894b6 into develop Jan 5, 2026
6 checks passed
@nchapman nchapman deleted the feature/trimuismartpro branch January 5, 2026 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants