zoukankan      html  css  js  c++  java
  • codeblocks+winavr开发avr单片机(atmega16)

    在avrfeaks论坛里,有一个帖子是关于在codeblocks环境下(与winavr结合)开发avr单片机的,挺不错的,这里转载一下:

    I got curious, so I downloaded the current C::B installer. It looks better than when I last used it (a year ago?):


    - A working installation program, with no need to install graphics packages and stuff (WxWidget, MinGW) separately.
    - A user manual is now available.

    Upon first launch I was asked if C::B should "steal" the C and C++ filetypes. I said no at this moment.

    I then was presented with a choice of copiler, and THERE IT WAS: GNU AVR GCC Compiler

    So I chose that, and started creating a new project. The project type "AVR Project" was available so I chose that.

    A wizard starts with the usual stuff in the first step: Project name, location etc.

    Second step: Select AVR processor, and I have a ATmega88 on the STK500 so I chose that. Here is also the setting of F_CPU, what files to generate and an option to run avr-size after build.

    Finish!

    I now have a main.c, with a int main(void) which I add two lines to so I get:


    Code:
    #include <avr/io.h>
    
    int main(void)
    {
        DDRB = 0xFF;
        PORTB = 0x55;
    
        while(1);
    
        return 0;
    } 


    I hit build and ... it does not work. C::B can not locate the compiler, and used odd names (In my view) for it. ON to theSettingsmenu,Compiler and Linker... item, Toolchain Executablestab. There I browse for the correct executables (in my case they are in the WinAVR installation) and add paths to the two directories containing those executables.

    But there it stops: I cannot get a build to build correctly.

    Choosing Compile current file I get
    Quote:
    Compiling: main.c
    cc1.exe: error: missing argument to "-mmcu="
    Process terminated with status 1 (0 minutes, 0 seconds)
    0 errors, 0 warnings

    A double-check that the AVR model is set in the project confirms that it is.

    Choosing Build it gets worse:
    Quote:
    "CBAVRtest - Debug" uses an invalid compiler. Skipping...
    Nothing to be done.

    Oh, well... It was woth the half-hour I spent. C::B has a nice forum with helpful people (you have to do your home/leg-work though. If you think we here at AVRfreaks are tough then you've seen nothing. Them there C::B'ers are far worse (or better?Wink)

    If anyone does anything more on this I am very interested in the results! Come back here with them!
  • 相关阅读:
    【题解】CF#983 E-NN country
    【题解】CF#403 D-Beautiful Pairs of Numbers
    【题解】CF#285 E-Positions in Permutations
    【题解】FJOI2015火星商店问题
    【题解】Atcoder AGC#01 E-BBQ Hard
    【题解】Atcoder AGC#03 E-Sequential operations on Sequence
    【题解】CF#280 C-Game on Tree
    【题解】CF#833 B-The Bakery
    [BZOJ3600] 没有人的算术 [重量平衡树+权值线段树]
    [bzoj3514][CodeChef GERALD07] Chef ans Graph Queries [LCT+主席树]
  • 原文地址:https://www.cnblogs.com/CodeWorkerLiMing/p/12007720.html
Copyright © 2011-2022 走看看