Teensyloader 1.52 onwards breaks ChibiOS on Teensy 4

emileA

New member
Hi all,
Let me start off by saying that I love the teensy and thank you to everyone on these forums and of course Paul!

So unfortunately I've discovered that when using teensyloader 1.52 and 1.53 (arduino 1.8.12 and 1.8.13), chibios does not work properly on the Teensy 4.
Here is a link to the chibios library: https://github.com/greiman/ChRt
What happens is that the program compiles properly and uploads but then renders the teensy dead - not even running the setup code. When trying to reprogram it, it does not get automatically programmed and I have to manually press the program button on the teensy to get it to respond.

I did some experimentation and found that teensyloader 1.51 on arduino 1.8.12 works fine, so it must be 1.52 that breaks it.

I also tried it with a second Teensy 4 with a different cable and same issue.

Thanks in advance for your help!
 
Sounds like it is faulting memory - IIRC that was turned on for writing to NULL pointers?

Enable fault detection perhaps - not sure how that is done for this chibiOS build - but there are #defines left in the CORES code that will enable some way to see the fault - or at least blink LED.

Or if the GDB debugger code build can be enabled and used it will so indicate.

Reading startup.c it should be easy to see where that memory protect is enabled and turned off to test, as it was posted and catching someone else and turning it off 'FIXED' the hang symptom for them.
 
I can confirm that i had same issue using ChibiOS + Teensy4 1.55 loader

i can confirm that this combo is broken for me, tested on linux.... ( same symptoms as above)..
git clone code from here and use any of the examples, such as 'chBlinkPrint'
https://github.com/greiman/ChRt
and arduino-1.8.16
with teensyloader 1.55 from https://www.pjrc.com/teensy/teensy_linux64.tar.gz

this combo works with the same ChRt example/s:
arduino-1.8.12 - https://downloads.arduino.cc/arduino-1.8.12-linux64.tar.xz
teensy loader 1.51 - https://www.pjrc.com/teensy/td_151/TeensyduinoInstall.linux64
 
On Windows 11, IDE 1.8.16 w/ TD 1.56 beta 2 with Teensy 4.1 : both a normal production and then push Button onto a Beta LOCKED T_4.1

Downloaded from github : ChRt
> never downloaded or built this ChRt before

Put in {sketchbook}\libraries

Built : ...\tCode\libraries\ChRt\examples\chBlink\chBlink.ino

chBlink Running!

Edited On and Off times and rebuilt and Blink changed - working as expected.

