Author Topic: ST official anouncment of new low level API  (Read 13295 times)

0 Members and 1 Guest are viewing this topic.

Offline MT

  • Frequent Contributor
  • **
  • Posts: 854
  • Country: fo
ST official anouncment of new low level API
« on: September 18, 2015, 12:52:49 am »
As mentioned earlier is now official by ST , whether it will be yet another ST software/documentation disaster is still yet to bee seen
after all it is still HAL and Cube, i quote from STM32 forum:


First, we apologize for this bug you are encountering. It will be fixed in next STM32CubeL1 V1.4.0 release planned e/o October.

As you may know it’s quite challenging to have bug free software, there are always few bugs not detected through the validation process. The root cause can be; the process is not followed as it should be, incomplete validation coverage …

However from ST we are engaged to reduce the number of bugs over time to reach this challenging bug free software. We are ensuring as well a regular maintenance of the different FW packages; either patch release to fix critical bugs, or full release to implement all the feedback we receive from our customers.

I will take this opportunity to share w/ you that we are introducing a new set of APIs, called Low Layer (LL), allowing performance and memory footprint optimization with register access level programming.

These LL APIs will be 1st introduced w/ STM32CubeL4 V1.1.0 to be available on ST web next week, deployment on all STM32 Series is ongoing with releases planned during 2016.
« Last Edit: September 18, 2015, 02:48:07 am by MT »
 

Offline mark03

  • Frequent Contributor
  • **
  • Posts: 396
  • Country: us
Re: ST official anouncment of new low level API
« Reply #1 on: September 18, 2015, 01:45:42 am »
From reading this it's clear (to me anyway) that their library quality will not improve until different people are involved in writing it, or managing the team, or more likely both.  All the "process" in the world cannot fix misguided design, and the quality problems go far beyond fixing a list of bugs.  You could make that code work perfectly and it would still be horrible.  From this statement you can tell that he (probably a he) does not understand the real deficiencies:  unhandled and pointless complexity and opacity.

This is not really an ST problem, though; the same could be said for most vendor-supplied library code.  Smart people with good code hygiene practices are a prerequisite for improvement, one which AFAICT is rarely if ever met.  Until that changes, expect more of the same.
 

Offline jnz

  • Frequent Contributor
  • **
  • Posts: 434
Re: ST official anouncment of new low level API
« Reply #2 on: September 18, 2015, 02:19:19 am »
From reading this it's clear (to me anyway) that their library quality will not improve until different people are involved in writing it, or managing the team, or more likely both.  All the "process" in the world cannot fix misguided design, and the quality problems go far beyond fixing a list of bugs.  You could make that code work perfectly and it would still be horrible.  From this statement you can tell that he (probably a he) does not understand the real deficiencies:  unhandled and pointless complexity and opacity.

This is not really an ST problem, though; the same could be said for most vendor-supplied library code.  Smart people with good code hygiene practices are a prerequisite for improvement, one which AFAICT is rarely if ever met.  Until that changes, expect more of the same.

I sort of read this as "everyone out there is crazy.... except me"   ... It's computer science / engineering. Ask 10 people's opinions and you'll get 18 answers back. There just is no one way to do anything.

If you see everyone having similar issues to ST, maybe there is a calculated reason that in terms of an OE who has to support every conceivable project out there and handle the tech support for anything they release - that they're not just stupid, but maybe have an idea of what will and won't work for them.

As to Low Layer.... I have no idea what this means. Are they replacing sections of CubeMx/Hal? Are they dividing up into two sections where Low Layer will be chip specific containing the have the defines and base code, and the HAL will apply the more complex peripheral handling to all devices equally as it's trying to do now?

It seems odd to me that they get moving on HAL and change it up right away, but at least they're still working on it and haven't just tossed their hands in the air like some other suppliers (ehm, microchip).
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 3806
  • Country: nl
Re: ST official anouncment of new low level API
« Reply #3 on: September 18, 2015, 03:32:41 am »
"incomplete validation coverage …"

LOL, there is someone there that thinks you can ever have anything but.
 

Offline MT

  • Frequent Contributor
  • **
  • Posts: 854
  • Country: fo
Re: ST official anouncment of new low level API
« Reply #4 on: September 18, 2015, 03:44:29 am »
Hooray! more fragmentation!

I just discovered that the latest F429 SPL lib dont compile! All i did was swapping the 2011 SPL for 2015! And that was the lib's alone!
And i don't even use SPL or HAL. I must be a complete fool! :o

I cant directly migrate a 103 project because ST have changed the 429 register definition names for a vast number of peripherals in the
2011 definition file! :scared:
« Last Edit: September 18, 2015, 03:50:22 am by MT »
 

