Working of 64 bit drivers - 32bit-64bit

I'm not a programmer, but learning some programming concepts.
My question is, on 32 and 64 bit systems, the HAL layer will be different as they are two different platform, how does the driver interact with HAL layer and in turn with CPU?
If we take an example of LAN driver, can anybody explain in high level what exactly happens in two different platform that is 32 and 64?
Any pointer will be great help...
Thanks,
Pramod.

You re-compile the drivers for each platform. The APIs are the same but the code generated by the compiler will be different.

Related

How to develop an OpenCL application targeting specifically Intel CoffeeLake-H GT2 (UHD Graphics 630) without this device?

I've been tasked to develop an OpenCL application for a specific platform, Intel CoffeeLake-H GT2 (UHD Graphics 630). There are two problems for me:
Even having some OpenCL programming experience (not that much though), I wouldn't know where to begin. I have no prior experience with targeting specific hardware before.
The device itself has to be emulated or something, because I don't have it at hand.
Of course, I tried googling information today, but couldn't find anything that could really help me. Guess, it's just because of my lack of experience. So, I'm stumped right now, and asking for help.
It would be really great if I can be helped. Any help would be appreciated. Thanks in advance.
Small note: I'm working on this project under Ubuntu 18.04.
I'm not aware of any emulated environment, and anyway, ultimately nothing replaces access to the target hardware. I see a few workarounds:
Target a similar-enough device. Intel GPUs haven't changed that drastically, so especially if you have an older/lower-spec one around, whatever you end up with should run better on the newer GPU. You can also work with a GPU from another vendor if you have at least sporadic access to a system with an Intel GPU. You don't want to go for too long at a time without testing on your target hardware. (It's generally a good idea to test OpenCL code against different implementations while developing, as it's easy to accidentally rely on implementation-defined or undefined behaviour otherwise.)
Rent a relevant physical device. Places exist that allow you to rent laptops or desktop PCs for a short time period.
Remote access to a target device. Presumably whoever posed the requirement actually has such devices. Ask for remote access to one of them, via the magic of the internet. (RDP, VNC, SSH)
Rent similar hardware in a data centre. There are bare metal hosting companies that rent out physical servers built from commodity hardware. Find one that offers servers with a close enough match to the system you're targeting and rent one there.
As for the skill gap, well, you'll either have to bridge that one yourself by following enough documentation, tutorials, etc. or by finding (hiring…) someone who will give you some degree of hand-holding through the project.

Possible to link 64 bit library to 32 bit application?

Actually I want to link 64 bit library to my 32 bit application.
I want to use a library which works faster under 64 bits under some circumstances. But i have to link that library to my 32 bit application . Is it possible or not ??
In a word, no. The only way to get compiled 64bit code talking to compiled 32bit code is via some form of IPC (e.g. pipe, named pipe, or network connection). That may well introduce performance bottlenecks of its own, so probably isn't worth the bother.
It is not easy as #robthebloke mentioned. But NVIDIA RTX Remix Runtime does it somehow, making older 32bit games running on 64-bit vulkan driver (bypassing 2-4GB virtual memory limit).

From a programming point of view, what does it mean when a program is 32 or 64 bit?

I'm a beginner programmer in my first year of Computer Science.
I'm curious about the 32 bit and 64 bit systems, and how it affects developing software.
When I download software I need to choose between the two, while other software only has a 32 bit version.
Are there different ways of programming for a 64 bit system?
Is it compiled in the same way?
What are the main benefits of a separate 64 bit app?
Cheers
Are there different ways of programming for a 64 bit system?
Yes and no. No, in the sense that most of the time you should be able to write platform-independent code, even if you are coding in a language like C. Yes, in the sense that having knowledge of the underlying architecture (not just the word size!) helps to speed up critical parts of your program. For instance, you may be able to use special instructions available.
Is it compiled in the same way?
Again, yes and no. Compilers for systems languages work in similar ways for all architectures, but of course, the details differ a bit. For instance, the compiler will use knowledge about your architecture to generate as efficient code as possible for it, but also has to take care of differences between architectures and other details, like calling conventions.
What are the main benefits of a separate 64 bit app?
I assume you are asking about the usual desktop CPUs, i.e. x86 architecture, but note that there are other architectures with word sizes ranging from 8-bit to 128-bit. Typically, people would compile a program targeting a single architecture (i.e. for a given machine), and that's about it.
However, x86 is a bit special, in that the CPU can operate in different modes, each with a different word size: 16-bit, 32-bit and 64-bit (among other differences). Effectively, they implement several ISAs (Instruction Set Architectures) in a single CPU.
This was done to preserve backwards compatibility, and it is key to their commercial success. Consider that, when people bought the first 64-bit capable CPUs, it was most likely that they were still using 32-bit operating systems and software, so they really needed the compatibility. The other options are emulating it (poor performance) or making sure all the popular customer software has been ported (hard to achieve in ecosystems like Windows with many independent, proprietary vendors).
There are several benefits of 64-bit x86 over 32-bit x86: more addressable memory, more integer registers, twice the XMM registers, a better calling convention, guaranteed SSE2... The only downside is using 64-bit pointers, which implies more memory and cache usage. In practice, many programs can expect to be slightly faster in x64 (e.g. 10%), but pointer-heavy programs may even see a decrease in performance.
Generally speaking the main benefit of 64 bit application is that it has access to more memory. Having 32 bit pointer you can access only 4GB of memory.
Most modern compilers have option to compile either 32 bit or 64 bit code.
32/64 coding is the same unless you are dealing with huge in-memory objects, where you would need to use 64 bit specifically.
An interesting fact/example is that Unix time is stored as a single number. It is calculated as a number of seconds passed from January 1st 1970. This number will soon reach 32-bit size, so eventually we will have to upgrade all of our systems to 64-bit so they can hold such a large number.

