Society of Robots - Robot Forum
Software => Software => Topic started by: smani on June 14, 2009, 06:33:51 AM
-
Here is a quick how-to for working with the Axon on Ubuntu (and any other distributions, just use the according packages). I prefer to work with minimalistic tools, i.e. text editor and command line, hence this "development environment" does not make use of AVR studios or similar, although AVR studios exists for linux, and therefore should not be too much of a problem to install.
Enjoy, smani
**************************************************
* Axon on Ubuntu Linux (tested with 9.04 and up) *
**************************************************
* INSTALLATION
- Base packages:
sudo apt-get install build-essential gcc-avr gdb-avr binutils-avr avr-libc simulavr minicom
- Compile the bootloader
Download the bootloader [1]
cd <bootloader_dir>
make
* WORKING WITH THE CONTROLLER
- Plug the controller in a USB port, recent kernels already contain the driver.
- Check if the BAUD rate of the serial port is correct [2]:
stty -F /dev/ttyUSB0 (use /dev/ttyUSB<n> according to your particular system)
The BAUD should be 115200, else set it:
stty -F /dev/ttyUSB0 115200
- Connect to ttyUSB0 via minicom [3]:
- run
minicom -s
choose Serial port setup and select the correct serial device node (here /dev/ttyUSB0)
- Save configuration as def[ault] (optional)
- run minicom, you should now be connected
- To quit minicom, CTRL+A, then Z and finally Q
* PROGRAMMING
- Download Axon source files
- Edit the source files as you need
- Run make
- Assure your Axon is turned OFF! (i.e. battery disconnected, but still connected to USB clearly)
- Upload the program to the device (make sure minicom is not active!):
./bootloader -d /dev/ttyUSB0 -b 115200 -p file.hex
where file.hex is your program (run bootloader without arguments for help)
- Turn on your Axon (i.e. connect power), programming should start (make sure there is no minicom instance running as it will lock the device!)
- Once programming is complete, your done.
* REFERENCES
[1] http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_type=project&item_id=1927 (http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_type=project&item_id=1927)
[2] http://embedded.seattle.intel-research.net/wiki/index.php?title=Using_other_UARTs_in_Linux (http://embedded.seattle.intel-research.net/wiki/index.php?title=Using_other_UARTs_in_Linux)
[3] http://www.cyberciti.biz/tips/connect-soekris-single-board-computer-using-minicom.html (http://www.cyberciti.biz/tips/connect-soekris-single-board-computer-using-minicom.html)
-
<3 , I've been looking to buy an Axon however I am a big Ubuntu fan and don't want to have to run Vista for all my microcontroller needs. I've been holding off buying one until I have enough time to properly get it working, this makes it so much easier for me!
Thanks for the tip!
-
I also wrote a simplier makefile that includes only the essential rules, allowing easier editing and also including a rule to program the device (note that bootloader needs to be in your PATH, otherwise change the path below, i.e. to ./bootloader):
# Simple Makefile for Axon
# Written by Sandro Mani, version 20.06.2009
#
# Rules:
# all -> build
# build build the program
# clean clean built files
# program program the device
# Project settings
# MCU type, i.e. atmega640
MCU = atmega640
# dev node of the controller, i.e. /dev/ttyUSB0
DEVNODE = ttyUSB0
# Name of the project
NAME = Axon
# List of needed object files
OBJFILES=a2d.o main.o buffer.o rprintf.o timer640.o uart4.o
# Compiler flags settings
CC = avr-gcc
CFLAGS = -mmcu=$(MCU) -Os -Wall -Wstrict-prototypes -std=gnu99
LDFLAGS = -lm
all: build
build: $(NAME).bin
@echo Creating program $(NAME).hex...
@avr-objcopy -O ihex -R .eeprom $(NAME).bin $(NAME).hex
@echo
@echo Done!
@avr-size --target=ihex $(NAME).hex
$(NAME).bin: $(OBJFILES)
@echo Linking $(OBJFILES) to $(NAME).bin...
@$(CC) $(CFLAGS) $(LDFLAGS) $(OBJFILES) -o $(NAME).bin
%.o: %.c
@echo Compiling $<...
@$(CC) -c $(CFLAGS) $< -o $@
clean:
@echo Cleaning up...
@rm -f *.o $(NAME).bin $(NAME).hex
program: build
./bootloader -d /dev/$(DEVNODE) -b 115200 -p $(NAME).hex
.PHONY: all build clean program
-
Is this using just the standard USB cable attached directly to the Axon? Or is it using some other hardware to attach to the Axon?
-
Nono, standard USB cable. Just Plug-n-Play.
-
Cool! One less reason for me to use Windows. Now if only my CAD software were to work in Linux, I'd probably swap :P
Anyway, I linked this up in step 2 here:
http://www.societyofrobots.com/axon/axon_getting_started_software.shtml (http://www.societyofrobots.com/axon/axon_getting_started_software.shtml)
-
Just wait, the more M$ releases garbage that is only designed to look fancy but is totally useless for anything else than playing, the more CAD manufacturers will realize where to focus development on ;D And Wine is getting better at an extremely fast rate, just in case ;)
-
And Wine is getting better at an extremely fast rate, just in case
Yeah, I'm able to get just about anything working with Wine now.
-
Why is the bootloader so slow? It takes 40 seconds to transfer a 108k .hex file.
-
Why is the bootloader so slow? It takes 40 seconds to transfer a 108k .hex file.
http://www.societyofrobots.com/axon/axon_FAQ.shtml#boot_slow (http://www.societyofrobots.com/axon/axon_FAQ.shtml#boot_slow)
-
I'm using Ubuntu.
-
EDIT* - My bad, it's already been posted http://www.societyofrobots.com/robotforum/index.php?topic=10792.0. (http://www.societyofrobots.com/robotforum/index.php?topic=10792.0.) Sorry about that.
Hey, I know this hasn't been posted in for a while but I'm running into some problems. I cant seem to run my makefile properly to build the hex file.
I'm rather new to compiling software from te command line but from what I read, I'm supposed just run make from the directory that my files are in:
root@turdferg-desktop:~/Documents/Robotics/my_robots/Axon/Servo# make
When I try this i get this error message:
.dep/a2d.o.d:1: *** multiple target patterns. Stop.
I'm really at a loss here, any help would be greatly appreciated ;)
Should I be using a different makefile for ubuntu than windows maybe?
-
Can you post the makefile? Also, copy and paste all the error messages when you compile after a make clean.
Joe
-
Just to ask... Why not run a VM??? Most of us guys, in University, simply do this... (VM = Virtual machine)
It's that easy... They won't get 100% processing power, but you don't need them for programming anyways...
It's merely that simple... ;)
-
Cool! One less reason for me to use Windows. Now if only my CAD software were to work in Linux, I'd probably swap :P
As someone said already, you can use Wine. I particularly use K3D for all my CAD. Not as intuitive as SketchUp but way more powerful.
If you really want to swap, I bet you'll always find an alternative piece of software or at least a way to run the one you already have. I use Oracle's VirtualBox for example when absolutely necessary. ;)