OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 3:56 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: How to incorporate thirdy-party libraries into my OS?
PostPosted: Fri Mar 23, 2018 6:54 am 
Offline

Joined: Wed Mar 14, 2018 8:07 am
Posts: 6
I'm writing an OS for microcontrollers and I'd like to run it on some architectures, so I want to make it very easy to port. Also, I want to write just the kernel of the OS. I intend to use open source software to make every other component of the system. I'll use a free implementation of the C Standard Library and I intend to use the free libraries of peripheral drivers provided by the microcontrollers vendors instead of writing my own drivers.

The big problem here is that the C compiler for each microcontroller usually comes with peripherals drivers and a minimal implementation of the C Standard Library. So I'll need to add a more complete implementation of the C Standard Library in my project. But then I'll have conflicts between the two implementations.

I could just turn off the C Library that comes with the compiler, keeping just the peripheral drivers part. But I don't know how to do that. Is it possible?

What I think I can do is to download everything (C Standard Library, Microcontroller's Library), add them to my project's folder and edit them to fit my needs. That is an alternative but I don't know if it is the best one.

As this is a forum with lots of experienced OS programmers I think someone could give me some directions.

Should I just download everything and include it in my project's folder or should I keep compiler's library code in its own directory and try to make this two pieces of code work together somehow?


Top
 Profile  
 
 Post subject: Re: How to incorporate thirdy-party libraries into my OS?
PostPosted: Sun Mar 25, 2018 12:32 pm 
Offline
User avatar

Joined: Sun Mar 25, 2018 10:35 am
Posts: 11
Location: Exchange student in Moscow
You not want rely so hard on C library in OS project.

_________________
https://schol-r-lea.tumblr.com


Top
 Profile  
 
 Post subject: Re: How to incorporate thirdy-party libraries into my OS?
PostPosted: Sun Mar 25, 2018 1:03 pm 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4591
Location: Chichester, UK
igorov70 wrote:
You not want rely so hard on C library in OS project.
Well, you obviously want a C library when you want to write user programs for the OS.

But you can't just use third-party libraries. You'll have to port them to your OS, using the source code. How easy this is depends upon how closely your OS imitates the OS those libraries were written for.


Top
 Profile  
 
 Post subject: Re: How to incorporate thirdy-party libraries into my OS?
PostPosted: Sun Mar 25, 2018 1:49 pm 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
igorov70 wrote:
You not want rely so hard on C library in OS project.

That's harder than you think. You need a cross compiler. That cross compiler needs the C standard headers of your target platform. Your target platform doesn't really exist yet, though. So you have a kind of chicken-and-egg-problem there.

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: How to incorporate thirdy-party libraries into my OS?
PostPosted: Sun Mar 25, 2018 4:37 pm 
Offline
User avatar

Joined: Sun Mar 25, 2018 10:35 am
Posts: 11
Location: Exchange student in Moscow
max wrote:
igorov70 wrote:
You not want rely so hard on C library in OS project.

That's harder than you think. You need a cross compiler. That cross compiler needs the C standard headers of your target platform. Your target platform doesn't really exist yet, though. So you have a kind of chicken-and-egg-problem there.


I used #define for my microcontrollers when ported code amongst them. So if no function was present, i implemented it and turned it on with ifdefs. Good and fast trade off.

_________________
https://schol-r-lea.tumblr.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot] and 71 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group