bdring / Grbl_Esp32

A port of Grbl CNC Firmware for ESP32
GNU General Public License v3.0
1.7k stars 531 forks source link

Macro Kernel Panic #967

Open Emmpunkt opened 3 years ago

Emmpunkt commented 3 years ago

I´m trying to get a simple macro working and need a bit of help. My machine is a plotter and i want to plot some files by macro for daily use (Business Card, Adress Field etc.) I put a file in SPIFFS with the name "makro.g" wich contains $SD/Run=Schrift.nc. (I also tried it from SD..) If i send the command via serial or GUI it works and plots the file, if i try the macro, the ESP reboots.

I can see this over the serial monitor:

` [MSG:Caution: Unlocked] Guru Meditation Error: Core 1 panic'ed (Unhandled debug exception) Debug exception reason: Stack canary watchpoint triggered (clientCheckTask) Core 1 register dump: PC : 0x40085d3c PS : 0x00060436 A0 : 0x3ffd39d0 A1 : 0x3ffd3910
A2 : 0x3ffbeefc A3 : 0x00000000 A4 : 0x3ffede60 A5 : 0x00000140 A6 : 0x00040000 A7 : 0x3ff65000 A8 : 0x00000001 A9 : 0x00000010
A10 : 0x00000050 A11 : 0x00040000 A12 : 0x00000040 A13 : 0xff000000 A14 : 0x00000010 A15 : 0xffffffff SAR : 0x0000000a EXCCAUSE: 0x00000001
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffd

Backtrace: 0x40085d3c:0x3ffd3910 0x3ffd39cd:0x3ffd39f0 0x400ee5b7:0x3ffd3a10 0x400ee6bc:0x3ffd3a30 0x400ee7a5:0x3ffd3a60 0x40139676:0x3ffd3aa0 0x40135c11:0x3ffd3ac0 0x40136fba:0x3ffd3ae0 0x40137111:0x3ffd3b00 0x40137fd2:0x3ffd3b30 0x40139295:0x3ffd3da0 0x401559e9:0x3ffd3f10 0x4000bcc5:0x3ffd3f30 0x4015b4d5:0x3ffd3f50 0x40205319:0x3ffd3f70 0x400ee014:0x3ffd3ff0 0x400da07d:0x3ffd4020 0x400e87ee:0x3ffd4060 0x400e889c:0x3ffd40a0 0x400e7f21:0x3ffd41d0 0x400d7a81:0x3ffd4200 0x400d7c07:0x3ffd4250 0x400d7c3a:0x3ffd4280 0x400d807c:0x3ffd42c0 0x400ea062:0x3ffd42e0 0x400e7f21:0x3ffd4440 0x400d7a81:0x3ffd4470 0x400d7c07:0x3ffd44c0 0x400e2837:0x3ffd44f0 0x400e2bc1:0x3ffd46b0 0x4021f81d:0x3ffd46d0 0x400f26fa:0x3ffd46f0 0x400f27a1:0x3ffd4710 0x400f280e:0x3ffd4740 0x400f2977:0x3ffd4790 0x400e24ad:0x3ffd47e0 0x400eb772:0x3ffd4820 0x400eb434:0x3ffd4840 0x400da5df:0x3ffd4860 0x40090299:0x3ffd4880

Rebooting... ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:1216 ho 0 tail 12 room 4 load:0x40078000,len:9720 ho 0 tail 12 room 4 load:0x40080400,len:6352 entry 0x400806b8 `

So what am i doing wrong? Regards Michael

bdring commented 3 years ago

The stack canary means some area of the code is using more memory than it was allocated.

Macros were not in a robust manner. They run in an interrupt context from the switch interrupt. This means they have to be simple and quick. A more robust method would be for a flag to be set and the protocol loop to pick that up for execution.

Our new version of Grbl_ESP32, FluidNC, uses this method. That is in beta testing with most features working. I can try your macro on that.

https://github.com/bdring/FluidNC