Offline Len

  • Frequent Contributor
  • **
  • Posts: 515
  • Country: ca
Re: ST official anouncment of new low level API
« Reply #5 on: September 18, 2015, 03:48:46 am »
As to Low Layer.... I have no idea what this means. Are they replacing sections of CubeMx/Hal? Are they dividing up into two sections where Low Layer will be chip specific containing the have the defines and base code, and the HAL will apply the more complex peripheral handling to all devices equally as it's trying to do now?

According to ST's web page the Low Layer API can be used either with or instead of the HAL:
Quote
LL APIs make up a fast, light-weight, expert-oriented layer which is closer to the hardware than the HAL. HAL and LL APIs can be used simultaneously.

This shows one of the reasons I don't like these portability / abstraction layers (not just for MCUs but in lots of other situations). It always seems like you run into a roadblock where the abstraction layer either won't let you use a particular feature of a particular device, or makes it really inefficient. Almost always, it's better to write code for the specific device(s) that you will use, and just try to keep the platform-dependent code to a minimum.
« Last Edit: September 18, 2015, 09:18:50 am by Len »
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 15427
  • Country: nl
    • NCT Developments
Re: ST official anouncment of new low level API
« Reply #6 on: September 18, 2015, 06:06:13 am »
This is not really an ST problem, though; the same could be said for most vendor-supplied library code.
I always use vendor supplied code as an example for writing my own driver. The vendor provided code is usually buggy (demontrator level) and/or way too complicated (bloated) for what I want.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Online ajb

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: ST official anouncment of new low level API
« Reply #7 on: September 18, 2015, 06:47:31 am »
This shows one of the reasons I don't like these portability / abstraction layers (not just for MCUs but in lots of other situations). It always seems like you run into a roadblock where the abstraction layer either won't let you use a particular feature of a particular device, or makes it really inefficient. Almost always, it's better to write code for the specific device(s) that you will use, and just try to keep the platform-dependent code to a minimum.

This was exactly my experience with Atmel's ASF.  Want to shovel bytes between buffers and a UART?  No problem!  Oh, you need to do break detection?  Time to throw away the API and start poking registers.

Furthermore, the SAM parts have at least three different peripherals that can do asynch serial (SERCOMs, UARTs, and USARTs, and the latter two often appear together on the same chip), so you'd think they'd at least provide a consistent interface for all three, right?  Nope, each has its own set of API functions and configuration structs, so even with all of that abstraction you're STILL stuck manually porting between peripherals.

Really I think it would be best for everyone if the manufacturers just provided a simple, consistent, and WELL DOCUMENTED set of header files and maybe some useful helper functions for the simpler peripherals and focused their development efforts on providing solid easy-to-use stacks for the more complex things like USB and IP and so forth.  Hopefully what ST is working on now is more along those lines.  I've got my eye on one of their parts for a particular project coming up, so it would be nice to see a sane and actually useful API for it.
 

Online nctnico

  • Super Contributor
  • ***
  • Posts: 15427
  • Country: nl
    • NCT Developments
Re: ST official anouncment of new low level API
« Reply #8 on: September 18, 2015, 07:51:29 am »
For USB or IP you are better off looking at LUFA or Lwip. NXP for example forked LUFA to serve as their generic USB device/OTG/host stack.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline MT

  • Frequent Contributor
  • **
  • Posts: 854
  • Country: fo
Re: ST official anouncment of new low level API
« Reply #9 on: September 18, 2015, 09:47:10 am »
ST have now let the low level abstraction monster out of its cage!
It seams to be a complete dissaster, 200Mbyte zip, macro,static inline functions , yet another run of renamed register accesses. :scared: :palm:
« Last Edit: September 18, 2015, 10:02:31 am by MT »
 

Offline Ribster

  • Regular Contributor
  • *
  • Posts: 148
  • Country: be
  • Electronics enthousiast. Mostly on STM32
    • Robbe's Workshop
Re: ST official anouncment of new low level API
« Reply #10 on: September 18, 2015, 05:19:23 pm »
I can't seem to find it on their site. Could you give a hand as to where you found this ?
Veni Vidi Vagina - Ik kwam, en zag dat het kut was.
 

Online westfw

  • Super Contributor
  • ***
  • Posts: 2704
  • Country: us
Re: ST official anouncment of new low level API
« Reply #11 on: September 18, 2015, 08:06:42 pm »
Quote
maybe there is a calculated reason that in terms of an OE who has to support every conceivable project out there and handle the tech support for anything they release
Oh sure; you can usually see the motivations: Support all features, no compiler dependencies, meets XXYZ coding standards, "object oriented", "abstracted API", common APIs for different chips, "doesn't depend on current device state", etc.   Most of them even sound pretty reasonable.   But by the time you combine them all together, with a few less-than-brilliant decisions thrown in, you wind up with something so bloated and difficult to document that no one wants to use it.

