cancel
Showing results for 
Search instead for 
Did you mean: 

HAL (Hard Animal Layer)

RhSilicon
Lead

I thought I was the only one wondering how to implement DMA, but it seems to be different. I found this post, and found it interesting how the topic was addressed:

To be honest, this was not a post I was planning on at first. However, I was working on a side project that I needed to use DMA for, and getting it to work with the HAL was thus far the most painful experience I faced in embedded Rust. As a result, I figured I must write about it hoping it would benefit others. What was quite interesting was that, compared to other STM32 peripherals at the HAL, DMA was a different animal. Typically when I struggled with figuring stuff out or finding proper documentation I used to cross over to other STM32 HALs to find insight as there were many similarities. This was not the case for DMA as each HAL seemed to have its own way of doing DMA implementation.

https://dev.to/apollolabsbin/stm32f4-embedded-rust-at-the-hal-dma-controllers-daf

4 REPLIES 4
LCE
Principal

I am not a big fan of the STM32 HAL stuff in C.

But when I checked the DMA HAL functions, I found most quite okay, with not much overhead as in in the other HAL libs.

Cube/HAL is designed to provide outwardly simple solutions for typical applications (whatever Cube authors deem as typical), especially through clicking in CubeMX. As such, most of it deals just with its own internal structures and processes, so  it's rather unsuitable as a reference reading for hardware control. For that, the RM is more adequate, unsurprisingly.

Btw. Rust is another such bundle which is more obsessed with its own internals than with actual functionality (presumably for higher good), so the process described in initial post is basically trasferring a relatively small portion dealing with the hardware, between two environments which both entangle it into their extensive fabric.

JW

Pavel A.
Evangelist III

Ah, Rust. It is a major pain by itself. And amount of effort needed to bridge it with C. 

/* from experience... when you see that Microsoft loves and promotes some technology - rush to the opposite direction. They never fail to find a dead end. Python is the only exception so far. */

Piranha
Chief II

C'mon, in the link you posted, the author doesn't talk about ST's HAL...

https://docs.rs/stm32f4xx-hal/latest/stm32f4xx_hal/

HAL is a generic term. And then there is also this one, which also went wrong...