Closed MATTYGILO closed 2 years ago
From the docs https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/fatal-errors.html
InstrFetchProhibited
This CPU exception indicates that the CPU could not read an instruction because the address of the instruction does not belong to a valid region in instruction RAM or ROM.
Usually, this means an attempt to call a function pointer, which does not point to valid code. PC (Program Counter) register can be used as an indicator: it will be zero or will contain a garbage value (not 0x4xxxxxxx).
Decoded the backtrace
0x00000bac: ?? ??:0
0x42001b2e: libtf_interpreter_invoke at ??:?
0x4200195a: interpreter_invoke at tensorflow-microlite.c:?
0x420655c9: fun_builtin_1_call at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/objfun.c:71
0x4206d87d: mp_call_function_n_kw at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/runtime.c:664
(inlined by) mp_call_method_n_kw at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/runtime.c:680
0x4037886d: mp_execute_bytecode at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/vm.c:1008
0x420656e0: fun_bc_call at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/objfun.c:289
0x4206d87d: mp_call_function_n_kw at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/runtime.c:664
(inlined by) mp_call_method_n_kw at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/runtime.c:680
0x4037886d: mp_execute_bytecode at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/vm.c:1008
0x420656e0: fun_bc_call at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/objfun.c:289
0x4206d7bd: mp_call_function_n_kw at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/runtime.c:664
0x403787e1: mp_execute_bytecode at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/vm.c:923
0x420656e0: fun_bc_call at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/objfun.c:289
0x4206d7bd: mp_call_function_n_kw at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/runtime.c:664
0x403787e1: mp_execute_bytecode at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/vm.c:923
0x420656e0: fun_bc_call at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/objfun.c:289
0x4206d7bd: mp_call_function_n_kw at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/runtime.c:664
0x403787e1: mp_execute_bytecode at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/vm.c:923
0x420656e0: fun_bc_call at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/objfun.c:289
0x4206d7bd: mp_call_function_n_kw at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/runtime.c:664
0x403787e1: mp_execute_bytecode at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/vm.c:923
0x420656e0: fun_bc_call at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/objfun.c:289
0x4206d7e5: mp_call_function_n_kw at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/runtime.c:664
(inlined by) mp_call_function_0 at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/py/runtime.c:638
0x420ae45c: parse_compile_execute at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/shared/runtime/pyexec.c:116
0x420ae6ac: pyexec_friendly_repl at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/shared/runtime/pyexec.c:662
0x42089564: mp_task at /home/runner/work/tensorflow-micropython-examples/tensorflow-micropython-examples/micropython/ports/esp32/main.c:175
This is a memory error, what I'd suggest is cutting your code to the bare basics.
As bare as you can go and debug as much as possible, use mem_info to find block sizes etc
So after a tonne of debugging, I have worked out that you should reload the whole interpreter before doing a large batch of detections. Take this example.
Load interpreter (Use a global memoryview)
while True:
Record
ReLoad interpreter (Use the global memoryview)
Identify
Tons of random other functions
It would be great if you can assign a memory view for the arena instead of the passing in a arena size
I'm running on the optimised neural network firmware
However after doing 8 executions on my 9th this occurs, I'm uncertain of what the error is.
All help would be much appreciated.
Thanks