-
Notifications
You must be signed in to change notification settings - Fork 0
Fix issue Bad flash memory Usage #612
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
base: development
Are you sure you want to change the base?
Changes from all commits
22a2656
c0afad2
7e83b03
7a2408b
fdb3e2b
6468d31
ee248b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| release: patch | ||
| summary: add a FLASH_ST in .ld to keep the flash information that is not code |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,7 +41,9 @@ | |||||||||||||||||||||||||||||
| /* Entry Point */ | ||||||||||||||||||||||||||||||
| ENTRY(Reset_Handler) | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| /* Highest address of the user mode stack */ | ||||||||||||||||||||||||||||||
| _sstack = ORIGIN(DTCMRAM); | ||||||||||||||||||||||||||||||
| _estack = ORIGIN(DTCMRAM) + LENGTH(DTCMRAM); /* end of RAM */ | ||||||||||||||||||||||||||||||
| /* Generate a link error if heap and stack don't fit into RAM */ | ||||||||||||||||||||||||||||||
| _Min_Heap_Size = 0x200 ; /* required amount of heap */ | ||||||||||||||||||||||||||||||
|
|
@@ -52,7 +54,9 @@ MEMORY | |||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K | ||||||||||||||||||||||||||||||
| DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K | ||||||||||||||||||||||||||||||
| FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K-128K | ||||||||||||||||||||||||||||||
| FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K-128K - 128K | ||||||||||||||||||||||||||||||
| FLASH_ST (rx) : ORIGIN = 0x080C0000, LENGTH = 128K | ||||||||||||||||||||||||||||||
| FLASH_BT (rx) : ORIGIN = 0x080E0000, LENGTH = 128K | ||||||||||||||||||||||||||||||
| RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 320K | ||||||||||||||||||||||||||||||
| RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 32K | ||||||||||||||||||||||||||||||
| RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 16K | ||||||||||||||||||||||||||||||
|
|
@@ -89,6 +93,8 @@ SECTIONS | |||||||||||||||||||||||||||||
| .text : | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| . = ALIGN(4); | ||||||||||||||||||||||||||||||
| _stext = .; | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| *(.text) /* .text sections (code) */ | ||||||||||||||||||||||||||||||
| *(.text*) /* .text* sections (code) */ | ||||||||||||||||||||||||||||||
| *(.glue_7) /* glue arm to thumb code */ | ||||||||||||||||||||||||||||||
|
|
@@ -111,6 +117,14 @@ SECTIONS | |||||||||||||||||||||||||||||
| . = ALIGN(4); | ||||||||||||||||||||||||||||||
| } >RAM_D1 | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| .hardfault_stack (NOLOAD) : /*Stack memory to avoid memfault inside hardfault handler*/ | ||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||
| . = ALIGN(8); | ||||||||||||||||||||||||||||||
| _hf_stack_start = .; | ||||||||||||||||||||||||||||||
| . += 0x400; /* 1 KB */ | ||||||||||||||||||||||||||||||
| _hf_stack_end = .; | ||||||||||||||||||||||||||||||
| } >DTCMRAM | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
Comment on lines
+120
to
+127
|
||||||||||||||||||||||||||||||
| .hardfault_stack (NOLOAD) : /*Stack memory to avoid memfault inside hardfault handler*/ | |
| { | |
| . = ALIGN(8); | |
| _hf_stack_start = .; | |
| . += 0x400; /* 1 KB */ | |
| _hf_stack_end = .; | |
| } >DTCMRAM |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new .hardfault_stack reserved region and symbols (_hf_stack_start/_hf_stack_end) are not referenced anywhere in the repo (no code/asm uses them), so this change currently just consumes 1KB of DTCMRAM without affecting HardFault behavior. Either wire these symbols into the HardFault handler to actually switch to the dedicated stack, or remove the reserved section to avoid wasting memory.
| .hardfault_stack (NOLOAD) : /*Stack memory to avoid memfault inside hardfault handler*/ | |
| { | |
| . = ALIGN(8); | |
| _hf_stack_start = .; | |
| . += 0x400; /* 1 KB */ | |
| _hf_stack_end = .; | |
| } >DTCMRAM |
Copilot
AI
Apr 1, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HardfaultTrace.h now depends on linker-provided symbols _hf_log and _metadata, but this RAM linker script does not define .hardfault_log / .metadata_pool sections nor PROVIDE(_hf_log=...) / PROVIDE(_metadata=...). Builds that use STM32H723ZGTX_RAM.ld and link HardfaultTrace.c will fail with undefined symbols (or point at the wrong address). Add equivalent FLASH_ST sections + PROVIDE symbols here, or conditionally compile out HardFault/metadata flash usage for the RAM build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.hardfault_logand.metadata_poolreserve flash space by advancing.(0x200 / 0x100), which means the built image will contain data for those addresses. If these regions are intended to persist runtime-written logs/metadata across firmware reflashes, consider marking the sectionsNOLOADand/or ensuring the flashing process does not program/eraseFLASH_ST, otherwise flashing the firmware will overwrite any stored log/metadata.