2022-02-07 01:42 PM
2022-02-07 03:52 PM
Depends.
Assembler in my experience is relatively rare in 32-bit ARM/MIPS products.
C is predominant, as it can be significantly more predictable in it's consumption of limited resources.
C++ has popularity, but a lot of that is in more complex products, or ones using an actual OS of some type.
HAL's generally are very popular as they save a lot of time, you can focus on YOUR part of the PRODUCT, and not the minutia of the peripherals.
There are product spaces where ST's HAL isn't sufficiently solid and tested to be usable.
For hiring Embedded "SW" Engineers, I'd expect to see some competence in HW, able to read schematics and data sheets, register level peripheral function, register level MCU function, and some assembler familiarity.
2022-02-07 06:05 PM
Since we're speaking in generalities, I would estimate the majority of STM32 microcontroller code is written in C, followed by C++, followed distantly by assembly.
HAL did not exist a few years ago and I would estimate most developed codebases that existed have no reason to migrate.
HAL is written in C, so those are not mutually exclusive.
You can certainly make an excellent product using any of those languages and/or libraries. The best tool is the one you know how to use.
2022-02-07 06:39 PM
Speaking as someone who has done projects from the ground up (Schematic - PCB - F/W development) the target is to always get the first Beta version up and running as soon as possible, so It can be determined early on if there is a Hardware or Firmware limitation in the design.
So I always start with HAL everything. It can be really quick to get a functional beta if you don't have to worry about the little register level details.
Having said that, by the time I get to the release version I have often removed some (at least half) of the HAL usage when I run into its limitations and revert to some LL usage when I need to know exactly what the hardware is doing.
As for the choice of language - I always use C as there are abundant resources available as reference when I get stuck, and sample code from ST is in C too.
Not planning on reinventing the wheel, just need to get the job done well.
2022-02-07 07:31 PM
Quick question : Anyone tried to have an alternate HAL gpio driver api which handles only one pin name at a time, like HAL_IO_Toggle(PA_5) ?
2022-02-07 08:05 PM
I used ST hardware from STR750 to F1, F2, F4, L0, L1 and L4. I did use the SPL library because it was a reliable way to extract register functions when reusing code across families. I never used HAL, LL, or the code generator IDEs.
The problem is lack of internal documentation. I've seen mention of hidden spinlocks and other nasty surprises in the forum. The sheer volume of issues is enough to deter any use of these libraries on a commercial product. If I have to spend the time to reverse engineer all that code I'd just as soon use my own.
For the families without ST issued SPL libraries I converted the closest match from another family. On average it would take about 4 weeks with an assistant writing tests. The time paid off in years of code reuse afterwards.
Embedded programmer qualifications? I looked for ability to read schematics and IC specsheets, solid experience in C, and most of all an understanding of why it was so important to build maintainable code for the next guy over a 20 year product lifespan.
When hiring I never bothered with code tests or whiteboarding a sample project. No one can remember every nuance of C; that's what the internet is for. What I looked for is knowledge of the "gotchas" in realtime programming, things like priority inversion, race conditions, when a mutex is needed.
Of all the programmers I replaced, not one ever instrumented or profiled their code. Many didn't even check for errors. Documentation was a dirty word. If someone told me "the code is self-documenting" then I knew they were too lazy to worry about passing on design knowledge to their successor.
I hope everyone has the experience of being handed 50K lines of "cowboy code" once in their career and told to keep it working. Come to think of it, go ahead and use the CubeMX for a project that ships 50K units a year.
2022-02-07 11:04 PM
> Anyone tried to have an alternate HAL gpio driver api which handles only one pin name
Yep. Both as real functions with one parameter, and as a cheap macro trick like this:
#define G(gpioname) gpioname ## _GPIO_Port, gpioname ## _Pin
HAL_GPIO_ReadPin( G(THING) );
2022-02-07 11:06 PM
What is "embedded software industries"?
JW
2022-02-08 05:16 AM
We don't use the HAL, because:
- She changes too often. From one project to another it has changed... And it must be requalified to eliminate the bugs introduced.
- For other than trivial uses, you have to see how it is written. It is therefore necessary to know the hardware device (the registers). and also how ST designed their software: double work.
- it is a HAL: therefore generic, and it concentrates all the particular cases of each family. Too complex.
On the other hand, sometimes reading its code is instructive.
The LL is used for many basic functions such as everything related to clocks for example.
2022-02-08 07:37 AM
"use HAL for developing ... or do they prefer using C or Assembly?"
Eh ??
The HAL is C !