Executing instruction from ram gives "InstrFetchProhibited"

TheSAM32
Posts: 2
Joined: Sat Feb 01, 2020 2:11 am

Executing instruction from ram gives "InstrFetchProhibited"

Postby TheSAM32 » Sat Feb 01, 2020 2:21 am

I am trying to load raw binary into ram and execute it. When I do so i get the following error:
Guru Meditation Error: Core 1 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x3ffc4ea0 PS : 0x00060f30 A0 : 0x800d3388 A1 : 0x3ffc8bd0
A2 : 0x3ffc4ea0 A3 : 0x400d19b5 A4 : 0x3ffc5288 A5 : 0x80000020
A6 : 0x00000008 A7 : 0x00000001 A8 : 0x800d19c9 A9 : 0x3ffc8bb0
A10 : 0x400d17d4 A11 : 0x3f4015e9 A12 : 0x3ffc4e96 A13 : 0x3ffc4e96
A14 : 0x3ffc5288 A15 : 0x3ffc6ca0 SAR : 0x0000000a EXCCAUSE: 0x00000014
EXCVADDR: 0x3ffc4ea0 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffa

Backtrace: 0x3ffc4ea0:0x3ffc8bd0 0x400d3385:0x3ffc8bf0 0x4008e0bd:0x3ffc8c10
From what I understand is that the ESP32 said that the memory it is accessing is out of bounds, but the PC is in the ram region of the ESP32.

ESP_Sprite
Posts: 9051
Joined: Thu Nov 26, 2015 4:08 am

Re: Executing instruction from ram gives "InstrFetchProhibited"

Postby ESP_Sprite » Sat Feb 01, 2020 9:21 am

The Xtensa has pretty rigidly separated instruction and data buses; the 0x3Fxxxxxx range is strictly data-only, while the 0x40xxxxxx range can only execute instructions (and allows 32-bit aligned loads/stores to get those instructions there). I'm not sure what you use to get the memory range, but you should use heap_caps_malloc() with the MALLOC_CAP_EXEC flag to get executable RAM.

Who is online

Users browsing this forum: Baidu [Spider] and 121 guests