极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 12628|回复: 2

如何把avr-gcc编译的代码放到ARDUINO IDE里编译?

[复制链接]
发表于 2017-8-18 04:59:57 | 显示全部楼层 |阅读模式
本帖最后由 Stormer 于 2017-8-18 17:16 编辑

刚从GITHUB上找了个源码,作者是用gcc什么的把C语言源码写入ARDUINO的。 感觉好蛋疼啊,放着GUI的IDE不用。是不是LINUX下没有ARDUINO的IDE?

我看看能不能把这些源码转移到ARDUINO IDE的工程下。



\\-----------------------------------------------------

奇怪我把.h文件include进去,编译错误,说找不到函数声明,这是怎么回事?





然后我吧.h .c文件复制到 arduino/lib 目录, #include <ym2149.h>, 编译保存函数重复定义。。晕


libraries/YM2149/ym2149.c.o (symbol from plugin): In function `set_ym_clock':
(.text+0x0): multiple definition of `set_ym_clock'
sketch/ym2149.c.o (symbol from plugin).text+0x0): first defined here
libraries/YM2149/ym2149.c.o (symbol from plugin): In function `set_ym_clock':
(.text+0x0): multiple definition of `set_bus_ctl'
sketch/ym2149.c.o (symbol from plugin).text+0x0): first defined here
libraries/YM2149/ym2149.c.o (symbol from plugin): In function `set_ym_clock':
(.text+0x0): multiple definition of `set_data_out'
sketch/ym2149.c.o (symbol from plugin).text+0x0): first defined here
libraries/YM2149/ym2149.c.o (symbol from plugin): In function `set_ym_clock':
(.text+0x0): multiple definition of `set_data_in'
sketch/ym2149.c.o (symbol from plugin).text+0x0): first defined here
libraries/YM2149/ym2149.c.o (symbol from plugin): In function `set_ym_clock':
(.text+0x0): multiple definition of `set_address'
sketch/ym2149.c.o (symbol from plugin).text+0x0): first defined here
libraries/YM2149/ym2149.c.o (symbol from plugin): In function `set_ym_clock':
(.text+0x0): multiple definition of `set_data'
sketch/ym2149.c.o (symbol from plugin).text+0x0): first defined here
libraries/YM2149/ym2149.c.o (symbol from plugin): In function `set_ym_clock':
(.text+0x0): multiple definition of `get_data'
sketch/ym2149.c.o (symbol from plugin).text+0x0): first defined here
libraries/YM2149/ym2149.c.o (symbol from plugin): In function `set_ym_clock':
(.text+0x0): multiple definition of `send_data'
sketch/ym2149.c.o (symbol from plugin).text+0x0): first defined here
libraries/YM2149/ym2149.c.o (symbol from plugin): In function `set_ym_clock':
(.text+0x0): multiple definition of `read_data'
sketch/ym2149.c.o (symbol from plugin).text+0x0): first defined here
/var/folders/xv/p4nlbyh12w3dfympc6_5pj_80000gn/T//cc6JF2Pd.ltrans0.ltrans.o: In function `setup':
/Users/starock/Desktop/YM2149/YM2149.ino:38: undefined reference to `set_ym_clock()'
/Users/starock/Desktop/YM2149/YM2149.ino:39: undefined reference to `set_bus_ctl()'
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino/Genuino Uno.







-----------PS: 下面是我尝试用avr-gcc编译的笔记,可以忽略------------------


OK,不用ARDUINO IDE,折腾半天装好avr-gcc什么的,make,成功,但是make flash向板子写入的时候又出错了。




应该是MAKE文件里的端口写的不正确,打开MAKE文件:


我改成在ARDUINO IDE TOOLS菜单里显示的端口名称



>make flash

依然不对,报错:avrdude: ser_open(): can't open device "/dev/cu.submodem1441": No such file or directory

这里该怎么写呢?

-----------------------------------

艹,笔误。。。。。submodem1441 应该是 usbmodem1441。

搞定了。



\\-----------------------------------------------------
READ ME:


Title: ym2149-test

The ym2149-test is a little firmware to check that the [YM2149 &
Arduino circuit][2] is working properly.

Requirements
------------

The following libraries are required:

* avr-gcc
* avr-libc
* avrdude

How to test the circuit
-----------------------

    $ make
    $ make flash

More information
----------------

More information can be found on my blog:

* [Driving YM2149F sound chip with an Arduino][2]
* [Arduino Hello World without IDE][3]

Besides, a video showing the [YM2149 & Arduino circuit playing a tune][1] is
available.

[1]: https://www.youtube.com/watch?v=MTRJdDbY048
[2]: http://www.florentflament.com/bl ... ith-an-arduino.html
[3]: http://www.florentflament.com/bl ... ld-without-ide.html

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复

使用道具 举报

发表于 2017-8-18 10:28:14 | 显示全部楼层
估计作者。。。习惯用文档编辑器写代码了~
回复 支持 反对

使用道具 举报

 楼主| 发表于 2017-8-18 10:38:53 | 显示全部楼层
弘毅 发表于 2017-8-18 10:28
估计作者。。。习惯用文档编辑器写代码了~

嗯 调试太不方便了。 我得想法把代码放到ARDUINO IDE里编译。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则 需要先绑定手机号

Archiver|联系我们|极客工坊

GMT+8, 2024-3-28 15:13 , Processed in 0.049739 second(s), 19 queries .

Powered by Discuz! X3.4 Licensed

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表