How to build avr-libc only on a linux machine

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I know kmr was missing the new avr-libc on his MAC OSX mchine

So this is for him or others , that want to make a new avr-libc , that is ready to distribute to another platform (Win/OSX etc ...)

I described my first build of the avr-toolchain in this thread , and as you can read the "Gurus" Jörg & EW said i did it correctly , and could install the resulting avr-libc on my WinXP machine

https://www.avrfreaks.net/index.p...

You will see that avr-libc is a binary package , that can be build fine under linux. And then later installed under Windows or OSX or .....

I did make a guide for installing a linux builded in Windows , i guess it will do fine under OSX also (substituting w. the correct commands)

The libraries are stripped (by the script) , so all you need to worry about is if MAC still uses 0x0d (CR) as end of line in a textfile , linux uses 0x0a (LF).

The same goes for Windows , substituting the linux (LF) by (CR/LF)

You'll have to convert the .h files to mac/win format

This could prob be done by ftp'ing the archive to the mac , as ftp usually converts "text" files to the correct ending , and leaves binary files alone (the .a & .o files).

Or by some "magic" mac utillity.

On Win look (google) for the utility "utod" (unix to dos) or some other capable textfile conversion tool.

Else convert the files under linux , before xferring them.
This might actually be the easiest way , it would be easy to compile utod.c on a linux.

This method requires that a working avr-gcc is on the users path (ie. first run avr-gcc linux buildscript).

This method will make a directory called avr-libc in the users homedir. Make sure it isn't there allready.

0: Don't be root
1: Make a directory for the avr-libc sources & doc
2: Step into it
3: Execute the below commands (note these points to avr-libc-1.6.2) , change to the newest version.
Or download manually from here (must be the .bz2 versions)
http://download.savannah.gnu.org...


4: Download the attached script, unzip it in the new dir.
5: do a chmod +x *.sh
6: do a ./build-libc.sh

When you are done building the avr-libc , the files in the avr-libc directory is the files that should be copied to the avr subdirectory of our avr-compiler.

/Bingo

Quote:

I once made a "Howto update avrlibc"

Here it is rewritten for version 1.2.6

[code]
Here are some usefull links:
The avr-libc homepage : http://www.nongnu.org/avr-libc/
The avr-libc binary : http://savannah.nongnu.org/downl...
The avr-libc sourcecode : http://savannah.nongnu.org/downl...
The avr-libc user manual: http://savannah.nongnu.org/downl...
The avr-libc online man : http://www.nongnu.org/avr-libc/u...

Hint ... When i download the (pdf manual) avr-libc-user-manual-1.2.6.pdf.bz2 (using save link as)
Firefox would like to append a .pdf to the file in the save box so the name would be
avr-libc-user-manual-1.2.6.pdf.bz2.pdf ... (Make sure to remove the last .pdf)

How to install:

The quick way :

1: Copy the file avr-libc-bin-1.2.6.zip to your directory
2: Use WinZip "Extract to here" function
3: Ansver yes to overwrite

The safe way:

1 : Backup/Copy your /avr directory to a safe place ,
or at least the "lib and include" directories within the /avr directory.
As they are going to be overwritten (deleted) following this procedure.

2: Unzip the avr-libc-bin-1.2.6.zip somewhere , it will make an avr-libc-bin-1.2.6 directory that contains
three directories named bin,lib and include. The lib and include contains the new avr-libc (in lib) ,
and the corresponding header files (in include) , in bin is some kind of manual.

3: MAKE sure you did step 1 !!!!!!!

4: In the /avr directory , delete or move the two directories named lib and include ,
so you will end up with just a bin directory.
You still need the bin directory , as that is where the avr tools and the compiler is located.

5: Now copy the three direct ories from step 2 , into the /avr directory so you now have
3 directories within /avr. You should have bin , include and lib in there.

6: Copy the ldscripts directory located in your "Backup/Copy" avr/lib directory , to the new 1.2.6 avr/lib directory
the ldscripts dir gets installed with binutils , and is not a part of avr-libc , but is needed by the linker.

7: You are now done , installing the new avr-libc

8: You are urged to get the avr-libc documentation and read it.
Get it from the link in the top.

9: If you want to get back to the original avr-libc , then do step 4 , and restore the files mentioned in step 1 ,
into the /avr directory

Have fun....

Bingo

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the info, I'll give it a try on OS X!