sbfreddie
Well-known member
All:
This problem is a doozy.
The problem started when I rebuilt an already working project that was originally built in Teensy 1.57, where everything was working fine.
When I built this project without making any changes it refused to startup, meaning blank screen on the TFT and no output to the serial monitor. Fortunately I saved a copy of the original project folder and was able to reload the .hex file with the Teensy loader program. When it started up it revealed this error from the crash report on the serial monitor:
So I converted the .elf file to a .lst file with objdump and checked out address 0x6000177E which contains this obj code:
Finding something as common as TwoWire::begin to blow up like this is very strange, so I looked closer at the libWire.a files after compiling and discovered that they were built with different compilers. The working version looks this:
The non-working one looks like this:
Both of these projects were built with PlatformIO. Here is the build output from the non-working version:
Any one have any ideas about how to fix this problem??
Thanks,
Ed
This problem is a doozy.
The problem started when I rebuilt an already working project that was originally built in Teensy 1.57, where everything was working fine.
When I built this project without making any changes it refused to startup, meaning blank screen on the TFT and no output to the serial monitor. Fortunately I saved a copy of the original project folder and was able to reload the .hex file with the Teensy loader program. When it started up it revealed this error from the crash report on the serial monitor:
Code:
CrashReport:
A problem occurred at (system time) 17:14:44
Code was executing from address 0x6000177E
CFSR: 82
.(DACCVIOL) Data Access Violation
.(MMARVALID) Accessed Address: 0x0 (nullptr)
. Check code at 0x6000177E - very likely a bug!
. Run "addr2line -e mysketch.ino.elf 0x6000177E" for filename & line number.
Temperature inside the chip was 35.00 °C
Startup CPU clock speed is 600MHz
So I converted the .elf file to a .lst file with objdump and checked out address 0x6000177E which contains this obj code:
Code:
60001768 <TwoWire::begin()>:
60001768: 4916 ldr r1, [pc, #88] ; (600017c4 <TwoWire::begin()+0x5c>)
6000176a: 6942 ldr r2, [r0, #20]
6000176c: 6b8b ldr r3, [r1, #56] ; 0x38
6000176e: f423 037c bic.w r3, r3, #16515072 ; 0xfc0000
60001772: f443 2380 orr.w r3, r3, #262144 ; 0x40000
60001776: b570 push {r4, r5, r6, lr}
60001778: 638b str r3, [r1, #56] ; 0x38
6000177a: 4604 mov r4, r0
6000177c: 4d12 ldr r5, [pc, #72] ; (600017c8 <TwoWire::begin()+0x60>)
6000177e: e9d2 1300 ldrd r1, r3, [r2]
60001782: 680a ldr r2, [r1, #0]
60001784: 431a orrs r2, r3
60001786: 6903 ldr r3, [r0, #16]
60001788: 600a str r2, [r1, #0]
6000178a: 2202 movs r2, #2
6000178c: 2100 movs r1, #0
6000178e: 611a str r2, [r3, #16]
60001790: 4a0e ldr r2, [pc, #56] ; (600017cc <TwoWire::begin()+0x64>)
60001792: 6119 str r1, [r3, #16]
60001794: 649a str r2, [r3, #72] ; 0x48
60001796: 2201 movs r2, #1
60001798: 625a str r2, [r3, #36] ; 0x24
6000179a: 629d str r5, [r3, #40] ; 0x28
6000179c: f44f 3530 mov.w r5, #180224 ; 0x2c000
600017a0: 62dd str r5, [r3, #44] ; 0x2c
600017a2: f04f 1501 mov.w r5, #65537 ; 0x10001
600017a6: 6c9e ldr r6, [r3, #72] ; 0x48
600017a8: 651e str r6, [r3, #80] ; 0x50
600017aa: 6219 str r1, [r3, #32]
600017ac: 659d str r5, [r3, #88] ; 0x58
600017ae: 611a str r2, [r3, #16]
600017b0: 7e01 ldrb r1, [r0, #24]
600017b2: f7ff ff4f bl 60001654 <TwoWire::configSDApin(unsigned char)>
600017b6: 7e61 ldrb r1, [r4, #25]
600017b8: 4620 mov r0, r4
600017ba: e8bd 4070 ldmia.w sp!, {r4, r5, r6, lr}
600017be: f7ff bf8d b.w 600016dc <TwoWire::configSCLpin(unsigned char)>
600017c2: bf00 nop
600017c4: 400fc000 .word 0x400fc000
600017c8: 05050bb8 .word 0x05050bb8
600017cc: 1928373b .word 0x1928373b
Finding something as common as TwoWire::begin to blow up like this is very strange, so I looked closer at the libWire.a files after compiling and discovered that they were built with different compilers. The working version looks this:
Code:
!<arch>
/ 0 0 0 0 786 `
ÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊÊ_ZN5Print17availableForWriteEv_ZN7TwoWire9availableEv_ZN7TwoWire4readEv_ZN7TwoWire4peekEv_ZN7TwoWire5flushEv_ZN7TwoWire5writeEh_ZN7TwoWire5writeEPKhj_ZN7TwoWire5beginEv_ZN7TwoWire3endEv_ZN7TwoWire11force_clockEv_ZN7TwoWire9wait_idleEv_ZN7TwoWire15endTransmissionEh_ZN7TwoWire11requestFromEhhh_ZN7TwoWire11requestFromEhhmhh_ZN7TwoWire5beginEh_ZN7TwoWire3isrEv_Z10lpi2c1_isrv_Z10lpi2c3_isrv_Z10lpi2c4_isrv_ZN7TwoWire6setSDAEh_ZN7TwoWire12configSDApinEh_ZN7TwoWire6setSCLEh_ZN7TwoWire12configSCLpinEh_ZN7TwoWire8setClockEm_ZTV7TwoWireWire2Wire1_ZN7TwoWire13i2c4_hardwareE_ZN7TwoWire13i2c3_hardwareEWire_ZN7TwoWire13i2c1_hardwareE// 20 `
WireKinetis.cpp.o/
Wire.cpp.o/ 1677591497 502 20 100644 772 `
ELF(ú4( GCC: (GNU Tools for ARM Embedded Processors) 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496]A6aeabi,Cortex-M7
M
"ÒˇWire.cpp.symtab.strtab.shstrtab.text.data.bss.comment.ARM.attributes4!4'4,04o5p£7VE‹p L
WireIMXRT.cpp.o/1677591498 502 20 100644 9712 `
ELF(X4(74
The non-working one looks like this:
Code:
!<arch>
/ 0 0 0 0 900 `
!_ZN5Print17availableForWriteEv_ZN7TwoWire9availableEv_ZN7TwoWire4readEv_ZN7TwoWire4peekEv_ZN7TwoWire5flushEv_ZN7TwoWire5writeEh_ZN7TwoWire5writeEPKhj_ZN7TwoWireC2EP13IMXRT_LPI2C_tRKNS_14I2C_Hardware_tE_ZN7TwoWireC1EP13IMXRT_LPI2C_tRKNS_14I2C_Hardware_tE_ZN7TwoWire3endEv_ZN7TwoWire11force_clockEv_ZN7TwoWire9wait_idleEv_ZN7TwoWire15endTransmissionEh_ZN7TwoWire11requestFromEhhh_ZN7TwoWire11requestFromEhhmhh_ZN7TwoWire3isrEv_Z10lpi2c1_isrv_Z10lpi2c3_isrv_Z10lpi2c4_isrv_ZN7TwoWire12configSDApinEh_ZN7TwoWire6setSDAEh_ZN7TwoWire12configSCLpinEh_ZN7TwoWire5beginEh_ZN7TwoWire6setSCLEh_ZN7TwoWire5beginEv_ZN7TwoWire8setClockEm_ZTV7TwoWireWire2Wire1_ZN7TwoWire13i2c4_hardwareE_ZN7TwoWire13i2c3_hardwareEWire_ZN7TwoWire13i2c1_hardwareE// 20 `
WireKinetis.cpp.o/
Wire.cpp.o/ 1688752734 502 20 100644 708 `
ELF(\4( GCC: (Arm GNU Toolchain 11.3.Rel1) 11.3.1 20220712A1aeabi'7E-M
M
"ÒˇWire.cpp.symtab.strtab.shstrtab.text.data.bss.comment.ARM.attributes4!4'4,0445ph2úp
EWireIMXRT.cpp.o/1688752735 502 20 100644 9500 `
ELF(‰4(;:
Both of these projects were built with PlatformIO. Here is the build output from the non-working version:
Code:
* Executing task: platformio run
Processing release (platform: teensy; board: teensy41; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Build number: 1.0.109 (waiting for upload before next increment)
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.18.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
- framework-arduinoteensy @ 1.158.0 (1.58)
- tool-teensy @ 1.158.0 (1.58)
- toolchain-gccarmnoneeabi-teensy @ 1.110301.0 (11.3.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 106 compatible libraries
Scanning dependencies...
Dependency Graph
|-- Eds_BME680
|-- TMP117-Arduino @ 1.0.3
|-- WDT_T4 @ 0.1
|-- AT24CX
|-- DS3231RTC
|-- EEPROMEx @ 0.0.0-alpha+sha.09d7586108
|-- SPI @ 1.0
|-- SparkFun_u-blox_GNSS_Arduino_Library
|-- Streaming @ 6.0.9
|-- Timezone @ 1.2.4
|-- Wire @ 1.0
|-- Ra8876LiteTeensy
|-- MCP9808
|-- memcpy
Building in release mode
Compiling .pio/build/release/src/TestingTFT.cpp.o
Compiling .pio/build/release/libe9f/SPI/SPI.cpp.o
Compiling .pio/build/release/libb68/Wire/Wire.cpp.o
Compiling .pio/build/release/libb68/Wire/WireIMXRT.cpp.o
Compiling .pio/build/release/libb68/Wire/WireKinetis.cpp.o
Compiling .pio/build/release/libb68/Wire/utility/twi.c.o
Compiling .pio/build/release/lib525/Eds_BME680/Eds_BME680.cpp.o
Compiling .pio/build/release/lib313/TMP117/TMP117.cpp.o
Compiling .pio/build/release/lib9cd/AT24CX/AT24CX.cpp.o
Compiling .pio/build/release/lib983/Time/DateStrings.cpp.o
Compiling .pio/build/release/lib983/Time/Time.cpp.o
src/TestingTFT.cpp: In function 'void setup()':
src/TestingTFT.cpp:2083:12: warning: variable 'temp_t' set but not used [-Wunused-but-set-variable]
2083 | time_t temp_t;
| ^~~~~~
Archiving .pio/build/release/lib313/libTMP117.a
Archiving .pio/build/release/lib9cd/libAT24CX.a
Indexing .pio/build/release/lib313/libTMP117.a
Indexing .pio/build/release/lib9cd/libAT24CX.a
Archiving .pio/build/release/libb68/libWire.a
Compiling .pio/build/release/lib2c0/DS3231RTC/DS3231RTC.cpp.o
Indexing .pio/build/release/libb68/libWire.a
Compiling .pio/build/release/lib9d8/EEPROMEx/EEPROMex.cpp.o
Compiling .pio/build/release/lib61f/SparkFun_u-blox_GNSS_Arduino_Library/SparkFun_u-blox_GNSS_Arduino_Library.cpp.o
Compiling .pio/build/release/liba32/Timezone/Timezone.cpp.o
Archiving .pio/build/release/libe9f/libSPI.a
Indexing .pio/build/release/libe9f/libSPI.a
Compiling .pio/build/release/libc61/Ra8876LiteTeensy/RA8876_t3.cpp.o
Archiving .pio/build/release/lib983/libTime.a
Indexing .pio/build/release/lib983/libTime.a
Compiling .pio/build/release/libc61/Ra8876LiteTeensy/_font_ComicSansMS.c.o
Archiving .pio/build/release/lib525/libEds_BME680.a
Indexing .pio/build/release/lib525/libEds_BME680.a
Compiling .pio/build/release/libc61/Ra8876LiteTeensy/font_Arial.c.o
Archiving .pio/build/release/lib9d8/libEEPROMEx.a
Indexing .pio/build/release/lib9d8/libEEPROMEx.a
Archiving .pio/build/release/liba32/libTimezone.a
Compiling .pio/build/release/libc61/Ra8876LiteTeensy/glcdfont.c.o
Indexing .pio/build/release/liba32/libTimezone.a
Compiling .pio/build/release/libfc6/MCP9808/mcp9808.cpp.o
Compiling .pio/build/release/libe93/memcpy/memcpy.c.o
Compiling .pio/build/release/FrameworkArduino/AudioStream.cpp.o
Archiving .pio/build/release/lib2c0/libDS3231RTC.a
Indexing .pio/build/release/lib2c0/libDS3231RTC.a
Compiling .pio/build/release/FrameworkArduino/CrashReport.cpp.o
Compiling .pio/build/release/FrameworkArduino/DMAChannel.cpp.o
Compiling .pio/build/release/FrameworkArduino/EventResponder.cpp.o
Archiving .pio/build/release/libe93/libmemcpy.a
Indexing .pio/build/release/libe93/libmemcpy.a
Compiling .pio/build/release/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/release/FrameworkArduino/HardwareSerial1.cpp.o
Archiving .pio/build/release/libfc6/libMCP9808.a
Indexing .pio/build/release/libfc6/libMCP9808.a
Compiling .pio/build/release/FrameworkArduino/HardwareSerial2.cpp.o
Compiling .pio/build/release/FrameworkArduino/HardwareSerial3.cpp.o
Compiling .pio/build/release/FrameworkArduino/HardwareSerial4.cpp.o
Compiling .pio/build/release/FrameworkArduino/HardwareSerial5.cpp.o
Compiling .pio/build/release/FrameworkArduino/HardwareSerial6.cpp.o
Compiling .pio/build/release/FrameworkArduino/HardwareSerial7.cpp.o
Compiling .pio/build/release/FrameworkArduino/HardwareSerial8.cpp.o
Compiling .pio/build/release/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/release/FrameworkArduino/IntervalTimer.cpp.o
Compiling .pio/build/release/FrameworkArduino/Print.cpp.o
Compiling .pio/build/release/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/release/FrameworkArduino/Time.cpp.o
Compiling .pio/build/release/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/release/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/release/FrameworkArduino/WString.cpp.o
Compiling .pio/build/release/FrameworkArduino/analog.c.o
Compiling .pio/build/release/FrameworkArduino/bootdata.c.o
Compiling .pio/build/release/FrameworkArduino/clockspeed.c.o
Compiling .pio/build/release/FrameworkArduino/debugprintf.c.o
Compiling .pio/build/release/FrameworkArduino/delay.c.o
Compiling .pio/build/release/FrameworkArduino/digital.c.o
Compiling .pio/build/release/FrameworkArduino/eeprom.c.o
Compiling .pio/build/release/FrameworkArduino/extmem.c.o
Compiling .pio/build/release/FrameworkArduino/fuse.c.o
Compiling .pio/build/release/FrameworkArduino/interrupt.c.o
Compiling .pio/build/release/FrameworkArduino/keylayouts.c.o
Compiling .pio/build/release/FrameworkArduino/main.cpp.o
Compiling .pio/build/release/FrameworkArduino/memcpy-armv7m.S.o
Compiling .pio/build/release/FrameworkArduino/memset.S.o
Compiling .pio/build/release/FrameworkArduino/new.cpp.o
Compiling .pio/build/release/FrameworkArduino/nonstd.c.o
Compiling .pio/build/release/FrameworkArduino/pwm.c.o
Compiling .pio/build/release/FrameworkArduino/rtc.c.o
Compiling .pio/build/release/FrameworkArduino/serialEvent.cpp.o
Compiling .pio/build/release/FrameworkArduino/serialEvent1.cpp.o
Compiling .pio/build/release/FrameworkArduino/serialEvent2.cpp.o
Compiling .pio/build/release/FrameworkArduino/serialEvent3.cpp.o
Compiling .pio/build/release/FrameworkArduino/serialEvent4.cpp.o
Compiling .pio/build/release/FrameworkArduino/serialEvent5.cpp.o
Compiling .pio/build/release/FrameworkArduino/serialEvent6.cpp.o
Compiling .pio/build/release/FrameworkArduino/serialEvent7.cpp.o
Compiling .pio/build/release/FrameworkArduino/serialEvent8.cpp.o
Compiling .pio/build/release/FrameworkArduino/serialEventUSB1.cpp.o
Compiling .pio/build/release/FrameworkArduino/serialEventUSB2.cpp.o
Compiling .pio/build/release/FrameworkArduino/sm_alloc_valid.c.o
Compiling .pio/build/release/FrameworkArduino/sm_calloc.c.o
Compiling .pio/build/release/FrameworkArduino/sm_free.c.o
Compiling .pio/build/release/FrameworkArduino/sm_hash.c.o
Compiling .pio/build/release/FrameworkArduino/sm_malloc.c.o
Compiling .pio/build/release/FrameworkArduino/sm_malloc_stats.c.o
Compiling .pio/build/release/FrameworkArduino/sm_pool.c.o
Compiling .pio/build/release/FrameworkArduino/sm_realloc.c.o
Compiling .pio/build/release/FrameworkArduino/sm_realloc_i.c.o
Compiling .pio/build/release/FrameworkArduino/sm_realloc_move.c.o
Compiling .pio/build/release/FrameworkArduino/sm_szalloc.c.o
Compiling .pio/build/release/FrameworkArduino/sm_util.c.o
Compiling .pio/build/release/FrameworkArduino/sm_zalloc.c.o
Compiling .pio/build/release/FrameworkArduino/startup.c.o
Compiling .pio/build/release/FrameworkArduino/tempmon.c.o
Compiling .pio/build/release/FrameworkArduino/usb.c.o
Compiling .pio/build/release/FrameworkArduino/usb_audio.cpp.o
Compiling .pio/build/release/FrameworkArduino/usb_desc.c.o
Compiling .pio/build/release/FrameworkArduino/usb_flightsim.cpp.o
Compiling .pio/build/release/FrameworkArduino/usb_inst.cpp.o
Compiling .pio/build/release/FrameworkArduino/usb_joystick.c.o
Compiling .pio/build/release/FrameworkArduino/usb_keyboard.c.o
Compiling .pio/build/release/FrameworkArduino/usb_midi.c.o
Compiling .pio/build/release/FrameworkArduino/usb_mouse.c.o
Compiling .pio/build/release/FrameworkArduino/usb_mtp.c.o
Compiling .pio/build/release/FrameworkArduino/usb_rawhid.c.o
Compiling .pio/build/release/FrameworkArduino/usb_seremu.c.o
Compiling .pio/build/release/FrameworkArduino/usb_serial.c.o
Compiling .pio/build/release/FrameworkArduino/usb_serial2.c.o
Compiling .pio/build/release/FrameworkArduino/usb_serial3.c.o
Compiling .pio/build/release/FrameworkArduino/usb_touch.c.o
Compiling .pio/build/release/FrameworkArduino/yield.cpp.o
Archiving .pio/build/release/libFrameworkArduino.a
Indexing .pio/build/release/libFrameworkArduino.a
Archiving .pio/build/release/libc61/libRa8876LiteTeensy.a
Indexing .pio/build/release/libc61/libRa8876LiteTeensy.a
Archiving .pio/build/release/lib61f/libSparkFun_u-blox_GNSS_Arduino_Library.a
Indexing .pio/build/release/lib61f/libSparkFun_u-blox_GNSS_Arduino_Library.a
Linking .pio/build/release/firmware.elf
Memory region Used Size Region Size %age Used
ITCM: 119820 B 512 KB 22.85%
DTCM: 37120 B 512 KB 7.08%
RAM: 12416 B 512 KB 2.37%
FLASH: 162 KB 7936 KB 2.04%
ERAM: 0 GB 16 MB 0.00%
Calculating size .pio/build/release/firmware.elf
Checking size .pio/build/release/firmware.elf
teensy_size: Memory Usage on Teensy 4.1:
teensy_size: FLASH: code:125676, data:31976, headers:8232 free for files:7960580
teensy_size: RAM1: variables:37120, code:119816, padding:11256 free for local variables:356096
teensy_size: RAM2: variables:12416 free for malloc/new:511872
Building .pio/build/release/firmware.hex
Any one have any ideas about how to fix this problem??
Thanks,
Ed