-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Description
CircuitPython version
Adafruit CircuitPython 8.0.0-beta.4-29-g2c479f4fc-dirty on 2022-11-26; Adafruit Metro M4 Express with samd51j19
Board ID:metro_m4_express
UID:B54635543254375320202039372C0BFF
Code/REPL
>>> from displayio import Group
>>> g = Group()
>>> g = Group(scale=2) # <- creating Group works fine
>>> from adafruit_display_text import label
>>> import terminalio
>>> label.Label(terminalio.FONT) # <- Hard Fault occurs when we run this
Behavior
On a Metro M4 with DEBUG=1
build I am getting a Hard Fault from creating a Label object in the REPL without doing anything else with it. Haven't initialized or shown anything on a display, only created the Label with it's constructor and that leads to the Hard Fault.
Label class extends LabelBase which itself extends displayio.Group
. I tried creating a Group directly with it's constructor and that does execute successfully with no hardfault.
I also attempted to create the LabelBase class and that also results in the HardFault:
>>> from adafruit_display_text import LabelBase
>>> import terminalio
>>> lb = LabelBase(terminalio.FONT) # <- this leads to the same HardFault
Running the same code on the same device with a stock build i.e. without DEBUG
seems to run fine and does not lead to the Hard Fault. As best as I can tell somehow the DEBUG
flag introduces something that is causing or helping to cause the HardFault but I'm not super confident in my findings thus far.
Description
No response
Additional information
I found this while I was attempting to debug a different Hard Fault so I was setup to get the backtrace from it using a J-Link debugger. This is the resulting backtrace from setting a breakpoint at HardFault_Handler
Breakpoint 1, HardFault_Handler () at supervisor/port.c:718
718 reset_into_safe_mode(HARD_CRASH);
(gdb) bt
#0 HardFault_Handler () at supervisor/port.c:718
#1 <signal handler called>
#2 0x00028186 in mp_execute_bytecode (code_state=0x20001934 <_pystack+288>, inject_exc=<optimized out>) at ../../py/vm.c:1240
#3 0x000206d8 in fun_bc_call (self_in=0x20027e20, n_args=<optimized out>, n_kw=0, args=0x200018c4 <_pystack+176>) at ../../py/objfun.c:297
#4 0x000284e8 in mp_execute_bytecode (code_state=0x200018ac <_pystack+152>, inject_exc=<optimized out>) at ../../py/runtime.c:680
#5 0x000206d8 in fun_bc_call (self_in=0x20005ab0, n_args=<optimized out>, n_kw=2, args=0x20004a00) at ../../py/objfun.c:297
#6 0x00047e1a in closure_call (self_in=0x200286a0, n_args=2, n_kw=2, args=0x20001894 <_pystack+128>) at ../../py/objclosure.c:56
#7 0x0002834e in mp_execute_bytecode (code_state=0x20001854 <_pystack+64>, inject_exc=<optimized out>) at ../../py/runtime.c:858
#8 0x000206d8 in fun_bc_call (self_in=0x20006420, n_args=<optimized out>, n_kw=2, args=0x200049c0) at ../../py/objfun.c:297
#9 0x00047e1a in closure_call (self_in=0x20027a60, n_args=2, n_kw=2, args=0x200049a4) at ../../py/objclosure.c:56
#10 0x0002ba8c in mp_obj_instance_make_new (self=<optimized out>, n_args=1, n_kw=2, args=0x20001830 <_pystack+28>) at ../../py/objtype.c:384
#11 0x000284e8 in mp_execute_bytecode (code_state=0x20001814 <_pystack>, inject_exc=<optimized out>) at ../../py/runtime.c:680
#12 0x000206d8 in fun_bc_call (self_in=0x20029570, n_args=<optimized out>, n_kw=0, args=0x0) at ../../py/objfun.c:297
#13 0x00031e30 in parse_compile_execute (source=0x6b0e5, input_kind=<optimized out>, exec_flags=32, result=0x20000ebc <_exec_result.lto_priv.0>)
at ../../shared/runtime/pyexec.c:146
--Type <RET> for more, q to quit, c to continue without paging--
#14 0x000247b8 in pyexec_file (result=0x20000ebc <_exec_result.lto_priv.0>, filename=<optimized out>) at ../../shared/runtime/pyexec.c:750
#15 maybe_run_list (filenames=filenames@entry=0x68e24 <supported_filenames>) at ../../main.c:250
#16 0x00039144 in run_code_py (simulate_reset=<synthetic pointer>, safe_mode=<optimized out>) at ../../main.c:428
#17 main () at ../../main.c:1018
Note: In order to make a DEBUG build for the metro M4 I had to disable module(s) to save space to get the build to work. I disabled ULAB with CIRCUITPY_ULAB = 0
inside of mpconfig file.