As an example, someone mentioned "break detection" on a UART.  I can see it now: SW buffer width increased to 16 bits so it can hold status bits as well as data! BREAK, parity, framing err, overrun, and shucks, it will hold the 9bit data some UARTs can support too!   that'll be great!  It's good for them, too; most uart drivers are really poor at error detection, which is bad programming practice!
 

Online Kjelt

  • Super Contributor
  • ***
  • Posts: 4983
  • Country: nl
Re: ST official anouncment of new low level API
« Reply #12 on: September 18, 2015, 08:47:47 pm »
Why all the complaints. No one forces you to use it. You can use it as a reference to build your own or expand it for your own products.
I think it is better there are libraries provided than nothing at all like in the old days where hardware manufacturers did not give a damn.
We have tens of products in the market using the STM32 HAL without problems, well not many problems  :D
Yeah we all would like utopia, perfect bug free hardware, every year updated ARM cores (instead of the 4 yr old versions) and perfect bug free drivers and all we need to do is write the main(). Wake up.
 

Offline bigdawg

  • Regular Contributor
  • *
  • Posts: 98
  • Country: us
Re: ST official anouncment of new low level API
« Reply #13 on: September 18, 2015, 11:07:14 pm »
I can't seem to find it on their site. Could you give a hand as to where you found this ?

same here. I would've thought that ST will put the links out more prominently since this is something many people might find useful. I have just switched to ST from atmel and NXP, and I already hate working with HAL to port my existing code.
 

Offline bigdawg

  • Regular Contributor
  • *
  • Posts: 98
  • Country: us
Re: ST official anouncment of new low level API
« Reply #14 on: September 18, 2015, 11:14:28 pm »

According to ST's web page the Low Layer API can be used either with or instead of the HAL:


This is something I would be very curious about. If I can use HAL along with a low layer API without running into any major bugs than that's a definite plus. for whatever reason, I feel like that might just be wishful thinking on my part, and doing it will be a major PITA.
 

Offline MT

  • Frequent Contributor
  • **
  • Posts: 854
  • Country: fo
Re: ST official anouncment of new low level API
« Reply #15 on: September 18, 2015, 11:43:15 pm »
Why all the complaints. No one forces you to use it. You can use it as a reference to build your own or expand it for your own products.
You dont see westfw and other peoples  hard earned points? Comming here and complain about complaints!!
This thread is about complaining ST forcing people use their crap...yees even their definition files is crap which we is forced to use!  >:D
Quote
http://www.eevblog.com/forum/microcontrollers/st%27s-%28stm32cube%29-software-ecosystem-is-terrible-how-can-we-fix-it/
Quote
I think it is better there are libraries provided than nothing at all like in the old days where hardware manufacturers
did not give a damn. We have tens of products in the market using the STM32 HAL without problems, well not many problems  :D
Yeah we all would like utopia, perfect bug free hardware, every year updated ARM cores (instead of the 4 yr old versions)
and perfect bug free drivers and all we need to do is write the main(). Wake up.
See, you aswered your own allegation, a sign of a lazy coder who is scared to poke around in registers
and actually learn underlying hardware instead want everything served on a silver plate and spoon feed!
So yes it is 2015 and we really really deserves utopia, its about time!

This is what guru Clive 1 says about it all Kjelt, and you better listen to guru Jan and guru Clive!

Quote
Honestly I did try to reason with them, but didn't seem to get a lot of traction, at this point it's all going to have to collapse under it's own weight. Someone there is going to have to have some sort of epiphany, as the way things are going it's just going to get more unmaintainable. I'm going to join the Jan on the Dark Side, and tinker at the register level.

Time to wake up from your fairygreen dream Kjelt and join us on the dark side!

