我无法让avr-精灵窗口和WinAVR工作.我已经成功地构建了由avr (ATmega2560)提供的示例。但是,如果我尝试使用另一个芯片或开始使用WinAVR提供的包和项目,我会不断地收到错误,我无法解决。
方法1:
修改ATmega2560示例以使用WinAVR包。
更改:
with Atmega2560; use Atmega2560;至:
with AVR; use AVR;
with AVR.Atmega328p; use AVR.atmega328p;创建一个项目文件,其中包括:
with "C:\WinAVR-20100110\lib\gnat\avr.gpr";
with "C:\WinAVR-20100110\lib\gnat\avr_app.gpr";运行使我得到以下错误:
avr-gnatmake:"C:\WinAVR-20100110\lib\gnat\avr_lib\avr-int_img.adb“编译错误
很好,我有一个编译问题,但我看不到错误。
方法2:
在GPS中打开上面的项目文件。将生成设置更改为gnatmake。GPS现在开始报告错误和警告:
项目警告:对象目录“avr_lib/avr 5/obj”未找到项目库目录"C:\WinAVR-20100110\lib\gnat\avr_lib\avr5\lib\“不存在
后一个问题显然是,我没有正确地设置GPS来告诉它微控制器和体系结构的价值,但我似乎找不到任何东西来解决这个问题。
方法3:
要直接使用makefiles设置的WinAVR,这将给出错误:
avr-gnatmake: RTS路径无效:缺少adainclude和adalib目录
如果我按照我通过搜索web可以找到的说明,我只能找到在Linux下构建所需库的详细信息。
站台: Windows 7。
通过以上两种答案的结合,我现在成功地将我的示例代码链接起来。至于它是否会在Arduino上工作,这是另外一个问题。
非常感谢你的帮助。
我觉得这有点让人沮丧,我想知道是否还有其他人可能会放弃Arduino上的Ada,回到Arduino IDE,因此错过了学习一门更有结构的语言的机会。有许多误导的网页,也没有帮助。
发布于 2013-03-30 23:27:33
您可能想看看报纸在Ada中集成8位AVR微控制器。基本上,您可以使用GPS项目文件arduino.gpr,如
project Arduino is
for Source_Dirs use (".", "src");
for Object_Dir use "obj";
for Exec_Dir use "bin";
for Main use ("main.adb");
package Compiler is
for Default_Switches ("ada") use ("-mmcu=avr5");
end Compiler;
package Ide is
for Gnat use "avr-gnat";
for Gnatlist use "avr-gnatls";
for Debugger_Command use "avr-gdb";
end Ide;
package Builder is
for Executable_Suffix use ".elf";
for Default_Switches ("ada") use ("--RTS=rts-zfp");
end Builder;
package Linker is
for Default_Switches ("ada") use ("obj\crtm328p._o", "-nostdlib", "-lgcc", "-mavr5", "-Tdata=0x00800200", "-mmcu=avr5");
end Linker;
end Arduino;您可以为您的ATmega328P编写规范,如
with Interfaces; use Interfaces;
with System;
package ATmega328P is
-- PORTB: Port B Data Register
PORTB : Unsigned_8;
for PORTB'Address use System'To_Address (16#25#);
-- DDRB: Port B Data Direction Register
DDRB : Unsigned_8;
for DDRB'Address use System'To_Address (16#24#);
-- PINB: Port B Input Pins
PINB : Unsigned_8;
for PINB'Address use System'To_Address (16#23#);
end ATmega328P;由主文件或库导入。
发布于 2013-03-30 23:37:13
如果这不是直接的答案,请耐心等待我;我只在Linux上使用了AVR工具链,所以我们可能不得不迭代到一个解决方案,除非其他人首先发现了问题。
首先要破译的是您拥有的Ada工具的哪个版本:
您的项目文件曾经需要(使用ada 1.1)
with "C:\WinAVR-20100110\lib\gnat\avr.gpr";现在使用avr 1.2.1,您需要(而不是)
with "C:\WinAVR-20100110\lib\gnat\avr_app.gpr";用于构建应用程序,<same path>/avr_lib.gpr用于库。
我不相信你两样都需要!他们可能会发生冲突。
我不知道Windows二进制构建的状态,但是如果您需要最新版本(推荐:这是一个真正的改进),您可能需要从源代码构建它。
方法1:您是从命令行运行Make吗?如果是这样的话,我希望看到错误的所有血淋淋的细节。
方法2:在这里帮不了你,我对GPS不太了解。但是,我可以说,在Linux上,在there /avr/lib/gnat/avr_lib中没有"avr5“文件夹。(328 p的AVR5是正确的)
相反,这里有一个包含libc和其他C相关对象的there /avr/lib/avr 5--包括Rego在他的链接器开关中命名的crtm328p.o,以及包含libgcc.a的there/lib/gcc/avr/4.7.2/avr 5文件夹。你可能需要找到前者并指向它..。
方法3:这看起来是最容易修复的。"gnatmake“命令需要一个- RTS =选项,指向328 p的正确RTS。假设正确安装了RTS,这应该是--RTS=rts/avr5。
或者,一条完整的道路应该能行得通。在这里,那应该是
--RTS=/opt/avr_472_gnat/lib/gcc/avr/4.7.2/rts/avr5在Windows上,您可能需要四处查看以找到正确的路径。使用方法1这个-RTS选项是由avr_app.gpr自动生成的.
发布于 2013-04-27 07:08:54
看来,安装了3或4个工具链的组合,提供了WinAvr的一个方面,AvrAda会引起重大问题(包括WinAvr、AvrAda、Cygwin、Adacore和MinWG的AVR编译器)。
从全新的Win7或Win8安装开始,执行以下操作:
Install WinAVR-20100110 to C:\WinAVR-20100110
Copy the content of the Avr-Ada-1.2.0_bin to C:\avr-ada-1.2.0
Add C:\avr-ada-1.2.0\bin to the PATH
Compiling the content of each of the examples in C:\avr-ada-1.2.0\share\doc\avr-ada\apps identifies that some DLLs are missing: libiconv-2.dll, libgmp-10.dll, libmpc-2.dll, libmpfr-1.dll
These can be found in a MinGW installtion.
Create a virtual machine to install MinGW on, in order to ensure it did not mess with the main PC.
Copy the missing DLLs in C:\WinAVR-20100110\bin
The example in DS1820 will not compile due to crc_lib being missing.
In order to upload to the Arduino the makefiles must be modified for your local installation, board type etc.https://stackoverflow.com/questions/15723946
复制相似问题