-
Notifications
You must be signed in to change notification settings - Fork 319
Low memory mode #1239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mutatrum
wants to merge
4
commits into
bitaxeorg:master
Choose a base branch
from
mutatrum:low-memory-mode
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Low memory mode #1239
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BitMaker-hub
pushed a commit
to BitronicsLabs/ESP-Miner
that referenced
this pull request
Nov 27, 2025
Add conditional initialization to support devices without PSRAM, preventing crashes and ensuring basic functionality remains operational. Changes: - Skip BAP initialization when PSRAM unavailable - Skip statistics and hashrate monitor tasks when no PSRAM detected - Add clear warning messages for low memory mode - Mining core functionality remains unaffected Based on upstream PR: bitaxeorg#1239 This allows devices with misconfigured or missing PSRAM to boot successfully and mine normally, with only non-critical features disabled (BAP, statistics logging). Web UI remains fully accessible.
Collaborator
|
@mutatrum Can you pls resolve conflicts so I can push some frontend improvements. |
BitMaker-hub
pushed a commit
to BitronicsLabs/ESP-Miner
that referenced
this pull request
Nov 28, 2025
Additional fixes to prevent crashes on devices without PSRAM by adding fallback to internal RAM for critical allocations. Changes: - ASIC task: Use malloc() fallback for job buffers when no PSRAM - LVGL display: Use MALLOC_CAP_INTERNAL when no PSRAM - Websocket task: Disable completely in low memory mode These allocations were causing immediate crashes on boot before the conditional task creation in main.c could take effect. Related to: bitaxeorg#1239
BitMaker-hub
pushed a commit
to BitronicsLabs/ESP-Miner
that referenced
this pull request
Nov 28, 2025
Critical fix: Disable forced PSRAM requirements in ESP-IDF config to allow device to boot when PSRAM is not present or misconfigured. Changes: - Disable CONFIG_SPIRAM_MODE_OCT (was forcing Octal mode) - Disable CONFIG_SPIRAM_ALLOW_BSS_SEG_EXTERNAL_MEMORY (crash if no PSRAM) - Enable CONFIG_SPIRAM_IGNORE_INIT_FAIL (boot even if PSRAM init fails) - Keep CONFIG_SPIRAM_IGNORE_NOTFOUND enabled This prevents the bootloader from aborting with: 'E cpu_start: Failed to init external RAM!' Related to: bitaxeorg#1239
BitMaker-hub
pushed a commit
to BitronicsLabs/ESP-Miner
that referenced
this pull request
Nov 28, 2025
Self-test was aborting boot when PSRAM not found, preventing device from running in low memory mode. Changes: - Skip PSRAM test failure in low memory mode - Show 'PSRAM:NONE' message instead of 'PSRAM:FAIL' - Continue self-test execution when no PSRAM detected - Only fail if PSRAM was expected but initialization failed This allows factory self-test to complete successfully on devices without PSRAM, entering low memory mode normally. Related to: bitaxeorg#1239
BitMaker-hub
pushed a commit
to BitronicsLabs/ESP-Miner
that referenced
this pull request
Dec 15, 2025
Critical fix: hashrate_monitor_task is essential for display updates, it cannot be disabled even in low memory mode. Instead, make it use internal RAM when PSRAM is unavailable. Problem: - Previous implementation disabled hashrate_monitor_task without PSRAM - This task updates SYSTEM_MODULE->current_hashrate shown on display - Display would show "Gh/s: --" and appear frozen without this task Solution: - Modified hashrate_monitor_task to use MALLOC_CAP_INTERNAL when no PSRAM - Task stack also uses internal RAM via task_mem_caps variable - Only statistics_task remains disabled (non-critical for display/mining) Impact: - Display now works perfectly in low memory mode - Hashrate, temperature, and all stats update normally - Small RAM footprint (~3KB for measurements + 8KB stack) Related to: bitaxeorg#1239
BitMaker-hub
pushed a commit
to BitronicsLabs/ESP-Miner
that referenced
this pull request
Dec 15, 2025
Comprehensive audit revealed 3 more critical hardcoded SPIRAM usages that would cause crashes without PSRAM. Added automatic fallback to internal RAM for all of them. Problems fixed: 1. LVGL memory pool (lv_conf.h) - MOST CRITICAL - All LVGL allocations were hardcoded to SPIRAM - Would crash immediately on any display operation - Now tries SPIRAM first, falls back to internal RAM 2. DNS server task (dns_server.c) - CRITICAL - Task creation hardcoded to SPIRAM - Would crash when enabling AP mode (captive portal) - Now falls back to internal RAM automatically 3. Stratum heartbeat task (stratum_task.c) - CRITICAL - Heartbeat task hardcoded to SPIRAM - Would crash when connecting to mining pool - Now falls back to internal RAM automatically Solution: Changed all from MALLOC_CAP_SPIRAM to MALLOC_CAP_SPIRAM | MALLOC_CAP_INTERNAL This makes FreeRTOS automatically use internal RAM if SPIRAM unavailable. Impact: - Prevents 3 different crash scenarios in low memory mode - Mining, display, WiFi AP, and pool connection all work now - Total additional RAM usage: ~24KB (3 x 8KB task stacks) Related to: bitaxeorg#1239
BitMaker-hub
pushed a commit
to BitronicsLabs/ESP-Miner
that referenced
this pull request
Dec 15, 2025
After comprehensive RAM analysis, determined that ESP32-S3 has sufficient internal RAM (~320KB) to run both statistics and websocket features even without PSRAM. Memory usage analysis shows safe margins. Changes: 1. Statistics task - ENABLED with internal RAM fallback - Modified statistics_task.c buffer allocation to use fallback - Task always created, uses MALLOC_CAP_SPIRAM | MALLOC_CAP_INTERNAL - Buffer grows gradually (0→32KB over 1 hour) - Enables historical stats graphs in AxeOS 2. Websocket logs - ENABLED with internal RAM fallback - Modified http_server.c to always create websocket task - Modified websocket.c queue to use standard xQueueCreate - Only ~8.5KB overhead, mostly unused without connected clients - Enables live log streaming in Web UI for debugging RAM Analysis (see MEMORY_ANALYSIS.md): - Base system: ~130-140KB - With statistics + websocket at boot: ~173KB used, 147KB free (46%) - Worst case after 1 hour: ~217KB used, 103KB free (32%) - Minimum recommended free: 80KB (25%) - Safety margin: Excellent ✅ Benefits: - Full AxeOS functionality (statistics graphs work) - Better debugging experience (websocket logs) - Only BAP remains disabled (rarely used, 26KB overhead) Impact: Low memory mode now has nearly full feature parity with PSRAM mode, only missing BAP protocol which is non-essential for most users. Related to: bitaxeorg#1239
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Skip statistics and bap when no PSRAM detected, adds warnings.
Runs with ~30kb free memory. Without this change, everything starts crashing and AxeOS is not reachable if PSRAM is not there or not configured correctly.
See #1234 and #826