(PS: im not angry or so, it's just self entertaintment, mostly i just sit and laught).. ;)
« Last Edit: September 20, 2015, 07:24:47 am by MT »
 

Offline donotdespisethesnake

  • Frequent Contributor
  • **
  • Posts: 746
  • Country: gb
  • Embedded stuff
Re: ST official anouncment of new low level API
« Reply #16 on: September 19, 2015, 12:20:49 am »
The Low Level drivers are so far only in the CubeL4 package http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/LN1897/PF261908 "Uses CodeSonar", apparently.
Bob
"All you said is just a bunch of opinions."
 

Offline bigdawg

  • Regular Contributor
  • *
  • Posts: 98
  • Country: us
Re: ST official anouncment of new low level API
« Reply #17 on: September 19, 2015, 01:26:33 am »
The Low Level drivers are so far only in the CubeL4 package http://www.st.com/web/catalog/tools/FM147/CL1794/SC961/SS1743/LN1897/PF261908 "Uses CodeSonar", apparently.

I suspected that but thanks for the clarification. I was looking for low level drivers for STM32F4 and STM32F7 but I couldnt find anything new listed on their respective cube pages.
 

Offline mark03

  • Frequent Contributor
  • **
  • Posts: 396
  • Country: us
Re: ST official anouncment of new low level API
« Reply #18 on: September 19, 2015, 01:29:17 am »
Why all the complaints. No one forces you to use it. You can use it as a reference to build your own or expand it for your own products.
I think it is better there are libraries provided than nothing at all like in the old days where hardware manufacturers did not give a damn.
We have tens of products in the market using the STM32 HAL without problems, well not many problems  :D

It's nice to know the vendor libraries are useful for some.  I guess part of the complaining is a perfectionistic streak a lot of us have, an instinctive dislike of obviously sub-par solutions, when we know they could have been so much better, and probably with less effort on the vendor's part at that.

I guess if they want to waste their time on code which is so widely reviled (based on my informal poll of working embedded devs), I should not mind, except that there are other support areas just crying out for attention:  quality documentation, for example.  If you assess the quality of writing and clarity of exposition in any MCU reference manual today, and compare it with one from 20 years ago, it is shocking.  I find myself trying to parse sentences which are barely English on a regular basis now.  Terribly frustrating.  Just yesterday, in fact, I was trying to educate myself on a new STM32 peripheral, the DFSDM (digital filter for sigma-delta modulation), but the bad writing seriously hinders comprehension.
 

Offline bigdawg

  • Regular Contributor
  • *
  • Posts: 98
  • Country: us
Re: ST official anouncment of new low level API
« Reply #19 on: September 19, 2015, 01:36:51 am »

So yes it is 2015 and we really really deserves utopia, its about time!

This is what guru Clive 1 says about it all and Kjelt and you better listen to guru Jan and guru Clive!


I have to agree with the sentiments expressed by MT here. Sure, one can throw away the libraries and do everything from scratch but is that a good use of our time ? I am sure some of you guys on this forum have tons of experience and knowledge to avoid libraries completely and still write your code in a timely fashion but for other folks like me who tinker with writing/editing code on when we have to, and whose core competency is in other fields; libraries are god-send. My beef with STM is not that they dont provide libraries to do everything (thats impossible!); but they provide libraries to do a lot of things, and that none of those seem to work exactly as they have described, leading to countless hours being wasted trying to troubleshoot.

I would be very interested to know what kind of validation they have done on their HAL libraries.

Another thing which annoys me about their forums is there is one guy (clive1) who provides vast majority of useful answers and the ST employees seem to barely pull their weights. I am sorry, but this is quite contrary to what I have seen elsewhere. Ofcourse, I like the ST hardware, thats why I am going through all the trouble of making it work!
 

Online ajb

  • Super Contributor
  • ***
  • Posts: 1460
  • Country: us
Re: ST official anouncment of new low level API
« Reply #20 on: September 19, 2015, 01:54:09 am »
Why all the complaints. No one forces you to use it. You can use it as a reference to build your own or expand it for your own products.
I think it is better there are libraries provided than nothing at all like in the old days where hardware manufacturers did not give a damn.

Sure, but when you have to dig through fifteen layers of abstraction to figure out what the library is actually doing at the hardware level, it's not a terribly great reference, especially if the only "documentation" for it is useless doxygen boilerplate.  Couple that with some of the really disappointing datasheets/reference guides that are out there and you do not have a good recipe for understanding.  A better reference would be some application examples showing the required register accesses with explanations of how and why the peripherals are configured for a given application.  This also gives you an immediate idea of what registers should have what values at each point in the program, which makes debugging vastly easier.  You could even wrap them up into a nice set of library functions without trying to abstract all sense out of the code and have something that is more compact, easier to understand, and takes less work for the manufacturers to produce, validate, and maintain.  From the user side, if your application fits into one of the boxes that the library's writers anticipated, then you can use it as is with no problem, just as some do now with the higher level libs--but if you need to alter or extend the library (or even start over from scratch), you'll have a much easier time of it with a low level library than a huge and endlessly abstracted library. 
« Last Edit: September 19, 2015, 01:56:10 am by ajb »
 

Offline Tainer

  • Contributor
  • Posts: 37
  • Country: 00
Re: ST official anouncment of new low level API
« Reply #21 on: September 19, 2015, 10:07:18 pm »
I'm surprised that libopencm3 hasn't been mentioned yet. I think the best thing ST could do is to contribute to the project :)
 

