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.

Support Forum » LCD Display only shows first line

December 26, 2010
by sthrs
sthrs's Avatar

Hi, I'm running my NerdKit toolchain on Gentoo with:

Using built-in specs.
Target: avr
Configured with: /var/tmp/cross/avr/portage/cross-avr/gcc-4.5.1-r1/work/gcc-4.5.1/configure --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/avr/gcc-bin/4.5.1 --includedir=/usr/lib/gcc/avr/4.5.1/include --datadir=/usr/share/gcc-data/avr/4.5.1 --mandir=/usr/share/gcc-data/avr/4.5.1/man --infodir=/usr/share/gcc-data/avr/4.5.1/info --with-gxx-include-dir=/usr/lib/gcc/avr/4.5.1/include/g++-v4 --host=x86_64-pc-linux-gnu --target=avr --build=x86_64-pc-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --disable-lto --enable-nls --without-included-gettext --with-system-zlib --disable-werror --enable-secureplt --disable-libmudflap --disable-libssp --enable-cld --with-python-dir=/share/gcc-data/avr/4.5.1/python --enable-checking=release --disable-libgcj --enable-languages=c,c++ --enable-shared --disable-threads --disable-bootstrap --with-bugurl= --with-pkgversion='Gentoo 4.5.1-r1 p1.4, pie-0.4.5'
Thread model: single
gcc version 4.5.1 (Gentoo 4.5.1-r1 p1.4, pie-0.4.5)

built using crossdev -t avr. Upon turning on my NerdKit for the first time, the original program in flash displayed correctly, but subsequent attempts using homebrew compiled on my computer only show the last line of text that was entered on the first line. For the initialload program, for example, it only says "is alive!" on the first line. I tried the -O0 trick, but it had no effect. Please help, and feel free to ask me for more information. Thanks!

December 26, 2010
by mrobbins
(NerdKits Staff)

mrobbins's Avatar

Hi sthrs,

Welcome to the forums!

This issue has to do with a compiler "optimization" that other Gentoo and Fedora-using customers have discovered before (see 1, 2). Another customer helped figure out the root cause today. In the past, such as in the two forum discussions I just linked to, we had recommended switching to optimization level "-O0" for the libnerdkits code. However, we've got a possibly better way to go about it now. In your project Makefile, replace:

avr-objcopy -j .text -O ihex YOURCODE.o YOURCODE.hex


avr-objcopy -O ihex YOURCODE.o YOURCODE.hex

That is, just remove the "-j .text" part. Then, touch the code file so it's forced to recompile, and make and upload. This way it includes all compiled sections, including part of the LCD code that apparently gets optimized into a data table.

Please give that a try and let me know if it works!


December 26, 2010
by sthrs
sthrs's Avatar

I will try that tomorrow as I have to go now. I will reply with the results. Thank you!

December 27, 2010
by sthrs
sthrs's Avatar

That worked! Thank you!

Post a Reply

Please log in to post a reply.

Did you know that talking to the microcontroller over the USB/Serial link is easy under Windows, Linux, and OS X? Learn more...