Create a gap between the BSS and the stack guard.
Set this gap (STACK_GUARD_MARGIN) to 32 bytes in all variants.
The gap serves two purposes:
- Detect a stack overflow earlier (falsely triggering in overtight
situations is OK!), so that we can hopefully avoid smashing
the heap and have a clean view during the dump.
- Reserve spack space itself for the stack dumping machinery,
which is going to grow the stack even further.
Remove get_stack_guard_test_value() which was unused.
As suggested by @3d-gussner, announce to the host that a dump is
available for retrieval using an action "dump_available".
Any kind of dump is announced (even if manually triggered).
To avoid reading from xflash twice, remove some duplication and return
the crash reason directly in xfdump_check_state().
If MENU_DUMP is enabled, a new entry at the end of the "Support" menu is
added that allows to dump memory for offline use.
This allows to trigger a memory dump at any moment during regular usage
(either idling or printing) and to recover the dump later even after a
hardware reset.
If EMERGENCY_DUMP is defined, crash and dump using the new xflash dump
functionality instead of just continuing with an error message.
When an emergency crash is stored, the first restart after a crash
displays a message that debug data is available and to contact support
to submit the crash for analysis.
Ensure the language data always fits the reserved space in the XFLASH.
The script *should* use the LANG_SIZE definition from "xflash_layout",
which can be obtained by preprocessing the source code.
At the moment though this step has been omitted since running
arduino-builder to preprocess the source requires extra flags passed by
build.sh. The size has been hard-coded (and it's unlikely to change
given the content size is constant for the architecture).
This requires expanding the dcode_core address type to 32bit type,
thus enlarges the D2/D3 implementation as a result.
Still allow to save all the original space if D6 is disabled, for now.
Allow to read up to 0x21ff, which is the last byte of SRAM. Set default
starting address to 0x200, which is the first true byte.
0x0-200 is mapped to register/io space and could cause issues when read
from bi-directional registers.
Farmers want to abuse a bug from the previous firmware releases
- they need to see the filename on the status screen instead of "Wait for user..."
So we won't update the message in farm mode...