Make List

I have been making use of the Arduino Makefile from ed.am for some time but recently I needed more functionality from the Makefile.

I ran across a case when needed to check the number of instructions/clock cycles that my C/C++ code was generating. To do this I needed to have a look at the assembly listing that was created. Reading just the assembly is tricky so adding in the C/C++ that creates it makes following it a little easier.

The instructions contained here detail the commands required to generate the debugging information and the flags for avr-objdump which allow the C++/ASM listing to be generated. Typing in all these commands takes time, hence why I am using a Makefile in the first place. What I needed was to add them to the existing ed.am Makefile.

It turns out that the easiest way to do this is not to modify the original Makefile. Instead I created a blank Makefile for my project and include the ed.am Makefile. Having done this I can overload and add to its contents.

This is what I came up with, using “make list” will generate a program listing interspersed with the source code.

# Include Arduino Makefile
# ========================
include ~/bin/arduino.mk
# Arduino Makefile downloaded from:
# http://ed.am/dev/make/arduino-mk

# Override some of the included Makefile settings
# ===============================================

# Add '-g' to compiler flag to embed debug info (doesn't end up in .hex)
CPPFLAGS += -g

# Locate avr-objdump on system
OBJDUMP := $(call findsoftware,avr-objdump)

# Create a listing of asm and C source code
list: $(TARGET).elf
	@echo "Generating Listing"
	$(OBJDUMP) -h -S $(TARGET).elf > $(TARGET).lst

# Override clean target to remove additonal files
clean:
	rm -f $(OBJECTS)
	rm -f $(TARGET).elf $(TARGET).hex $(ARDUINOLIB) *~
	rm -rf .lib .dep
	rm -f $(TARGET).map $(TARGET).lst

Arduino + Ethernet Sheild + Linux 64 Bit = Headache

I have been trying for the past few hours to get the simple web server sketch working with an arduino board and my recently acquired ethernet shield. All seemed to be going well the sketches were uploading to the board and I was able to ping the ip address over the network. Why then could I not connect to the device to see the generated output? Much time has been spent looking at different libraries and other peoples sketches looking for alternative ways of doing the same thing. Each time my sketch would stall whilst trying to read the client data. A single line of code which for some reason would stall the program execution.

Searching on this particular problem rather than just generic "Why is the ethernet shield not working?" I came across Issue #267. It seems that on the 64bit build there is a problem with the command. To test this out I reverted to 32bit Windows and used that version of the software to upload the sketch to the chip. Suddenly it all works flawlessly. Needless to say I have had enough of playing around with the thing today and wont be getting creative with my newly working hardware until the frustration has worn off.