Offline ntfreak

  • Contributor
  • Posts: 12
  • Country: gb
Re: ST official anouncment of new low level API
« Reply #22 on: September 19, 2015, 10:31:23 pm »
I'm surprised that libopencm3 hasn't been mentioned yet. I think the best thing ST could do is to contribute to the project :)
I would imagine the LGPL licence is not helping libopencm3 with vendors or any commercial use.
 

Offline donotdespisethesnake

  • Frequent Contributor
  • **
  • Posts: 746
  • Country: gb
  • Embedded stuff
Re: ST official anouncment of new low level API
« Reply #23 on: September 19, 2015, 11:23:32 pm »
I'm surprised that libopencm3 hasn't been mentioned yet. I think the best thing ST could do is to contribute to the project :)

What about mbed? ST contribute to that, as do several other ARM vendors. The online compiler is a PITA, but you can build offline with several different IDEs.
Bob
"All you said is just a bunch of opinions."
 

Offline ntfreak

  • Contributor
  • Posts: 12
  • Country: gb
Re: ST official anouncment of new low level API
« Reply #24 on: September 19, 2015, 11:54:40 pm »
I'm surprised that libopencm3 hasn't been mentioned yet. I think the best thing ST could do is to contribute to the project :)

What about mbed? ST contribute to that, as do several other ARM vendors. The online compiler is a PITA, but you can build offline with several different IDEs.
If I recall mbed uses an Apache licence rather than LGPL.
 

Offline MT

  • Frequent Contributor
  • **
  • Posts: 854
  • Country: fo
Re: ST official anouncment of new low level API
« Reply #25 on: September 20, 2015, 01:19:14 am »
folks like me who tinker with writing/editing code on when we have to, and whose core competency is in other fields; libraries are god-send.  I would be very interested to know what kind of validation they have done on their HAL libraries.

I dont se the point of this abstraction madness where a lib user has to do a call to a library just to wiggle a pin! Or abstracting
to death utterly simple things like systick who barely needs 3 register writes to be initialized, setup, and enabled and at the
same time they completely destroyed portability of code between devices by splitting up the systick definitions onto 3 different
files for one family of devices while for other devices continue to have systick neatly described in one file it is suposed to be
namely the definition file. And that for a function that is part of the ARM package and not ST. Same goes for NVIC but im not
100% sure on that one.(disclaimer if im all wrong).

Btw, systick is faster then NVIC because you have automatic reset of isr flag! ;)

I dont mind one thick definition file nor many smal ones as long as they are written well. Im not against libraries or abstraction
per see, it's the way STM creating and managing the whole gorilla i'm against! What's worst of all ST is loosing money
by doing all those convoluted abstraction layers, and they don't realizing it , they believe they are "hipp" and modern
and trendy! As Clive described just imagine all the people needed to wrestle with this gorilla that now weights
200mega tonnes and in 5 years time when even more devices is added will weight 800Mtonnes +!

Everything boils down to bad management!

However there is one very god thing about this 200megaton abstracted low level gorilla. As it grows STM have to put on larger Flash and SRAM memories on the devices to compensate for the ever expanding bloat it creates. Something we on the dark side is quite pleased about! So yes, i have changed my mind, this new lib is actually great! Hohumm!
« Last Edit: October 02, 2015, 07:58:06 am by MT »
 

Offline donotdespisethesnake

  • Frequent Contributor
  • **
  • Posts: 746
  • Country: gb
  • Embedded stuff
Re: ST official anouncment of new low level API
« Reply #26 on: September 20, 2015, 01:25:36 am »
If I recall mbed uses an Apache licence rather than LGPL.

Most of the mbed client side stuff is Apache, although there are some proprietary drivers. Mbed have been and still are quite fuzzy when it comes to what "Open Source" means. The idea with mbed now seems to be they give the mbed IoT client side, "free", and will charge for use of IoT server side software.

What is puzzling though is the restrictive licenses vendors use, e.g. ST's laughably entitled "ST Liberty License" - "must not use with other manufacturer's devices". When queried, ST rep said this was because "they get a lot of counterfeits". However, when it comes to mbed, they seem to happy to give essentially the same thing under very permissive license.

Of course, the Holy Grail of an API which is efficiently implemented over a wide range of devices will never happen, regardless of licensing or commercial interest.  There will always be a compromise between efficiency and portability.

