Thanks for the advice in the previous thread. I fired up gdb, and ran
the program several times. This is the stack trace I get most of the

(gdb) where
#0  _hardFaultHandler (ctx=0x2000bea0)
#1  <signal handler called>
#2  0x08101374 in ?? ()
#3  <signal handler called>
#4  xpcc::BufferedGraphicDisplay<(unsigned short)160, (unsigned
short)128>::drawImageRaw (
    this=0x20000854 <hardware::lcd>, upperLeft=..., width=5, height=8, data=...)
#5  0x080011b0 in xpcc::GraphicDisplay::write (this=0x20000854
<hardware::lcd>, c=<optimized out>)
    at D:\Prog\xpcc_test\xpcc\src\xpcc\ui\display\graphic_display_text.cpp:115
#6  0x080011d8 in xpcc::GraphicDisplay::Writer::write (this=<optimized
out>, c=<optimized out>)
    at D:\Prog\xpcc_test\xpcc\src\xpcc\ui\display\graphic_display_text.cpp:139
#7  0x08000d86 in xpcc::IOStream::writeInteger (this=0x20000858
<hardware::lcd+4>, value=48)
    at D:\Prog\xpcc_test\xpcc\src\xpcc\io\iostream.cpp:55
#8  0x08000dc0 in xpcc::IOStream::writeInteger (this=0x20000858
<hardware::lcd+4>, value=<optimized out>)
    at D:\Prog\xpcc_test\xpcc\src\xpcc\io\iostream.cpp:35
#9  0x08000c40 in operator<< (v=<synthetic pointer>, this=0x20000858
    at D:\Prog\xpcc_test\xpcc\src/xpcc/io/iostream.hpp:206
#10 main () at main.cpp:41

What I get from this is that something causes an interrupt while
drawImageRaw is running, and then tries to jump to 0x08101374, an
invalid address, which causes the hard fault.

The code in frame 4 is:

87                      uint16_t row = upperLeft.getY() / 8;
88                      uint16_t rowCount = (height + 7) / 8;   //
always round up
90                      if ((height & 0x07) == 0)
91                      {
92                              for (uint_fast16_t i = 0; i < width; i++)
93                              {
94                                      for (uint_fast16_t k = 0; k <
rowCount; k++)
95                                      {
96                                              uint16_t x =
upperLeft.getX() + i;

Line 92 is the for loop header, and I don't see anything that can go wrong here.

Also, it's not the exact same invocation where it crashes, the
upperLeft parameter of drawImageRaw is different every time.

Can you suggest anything I should try next?
xpcc-dev mailing list

Reply via email to