At the first beginning, I just want to programming Arduino (or AVR in C) on Eclipse CDT under my Windows 7 64bit machine. However, I have no idea why Eclipse did not recognize Cygwin GCC. I google and check many articles and follow the instructions (e.g. Environment variables, registry...etc). It does not help.
Okay, so I give up and switch to Ubuntu (where it is installed in my USB HD as portable). Because I need to use Win7 for other work, I decided to use VMware to boot the USB HD as what I did before. Ah~~ It fails again! An error popped from Vmware about the Physical Drive problem. I spend 1/2 days to solve this problem. The solution is simple:
* Start VMware as Adminstrator *.....
OMG~! after solving the HD problem, Ubuntu starts with error.. it halts for no reason.... When I boot it normally (not under VM), it works very well.... Why it is not working in VM? I find out the cause after 2 hours: I have installed the Nvidia driver in Ubuntu before... So, I uninstall the packages and boot... Good. Ubuntu can be run in VM now.
So, the next task is setup the Eclipse (following online tutorial). It is not difficult when I follow the instruction:
http://www.arduino.cc/playground/Code/Eclipse
However, the last part is not very clear and I need to solve it by trial-an-error. The following are the note:
- Create a project to build the static library for Mega2560 (that's what I am using now)
- Follow the instruction and create a sample project (e.g. Blink). It will be cloned for future use
- It needs special setting for AVRdude:
- For Mega2560, protocol is STK500 V2
- Use default baud rate or 1152000 (I guess, not yet tested)
- Port in Ubuntu is: /dev/ttyACM0 (not ttyUSB). It is easy to check the port under Arduino IDE
- Setup the C++ setting for both DEBUG and RELEASE
- Header fix is not working, I leave it
- Messed up with main.c and main.cxx.... I use main.c and modify it:
- Put the include for
- Put(copy) the setup, loop function from what we did in Arduino IDE
Finally, I can program the Blink test in Eclipse and upload to my Mega2560 directly. I also notice that the complied size in Eclipse is bigger than Arduino IDE. I believe we can do better optimization in linker/compiler setting. It could be the next step in future...
Time to bed....
沒有留言:
發佈留言