avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-libc-dev] [patch #8587] Move device specific functions to libdev.a


From: Pitchumani
Subject: [avr-libc-dev] [patch #8587] Move device specific functions to libdev.a
Date: Mon, 23 Feb 2015 11:45:25 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36

Follow-up Comment #4, patch #8587 (project avr-libc):

EEPROM functions can be called in the same way. Only the internal name
mangling is changed. Older compiler versions can not find the new device
specific library (libdev.a) where the EEPROM functions are present now. So,
libdev.a library needs to linked explicitly.

Also the older compilers check for startup file with the name
crt<device-short-name>.o. Now startup file also moved to device specific
folder. So, we have to tell compiler to use new startup file.

Example: compile following test.c for device atxmega128b1
*test.c*

#include <avr/eeprom.h>
void main (void)
{
  uint8_t ByteOfData ;
  ByteOfData = eeprom_read_byte (( uint8_t *) 46) ;
}


*compile steps*
_(1) No change in compiler usage. Compiler couldn't find start-up file_

$ avr-gcc test.c -mmcu=atxmega128b1
install/bin/../lib/gcc/avr/4.8.1/../../../../avr/bin/ld: cannot find
crtx128b1.o: No such file or directory
collect2: error: ld returned 1 exit status



_(2) Tell compiler not to use start-up file (-nostartfiles). Compiler couldn't
find eeprom functions now._

$ avr-gcc test.c -mmcu=atxmega128b1 -nostartfiles
/tmp/ccHBVWba.o: In function `main':
test.c:(.text+0xe): undefined reference to `eeprom_read_byte'
collect2: error: ld returned 1 exit status



_(3) Tell compiler not use start-up file (-nostartfiles).
Link new device start-up file (crt1.o). Link new device specific library
(libdev.a) with option -ldev. Specify the libary path using -L option._

$avr-gcc test.c -mmcu=atxmega128b1 -nostartfiles
install/avr/lib/dev/atxmega128b1/crt1.o -ldev -L
install/avr/lib/dev/atxmega128b1/


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/patch/?8587>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]