通过 CrossPack AVR 在 Mac 上编译 AVR 程序

通过 CrossPack AVR 在 Mac 上编译 AVR 程序

TONYLABS 27 Jan, 2014
Share:

CrossPack 官方网址:http://www.obdev.at/products/crosspack/index.html 通过 avr-project 命令创建一个演示程序,只需在 Terminal 中执行 avr-project 即可 bash$ cd Desktop bash$ avr-project Demo bash$ cd Demo bash$ ls -l total 0 drwxr-xr-x 3 cs cs 102 Nov 22 18:29 Demo.xcodeproj drwxr-xr-x 4 cs cs 136 Nov 22 18:29 firmware bash$ cd firmware bash$ ls -l total 24 -rw-r--r-- 1 cs cs 4139 Nov 22 18:29 Makefile -rw-r--r-- 1 cs cs 348 Nov 22 18:29main.c   #include #include int main(void) {    DDRD = 1 << 4; /* make the LED pin an output */    for(;;)    {        char i;        for(i = 0; i < 10; i++){            _delay_ms(30); /* max is 262.14 ms / F_CPU in MHz */        }        PORTD ^= 1 << 4; /* toggle the LED */    }    return 0; /* never reached */ }

 编译上传

bash$ make avr-gcc -Wall -Os -DF_CPU=8000000 -mmcu=atmega8 -c main.c -o main.o avr-gcc -Wall -Os -DF_CPU=8000000 -mmcu=atmega8 -o main.elf main.o rm -f main.hex avr-objcopy -j .text -j .data -O ihex main.elf main.hex bash$ make flash avrdude -c USBasp -p atmega8 -U flash:w:main.hex:i avrdude: AVR device initialized and ready to accept instructions Reading | ############################################ | 100% 0.19s ... bash$ make fuse avrdude -c USBasp -p atmega8 -U hfuse:w:0xd9:m -U lfuse:w:0x24:m ​avrdude: AVR device initialized and ready to accept instructions Reading | ############################################ | 100% 0.19s ...

 下载地址:

Like what you're reading? Subscribe to our top stories.

We will continue to update Front; if you have any questions or suggestions, please contact us!

Follow us on Medium, Twitter, Facebook, YouTube, and Dribbble.

Image Description
Written by

Hanna Wolfe

I create advanced website builders made exclusively for web developers.

3 Comments

  • Image Description
    Dave Austin 1 day ago

    As a Special Education teacher this resonates so well with me. Fighting with gen ed teachers to flatten for the students with learning disabilities. It also confirms some things for me in my writing.

    Reply
    • Image Description
      Hanna Wolfe 1 day ago

      Love it Dave! We're all about keeping it up.

      Reply
  • Image Description
    Christina Kray 2 days ago

    Since our attention spans seem to be shrinking by the day — keeping it simple is more important than ever.

    Reply

Post a comment

Stay in the know

Get special offers on the latest developments from Front.