In my experience, hardware vendors are always lousy at providing software. I would prefer vendors to get the silicon right first, then provide a basic set of register definitions and low level functions. Let customers and third parties who know what they are doing provide software solutions.
Bob
"All you said is just a bunch of opinions."
 

Offline Lukas

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: de
    • carrotIndustries.net
Re: ST official anouncment of new low level API
« Reply #27 on: September 20, 2015, 01:44:14 am »
Instead of churning out yet another API of questionable quality and usefulness, they could revamp their header/SVD files to include register field enumerations.
So instead of writing
Code: [Select]
GPIOA->MODER |= GPIO_MODER_MODER5_0 | GPIO_MODER_MODER5_1;

I'd be able to write
Code: [Select]
GPIOA->MODER |= GPIO_MODER_MODER5_AF;

Shouldn't be rocket science for ST do do that...
 

Offline Ribster

  • Regular Contributor
  • *
  • Posts: 148
  • Country: be
  • Electronics enthousiast. Mostly on STM32
    • Robbe's Workshop
Re: ST official anouncment of new low level API
« Reply #28 on: September 20, 2015, 09:19:03 pm »
I think this is no rocket sience for you either. Just put a days work into it and you have what you need...
Veni Vidi Vagina - Ik kwam, en zag dat het kut was.
 

Offline obiwanjacobi

  • Frequent Contributor
  • **
  • Posts: 832
  • Country: nl
  • What's this yippee-yayoh pin you talk about!?
Re: ST official anouncment of new low level API
« Reply #29 on: September 20, 2015, 09:50:04 pm »
Im not familiar with ST tools or frameworks but what I read is common to all software development, me think.

One is trying to build something that is useful in their perspective, others are not used to that way of thinking and reject anything they do not know and/or understand. Having a questionable track record does not help. Having non-domain-experts do the programming does not help either.

Then there is (especially in IT software development) the hype-factor and the accompanying roller coaster..

With embedded-programmers it seems that any form of abstraction is viewed as an unnecessary added complexity and indirection. Maybe that is because in resource-restricted processor environments, there simply is no room for the overhead and thus they never learned to think in those terms.

Being an IT-developer myself, I think I understand the reasoning but I also see the advantages of abstraction, although abstraction has different restrictions on different 'levels'. However, I think it can be done but I am not naive to think that it will be perfect in v1.0. Every 'new' viewpoint takes time to mature and to thoroughly understand.

Note: It is not my intention to disrespect anybody. We all had our -different- journey and that is fine. These are just my observations and not to be interpreted as absolute truth (if such a thing exists).

Online djacobow

  • Frequent Contributor
  • **
  • Posts: 819
  • Country: us
  • takin' it apart since the 70's
Re: ST official anouncment of new low level API
« Reply #30 on: September 21, 2015, 03:36:33 am »
One is trying to build something that is useful in their perspective, others are not used to that way of thinking and reject anything they do not know and/or understand. Having a questionable track record does not help. Having non-domain-experts do the programming does not help either.

Let me be the first to say this criticism has little to do with users not understanding.

These criticisms of ST's library are not coming from a place of ignorance, or unfamiliarity or unwillingness to use abstractions. They are coming from a place of wanting to work at an abstracted level, being offered a library that makes promises and then fails to deliver. Every. Single. Time.

The ST HAL is just crap. Most of the functions it provides are nothing more than dumb wrappers around the register pokes. Usually, you have to fill a large struct full of members whose names are suspiciously similar to the registers they relate to, then you pass the struct to some mysterious function, which pokes the real registers with the values from the struct you filled out. What has that bought me? Is there some kind of error checking? No. Does the function make sure my choices are consistent with each other? No. Does the function wrap any checking for preconditions necessary for the peripheral to work, like the clocks being enabled or DMA being set up in advance? No. Is the setup for the function very simple for the most /common/ uses? Not usually. Does a return code help me understand why the peripheral is not behaving as expected? No. Finally, does this library allow me to get by without knowing the details of how that part actually works? That is, can I read the documentation for the *library* and *NOT* read the documentation for the part and expect to get by with that? This is the real test of an abstraction, and the answer is invariably no, too. Because when things don't go as you expected, you have to dig into those registers yourself to figure out what's what.

Resources are tight in embedded systems, but not as tight as they once were, and I think most embedded folks would be happy to pay the size and performance overhead of libraries IF they made their lives easier. And of course, in cases, where size and performance were critical, they would do the LL stuff themselves. But these libraries just don't make life much easier.
 
The following users thanked this post: autobot

Offline andyturk

  • Frequent Contributor
  • **
  • Posts: 874
  • Country: us
