🩹 Fix memory visualizer, ProUI conditionals (#28360)
This commit is contained in:
@@ -46,13 +46,13 @@
|
||||
#include "../../lcd/extui/ui_api.h"
|
||||
#endif
|
||||
|
||||
#if HAS_PROUI_MESH_EDIT
|
||||
#if ALL(HAS_MESH, DWIN_LCD_PROUI)
|
||||
#include "../../lcd/dwin/proui/bedlevel_tools.h"
|
||||
#endif
|
||||
|
||||
bool leveling_is_valid() {
|
||||
return (
|
||||
#if HAS_PROUI_MESH_EDIT
|
||||
#if ALL(HAS_MESH, DWIN_LCD_PROUI)
|
||||
bedLevelTools.meshValidate()
|
||||
#else
|
||||
TERN1(HAS_MESH, bedlevel.mesh_is_valid())
|
||||
|
||||
@@ -581,9 +581,6 @@
|
||||
#define DO_LIST_BIN_FILES 1
|
||||
#define LCD_BRIGHTNESS_DEFAULT 127
|
||||
#define STATUS_DO_CLEAR_EMPTY
|
||||
#if HAS_MESH
|
||||
#define HAS_PROUI_MESH_EDIT 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Serial Controllers require LCD_SERIAL_PORT
|
||||
|
||||
@@ -400,6 +400,14 @@
|
||||
#ifndef Z_PROBE_ERROR_TOLERANCE
|
||||
#define Z_PROBE_ERROR_TOLERANCE Z_CLEARANCE_MULTI_PROBE
|
||||
#endif
|
||||
#if ENABLED(DWIN_LCD_PROUI) && DISABLED(BD_SENSOR)
|
||||
#ifndef MULTIPLE_PROBING
|
||||
#define MULTIPLE_PROBING 2
|
||||
#endif
|
||||
#ifdef EXTRA_PROBING
|
||||
#undef EXTRA_PROBING // Not used with MULTIPLE_PROBING
|
||||
#endif
|
||||
#endif
|
||||
#if MULTIPLE_PROBING > 1
|
||||
#if EXTRA_PROBING > 0
|
||||
#define TOTAL_PROBING (MULTIPLE_PROBING + EXTRA_PROBING)
|
||||
@@ -503,6 +511,12 @@
|
||||
#if !HAS_MESH
|
||||
#undef MESH_INSET
|
||||
#endif
|
||||
#if ALL(DWIN_LCD_PROUI, HAS_MESH)
|
||||
#define HAS_PROUI_MESH_EDIT 1
|
||||
#ifndef MESH_INSET
|
||||
#define MESH_INSET 10
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if NONE(PROBE_SELECTED, AUTO_BED_LEVELING_UBL)
|
||||
#undef Z_CLEARANCE_BETWEEN_PROBES
|
||||
|
||||
@@ -4465,12 +4465,12 @@ void drawMaxAccelMenu() {
|
||||
}
|
||||
|
||||
void centerMeshArea() {
|
||||
float max = (mesh_min.x + mesh_min.y) * 0.5f;
|
||||
NOLESS(max, (X_BED_SIZE) - mesh_max.x);
|
||||
NOLESS(max, mesh_min.y);
|
||||
NOLESS(max, (Y_BED_SIZE) - mesh_min.y);
|
||||
mesh_min.set(max, max);
|
||||
mesh_max.set((X_BED_SIZE) - max, (Y_BED_SIZE) - max);
|
||||
const float half_width = 0.5 * (mesh_max.x - mesh_min.x);
|
||||
const float half_height = 0.5 * (mesh_max.y - mesh_min.y);
|
||||
const float half_extent = min(min(half_width, half_height), min((float)X_CENTER, (float)Y_CENTER));
|
||||
|
||||
mesh_min.set(X_CENTER - half_extent, Y_CENTER - half_extent);
|
||||
mesh_max.set(X_CENTER + half_extent, Y_CENTER + half_extent);
|
||||
resetMeshInset();
|
||||
redrawMenu();
|
||||
}
|
||||
|
||||
@@ -33,14 +33,17 @@
|
||||
#include <stddef.h>
|
||||
#include "../../../core/types.h"
|
||||
|
||||
//#define TJC_DISPLAY // Enable for TJC display
|
||||
//#define DACAI_DISPLAY // Enable for DACAI display
|
||||
//#define TITLE_CENTERED // Center Menu Title Text
|
||||
//#define TJC_DISPLAY // Enable for TJC display
|
||||
//#define DACAI_DISPLAY // Enable for DACAI display
|
||||
//#define TITLE_CENTERED // Center Menu Title Text
|
||||
|
||||
#if defined(__STM32F1__) || defined(STM32F1)
|
||||
#define DASH_REDRAW 1
|
||||
#endif
|
||||
|
||||
#define HAS_FEEDRATE_EDIT 1 // Feedrate percentage
|
||||
#define HAS_FLOW_EDIT 1 // Flow percentage
|
||||
|
||||
#if DISABLED(PROBE_MANUALLY) && ANY(AUTO_BED_LEVELING_BILINEAR, AUTO_BED_LEVELING_LINEAR, AUTO_BED_LEVELING_3POINT, AUTO_BED_LEVELING_UBL)
|
||||
#define HAS_ONESTEP_LEVELING 1
|
||||
#endif
|
||||
@@ -119,13 +122,4 @@
|
||||
#if HAS_PROUI_MESH_EDIT
|
||||
#define Z_OFFSET_MIN -3.0 // (mm)
|
||||
#define Z_OFFSET_MAX 3.0 // (mm)
|
||||
#ifndef MESH_INSET
|
||||
#define MESH_INSET 10
|
||||
#endif
|
||||
#define MIN_MESH_INSET 0
|
||||
#define MAX_MESH_INSET X_BED_SIZE
|
||||
#endif
|
||||
|
||||
#ifndef MULTIPLE_PROBING
|
||||
#define MULTIPLE_PROBING 0
|
||||
#endif
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Visualize memory map
|
||||
#
|
||||
# Memory Map Visualizer for Marlin Firmware (AVR and ARM/STM32)
|
||||
# Generates an interactive HTML page showing memory layout with color coding
|
||||
# Uses nm to extract symbols from ELF file
|
||||
#
|
||||
# Author: Dust
|
||||
# Additional contributor: Thomas Toka (Windows support)
|
||||
# Implementation assistance: Claude Sonnet 4.5
|
||||
#
|
||||
"""
|
||||
Visualize memory map
|
||||
|
||||
Memory Map Visualizer for Marlin Firmware (AVR and ARM/STM32)
|
||||
Generates an interactive HTML page showing memory layout with color coding
|
||||
Uses nm to extract symbols from ELF file
|
||||
|
||||
Author: Dust
|
||||
Additional contributor: Thomas Toka (Windows support)
|
||||
Implementation assistance: Claude Sonnet 4.5
|
||||
"""
|
||||
|
||||
import re
|
||||
import sys
|
||||
@@ -20,7 +20,6 @@ import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
from collections import defaultdict
|
||||
import glob
|
||||
|
||||
def parse_size(size_str):
|
||||
"""Parse size string with optional KB/MB suffix to bytes.
|
||||
@@ -391,7 +390,6 @@ def categorize_symbol(name, warn_conflicts=False):
|
||||
# Warn if multiple categories match
|
||||
if warn_conflicts and len(matches) > 1:
|
||||
categories = [m[0] for m in matches]
|
||||
patterns_matched = [m[1] for m in matches]
|
||||
print(f" ⚠ Ambiguous: '{name}' matches {len(matches)} categories: {', '.join([f'{c} ({p})' for c, p in matches])} → using {categories[0]}")
|
||||
|
||||
# Return first match or 'Other'
|
||||
@@ -403,15 +401,15 @@ def categorize_symbol(name, warn_conflicts=False):
|
||||
def categorize_section(section_name):
|
||||
"""Categorize section for color coding"""
|
||||
if section_name.startswith('.text'):
|
||||
return 'code', '#4CAF50', 'flash' # Green for code
|
||||
return 'code', '#4CAF50', 'flash' # Green code
|
||||
elif section_name.startswith('.data'):
|
||||
return 'data', '#2196F3', 'ram' # Blue for initialized data
|
||||
return 'data', '#2196F3', 'ram' # Blue initialized data
|
||||
elif section_name.startswith('.bss'):
|
||||
return 'bss', '#FF9800', 'ram' # Orange for uninitialized data
|
||||
return 'bss', '#FF9800', 'ram' # Orange uninitialized data
|
||||
elif section_name.startswith('.rodata'):
|
||||
return 'rodata', '#9C27B0', 'flash' # Purple for read-only data
|
||||
return 'rodata', '#9C27B0', 'flash' # Purple read-only data
|
||||
else:
|
||||
return 'other', '#757575', 'flash' # Gray for other
|
||||
return 'other', '#757575', 'flash' # Gray other
|
||||
|
||||
def generate_memory_blocks_html(items, module_colors, zoom_level=1, total_memory_size=None, special_symbols=None, arch='avr'):
|
||||
"""Generate HTML for memory blocks as a byte-by-byte map
|
||||
@@ -425,7 +423,6 @@ def generate_memory_blocks_html(items, module_colors, zoom_level=1, total_memory
|
||||
|
||||
# Calculate actual pixels per byte and delimiter size
|
||||
pixels_per_byte = zoom_level * 2
|
||||
delimiter_width = zoom_level * 1
|
||||
|
||||
# Find memory range
|
||||
min_addr = min(item['addr'] for item in items)
|
||||
@@ -557,14 +554,14 @@ def generate_memory_blocks_html(items, module_colors, zoom_level=1, total_memory
|
||||
# Unused space at end
|
||||
if needs_delimiter:
|
||||
html += f' <div class="memory-pixel" style="flex-grow: {count}; background: #1a1a1a;" data-unused="true" data-addr="0x{display_addr:08x}" data-size="{count}" title="Unused: {count} bytes"></div>\n'
|
||||
html += f' <div class="memory-delimiter"></div>\n'
|
||||
html += ' <div class="memory-delimiter"></div>\n'
|
||||
else:
|
||||
html += f' <div class="memory-pixel" style="flex-grow: {count}; background: #1a1a1a;" data-unused="true" data-addr="0x{display_addr:08x}" data-size="{count}" title="Unused: {count} bytes"></div>\n'
|
||||
else:
|
||||
# Gap between symbols - likely linker-inserted code, padding, or alignment
|
||||
if needs_delimiter:
|
||||
html += f' <div class="memory-pixel" style="flex-grow: {count}; background: #3a3a3a;" data-unallocated="true" data-addr="0x{display_addr:08x}" data-size="{count}" title="Linker code/padding: {count} bytes"></div>\n'
|
||||
html += f' <div class="memory-delimiter"></div>\n'
|
||||
html += ' <div class="memory-delimiter"></div>\n'
|
||||
else:
|
||||
html += f' <div class="memory-pixel" style="flex-grow: {count}; background: #3a3a3a;" data-unallocated="true" data-addr="0x{display_addr:08x}" data-size="{count}" title="Linker code/padding: {count} bytes"></div>\n'
|
||||
else:
|
||||
@@ -645,7 +642,7 @@ def check_pattern_conflicts():
|
||||
|
||||
if conflicts:
|
||||
print("Pattern conflict analysis:")
|
||||
for p1, c1, p2, c2, conflict_type in conflicts:
|
||||
for p1, c1, p2, c2 in conflicts:
|
||||
print(f" ℹ '{p1}' ({c1}) vs '{p2}' ({c2}) - '{p1}' has priority")
|
||||
|
||||
return len(conflicts)
|
||||
@@ -719,7 +716,7 @@ def generate_html(symbols, special_symbols, output_path, flash_size, ram_size, a
|
||||
ram_items = []
|
||||
|
||||
for item in symbols:
|
||||
cat, color, mem_type = categorize_section(item['section'])
|
||||
color, mem_type = categorize_section(item['section'])
|
||||
if mem_type == 'flash':
|
||||
total_flash += item['size']
|
||||
module_stats[item['module']]['flash'] += item['size']
|
||||
|
||||
Reference in New Issue
Block a user