3

While reading through Embedded Linux System Design and Development, I came across the following text

So when we talk about the MIPS HAL it means the support for the MIPS processors and the boards built with MIPS processors. When we talk about a BSP we refer to the software that does not have the processor support software but just the additional software for supporting the board. The HAL can be understood as a superset of all supported BSPs and it additionally includes the processor-specific software.

What exactly is the Hardware abstraction layer (Talking in terms of Linux) ? Is this in some way related to BSP ? From my understanding, BSP is the Board specific code such as Bootloader, kernel core, specific drivers for the peripherals etc. How does the HAL come up as a superset to BSP ?

RohitMat
  • 145
  • 1
  • 14

1 Answers1

2

I don't think HAL is a Linux specific concept, i.e. it's not a subsystem or a proper logical grouping of code. It's possible that the authors have introduced it in order to help explain other concepts. In a way, operating system kernels can be described as HAL since they abstract away the hardware, providing uniform interface to user space. So the exact answer will only be in the context of the book.

In bare metal/RTOS-based embedded systems, HAL layer, if present, would sit on top of drivers in order to provide same API to higher layers even when underlying drivers or the physical components (like peripheral or bus connecting micro controller to the peripheral) change. It is different from board bringup code or bootloader which runs before HAL becomes useful.

Hope that addresses your query.

bytefire
  • 4,156
  • 2
  • 27
  • 36
  • 2
    Why would it matter if the microcontroller has a MMU or not? I think you rather mean bare metal or RTOS applications. – Lundin Nov 16 '16 at 09:06
  • @Lundin that's correct. Usually processors with MMU tend to have a more evolved/complicated set up and I wanted to exclude them. But bare metal or RTOS conveys the point better. Please edit if you like. – bytefire Nov 16 '16 at 09:17
  • MCUs typically don't have a HAL. That just adds useless bloat. It is actually a marketing-thing (e.g. ST) to make managers press their developers to use the devices as it allows "portable code and faster development". Both are nonsense on these platforms. – too honest for this site Nov 16 '16 at 09:56
  • @Olaf I never said they typically have. I just explained the concept in context of MCUs to give a concrete example. Whether it's useful thing or not is a matter of debate and I agree it can be just extra layer sitting there as a potential for bugs. But that's nothing to do with what HAL is, which is OP's question. – bytefire Nov 16 '16 at 10:13
  • You then should rephrase your 2nd paragraph. As it reads now, the imression is you **have to** use a HAL on MCUs. And it is not just the potential for bugs, but that it does not keep the promise of portability. Anyway, My point was not the discussion, but what your text implies. – too honest for this site Nov 16 '16 at 10:17