Re: ST official anouncment of new low level API
« Reply #31 on: September 21, 2015, 05:17:04 am »
I think all OEM HALs suffer from the same problem: they're designed to expose the entire feature set of the hardware. The OEM firmware folks have to implement wrappers for all the interrupts, DMA behaviors, etc. It's particularly obvious in PWM implementations because those peripherals can be used in so many different ways (e.g., for reading rotary encoders, simple PWM, motor control, etc.). My point of view--as someone implementing an embedded application--is that when all I need is an RGB LED (with three simple PWM channels), I don't want to wade through the OEM API that's designed to handle every possible use. I just want to blink the damn LED!

Fortunately, the people who write mcu datasheets seem to much better at documenting their work than the OEM firmware teams. I.e., if I crack open the datasheet for the most gnarly peripheral with dozens of registers, it's still going to be documented well enough to figure out what has to happen. It often turns out that banging registers directly is an easier way to add functionality.

Rolling your own peripheral implementation is even more important if you've got a non-OEM RTOS in the design because then you're probably having to do special things in interrupt handlers. Suppose you're writing a block of bytes in some serial format (e.g., I2C, UART, SPI) and you need to block the calling thread until the transfer is complete. Those OEM HALs usually don't have the kind of hooks you'll need to pull that off. Sometimes the OEM will offer their own RTOS (with HAL support), but that's a much bigger commitment to your embedded architecture.

Summary:

1. OEM HALs suck universally.
2. MCU datasheets suck (a lot) less, so don't be afraid to study peripheral registers and bang them directly.
 

Offline autobot

  • Regular Contributor
  • *
  • Posts: 66
Re: ST official anouncment of new low level API
« Reply #32 on: September 22, 2015, 03:11:01 am »
I think ChibiOs has a HAL that one could use separately , that solves at least some of the point djacobow talks about in his post.
 

Offline AndyC_772

  • Super Contributor
  • ***
  • Posts: 3264
  • Country: gb
  • Will design for cookies
Re: ST official anouncment of new low level API
« Reply #33 on: September 22, 2015, 03:33:09 am »
1. OEM HALs suck universally.
2. MCU datasheets suck (a lot) less, so don't be afraid to study peripheral registers and bang them directly.

Yes  :-+

You've hit the nail on the head here. ST's HAL is indeed nothing more than an obfuscation layer between the device's registers - which for the most part are clear and easily understood - and the code. It doesn't make common functions any easier to set up than poking registers directly, and certainly doesn't relieve any need to read and understand the device's reference manual.

The manual, thankfully, is pretty decent IMHO.
 

Offline Molenaar

  • Regular Contributor
  • *
  • Posts: 73
  • Country: nl
Re: ST official anouncment of new low level API
« Reply #34 on: October 01, 2015, 06:35:33 pm »
How is the quality of the ST HAL compared to the code generated by TI's HALcoGEN? Or TI's driverlib?
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 6434
  • Country: nz
Re: ST official anouncment of new low level API
« Reply #35 on: October 01, 2015, 06:38:03 pm »
We use the TI CC2540 HAL at work, it doesnt seem too bad.
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline marcopolo

  • Regular Contributor
  • *
  • Posts: 68
  • Country: fr
    • Retronik
Re: ST official anouncment of new low level API
« Reply #36 on: April 02, 2016, 08:28:41 am »
From stm32_embedded_software_offering.pdf
Low-layer APIs availability :

Offline Psi

  • Super Contributor
  • ***
  • Posts: 6434
  • Country: nz
Re: ST official anouncment of new low level API
« Reply #37 on: April 02, 2016, 10:51:20 am »
Personally i think a lot of people just want stmcube to generate register level code.

To make it simple to init and change hardware peripheral modes without having to study the datasheet for 2 hours.

Im hoping the new low level api will allow this without adding tonns of unnessesary crap. but im not holding my breath

The stm32cube ide to setup all the hardware and graphically show you clock settings is great. It just needs to generate simple code.
« Last Edit: April 02, 2016, 10:53:47 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline autobot

  • Regular Contributor
  • *
  • Posts: 66
Re: ST official anouncment of new low level API
« Reply #38 on: April 03, 2016, 09:41:21 am »
One is trying to build something that is useful in their perspective, others are not used to that way of thinking and reject anything they do not know and/or understand. Having a questionable track record does not help. Having non-domain-experts do the programming does not help either.

Let me be the first to say this criticism has little to do with users not understanding.

These criticisms of ST's library are not coming from a place of ignorance, or unfamiliarity or unwillingness to use abstractions. They are coming from a place of wanting to work at an abstracted level, being offered a library that makes promises and then fails to deliver. Every. Single. Time.

