Commit Graph

5039 Commits

Author SHA1 Message Date
Yuri D'Elia
96aad0a475 Remove duplication in crash handlers
It's kind of nice that all handlers eventually came to become the same.
2021-06-14 12:38:23 +02:00
Yuri D'Elia
fa0f58d5bc serial_dump: add description about bad_isr 2021-06-14 12:30:24 +02:00
Yuri D'Elia
e90f5d81ec
Merge pull request #7 from leptun/improve_d2
bad ISR catch
2021-06-14 12:27:31 +02:00
Voinea Dragos
8e667a8acd bad ISR catch 2021-06-14 11:30:38 +03:00
Yuri D'Elia
d2041ee2fe Enable debugging features on all variants
- XFlash crash dumper on MK3+ series
- Online crash dumper on MK2.5+ series
- D2/D6 on MK3+ series
- D2 on MK2.5+ series
2021-06-13 22:35:43 +02:00
Yuri D'Elia
7db667ca86 serial_dump_and_reset: turn on print fan while dumping
To avoid scorching the sheet while dumping close to the bed.
2021-06-13 22:28:28 +02:00
Yuri D'Elia
ea51d65137 serial_dump_and_reset: do not completely disable WDT
Set it to 8s which is long enough to complete the dump.
2021-06-12 15:39:37 +02:00
Yuri D'Elia
6de98f7b0d Move inclusion closer to the usage point 2021-06-12 15:33:18 +02:00
Yuri D'Elia
050cf72e98 Move stack checking to the temperature ISR
Now that the stack_error function is truly minimal,
we can check for stack errors much more frequently.

Also move away stack_error from ultralcd to Marlin_main.
2021-06-12 15:23:33 +02:00
Yuri D'Elia
01934b89e9 xflash_dump is now always required in all variants 2021-06-12 15:13:32 +02:00
Yuri D'Elia
449510392d Untangle a bit some recursive include mess 2021-06-12 15:09:03 +02:00
Yuri D'Elia
e28301f391 Report crash also in MK2.5, fix stack_error abuse
Rename EEPROM_CRASH_ACKNOWLEDGED to EEPROM_FW_CRASH_FLAG.

Use EEPROM_FW_CRASH_FLAG to always set the last crash reason, which
simplifies handling between the online/offline variants.

Make stack_error safe, by setting the flag and restarting immediately,
so that the error can be shown after restart.
2021-06-12 14:41:54 +02:00
Yuri D'Elia
bd57e00448 Implement an online crash dumper for MK2.5 boards
When XFLASH is not available, allow users to request _online_ crash
dumps by using D23 (since these require active user cooperation).

Once enabled, instead of just rebooting, dump memory directly to
the serial.

As similarly done with EMERGENCY_DUMP, we have two features that can be
enabled:

