NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » Anybody using Programmer's Notepad?

January 14, 2011
by Ralphxyz
Ralphxyz's Avatar

I am looking at using Programmer's Notepad.

How does one reference the libnerkits .o (Object) files?

When/which do you use Make All, Make Clean or Program?

Anything else I should know?

Ralph

January 14, 2011
by Rick_S
Rick_S's Avatar

I Use it all the time, Ralph. If you leave the makefile the way it is, and keep it in the same folder as the file you are editing, just select [WinAVR]Make All and it will complie just as if you did it from the command line... On a PC... Not sure about Linux or MAC.

With the make files simple as the included one's are, [WinAVR]Make Clean, and [WinAVR]Program, will error out because there are no entries for them in the makefile. I will occasionally add the line

program: progname.hex

where progname is the name of the file I'm working with then I can select [WinAVR]Program and just compile without uploading to the chip. This comes in handy when I'm just wanting to do a quick complie to check for my typo's in the program. :)

January 14, 2011
by Ralphxyz
Ralphxyz's Avatar

Ah that's great thanks Rick. I'll keep playing with it.

I thought I had a Makefile in the project folder probable not.

I will probable use program: progname.hex as my current project uses PB0 which conflicts with the bootloader so I am flashing the mcu with my Dragon programmer.

Thanks again,

Ralph

January 14, 2011
by Ralphxyz
Ralphxyz's Avatar

Rick, when I try to do "Make All" it is looking for a device on the com port.

How do I tell it to just make the .hex file?

Where does program: progname.hex go?

I assume the AVRDUDE line has to be modified also?

Ralph

January 14, 2011
by mongo
mongo's Avatar

I use it! I just have to teach myself how each time as I go long spells between them.

January 15, 2011
by Rick_S
Rick_S's Avatar

This is a sample makefile for a project I was working on. As you can see, it's just like the NK files only with the program: line added. If I select [WinAVR]Program, it just compiles. If I select [WinAVR]Make All, it compiles then uploads using the bootloader. If I wanted it to upload via ISP, I'd just change my AVRDUDEFLAGS to reflect that.

GCCFLAGS=-g -Os -Wall -mmcu=atmega328p 
LINKFLAGS=-Wl,-u,vfprintf -lprintf_flt -Wl,-u,vfscanf -lscanf_flt -lm
AVRDUDEFLAGS=-c avr109 -p m328p -b 115200 -P com1
LINKOBJECTS=../libnerdkits/delay.o ../libnerdkits/lcd.o ../libnerdkits/uart.o

all:    Greenvr2-upload

program: Greenvr2.hex

Greenvr2.hex:   Greenvr2.c
    make -C ../libnerdkits
    avr-gcc ${GCCFLAGS} ${LINKFLAGS} -o Greenvr2.o Greenvr2.c ${LINKOBJECTS}
    avr-objcopy -j .text -O ihex Greenvr2.o Greenvr2.hex

Greenvr2.ass:   Greenvr2.hex
    avr-objdump -S -d Greenvr2.o > Greenvr2.ass

Greenvr2-upload:    Greenvr2.hex
    avrdude ${AVRDUDEFLAGS} -U flash:w:Greenvr2.hex:a
January 15, 2011
by Ralphxyz
Ralphxyz's Avatar

Thanks Rick, works great. Just to note I have to remove any existing .hex and .o files from the program folder before [WinAvr] Program works.

Without deleting the .hex an .o I get:

"make.exe" program make.exe: Nothing to be done for 'program'.

Process Exit Code: 0 Time Taken: 00:00

This is just noted for future reference in case any comes behind me.

Thanks again,

Ralph

January 15, 2011
by Rick_S
Rick_S's Avatar

You shouldn't have to do that if you change something in your program, then save it. Make should note the change in the source file and re-compile. If you try to re-compile without making any changes you will get that response because... there isn't really anything for make to do, the hex is current.

January 16, 2011
by Ralphxyz
Ralphxyz's Avatar

Damm I hate applications that are smarter than I am.

That makes sense. I was testing the same code.

Ralph

Post a Reply

Please log in to post a reply.

Did you know that you can use a transistor to interface between different voltage levels of digital logic? Learn more...