patchAVR C Runtime Library - Patches: patch #8587, Move device specific functions to...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #8587: Move device specific functions to libdev.a

Submitter:  Pitchumani <pitchumani>
Submitted:  Fri 02 Jan 2015 10:15:56 AM UTC
   
 
Category:  None Priority:  7 - High
Status:  Done Privacy:  Public
Assigned to:  pitchumani Open/Closed:  Closed

Jump to the original submission

Thu 18 Jun 2015 10:12:33 AM UTC, comment #7: 

Device library build is based on compiler detected or configure option.
Ref:
https://savannah.nongnu.org/bugs/?44869
http://svn.savannah.nongnu.org/viewvc?view=rev&root=avr-libc&revision=2475

Pitchumani <pitchumani>
Group Member
Wed 25 Feb 2015 09:05:12 PM UTC, comment #6: 


> For backward compatibility with older compiler versions:
> avr-libc build mechanism can detect gcc version and
> configure either old libs or libdev.a. Is this option ok?


Yes, I was already about to suggest this.

Without such an option, by our own standards[*], we'd have
to bump the major version number due to a change in the API.
In consequence, this would also mean to maintain an SVN
branch for the old revision line for some time, and to merge
all important bug fixes from trunk to the branch.  We used
to do this in the past, but it's quite a bit of work.

[*] http://www.nongnu.org/avr-libc/user-manual/release_method.html

However, if the autoconf stuff can detect whether the compiler
used supports automatic libdev.a inclusion or not, and the
build adapts to it, the change is going to be smooth enough
so anyone compiling a toolchain (e.g. Linux distribution
maintainers) will get a consistent toolchain without breaking
the user interface.

To get me right: I'm not opposed to the change as such, I've
never been really happy with the way the EEPROM functions
have been done so far.  This was just a stop-gap measure
introduced by its time to work around other problems, while
libdev.a + an appropriate compiler modification is certainly
much more elegant.

Joerg Wunsch <joerg_wunsch>
Group administrator
Wed 25 Feb 2015 12:58:41 PM UTC, comment #5: 

For backward compatibility with older compiler versions:
avr-libc build mechanism can detect gcc version and configure either old libs or  libdev.a. Is this option ok?

Pitchumani <pitchumani>
Group Member
Mon 23 Feb 2015 11:45:25 AM UTC, comment #4: 

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/


Pitchumani <pitchumani>
Group Member
Mon 23 Feb 2015 07:37:02 AM UTC, comment #3: 

Curious: how is that going to work to use the EEPROM
functions of a current avr-libc with an older compiler
version?

Joerg Wunsch <joerg_wunsch>
Group administrator
Mon 23 Feb 2015 07:21:46 AM UTC, comment #2: 
Pitchumani <pitchumani>
Group Member
Fri 02 Jan 2015 10:20:17 AM UTC, comment #1: 

ChangLog

2015-01-02  Joern Rennecke <joern.rennecke@embecosm.com>

        * configure.ac: (AC_CONFIG_FILES): Place all devices under avr/lib/dev.
        Remove device duplicates. Remove device specific lib for tiny-stack.
        * devtools/Device.am (VPATH): Add $(top_srcdir)/libc/misc.
        ($(top_srcdir)/libc/misc/Rules.am): Include.
        (avr_LIBRARIES, libdev_a_SOURCES): New library.
        * devtools/gen-avr-lib-tree.sh (AVR12_DEV_INFO): Remove duplicate devices.
        (AVR3_DEV_INFO, AVR31_DEV_INFO): Likewise.
        Place all devices under avr/lib/dev.
        * libc/misc/Rules.am: Remove eeprom file name mangling.


Pitchumani <pitchumani>
Group Member
Fri 02 Jan 2015 10:15:56 AM UTC, original submission:  

Submitted on behalf of Joern Rennecke (joern.rennecke@embecosm.com)
Ref: https://github.com/embecosm/avr-libc/commit/93f15d167faf4ee3019ddefbd520740c04bb3123
--
Attached patch moves device specific eeprom functions into device library (libdev.a). Earlier these functions are part of standard c library (libc.a).

Also it removes the duplicate device libraries.

Generated libs will be aligned with avr-gcc expected layout.
http://lists.nongnu.org/archive/html/avr-gcc-list/2014-10/msg00018.html

Pitchumani <pitchumani>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #32747:  libdev.patch added by pitchumani (28KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by joerg_wunsch (Posted a comment)
  • -email is unavailable- added by pitchumani (Submitted the item)
  • -email is unavailable- added by pitchumani
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-06-18 pitchumani StatusReady For Test Done
        Assigned toNone pitchumani
        Open/ClosedOpen Closed
    2015-02-23 joerg_wunsch StatusDone Ready For Test
        Open/ClosedClosed Open
    2015-02-23 pitchumani StatusIn Progress Done
        Open/ClosedOpen Closed
    2015-01-02 pitchumani Attached File- Added libdev.patch, #32747
        Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code