EMERGENCY_SERIAL_DUMP: enables dumping on crash after being requested
MENU_SERIAL_DUMP: allow triggering the same manually through the support
menu.
2021-06-12 13:37:20 +02:00
Yuri D'Elia
f7dc8dcaef Fix usage of RAMEND
RAMEND is the last valid address, not one-past as I expected it to be...
2021-06-12 13:16:12 +02:00
Yuri D'Elia
f18d4757c6 Introduce STACK_GUARD_MARGIN in all variants
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.
2021-06-12 12:08:53 +02:00
Yuri D'Elia
9663653671 xfdump_erase: remove redundant XFLASH_SPI_ENTER() 2021-06-12 12:05:02 +02:00
Yuri D'Elia
3187b96ca4 xfdump: report to the host that a dump is available
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().
2021-06-11 19:21:51 +02:00
Yuri D'Elia
31f416fd5e Rename dump_crash_source to dump_crash_reason 2021-06-10 17:35:49 +02:00
Yuri D'Elia
c375610668 Move "WDR dump" inside EMERGENGENCY_DUMP 2021-06-10 17:02:41 +02:00
Yuri D'Elia
63f870c089 Enable the "WDR reset" menu item in DEBUG_BUILD only 2021-06-10 16:30:59 +02:00
Yuri D'Elia
0362b6484f xfdump_full_dump_and_reset: set a guaranteed minimum WDT
Just prior to dumping, reset the WDT to a known-safe (and not too long)
interval that guarantees a complete dump.
2021-06-10 16:30:39 +02:00
Yuri D'Elia
3f7b9b42b2
Merge pull request #6 from leptun/improve_d2
WDT crash detection
2021-06-10 16:02:56 +02:00
Voinea Dragos
0a77f2c02d Dump header as well 2021-06-10 11:58:46 +03:00
Voinea Dragos
094c577e9d Fix XFLASH_DUMP print_mem 2021-06-09 14:10:20 +03:00
Voinea Dragos
1e786c7f55 WDR crash initial 2021-06-09 13:59:26 +03:00
Voinea Dragos
8c3d76f85f Fix millis reference 2021-06-09 12:44:28 +03:00
Yuri D'Elia
fab04dbc6c D6: remove option for unsupported models 2021-06-08 19:53:37 +02:00
Yuri D'Elia
318ee695c2 xfdump_layout: add some comments 2021-06-08 19:50:43 +02:00
Yuri D'Elia
c2e64c8c6e xfdump: fix another off-by-one static size check 2021-06-08 19:08:03 +02:00
Yuri D'Elia
378f239ff0 dcode_code: fix inverted define to print larger types 2021-06-08 18:57:16 +02:00
Yuri D'Elia
56d0848ea9 xfdump: fix size check 2021-06-08 18:43:32 +02:00
Yuri D'Elia
9d3b19b637 xfdump: defensive static checks to ensure dump location always fits 2021-06-08 18:29:55 +02:00
Yuri D'Elia
dcfdce87c7 Document new applicable build options in the variant files
Document, but don't enable them.
Leave exiting functionality unchanged for now.
2021-06-08 18:17:56 +02:00
Yuri D'Elia
c072fbbf02 Dcodes: fix daddr_t type when only XFLASH_DUMP is enabled 2021-06-08 18:14:49 +02:00
Yuri D'Elia
c331c07b16 xfdump: reuse standard definitions for SRAM size/offset 2021-06-08 17:53:06 +02:00
Yuri D'Elia
520f7a2e26 config: add sanity checks for XFLASH_DUMP options 2021-06-08 17:32:14 +02:00
Yuri D'Elia
0e75bc9d8e lang/fw-build.sh: fix padding calculation 2021-06-08 17:24:10 +02:00
Yuri D'Elia
1a88e339bf xfdump: fix build with XFLASH_DUMP disabled 2021-06-08 17:17:18 +02:00
Yuri D'Elia
a6e372e696 Typo 2021-06-08 17:14:22 +02:00
Yuri D'Elia
c31109c750 Implement MENU_DUMP: offline memory dump from "Support"
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.
2021-06-08 16:56:58 +02:00
Yuri D'Elia
c089ac5341 Implement EMERGENCY_DUMP for offline analysis
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.
2021-06-08 16:42:43 +02:00
Yuri D'Elia
e7f78125d3 Merge remote-tracking branch 'panayiotis/FixEepromAddressDocumentation' into improve_d2 2021-06-08 16:18:09 +02:00
Yuri D'Elia
30402e0404 Dcodes: add D20/D21/D22 to generate/read/clear dumps 2021-06-08 15:34:39 +02:00
Yuri D'Elia
8417083b13 lang/fw-build.sh: check for language data size during build
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).
2021-06-08 15:30:05 +02:00
Yuri D'Elia
6dfef76346 xfdump: implement dump-to-xflash functionality
Update xflash_layout to include information about the dump, which sits
at the end of xflash.
2021-06-08 15:28:02 +02:00
Yuri D'Elia
b398a09a4f xflash: add xflash_multipage_program and documentation
Add a new high-level command to perform multipage writes quickly.
2021-06-08 15:25:16 +02:00
Yuri D'Elia
86e753fe37 xflash: remove some duplication 2021-06-08 15:24:46 +02:00
Yuri D'Elia
5ae8bad0ba Introduce "xflash_layout" to organize XFLASH's content
Update the language code to use the new LANG_OFFSET definition
and remove hard-coded flash sizes.
2021-06-08 15:22:37 +02:00
Yuri D'Elia
af636c7f2a Move "xflash" include inside the conditional 2021-06-08 15:18:33 +02:00
Yuri D'Elia
0fcdada579 D6: add documentation 2021-06-07 19:58:18 +02:00