Emacs interfacing


I'm facing a weird problem with my Arduino Duemilanove. I use ubuntu 13.04. Under its IDE, my code compiles and uploads under two different configurations: "Arduino Diecimila or Duemilanove w/ ATmega168" or "Arduino Nano w/ ATmega168" without any problem. However, when I try to use emacs with CEDET it does no compile and requires a specific board as one of the in boards.txt file :(. My .bashrc is below,


export ARDUINO_DIR=/usr/share/arduino export ARDMK_DIR=/usr export AVR_TOOLS_DIR=/usr export BOARD=atmega168

The Arduino.mk is present and my Makefile is below,

ARDUINO_DIR = /usr/share/arduino TARGET = proj1 ARDUINO_LIBS = MCU = atmega328p F_CPU = 16000000L ARDUINO_PORT = /dev/ttyUSB0 AVRDUDE_ARD_BAUDRATE = 57600 AVRDUDE_ARD_PROGRAMMER = arduino include /usr/share/arduino/Arduino.mk

What is happening, please? Any help highly appreciated!


Andre Luiz

And the error is ..........



Thanks for the quick reply! The error is below,

Compilation started at Thu Jul 18 08:58:17

make /usr/share/arduino/Arduino.mk:194: *** BOARD is unset. Type 'make boards' to see possible values. Stop.

Compilation exited abnormally with code 2 at Thu Jul 18 08:58:17

Apart from that, I repeat that it works in the IDE and on the command line.


Andre Luiz

Are you starting emacs from the command line (in which case, the environment should be set), or are you starting it from your graphical desktop (in which case the variables in .bashrc won't be set in the emacs run)? I believe what is happening is the variables in ~/.bashrc aren't being set. While /bin/sh is invoked to run shell type commands, bash typically does not run ~/.bashrc if it is invoked as /bin/sh.

You could change the emacs variable "compile-command" from being "[u]make -k[/u] " to "[u]. ~/.bashrc; make -k[/u] " so that it would source ~/.bashrc before starting make. You might also want to add "-e" to the make line to make sure environment variable override the make file.

Or instead of starting emacs directly from the graphical environment, instead start a shell script that sources ~/.bashrc and then starts emacs.