3703 views|11 replies

37

Posts

0

Resources
The OP
 

Selection of HAL library and STD library [Copy link]

 

Compared to the STD library, some statements seem to have become longer.

If you write code in KEIL, it feels really painful.

Of course, it has no effect on me. I write code in vscode, which has an amazing syntax prompt function. It can provide you with several options even if you write something randomly.

I heard from others that HAL has good compatibility, easy code porting, etc. It depends on personal needs.

But I think that ST has developed several libraries, including LL library and STD library, which is actually the same as e-commerce acquiring supermarkets.

The logic behind e-commerce companies acquiring physical entities is that no matter how much they promote or develop online, their market share is still the same, so they need to acquire offline supermarkets.

The number of people using the STD library is relatively fixed, so we need to develop another library. This newly developed library must be easier to understand, but the cost is that it takes longer to write...

Think about how simple register development is, a few lines of code can implement the function. STD library requires a lot of code.

Register development is like Bruce Lee's Jeet Kune Do. There are very few people who can use Jeet Kune Do. It is at the top of the pyramid structure, but it is the most efficient in terms of operating efficiency.

And there is only one Bruce Lee in the world.

As for library functions, most people can accept them, but the price is that they are more verbose. They can be said to be in the middle of the pyramid.

The code for HAL is much longer than that for STD, but more people can accept it, and only when more people use it can ST benefit.

This post is from stm32/stm8

Latest reply

Simplify a myarmlib yourself and use your own   Details Published on 2023-9-23 22:29
 

1w

Posts

16

Resources
2
 

I use the standard library. I have nothing to do with any other library.

This post is from stm32/stm8
 
Personal signaturehttp://shop34182318.taobao.com/
https://shop436095304.taobao.com/?spm=a230r.7195193.1997079397.37.69fe60dfT705yr
 

6547

Posts

0

Resources
3
 

Experts use registers

The standard library is enough.

This post is from stm32/stm8
 
 

7422

Posts

2

Resources
4
 

Experts use registers

This post is from stm32/stm8
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 

1412

Posts

3

Resources
5
 
There is no difference between the standard library and the Hal library
This post is from stm32/stm8
 
 
 

2549

Posts

0

Resources
6
 

If this was still a problem two or three years ago, it is not a problem now. The HAL library is being replaced by the LL library. It is no longer the pure HAL library. The STD library has been basically eliminated.

This post is from stm32/stm8
 
 
 

377

Posts

0

Resources
7
 

The standard peripheral library gives you SPI_SendByte(), which can only send one byte at a time, and then use interrupts or queries to check whether the transmission is completed and send the next byte, thus completing the transmission of a buffer.

The HAL library will do the above work for you. It will give you the buffer address and length, and then you don't have to worry about it. After the buffer is sent, it may even prepare a "send completion callback" function for you.

HAL is a half-step upward. People who are used to the standard peripheral library are used to building a half-step upward by themselves. They can customize more functions (such as the UART start and end send callbacks, as well as the naming rules and interfaces of the HAL layer functions that they are used to), but it takes more time. The HAL library should be more popular with novices or people who switch from embedded systems. After all, it hides more hardware details and integrates better with cube. As for registers, just use LL.

This post is from stm32/stm8

Comments

All good, all good.  Details Published on 2021-4-9 09:10
 
 
 

58

Posts

0

Resources
8
 

Hal is a re-encapsulation of std, which is less dependent on the underlying layer and easy to transplant. Hal and LL can be mixed. LL is used for parts that require efficiency, such as timers. In fact, the official hal library also has a fancy operation of calling the ll library. In addition, it is no longer the 51 era. The speed has increased and the price has decreased. The speed difference is not big. I like to mix hal and LL. It is beautiful.

This post is from stm32/stm8
 
 
 

6062

Posts

4

Resources
9
 
LeoMe published on 2021-4-8 14:19 The standard peripheral library gives you SPI_SendByte(), which can only send one byte at a time, and then use interrupts or queries to check whether the transmission is completed.

Everything is good, except the chip price.

This post is from stm32/stm8
 
 
 

224

Posts

0

Resources
10
 

The use of registers is not recommended as it is not very readable.

This post is from stm32/stm8
 
 
 

351

Posts

3

Resources
11
 

What's so tangled about this? For a developer, time is money. If you work on a good project for half a year or a year, someone else might have already finished it before you. Therefore, major chip manufacturers are launching libraries, the purpose is to reduce the development cost of developers, save time, and produce products more efficiently. As for the efficiency problems caused by complex codes, with today's technology, they have long been perfectly covered by the technology updates of semiconductors. Think about the configuration of computer hosts ten years ago, and then look at the configuration of mobile phones now. Are you still worried about the low efficiency of code execution?

This post is from stm32/stm8
 
 
 

5

Posts

0

Resources
12
 

Simplify a myarmlib yourself and use your own

This post is from stm32/stm8
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list