Electronic – Eclipse + GNU ARM + STM32 – HAL or SPL

armcortexgcchal-librarystm32

I am going to start with ARM development (after 2 years of AVRs) and have picked up the STM DISCOVERY board with the stm32f4 microprocessor on it.

I have decided to go with eclipse + ARM gcc since I don't like the code limit on Keil and I don't have the money to get a paid version.

Following the tutorials I have installed eclipse along with gcc ARM tools + openocd + make utils etc.

My question is about the 'packages' plugin. Like every beginner, I am confused as to whether to use new STM HAL or the older SPL.

My understanding is that HAL has implemented abstraction to a level where it can be referred to as Arduino equivalent for arm. SPL on the other hand provides just enough abstraction to make coding faster but you still need to deal on chip level.

With this understanding I would like to stick with SPL to understand things better rather than using HAL.

What I would like to know is, does using packages for STM implicitly force me to use HAL? If so, can someone point me on how to use SPL with my setup?

Best Answer

The SPL, as I see, has nothing to do with what IDE you are using. You can simply include the relevant modules (e.g. stmf4xx_dma.c and stmf4xx_dma.h) in your project and use the functions exposed (and described very well) in the .c and .h files. In fact I've been learning on the stmf411 nucleo with gcc, openocd and SPL using just the windows command prompt; no IDE. Packages in eclipse probably would force you to use the HAL (since inside the downloaded 'Packages' folder for eclipse, I only see HAL modules).

The HAL itself IMO seems far much layered than necessary. Whereas accessing the registers directly gets tiresome and is hardly readable. The SPL seems just right. clive1, the guru on the st.com forum, also prefers the SPL over HAL. Here's my question on that forum... might be helpful.

Need help with USART on Nucleo stmf411