Skip to content

yetimdasturchi/avr-scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

avr-scripts

Collection of bash scripts for avr-gcc

Example code for testing:

#define F_CPU 16000000UL
#include <avr/io.h>
#include <util/delay.h>

void flip_flop() {
    static uint8_t state = 0;

    state = ~state;

    PORTB = (state & 0x01) << PORTB0 | (!(state & 0x01)) << PORTB1;
}

int main(void) {
    DDRB |= (1 << DDB0) | (1 << DDB1);

    while (1) {
        flip_flop();
        _delay_ms(500);
    }

    return 0;
}

Compiling code:

avr-gcc -mmcu=atmega328p -Os -o firmware.elf main.c

Using scripts:

./flash.sh firmware.elf
./ram_usage.sh firmware.elf

About

Collection of bash scripts for avr-gcc

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages