Author Topic: Linux toolchain and 50$ robot  (Read 3881 times)

0 Members and 1 Guest are viewing this topic.

Offline MikaeliTopic starter

  • Beginner
  • *
  • Posts: 3
  • Helpful? 0
Linux toolchain and 50$ robot
« on: March 17, 2008, 05:33:08 PM »
First I have to say that Society of robots is a great site and a great forum. I've been lurking here for a while and now it's time to post my first question.

I'm using Linux (Kubuntu) and Eclipse to develop code for AVR. So far I've been able to compile and program my ATMEGA128 development board without any problems (simple program to flash some leds).

I created a project in a similar manner for the 50$ robot too. I can compile the project, but when I program the robot it just sits still. Nothing works at all. If I program the robot with the compiled hex-file from the tutorial it starts working just great. The compiled .hex file is also of same size as the Photovore_v1.hex

So a couple of questions:
1. What is the most likely parameter in the compile process that is wrong?
2. Does anyone have experience using Linux+avr-toolchain+eclipse for AVR development?

I've tried to compare the make file and the cdt compiling settings in the Eclipse, but so far I have not found the correct parameters.

Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,431
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
    • Nerdcore - Programming, Electronics, Mechanics
Re: Linux toolchain and 50$ robot
« Reply #1 on: March 17, 2008, 05:55:15 PM »
I've found that maybe you can turn off the robot, unhook it from the programmer, and turn it back on that it might work.

Offline JesseWelling

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: Linux toolchain and 50$ robot
« Reply #2 on: March 17, 2008, 09:02:52 PM »
I don't use eclipse (i use vim...) and I haven't worked on the $50 robot but I have worked with the avr-gcc and make files so maybe I can help. Why don't you post your make file and see if we can figure out anything.

Offline MikaeliTopic starter

  • Beginner
  • *
  • Posts: 3
  • Helpful? 0
Re: Linux toolchain and 50$ robot
« Reply #3 on: March 18, 2008, 02:25:39 PM »
Here are the makefiles, automatically created by eclipse according to my build settings. I've tried to use the makefile for 50$ robot to get the settings right, but with no success.

First the makefile:

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

-include ../makefile.init

RM := rm -rf

# All of the sources participating in the build are defined here
-include sources.mk
-include subdir.mk
-include objects.mk

ifneq ($(MAKECMDGOALS),clean)
ifneq ($(strip $(C_DEPS)),)
-include $(C_DEPS)
endif
endif

-include ../makefile.defs

# Add inputs and outputs from these tool invocations to the build variables

# All Target
all: Photovore_v1.elf

# Tool invocations
Photovore_v1.elf: $(OBJS) $(USER_OBJS)
   @echo 'Building target: $@'
   @echo 'Invoking: GCC C Linker'
   avr-gcc -Wl,-Map=$(TARGET).map,--cref -lm -o"Photovore_v1.elf" $(OBJS) $(USER_OBJS) $(LIBS)
   @echo 'Finished building target: $@'
   @echo ' '
   $(MAKE) --no-print-directory post-build

# Other Targets
clean:
   -$(RM) $(OBJS)$(C_DEPS)$(EXECUTABLES) Photovore_v1.elf
   -@echo ' '

post-build:
   -avr-objcopy -O ihex Photovore_v1.elf Photovore_v1.hex
   -@echo ' '

.PHONY: all clean dependents
.SECONDARY: post-build

-include ../makefile.targets

Then sources.mk:

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

O_SRCS :=
C_SRCS :=
S_SRCS :=
OBJ_SRCS :=
ASM_SRCS :=
OBJS :=
C_DEPS :=
EXECUTABLES :=

# Every subdirectory with source files must be described here
SUBDIRS := \
. \

subdir.mk

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

# Add inputs and outputs from these tool invocations to the build variables
C_SRCS += \
../Photovore_v1.c \
../a2d.c

OBJS += \
./Photovore_v1.o \
./a2d.o

C_DEPS += \
./Photovore_v1.d \
./a2d.d


# Each subdirectory must supply rules for building sources it contributes
%.o: ../%.c
   @echo 'Building file: $<'
   @echo 'Invoking: GCC C Compiler'
   avr-gcc -I/usr/avr/include -O0 -gstabs -Wall -c -fmessage-length=0 -mmcu=atmega8 -std=gnu99 -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wstrict-prototypes -Wa,-adhlns=$(<:.c=.lst) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<"
   @echo 'Finished building: $<'
   @echo ' '

object.mk

################################################################################
# Automatically-generated file. Do not edit!
################################################################################

USER_OBJS :=

LIBS :=


pomprocker: Thanks for the tip. I've needed to do that a couple of times for the original *.hex code from 50$ robot.

Offline MikaeliTopic starter

  • Beginner
  • *
  • Posts: 3
  • Helpful? 0
Re: Linux toolchain and 50$ robot
« Reply #4 on: March 18, 2008, 04:07:32 PM »
After taking a better look at some documentation related to cdt (c/c++ development plug-in to eclipse) I found a way to use the makefile in the Photovore v1.zip. Now I can compile the code and program the robot with my Linux environment.

And just in case someone else is also interested to do some development work on Linux here's short instructions to get you going (on Ubuntu/Kubuntu).

1. Install binutils and gcc compiler for avr
> sudo apt-get install gcc-avr

2. Install avr-libc
> sudo apt-get install avr-libc

3. Install avr debuger
> sudo apt-get install gdb-avr

4. Install the programmer. I use uisp, but you can install your favorite tool
> sudo apt-get install uisp

That's it, now you have the basic avr tools installed. Next thing is to install Eclipse and a java runtime environment. The easiest way to do that is to use Adept, just select java and eclipse from the lists and press install.

5. start Eclipse as superuser and install cdt plug-in according to the instructions at http://max.berger.name/howto/cdt/cdt.pdf for example.

6. start C/C++ Perspective and create a new "Standard Make C Project". This means that you are using an external make file, instead one created by Eclipse. This was my problem.

7. Use "Import" to bring c- and header files and the makefile to the project.

8. Compile and use your favorite tool to program the MCU.

I'm really happy to get this working and I hope my struggle will help someone else out there.

 


data_list