Builds with no Edits and no warnings:
Code:
...
Compiling core...
Using precompiled core: R:\Temp\arduino_cache_698548\core\core_87b9ef5f1b9a2dd6275a143cb40f8a1c.a
Linking everything together...
"C:\\T_Drive\\Arduino_1.8.16_155\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-gcc" -O2 -Wl,--gc-sections,--relax "-TC:\\T_Drive\\Arduino_1.8.16_155\\hardware\\teensy\\avr\\cores\\teensy4/imxrt1062_t41.ld" -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -o "R:\\Temp\\arduino_build_243500/chBlink.ino.elf" "R:\\Temp\\arduino_build_243500\\sketch\\chBlink.ino.cpp.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\ChRt.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\ChRt.cpp.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\arm\\chcoreasm_v6m.S.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\arm\\chcoreasm_v7m.S.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\arm\\chcore_v6m.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\arm\\chcore_v7m.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\avr\\chcore.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\avr\\st_lld_avr.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\hal\\hal_st.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\oslib\\src\\chdelegates.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\oslib\\src\\chfactory.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\oslib\\src\\chmboxes.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\oslib\\src\\chmemcore.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\oslib\\src\\chmemheaps.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\oslib\\src\\chmempools.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\oslib\\src\\chobjcaches.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\oslib\\src\\chpipes.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chcond.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chdebug.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chdynamic.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chevents.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chmsg.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chmtx.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chregistry.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chschd.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chsem.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chstats.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chsys.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chthreads.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chtm.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chtrace.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\src\\chvt.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\rt\\templates\\meta\\module.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\sam3x\\st_lld_sam3x.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\samd\\st_lld_samd.c.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\teensy3\\st_lld_teensy3.cpp.o" "R:\\Temp\\arduino_build_243500\\libraries\\ChRt\\teensy4\\st_lld_teensy4.cpp.o" "R:\\Temp\\arduino_build_243500/..\\arduino_cache_698548\\core\\core_87b9ef5f1b9a2dd6275a143cb40f8a1c.a" "-LR:\\Temp\\arduino_build_243500" -larm_cortexM7lfsp_math -lm -lstdc++
"C:\\T_Drive\\Arduino_1.8.16_155\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 "R:\\Temp\\arduino_build_243500/chBlink.ino.elf" "R:\\Temp\\arduino_build_243500/chBlink.ino.eep"
"C:\\T_Drive\\Arduino_1.8.16_155\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-objcopy" -O ihex -R .eeprom "R:\\Temp\\arduino_build_243500/chBlink.ino.elf" "R:\\Temp\\arduino_build_243500/chBlink.ino.hex"
"C:\\T_Drive\\Arduino_1.8.16_155\\hardware\\teensy/../tools/teensy_secure" encrypthex TEENSY41 "R:\\Temp\\arduino_build_243500/chBlink.ino.hex"
encrypting 16384 bytes to R:\Temp\arduino_build_243500/chBlink.ino.ehex
"C:\\T_Drive\\Arduino_1.8.16_155\\hardware\\teensy/../tools/teensy_post_compile" -file=chBlink.ino "-path=R:\\Temp\\arduino_build_243500" "-tools=C:\\T_Drive\\Arduino_1.8.16_155\\hardware\\teensy/../tools/" -board=TEENSY41
"C:\\T_Drive\\Arduino_1.8.16_155\\hardware\\teensy/../tools/stdout_redirect" "R:\\Temp\\arduino_build_243500/chBlink.ino.sym" "C:\\T_Drive\\Arduino_1.8.16_155\\hardware\\teensy/../tools/arm/bin/arm-none-eabi-objdump" -t -C "R:\\Temp\\arduino_build_243500/chBlink.ino.elf"
"C:\\T_Drive\\Arduino_1.8.16_155\\hardware\\teensy/../tools/teensy_size" "R:\\Temp\\arduino_build_243500/chBlink.ino.elf"
Memory Usage on Teensy 4.1:
  FLASH: code:12096, data:3992, headers:8484   free for files:8101892
   RAM1: variables:5920, code:9424, padding:23344   free for local variables:485600
   RAM2: variables:12384  free for malloc/new:511904
Using library ChRt at version 1.3.0 in folder: C:\T_Drive\tCode\libraries\ChRt
 
re 'defragster's post... the other difference u have is u are windows and I'm on a recent ubuntu, so its possibly a linux-only issue? I'm also using a Teensy 4.0, and you are using a 4.1
 
more followup, i can confirm that when i use arduino-1.8.16 + teensyloader 1.55 on a windows 10 VM, it works fine here too, so the bug appears to be limited to linux platforms, and is not a 4.0/4.1 difference.

my linux box is Ubuntu 20.04.3 LTS .

Anyone else with data-points that disagree with this, or can confirm it on a linux/ubuntu install, please let us know here.
 
final note here. it was user error. after comparing the verbose logs from both IDEs on each platform, i discovered my linux box had an old copy of ChRt (1.2.0) in Arduino/libraries/ChRt/ that it was using, not the one from the same path/folder as the 'examples' script i opened... so it was building an old version. sorry for the noise, but it appears removing that one and using latest from github is fine.
 
final note here. it was user error. after comparing the verbose logs from both IDEs on each platform, i discovered my linux box had an old copy of ChRt (1.2.0) in Arduino/libraries/ChRt/ that it was using, not the one from the same path/folder as the 'examples' script i opened... so it was building an old version. sorry for the noise, but it appears removing that one and using latest from github is fine.

Great news ... that's one reason I copied the verbose to show the end of the build and the "ChRt at version 1.3.0" in use.

Having verbose on and scanning those 'Using library' lines can be a great help and indicator.

Those two T_4.1's from 5 hours ago still here blinking ...

Given the same 1062 processor - with the 4.1 the newer one - I didn't figure it was worth rebuilding it all for the 4.0 - glad that wasn't an issue.
 
Back
Top