Skip to main content
SoHaeng.Lee
Associate III
January 26, 2016
Question

Standard Periph Library vs HAL

  • January 26, 2016
  • 11 replies
  • 2257 views
Posted on January 26, 2016 at 11:29

Hi everybody.

I confuse.

I just begun study STM32 series.

In a month, i studied hard STM32F3, F4 and i used Standard Perish Library.

But, when i used STM32CubeMX, this application creat HAL base projects.

what is better selection?
    This topic has been closed for replies.

    11 replies

    Radosław
    Associate II
    January 26, 2016
    Posted on January 26, 2016 at 12:25

    The best choise is put away any library.   Use register based programming style.  Library use only for examples or help in some troubles.

    AvaTar
    Senior III
    January 26, 2016
    Posted on January 26, 2016 at 12:38

    > The best choise is put away any library.   Use register based programming style.

     

    Only the best choice for a hacker, doing single-device projects.

    If you develop for a device platform with several similar, but different controllers, you want to re-use as much code as possible, to cut costs for development time and testing.

    That's what a good library delivers.

    The 'old' SPL is stable, but abandoned by ST, and not available for the latest MCUs.

    The CubeMX is new, supported, and littered with bugs. And the ''Click and Drag'' approach (IMHO) totally misses ST's most important target audience.

    Or, as Murphy's Law states ''A software designed for idiots is only used by idiots''.

    Finally, the choice is yours.

    Radosław
    Associate II
    January 26, 2016
    Posted on January 26, 2016 at 13:20

    > The best choise is put away any library.   Use register based programming style.

    Only the best choice for a hacker, doing single-device projects.

    You are VARY not true.  Probably you don't now what you say.
    AvaTar
    Senior III
    January 26, 2016
    Posted on January 26, 2016 at 13:31

    > You are VARY not true.  Probably you don't now what you say.

     

    Perhaps true.

    But at least a dozen of companies in the embedded business, existing longer than a few month or years, are seeing it my way.

    Radosław
    Associate II
    January 26, 2016
    Posted on January 26, 2016 at 14:45

    And what? 

    I now many companys using STM32but NOT using any library. ST sales department says this same.

    AvaTar
    Senior III
    January 26, 2016
    Posted on January 26, 2016 at 15:15

    > ST sales department says this same.

     

    That says it all.

    Tesla DeLorean
    Guru
    January 26, 2016
    Posted on January 26, 2016 at 15:22

    It doesn't make it very portable, or transferable to others and can take hours to get right and debug. Most of the examples I see, claim to do it for efficiency, but are woefully implemented and poorly commented.

    If it works for you, great, but it is not how I'd recommend doing it.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
    Radosław
    Associate II
    January 26, 2016
    Posted on January 26, 2016 at 15:43

    > It doesn't make it very portable, or transferable to others and can take hours to get right and debug.

    1. Good register based code is much more portable than any library HAL or espessialy SPL.

    2. Is much more debuguble.You directly see what must be in register.

    3 Many people cry when they want to port aplication prom L1 (SPL) to L0 (SPL never exist). In reg based coding this wil take port this will take only few days.

    4. How many aplication starts be development before any library be develop. (I'm one of very good exaples of it).

    5. How many mistakes have SPL or HAL. ( quick look up of this forum 1 of 4 topic are bug report).

    6. Effeciency

    7. Better knowleage of architekture of periferals and core.

    8. What if after few years HAL will be ambadonned?

    ....

    This is my opinion
    waclawek.jan
    Super User
    January 26, 2016
    Posted on January 26, 2016 at 16:26

    > It doesn't make it very portable, or transferable to others

    SPL does not do much in way of portability either; the compatible peripherals do, but then it really does not matter whether you use SPL or not.

    > and can take hours to get right and debug.

    Eh?

    > Most of the examples I see, claim to do it for efficiency, but are woefully implemented and poorly commented.

    Omitting your examples, most SPL-based (or any other library-based) examples I see are woefully implemented and poorly commented.

    > If it works for you, great, but it is not how I'd recommend doing it.

    +1 (i.e. if ''libraries'' work for you, great, but it is not how I'd recommend doing it ;) )

    JW

    Tesla DeLorean
    Guru
    January 26, 2016
    Posted on January 26, 2016 at 18:54

    This is my opinion

     

    And that's fine, multiple opinions can exist and be valid, this stuff isn't black and white.

    I can put my black hat on when I need too, I've designed silicon chips, I understand how this stuff works at a gate level, and I don't have a need to micro-manage stuff at this level, it is brutal and unnecessary, and I can get efficiency where I need it using mechanical advantage, good algorithms and choices. I read the manuals, I understand the hardware, I can debug my own code.

    I respect the code and methods that Jan uses, but I, personally, don't need to get lost in the minutia of a specific part from a specific vendor. My horizons are a lot broader than that, and understanding of the problems deeper than most people probably appreciate. I could be a big troll, but I choose not to be.

    My problem is a lot of the other people using register level coding are useless at it, and think a load/store shit storm is more efficient than calling a subroutine and using processor registers effectively.

    >> and can take hours to get right and debug. >Eh?

    Yeah, I'm not internalizing, but observing respondents here dicking with stuff for days/weeks and not being able to debug there way out themselves. ''They chose poorly'' to paraphrase the words of the Knight.

    Transferability comes down to handing it off to someone with a equivalent skills/ability, sure that's easy, problem is most stuff gets dumped on the team member with the least ability or experience, and then clarity wins over obfuscation.

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..