Andes Workshop
http://forum.andestech.com/

How to create a static library and use it (English)
http://forum.andestech.com/viewtopic.php?f=23&t=822
Page 1 of 1

Author:  jonathan [ Tue Apr 08, 2014 6:49 pm ]
Post subject:  How to create a static library and use it (English)

how to create a static library
1. Step (1)
Select A+ icon to create a static library of project.
Attachment:
A+.JPG
A+.JPG [ 17.85 KiB | Viewed 7142 times ]

2. Step (2)
Modify chip profile window of options.
Attachment:
Chip profile.JPG
Chip profile.JPG [ 134.33 KiB | Viewed 7142 times ]

3. Step (3)
Input project name, select project to sataic library and check Toolchain.
Attachment:
C project.JPG
C project.JPG [ 65.14 KiB | Viewed 7141 times ]

4. Step (4)
Demo project will show on project explorer window.Than create a new source file as below.
Attachment:
Source File.JPG
Source File.JPG [ 103.43 KiB | Viewed 7141 times ]

5. Step(5)
Input Source file name.
Attachment:
Source file name.JPG
Source file name.JPG [ 59.14 KiB | Viewed 7141 times ]

6. Step (6)
Create your program in source file.
Attachment:
Create program.JPG
Create program.JPG [ 37.83 KiB | Viewed 7141 times ]

7. Step (7)
Select Build project icon to build demo project.
Attachment:
build project.JPG
build project.JPG [ 51.13 KiB | Viewed 7141 times ]

8. Step (8)
Generate a libdemo.a of static library file under demo project this Debug folder.
Attachment:
output libdemo.JPG
output libdemo.JPG [ 74.26 KiB | Viewed 7141 times ]



How to use static library
1. Step (1)
Select A+ icon than modify chip profile.
Attachment:
A+.JPG
A+.JPG [ 17.85 KiB | Viewed 7142 times ]

Attachment:
Use chip profile.JPG
Use chip profile.JPG [ 151.24 KiB | Viewed 7141 times ]

2. Step (2)
Modify C project option.
1.Inpute project name "use demo" in the project field.
2.Project type select Andes excupetable project type of Hellow World ANSI C project.
3. Check Toolchain and click Finish icon.
Attachment:
use C project.JPG
use C project.JPG [ 126.63 KiB | Viewed 7141 times ]

3. Step (3)
Copy static library libdemo.a file paste to use demo project.
Attachment:
use copy a file.JPG
use copy a file.JPG [ 62.43 KiB | Viewed 7141 times ]

4. Step (4)
Add a new header file in the use demo project.
Attachment:
use header file.JPG
use header file.JPG [ 98.75 KiB | Viewed 7141 times ]

5. Step (5)
Include static library "libdemo.a" file into use demo project.
Select Target Configuration icon into setting window.
Attachment:
use target config.JPG
use target config.JPG [ 76.15 KiB | Viewed 7141 times ]

Select "Settings" and select Andes C Linker of Libraries icon.
Attachment:
use lib setting.JPG
use lib setting.JPG [ 159.1 KiB | Viewed 7141 times ]

Select Static library file of path.
1.Select + icon as following red mark 1.
2.Select Workspace icon as red mark 2.
3.Select use demo project this folder in red mark 3. (Because libdemo.a of path is under use demo folder).
Attachment:
use path.JPG
use path.JPG [ 219.52 KiB | Viewed 7141 times ]

6. Step (6)
Select Libraries (-l) of + icon to input static file name.
We don't key in static file of full name"libdemo.a" into field. We just need to key in "Demo" into this field.
Attachment:
use add liber file.JPG
use add liber file.JPG [ 163.67 KiB | Viewed 7141 times ]

Attachment:
use path2.JPG
use path2.JPG [ 159.76 KiB | Viewed 7141 times ]

7. Step (7)
Modify use demo.c file to use static library.
Attachment:
use add program.JPG
use add program.JPG [ 135.76 KiB | Viewed 7141 times ]

8. Step (8)
Select use demo project to build project.
Attachment:
use build project.JPG
use build project.JPG [ 167.27 KiB | Viewed 7141 times ]

9. Step (9)
Select use demo project to run Debug as/ C/C++Application.
Attachment:
use debug as.JPG
use debug as.JPG [ 124.74 KiB | Viewed 7141 times ]

Using step into founction to run program and running static library of resault show on up right corner of window.
Attachment:
use resault.JPG
use resault.JPG [ 251.69 KiB | Viewed 7141 times ]


Attachments:
use +icon.jpg
use +icon.jpg [ 2.05 KiB | Viewed 7141 times ]

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/