Stormer 发表于 2017-8-18 04:59:57

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

本帖最后由 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] 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:

*
*

Besides, a video showing the is
available.

: https://www.youtube.com/watch?v=MTRJdDbY048
: http://www.florentflament.com/blog/driving-ym2149f-sound-chip-with-an-arduino.html
: http://www.florentflament.com/blog/arduino-hello-world-without-ide.html

弘毅 发表于 2017-8-18 10:28:14

估计作者。。。习惯用文档编辑器写代码了~

Stormer 发表于 2017-8-18 10:38:53

弘毅 发表于 2017-8-18 10:28
估计作者。。。习惯用文档编辑器写代码了~

嗯 调试太不方便了。 我得想法把代码放到ARDUINO IDE里编译。
页: [1]
查看完整版本: 如何把avr-gcc编译的代码放到ARDUINO IDE里编译?