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 » MAKEFILE and Problem with String Variables

September 16, 2010
by oldictguy
oldictguy's Avatar

I had massive problems trying to output strings variables (or use them altogether!).

The guys at AVRFreaks helped me out; http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=745183#745183

Use;

avr-objcopy -j .text -j .data -O ihex string_test.o string_test.hex

Something about "...hex file doesn't contain the string literal's initialization values (they are located in section ".data", and are copied over into SRAM by the startup code)."

September 16, 2010
by Ralphxyz
Ralphxyz's Avatar

Did you search the Nerdkit forum for "string variables" I think you will see there has been a lot of discussion on this subject.

Do you still have a question? The AVRfreaks guys are great in fact some of us are also AVRfreaks.

Ralph

September 16, 2010
by bretm
bretm's Avatar

The "-j .data" solution is not the most space-efficient solution. Using PROGMEM strings can often be a better choice when RAM is limited.

September 16, 2010
by oldictguy
oldictguy's Avatar

@bretm I could end up being limited on RAM. Any documentation on how to use PROGMEM, and what the MAKEFILE should look like?

@Ralphxyz I didn't search Nerdkits specifically, but I searched AVRFreaks, and half of Google! I probably should have looked here - but didn't realise it was a MAKEFILE related issue - just a general coding issue.

September 16, 2010
by bretm
bretm's Avatar

Tutorial or avr-libc manual or Nerdkits forum search or avr-libc reference

Post a Reply

Please log in to post a reply.

Did you know that binary numbers use base 2 to represent numbers, and these are important for understanding microcontroller registers? Learn more...