jdolinay / avr_debug

Source level debugger for Arduino - GDB stub for Atmega328 microcontroller used in Arduino Uno.
GNU Lesser General Public License v3.0
142 stars 33 forks source link

Fast transition from debug to release build #16

Closed msquirogac closed 4 years ago

msquirogac commented 4 years ago

These macros have the effect of removing, at compiling time, all the calls to the debug related functions when the firmware is built for release. This allows a fast and seamless transition from debug to release and has no negative effect over the system performance of firmware size. Fixes #15

msquirogac commented 4 years ago

I've created a PR, you can test it with this code:

#include <avr/io.h>
#include "avr_debugger.h"

int main(void)
{
    dbg_start();
    DDRB |= _BV(5);
    PORTB ^= _BV(5);
    PORTB ^= _BV(5);
    while(1)
    {
        dbg_breakpoint();
        PORTB ^= _BV(5);
    }    
}
jdolinay commented 4 years ago

Thanks! I tested it and it works great! It's a good idea to have the avr_debugger header file.