Commit Graph

5204 Commits

Author SHA1 Message Date
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
Yuri D'Elia
ed9f52dd85 D6: also hide declaration behind conditional 2021-06-07 18:50:45 +02:00
Yuri D'Elia
db096557d4 D[236]: remove "busy" messages while dumping, avoid WDT 2021-06-07 16:41:25 +02:00
Yuri D'Elia
12e124324f Remove PROGMEM handling from print_mem until D5 uses dcode_core
Handling PROGMEM also requires a 32bit address type.
2021-06-07 16:41:25 +02:00
Yuri D'Elia
f9371146d0 Implement reading XFLASH with D6
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.
2021-06-07 16:41:25 +02:00
Yuri D'Elia
915f5a7692 Unify D2 and D3 handling
Handle reading/writing memory using the same base functions
in order to save space.
2021-06-07 16:41:25 +02:00
Yuri D'Elia
2d25a5705f Fix D2 to read the entire SRAM content
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.
2021-06-07 16:37:34 +02:00
Yuri D'Elia
62f496e1d6 Allow D2 to be enabled selectively 2021-06-07 16:37:34 +02:00
DRracer
a8a253c0ae
Merge pull request #3163 from DRracer/farm-m1
Farm workaround M1 message
2021-05-27 09:07:49 +02:00
D.R.racer
6bb7c0e3d3 Farm workaround M1 message
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...
2021-05-25 09:45:42 +02:00
Panayiotis-git
3c63ddaafd Fix the eeprom address documentation 2021-05-22 17:09:55 +03:00
DRracer
f5ca79926e
Merge pull request #3141 from prusa3d/MK3_3.10.0
MK3_3.10.0 -> MK3
2021-05-07 13:56:46 +02:00
D.R.racer
04de9c0c8a Version changed (3.10.0 build 4481) 2021-05-06 13:46:05 +02:00
3d-gussner
e765c300b0 Update MK404 part to '--bootloader-file ""'
Some cosmetics
2021-05-05 20:05:35 +02:00
Yuri D'Elia
1a92f2e19f Merge remote-tracking branch 'upstream/MK3_3.10.0' into fix_partial_redraw2 2021-05-04 10:49:24 +02:00