TeensyDebug and Arduino 2.0 IDE

wearyhacker

Well-known member
The teensy_debug installation python script cannot find the right place to put things in an Arduino IDE 2.x installation. I have hacked it to put most things in the right places under ~/.arduino15/. However I am stuck on where to put boards.local.txt and platform.local.txt.

I have tried ./packages/teensy/hardware/avr/boards.local.txt ./packages/teensy/hardware/avr/1.57.2/boards.local.txt, but neither places seem to work. Has anyone got any suggestions on where the should go. The documentation seems vague on this point.

Thanks
 
Find the location where the boards.txt and platform.txt are located. Copy the .local. files there and restart the IDE and it should work.

On Windows this opens the folder holding the installed board 0.58.3 {for Beta of 1.58} and those text files: %appdata%\..\local\Arduino15\packages\teensy\hardware\avr
 
The location of the boards.txt and platform.txt files is here.
Code:
roger@dragon:~/.arduino15/packages/teensy/hardware/avr/1.57.2$ ls
boards.local.txt  boards.txt  cores  installed.json  keywords.txt  libraries  platform.local.txt  platform.txt

That is one of the locations I tried. I must be missing something else here.
 
I see that isn't 'Windows'. I've made at least one IDE 2 .local. edit that worked - under Windows using "that path".

Though IDE 2 does some caching for those .txt files - not sure if that is causing trouble seeing the results ... in addition to the OS, and maybe having known bugs/issues?

I know I just made some IDE 2 boards.txt edits that DID NOT work from the IDE2 - but do from the (windows) TSET CMDLINE tool used here, that uses the same build Paths as IDE2 as configured by default. Maybe I should try that with a .local. file to test. Was looking to re-enable the LTO compile options that are now commented out.

If you can find a way to have the .local. file preset a known change or addition - or maybe even an error just to prove that the IDE2 is even trying to include them?
 
Made local.txt changes and they were also ignored.

There are cached settings - there is a folder that needs to be removed with IDE 2 closed - See item #4 this post: Arduino-CLI-And-IDE-now-Released-Teensy-Supported!

Note - it may mess up other stuff?
> first T_4.1 build failed on the single opened sketch - opened a second and updated ESP32 board and then it built and responded to the .txt file changes.
 
That got things in the menu on the IDE working. My test sketch compiles. Just got to get it debugging. Do I need to launch gdb nanually in this environmen? I am more used to Platformio.
 
This is driving me nuts.

In the IDE compilation randomly fails. Nothing is being changed, I just have to keep pressing the Verify button until it works. It fails more times than it works. Looking at the output logs the difference is in the compiler flags being used. Unfortunately the build that fails is the one that contains the compiler flags from boards.local.txt. This is the one that fails.
Code:
/home/roger/.arduino15/packages/teensy/tools/teensy-tools/1.57.2/precompile_helper /home/roger/.arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 /tmp/arduino-sketch-CC81A5A23484C7D95A00AD5A53FB6A62 /home/roger/.arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-g++ -x c++-header -Og -g -DGDB_DUAL_SERIAL -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_DUAL_SERIAL -DLAYOUT_US_ENGLISH -I/home/roger/.arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 /tmp/arduino-sketch-CC81A5A23484C7D95A00AD5A53FB6A62/pch/Arduino.h -o /tmp/arduino-sketch-CC81A5A23484C7D95A00AD5A53FB6A62/pch/Arduino.h.gch
This is the one that works.
Code:
/home/roger/.arduino15/packages/teensy/tools/teensy-tools/1.57.2/precompile_helper /home/roger/.arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 /tmp/arduino-sketch-CC81A5A23484C7D95A00AD5A53FB6A62 /home/roger/.arduino15/packages/teensy/tools/teensy-compile/5.4.1/arm/bin/arm-none-eabi-g++ -x c++-header -O2 -g -Wall -ffunction-sections -fdata-sections -nostdlib -MMD -std=gnu++14 -fno-exceptions -fpermissive -fno-rtti -fno-threadsafe-statics -felide-constructors -Wno-error=narrowing -mthumb -mcpu=cortex-m7 -mfloat-abi=hard -mfpu=fpv5-d16 -D__IMXRT1062__ -DTEENSYDUINO=157 -DARDUINO=10607 -DARDUINO_TEENSY41 -DF_CPU=600000000 -DUSB_DUAL_SERIAL -DLAYOUT_US_ENGLISH -I/home/roger/.arduino15/packages/teensy/hardware/avr/1.57.2/cores/teensy4 /tmp/arduino-sketch-CC81A5A23484C7D95A00AD5A53FB6A62/pch/Arduino.h -o /tmp/arduino-sketch-CC81A5A23484C7D95A00AD5A53FB6A62/pch/Arduino.h.gch
It is difficult to make out what is going on. USB_DUAL_SERIAL appears in both but in different places. The "-Og -g -DGDB_DUAL_SERIAL" sequence comes from the boards.local.txt file.

What a mess!
 
Is TeensyDebug essentially dead now? I've tried the 2.x IDE and VSMicro/Visual Studio and cannot get it to work. Can anyone confirm a reliable install procedure? The best I have been able to do is get hello world to compile but it loads un-runnable code that generates 7 blinks. (randomly 8 blinks)

It would be a shame if this is abandonware, because I bet the core code works fine. I think it just hasn't been updated for the latest ide/teensyduino environment.

I tried to understand what the mapping would be, but I've got many vestigial arduino directories that have gotten installed over the years and can't afford to be monkeying around with the production environment.
 
I’ve used it recently on IDE 1.8.19 under Windows. (I’ve never migrated to 2.x because portable mode isn’t implemented: the issue raised over 5 years ago is locked for further comments with a dev comment that it’s “low priority” - now that’s abandonware 🤬)

The installation instructions given in the ReadMe should work for IDE 1.x - have you tried that? It should give the extra menu options, use a slightly different loading procedure (which calls the standard Teensy loader so you still see it happening), and pop up a debug window after the Teensy reboots.

If the Teensy doesn’t reboot properly (USB doesn’t enumerate) then the debug window doesn’t appear, and the IDE gives a message. If using dual serial then the ports can sometimes be named the wrong way round, which causes gdb not to attach to the remote, but at least it’s started - doesn’t sound like this is your issue, though.

There does seem to be an outstanding issue with Teensy startup code which causes it to crash very early. I usually provoke it when trying to debug a sketch using the Audio library; typically it hasn’t shown up with simple sketches but there’s no obvious reason for it one way or the other, so I guess it could do so. I’ve put in PR#673 which is a reliable fix for me - on the comments Paul said he’d committed a fix, but that’s not working for me. The fix is simple, changing the optimisation level for reset_PFD() in cores/teensy4/startup.c thus:
C++:
 __attribute__((optimize("O2")))
 FLASHMEM void reset_PFD()

I’ve definitely seen the red flash when the debugger has been stopped at a breakpoint for a while.

It‘s a good test to turn on the LED, wait for Serial, output and flush a message, turn the LED off, and only then execute halt_cpu(); this tells you quite a lot about whether your Teensy has started and which port is which.
 
Back
Top