历史上的今天
今天是:2025年01月03日(星期五)
2020年01月03日 | codeblocks+winavr开发avr单片机(atmega16)
2020-01-03 来源:eefocus
在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 int main(void) { DDRB = 0xFF; PORTB = 0x55; while(1); return 0; } Quote: Compiling: main.c Quote: "CBAVRtest - Debug" uses an invalid compiler. Skipping...
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
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:
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?
)
If anyone does anything more on this I am very interested in the results! Come back here with them!
史海拾趣
|
一份电子工程师常用网站 电子设计技术网: http://www.edn china.com 这个网站的各种资源较全面,其BLOG比较好使.只是有点慢. http://www.21 IC.COM 老牌的电子网站,内容多. 电子工程专辑: ht ...… 查看全部问答> |
|
新买的STC12C5412AD下载时提示MCU型号错,不知道是什么原因? 在淘宝新买的stc12c5412ad用STC-ISP软件下载时提示MCU型号错,请重选,我试了几块都是这样,而且型号是选对了呀!我用以前买的stc12c5404ad下载又可以,不知道是什么原因?难道芯片有假?不会吧!应该是我哪里出了问题,请各位大虾帮帮 ...… 查看全部问答> |
|
编译提示信息如下: 1>------ 已启动生成: 项目: Inline_ObOpenObjectByPointer.WXP, 配置: WXP checked Win32 ------ 1>正在执行生成文件项目操作 1>OSR DDKBUILD.CMD V7.2 (2008-04-14) - OSR, Open Systems Resources, Inc. 1>DDKBLD: >> Se ...… 查看全部问答> |
|
急死了,产品到最后调试发现驱动不支持Multicast 要求: 1 vxWorks环境 2 能支持Multicast、TCP、UDP 给出源码的400分,提供重要参考的100分 另开贴结分,谢了先 … 查看全部问答> |
|
单片机控制机械手臂的设计与制作.这个进栈push A 与 出栈 pop A 为何不相匹配? 在keil 中老是说表达类型不匹配指示?请指点! 单片机控制的伺服电机原程序如下: ORG 00H SJMP MAIN ORG 0008H L ...… 查看全部问答> |
|
被折磨了五天,终于调通了,今天共享,希望有同样经历的可以少走弯路。(还有个问题是发送多个字节的数据,智能读出第一个字节,可能是SPI出问题了吧,希望有解决者指教)一共三个text文件,分别是发送测试、发送、接收,都已在自己的开发板上测试 ...… 查看全部问答> |
|
剑走偏锋和非常规思维并不总是什么光彩的事情,因为你考虑的东西到底没有别人考虑的周全——一个人怎么比得上一群人呢?但是,有时候,真的不是我故意耍酷或者标新立异,才使用什么什么 非常规思维。然而,我的上司在看我的代码时,得出的结论总是 ...… 查看全部问答> |




