What is the difference between drivers and libraries in embedded C [closed] - c

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am wondering what is the difference between drivers and libraries in the embedded C programming. Assuming that I am using uControllers that only have application code/firmware like PICs

With respect to deeply embedded systems (such as the PIC) the distinction is generally that a driver is tied to the hardware and is not portable between platforms, while a regular library should be portable and have no direct hardware dependencies. This is not a hard and fast rule, however it is the most consistent one that I have come across in embedded systems.
It is also common for vendors to call a collection of drivers a library so in a way you can think of drivers as just a special type of hardware dependent library, and a library as simply a collection of related code.

Related

How does C access files? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 11 months ago.
Improve this question
everyone! I'm learning how to access files in C but, I wonder how my program(or C) access files(drive sectors)? I'm searching the Internet for answers but they don't have some proper explanation on how C(or my program), loads drive sectors to memory. Please give me some clarity, and thanks in advance.
C programs use functions of the kernel or a device driver to access hardware. A computing platform (Windows, Linux, OSX, etc) that supports C provides an implementation of the C standard library for programmers. This library contains system specific implementations of functions for accessing files, like fopen. The systems implementation of the standard library is most often just a wrapper around their specific system calls. For example on Windows, the C standard library is going to end up calling these functions: https://learn.microsoft.com/en-us/windows/win32/api/fileapi/

Install a C program to another machine without share code [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
This post was edited and submitted for review 11 months ago and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
I need to install a C program UNIX to another UNIX machine, what can I do?
In case the other machine has different architecture how can I share my program in the best way?
The simplest way to share your program is compile it and share the binaries. There are a lot of open question you will have to solve (libraries dependencies, specific distribution configurations, ...). You must to precompile for every targeted hardware architecture (x86-64, ARM, ...) and for every specific SO (BSD, Linux, ... even Windows).
As an example, Gimp is coded in C/C++ and exists binaries for many hardware architectures and operating systems.

Compiler for custom cpu architecture [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Is there a tool that will convert C to assembly that will run on Windows?
The cpu architecture (8 bit and 16 bit) is in-house meaning that it has it own instruction set.
The C compiler should use our in-house assembly language. The language is not based on x86 nor ARM. I can not provide too many further details because it is company's Intellectual Property.
You will have to learn one of the open source Compilers which are using replaceable backend for their code generation. Gcc, and CLang, might be a good starting point.
Yes, Virginia, there are "tools to convert C to assembly" on Windows. GCC comes to mind; likewise MS Visual Studio.
I'm sure this isn't what you want, since the off-the-shelf versions for Windows tend to generate x86 object code. It sounds like you want a compiler for a special not-x86 instruction set.
Given that you have not provided any details, there's no way for anybody to respond if such a compiler already exists.
In the absence of such detail, all one can do is offer you generic advice. It is possible to configure GCC to generate code for relatively arbitrary instruction sets. It isn't a walk in the park to do this, but it has been done for many different instruction sets.

What is the scope of C programming today? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am a computer science student. I studied C, then came to C++[an object oriented one] and now Java[More Object Oriented]. My question is whether 'C' language is of any importance these days? Did I study it for the sake of studying the languages in the order in which they were developed so as to understand languages step by step?
Is there things that can be done only with C? What is it's scope?
The main scopes are:
drivers
operating systems
systems where performance is critical
small embedded systems (thanks Joachim)
C is still heavily used in situations where otherwise one would drop down to assembler, since it's one of the few structured languages to let users code that close to the hardware.
And a lot of what claims to be C++ code is C code with an OOP wrapper.

How to build a GUI toolkit from scartch [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I've been chosen to spearhead the construction of an OS from scratch by my firm. In terms of OS basic functionality i'm cool, but I have quite an issue on UI design. How do engineers design UIs all from scratch? e.g. the Mac OSX UI is different from Windows UI and also Unix-like OS's all have different-looking UIs. I have an idea that it might involve C programming but how do engineers define these graphics, their looks plus their interactivity on user-initiated events, are there any libraries that i might not be aware of?
Thanks
Don't build the entire stack from scratch - you are much better off leveraging on at least low-level 2D graphics to ensure good performance. For example for UNIX based systems, you'd use Xlib primitives to build your windowing toolkit on top of it. Use that and lay your abstractions on top of it.
But again, in this time and age it is much better to use an existing toolkit and at worst port the underlying layer to your OS.

Resources