As always you have great advice. Hopefully I'll get this in place this
week.
-----Original Message-----
From: Brian Dean [mailto:bsd@bdmicro.com]
Sent: Monday, December 20, 2004 12:20 AM
To: AVR-Chat@yahoogroups.com
Subject: Re: [AVR-Chat] 3 debugging questions
On Mon, Dec 20, 2004 at 12:06:39AM -0500, wbounce wrote:
> This leads me to my 2nd question. I have debug print statements to the
> UART. Today I added a define efkdebug and put #ifndef efkdebug around
> the code that actually sends the charactors to the uart so I would not
> have to wait for them to timeout. Right now my define variable is
> hardcoded. I would like to set up a new menu item in PN called Build
> Debug and be able to have the Make file set the efkdebug define. I
> know there is a compiler command line option -D or -d that allows the
> defining a variable. But how do I have PN pass the make file a
> parameter that tells it to define debug. Working with make files is
> not my strong suite. From what I read any variables are global. I only
> want to set it if I am doing a build debug.
You can pass Makefile variables on the 'make' command line, like this,
for example:
make CPU_FREQ=16000000
Then, in your Makefile, you can pass that on to your C compiler by
adding this to your C command line, either directly, or by adding it to
typically the CFLAGS variable, i.e.,:
CFLAGS += -DCPU_FREQ=${CPU_FREQ}
Be sure that comes _after_ any direct assignment of CFLAGS, otherwise
your addition will be overwritten.
Or more directly to the C compiler command line, i.e.:
avr-gcc -DCPU_FLAGS=${CPU_FREQ} ...
If your variable can have spaces, be sure and use quotes as necessary.
Sorry I can't help with the others.
-Brian
--
Brian Dean
BDMICRO - ATmega128 Based MAVRIC Controllers http://www.bdmicro.com/
Yahoo! Groups LinksMessage
RE: [AVR-Chat] 3 debugging questions
2004-12-21 by wbounce
Attachments
- No local attachments were found for this message.