Minimal FOSS RTOS with TCP/IP, SSL, USB and basic file-system support for ARM

Here's a candid admission first -- that I know zilch about RTOS or Embedded programming, so folks who know better may help me frame the query more appropriately.
What would be the minimal FOSS RTOS (or any OS for that matter) with support for TCP/IP, SSL, USB and some basic file-system for low-end ARM devices like Cortex-M3's ?
Have not ruled out something like ARM9/ARM7TDMI, so an RTOS that has "optional" MMU support, may be a major plus. We are at present dabbling with few uncertainities like precise processor, MMU/no-MMU, running completely head-less (no display), however I wanted to start a little ramp-up.
Would gladly answer counter questions to clarify the requirement.
I believe that eCOS has support for all you need and is scalable.
Alternatively you could build from a self-selected kit of parts; choosing independent RTOS, filesystem, USB, etc. From different sources, and integrating them yourself.

Interested in Device Programming. Where to Start

All
I've a Good Command over C++, But I've never done anything anything on device programming. I've some basic understanding on Digital Logic Design. But I am complete Noob in Electronics. Currently I am getting huge interest on microcontroller Programming.
Where To Start ?
I don't think one really needs to have huge amount of knowledge on electronics to run a program on a microcontroller.
I am using Linux. and I've downloaded Keil. never tried to run it through Wine. I've ran it in Windows. But how the code works is not completely clear to me. though I can understand Logic as its written in C. But Its still like a Fog to me.I Just need a Quick Kickstart.
SO is not the best site to ask this kind of question. There's really a large distinction between programming for a PC and programming for an embedded system, other SE sites specialize in physical computing. I got this email from Robert Cartaino on Tuesday:
...Barring any last-minute interest from
[chiphacker.com], we will be launching [electronics.stackexchange.com]
either tomorrow [Wednesday 9/22] or
Thursday.
So, go commit to electronics.stackexchange.com here, and browse chiphacker.com while you wait. Take a look at these questions on Chiphacker:
How to become an embedded software developer?
Steps to learning Arduino Programming
PIC Programming
What are the best beginner project[s] using an arduino
There are a few things you should consider when planning your entry path to embedded systems programming.
What do you want to do?
What do you know how to do?
How fast are you comfortable learning?
I've outlined a few options in the following paragraphs.
You tagged your question linux-device-driver, does this mean that you want to make a custom device to use in Linux? If you meant embedded-linux, then you're into a larger class of microcontrollers. I suggest that you look at the BeagleBoard, also look at this Chiphacker question for some other options. If you want to do embedded linux, and want to build your own board, you'll first need to build up some experience in simpler levels of embedded systems design.
You also tagged your question avr, which is a popular microcontroller class made by Atmel (check out the avrfreaks forum for more info). I started learning embedded systems on the ATmega324p; they really have great documentation, are easy to use, and there are more sites online for the avr than most any other processor.
If you want an easier learning curve, I suggest taking a look at the Arduino environment. It uses Wiring, which is very similar to C/C++, and the Arduino can be enhanced with 'shields', which are modules that can be plugged into the Arduino main board to add functionality. This is your Quick Kickstart.
A good learning path would be to get familiar with the Arduino, then build your own AVR board (possibly a Linux device, like a joystick), then work with an ARM-based development kit, and finally move on to to building your own embedded linux board. You can skip a few steps if you don't mind a steep learning curve, or stop at any point along the way if a given level's capabilities satisfy your needs. You don't necessarily need a "huge amount of knowledge on electronics to run a program on a microcontroller", it's true, but you should understand some basic things like voltage and current before you try to light an LED or connect two devices.
Finally, you said in your question that you've installed the Keil IDE. While this is a fine and rather popular IDE, I'd suggest that you learn using a gcc-based command line toolchain. There are a staggering number of ways in which things that can go wrong when working with embedded systems, and an IDE adds a layer of magic on top of everything that happens. While this can be nice, I'm a strong advocate of minimizing the magic when trying to learn the system. You need to understand the low-level stuff when things don't work automagically. This advice doesn't apply when using the Arduino, which is designed to (and does) make all of the automagical stuff work well.
sparkfun.com has a lot of boards, arduino family and other. I recommend the armmite pro, the lillypad instead of the arduino pro because there is no soldering involved, for either you will need/want the correct usb to serial/power. The mbed2 costs a little more, the blue leds are brutal on the eyes, but easy to use. For none of the above are you required to play in their sandbox, you can use the canned environment, etc but not required.
if it is linux development you are after I recommend the hawkboard.org over the beagleboard.org, to make the beagleboard useable costs about twice as much as the board itself, the hawkboard is usable by only buying something to power it. But you can just learn linux drivers on your desktop/laptop and dont need to mess with embedded necessarily.
Emulators are a good start. Qemu is good stuff, emulates a number of processors, great for emulating virtual linux systems, learning linux driver development, etc. But getting visibility into what the (virtual/emulated) processor is doing is not the goal. I find it useful to have visibility. gdb includes a few emulators as well. mame is loaded with them, but like qemu designed for fast emulation and not for education. visual boy advance is good. Emulation is never perfect, so eventually you want to run on hardware, but emulators and compiler tools are free and you can learn quite a bit before you have to buy hardware. There is a considerable amount you cannot learn from an emulator though, loading your programs into flash/ram, debugging using jtag or other interfaces. i2c, spi, etc.

Resources