Commit Graph

5194 Commits

Author SHA1 Message Date
Yuri D'Elia
c096462aab Clarify statement by adding extra braces 2021-06-21 06:52:52 +02:00
Yuri D'Elia
051f03119b Fix misleading indentation warnings by expanding tabs 2021-06-21 06:52:52 +02:00
Yuri D'Elia
f2fe57bfc0 Fix unused static declaration warnings
Guard declarations using the appropriate defines
2021-06-21 06:52:52 +02:00
Jonas Meyer
7bd43b77d7 Remove unnecessary assignment 2021-06-21 06:47:59 +02:00
Yuri D'Elia
eafdf6c216 Also move host_keepalive to manage_inactivity()
This avoids the "busy" output interleaving with regular output in very
rare scenarios.

We should focus in finding which calls are not using manage_inactivity()
properly instead of working it around.
2021-06-21 06:46:24 +02:00
Yuri D'Elia
29322d4bf3 Move host_autoreport() to manage_inactivity()
This makes autoreport work more consistently.
2021-06-21 06:46:24 +02:00
Yuri D'Elia
5c8a231ed6 Move autoreporting out of the temperature ISR
Code running in the temperature ISR needs to be fully reentrant, which
is hard to track down.

Move autoreporting to the main processing loop. This can make the
autoreporting slower or pause at times, but removes the reentrant
restriction, which allows us to use printf_P.
2021-06-21 06:46:24 +02:00
Yuri D'Elia
97f66a6a13 Remove ignored/incorrect PROGMEM
This PROGMEM is currently ignored by gcc, but even if it wasn't it
wouldn't be correct since the following code is expecting to read "item"
without fetching the array itself from PROGMEM.
2021-06-21 06:44:19 +02:00
DRracer
5bb8bb2ccb
Merge pull request #3134 from wavexx/fix_partial_redraw2
Redraw "Preheating to load" in full when modified by other actions
2021-06-21 06:42:13 +02:00
Yuri D'Elia
700825ff76 serial_dump: include hex prefix 2021-06-19 13:57:40 +02:00
Yuri D'Elia
bff79d290a GETPC: Do not manipulate the 32bit return address
We can do that offline, saving over 30 bytes of instructions.
2021-06-19 13:56:40 +02:00
Yuri D'Elia
72b8f0d1e6 Add some warnings in lcd_buttons_update 2021-06-19 13:46:10 +02:00
3d-gussner
dde5cea48b Default extrusion graphics to line. Thanks @vintagepc point it out
Added -g 3 and 4 for more details extrusion lines
Check for updates is default. Fix update if internet connection is lost.
2021-06-18 20:40:17 +02:00
3d-gussner
bc98be3d29 Documentation and version number
Added some arguments and checks
2021-06-18 13:47:33 +02:00
3d-gussner
b12c0e2326 Use atmega404 if extanded RAM or FLASH size are chosen
Remove MK404 copy of lang file as it has been fixed in MK404
2021-06-18 13:46:25 +02:00
3d-gussner
ae41d6ca40 Change version to v2.0.0 2021-06-17 21:02:46 +02:00
3d-gussner
4614400298 Save ELF files for FW3.10.1 debugging PRs
Add verbose_IDE to output more information during build
2021-06-17 20:59:35 +02:00
Yuri D'Elia
06d91ddcee Handle Long-Press in the main loop
The longpress function is currently called within the temperature ISR,
which is bogus. Calling the longpress function at the wrong moment
can corrupt the menu buffers.

Move the call to the main loop by changing the logic slightly:

- still sample the lcd buttons inside the temperature ISR, which keeps
  scrollong/pressing responsive, but...
- set a flag to indicate that longpress has been triggered instead of
  calling the function directly
- call the function on the next manage_inactivity run

Combined with #3180 this removes _most_ unsafe operations out of the ISR
which can happen during a normal run (max/mintemp warnings are still an
exception).
2021-06-17 20:07:01 +02:00
3d-gussner
56889bae13 Update PF-build.sh to work after @DRracer Remove FW version parsing PR 2021-06-17 19:08:55 +02:00
3d-gussner
589b781d04 Merge branch 'MK3_MK404' into PFW-1271_PF-buildv20 2021-06-17 18:47:17 +02:00
Yuri D'Elia
dd8c6c064c xfdump: simplify stack debugging (sample pc+sp)
Instead of having to guess the PC where the SP was sampled, always take
both. This allows "seamless" stack decoding for both serial and xflash
dumps, since we don't have to guess which function generated the dump.

Make the core functions (doing the sampling) be ``noinline`` as well,
so that they always have valid frame.
2021-06-17 01:29:25 +02:00
Yuri D'Elia
97535ec0c1 Fix last commit 2021-06-15 22:10:08 +02:00
Yuri D'Elia
e6d520cf6e Add test code for the stack overflow handler 2021-06-15 18:49:20 +02:00
Yuri D'Elia
a614268c94 serial_dump_and_reset: do not call manage_heater with interrupts disabled
Do not call manage_heater() in print_mem() if interrupts are already
disabled. This means we're running inside the crash handler.
2021-06-15 18:44:44 +02:00
Yuri D'Elia
d193d0f7ac serial_dump: manipulate WDT just once 2021-06-15 16:21:56 +02:00
Yuri D'Elia
928c7211ad emergency handlers: always save SP _at_ the crash location
Save SP which is closest to the crash location, which simplifies
debugging. For serial_dump, write SP just before the dump.
For xfdump, save SP in the dump header.

This makes xfdump_dump and xfdump_full_dump_and_reset() equivalent for
stack debugging.
2021-06-15 11:47:27 +02:00
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