The ST HAL is just crap. Most of the functions it provides are nothing more than dumb wrappers around the register pokes. Usually, you have to fill a large struct full of members whose names are suspiciously similar to the registers they relate to, then you pass the struct to some mysterious function, which pokes the real registers with the values from the struct you filled out. What has that bought me? Is there some kind of error checking? No. Does the function make sure my choices are consistent with each other? No. Does the function wrap any checking for preconditions necessary for the peripheral to work, like the clocks being enabled or DMA being set up in advance? No. Is the setup for the function very simple for the most /common/ uses? Not usually. Does a return code help me understand why the peripheral is not behaving as expected? No. Finally, does this library allow me to get by without knowing the details of how that part actually works? That is, can I read the documentation for the *library* and *NOT* read the documentation for the part and expect to get by with that? This is the real test of an abstraction, and the answer is invariably no, too. Because when things don't go as you expected, you have to dig into those registers yourself to figure out what's what.

Resources are tight in embedded systems, but not as tight as they once were, and I think most embedded folks would be happy to pay the size and performance overhead of libraries IF they made their lives easier. And of course, in cases, where size and performance were critical, they would do the LL stuff themselves. But these libraries just don't make life much easier.

This is a great description of what's required from a good embedded library. Which manufacturer comes closest to this today ?
 

Online westfw

  • Super Contributor
  • ***
  • Posts: 2704
  • Country: us
Re: ST official anouncment of new low level API
« Reply #39 on: April 03, 2016, 04:26:32 pm »
Quote
Which manufacturer comes closest to this today ?
Arduino?  Although, for such a small and limited subset of the typical capabilities of a microcontroller, and usually at such a performance hit, that professionals don't like it very much.
The whole "pin number" abstraction is brilliant, especially for beginners.  And also terribly limiting :-( 
But that's the "big thing" - most of the reset is "adequate" libraries for basic functionality, without flexibility.
Try to change the CPU clock, it probably doesn't work.
Add pullup and pulldown configurations and you're stuck in a mire of "how the AVR happened to do it is now a standard."
 

Offline timb

  • Super Contributor
  • ***
  • Posts: 2528
  • Country: us
  • Pretentiously Posting Polysyllabic Prose
    • timb.us
Re: ST official anouncment of new low level API
« Reply #40 on: April 03, 2016, 05:51:30 pm »
FWIW, TI's DriverLib is usually pretty good. At least on the MSP430 and more mature TivaC parts I've used. MSP432 was a bit rough last time I looked, but that wasn't on final silicon, soo... Their MSPWare and TivaWare packages are also generally very good.

One huge advantage is a lot of the parts actually have the DriverLib stuff in ROM, so using that abstraction doesn't take up additional memory space. You can set it up so that, at build time, it checks to see if the target has the library in ROM; if so it calls the function from there; if not it compiles and executes it from memory. You can even override the ROM code for specific functions if you want; useful if the ROM based library has a bug that's fixed in a newer version of the DriverLib.
Any sufficiently advanced technology is indistinguishable from magic; e.g., Cheez Whiz, Hot Dogs and RF.
 
The following users thanked this post: autobot

Offline autobot

  • Regular Contributor
  • *
  • Posts: 66
Re: ST official anouncment of new low level API
« Reply #41 on: April 04, 2016, 02:05:48 am »
Quote
Which manufacturer comes closest to this today ?
Arduino?  Although, for such a small and limited subset of the typical capabilities of a microcontroller, and usually at such a performance hit, that professionals don't like it very much.
The whole "pin number" abstraction is brilliant, especially for beginners.  And also terribly limiting :-( 
But that's the "big thing" - most of the reset is "adequate" libraries for basic functionality, without flexibility.
Try to change the CPU clock, it probably doesn't work.
Add pullup and pulldown configurations and you're stuck in a mire of "how the AVR happened to do it is now a standard."

Wesft, that's true the arduino does that. It might be even be possible to do it without a big performance hit, like the xpcc[1] guys claim. But sadly, they only offer support for a few chips.


[1]http://xpcc.io/why-use-xpcc/
 

Offline Brutte

  • Frequent Contributor
  • **
  • Posts: 504
Re: ST official anouncment of new low level API
« Reply #42 on: April 04, 2016, 05:47:27 am »
I'd like to point out the core difference in between a hardware abstraction layer (HAL) and peripheral library (PL):
Within OS, HAL provides mechanisms for mutual exclusion and reentrancy of code.
That is not the case with PL.

So comparing advantages of some HAL implementation w.r.t. different implementation of PL is kind of playing with apples and oranges.

The new LL library is just a PL and is not suitable for OS environment as the user would have to add that mutual exclusion layer / reentrancy manually (PITA).
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf