Forum Rule: Always post complete source code & details to reproduce any issue!
Page 4 of 4 FirstFirst ... 2 3 4
Results 76 to 86 of 86

Thread: Using GDB with Teensy without hardware debugger, first Beta

  1. #76
    I spent a while on this but didn't get it working. I was using the latest Teensyduino and built the project in the Arduino IDE.

    Thanks for trying to help but I've given up for the moment. If I come at it again, I might figure it out.

  2. #77
    Junior Member
    Join Date
    Jan 2021
    Location
    Left Coast USSA
    Posts
    4

    Teensy 4.1 Gdb debugging with NativeEthernet programming Fail

    When trying to use TeensyDebug with NativeUDP after compiling and programming, the mid board LED flashes Yellow at about 4 Hz and the board becomes unreachable via USB until a valid program like Blink is compiled and loaded.
    I have successfully debugged other Teensy 4.1 programs and this issue appears only (so far) when trying to open a UDP port when compiling with the DEBUG Flag on.

    I've tried with and without #pragma and a bunch of other dial spinning and flailing attempts but to no avail.
    Anyone have any idea how to solve this issue?
    Also what does the rapidly flashing LED after a programming attempt mean? Boot loader Fail?

    Platform Linux Debian
    Arduino IDE 1.8.13
    Board Teensy 4.1 with Ethernet
    TeensyDebug version 0.0.1
    NativeEthernet version 1.0.3
    FNET version 0.1.3


    Code:

    #pragma GCC optimize ("O0")

    #include "TeensyDebug.h"
    #include <NativeEthernet.h>
    #include <NativeEthernetUdp.h>

    ////////////////////////////////////////////////////////////////////////////
    // UN-COMMENT LINE BELOW TO REPRODUCE ISSUE WHEN COMPILING WITH DEBUG FLAG ON
    //EthernetUDP Udp;

    void setup() {
    delay(1);
    debug.begin();
    }

    volatile int mark = 0;

    void loop() {
    Serial.print("mark=");Serial.println(mark++);
    delay(1000);
    }

    Attached Files Attached Files

  3. #78
    Member
    Join Date
    Jan 2014
    Location
    New Jersey, USA
    Posts
    63
    Quote Originally Posted by kburden000 View Post
    When trying to use TeensyDebug with NativeUDP after compiling and programming, the mid board LED flashes Yellow at about 4 Hz and the board becomes unreachable via USB until a valid program like Blink is compiled and loaded.
    I have successfully debugged other Teensy 4.1 programs and this issue appears only (so far) when trying to open a UDP port when compiling with the DEBUG Flag on.

    I've tried with and without #pragma and a bunch of other dial spinning and flailing attempts but to no avail.
    Anyone have any idea how to solve this issue?
    Also what does the rapidly flashing LED after a programming attempt mean? Boot loader Fail?

    Platform Linux Debian
    Arduino IDE 1.8.13
    Board Teensy 4.1 with Ethernet
    TeensyDebug version 0.0.1
    NativeEthernet version 1.0.3
    FNET version 0.1.3


    Code:

    #pragma GCC optimize ("O0")

    #include "TeensyDebug.h"
    #include <NativeEthernet.h>
    #include <NativeEthernetUdp.h>

    ////////////////////////////////////////////////////////////////////////////
    // UN-COMMENT LINE BELOW TO REPRODUCE ISSUE WHEN COMPILING WITH DEBUG FLAG ON
    //EthernetUDP Udp;

    void setup() {
    delay(1);
    debug.begin();
    }

    volatile int mark = 0;

    void loop() {
    Serial.print("mark=");Serial.println(mark++);
    delay(1000);
    }

    This sounds great. I used a software-based debugger for ATMega. A limitation was that interrupts needed to be running all the time in order for the debugger to work. Is it possible to set a breakpoint inside an ISR if the ISR disables interrupts for its duration?

  4. #79
    Junior Member
    Join Date
    Jan 2021
    Location
    Left Coast USSA
    Posts
    4
    The technique uses GdbStub more detail here:
    https://github.com/mborgerson/gdbstub

    The actual code is here:
    https://github.com/luni64/TeensyDebug

    Its great if you don't try to use it with the Ethernet add-on for the Teensy, then it doesn't work.
    Don't expect any help from ftrias (author) he's too busy to read this thread or fix any of his major issues.
    Good luck!

  5. #80
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,447
    Quote Originally Posted by kburden000
    The actual code is here:
    https://github.com/luni64/TeensyDebug
    Actually, this is just an unmaintained fork I made for some experiments. Here a link to the correct repository: https://github.com/ftrias/TeensyDebug

  6. #81
    Junior Member
    Join Date
    Jan 2021
    Location
    Left Coast USSA
    Posts
    4
    Hey Luni,
    Any idea on how to fix/workaround the issue with the Ethernet Interface on Teensy 4.1 detailed above?
    I need a debugger to fix the debugger! Reducto Il Absurdum

  7. #82
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    858
    If you need a full featured debugger, the MIMXRT1060-EVK is probably your best option.

  8. #83
    Junior Member
    Join Date
    Jan 2021
    Location
    Left Coast USSA
    Posts
    4
    The MIMXRT1060-EVK looks like a dev tools for making Cortex M7 systems not something used on existing Teensys. Yes?
    Perhaps Paul used one when he made the Teensy.

    My Use Case is debugging an extant Teensy 4.1+Ethernet, which to the best of my knowledge doesn't bring out any hardware debug pins, so the GdbStub method tfrias et. al. used is appropriate.
    But it doesn't work on a Teensy if Ethernet is used. I just wanted that bug fixed.

  9. #84
    Then I guess you need to fix up the debugger code, take a fork and mend it.

    Use a logic analyzer, Oscilloscope or console out to find out why it is not working.

  10. #85
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    13,915
    Quote Originally Posted by AndyCap View Post
    Then I guess you need to fix up the debugger code, take a fork and mend it.

    Use a logic analyzer, Oscilloscope or console out to find out why it is not working.
    Indeed, Thread was marked BETA - and a good amount of effort shows GDB generally usable - but has some limitations - for whatever reason the author hasn't updated in 10 months. Whether lack of interest when time was at hand or complexity of doing more given the process and parts that worked with this fixed external tool.

    Ethernet is speedy and perhaps naughty to the ways of the debugger. Perhaps some things like building with Ethernet disabled or made active later would allow it to start and then maybe even trap where it dies?

  11. #86
    Senior Member
    Join Date
    May 2015
    Location
    USA
    Posts
    858
    To clarify, the MIMXRT1060-EVK can be used to temporarily replace a teensy 4. I haven't tried this one, but with previous eval boards, it wasn't hard to load and run teensy code. Unlike the T4, it then allows easy attachment of a hardware debugger. It's not hard to save $120 in time.

    That being said, with enough print statements and pin toggling, one can find a bug without a debugger.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •