Re: RFC on STM32 Ethernet driver

Erwan Gouriou

Hi Erwin,

Thanks for proposing this driver, I think it will interest a lot of people.

About your last point, let me mention ST view on this:

This is a question of trade-off. Using HAL has some drawbacks (some might
be objectives like footprint or more subjective like CamelCase), but it's
definitely possible in Zephyr.
Main interest is that it will help having a reliable driver working on all STM32
SoCs supporting ethernet (today in zephyr: stm32f407, stm32f429, stm32f469,
stm32f7xx under review) faster. More supported SoCs also means more
interested people, which will help in getting the driver mature.
In the end, it should save time to work on end applications rather than porting.

A native driver, specific to the IP (which might also be used on other SoCs),
might be more optimized, but this might also take you some time before
having it mature for complex IPs such as ethernet (or USB..).

In any case, I think it would be great to have your driver upstreamed in
a first time. Then, time will tell if a native driver is nice to have or required.


On 3 June 2017 at 15:17, Erwin Rol <mailinglists@...> wrote:

I made an initial STM32F4 Ethernet driver. It is based on the HAL
version, and doesn't try to be smart with DMA and packet buffer memory,
it just does memcpy to/from the DMA buffers. But it works.

It can be found at github;
Since it is for the olimex_stm32_e407 board (which is still pending to
be merged) I didn't want to create a pull request yet.

The driver use the STM32 HAL (or at least parts of it), and as I
mentioned "it works" but I am very uncertain about if I like the HAL
thing or not.

For example the ISR uses this __weak callbacks, but you will not have
access to your device structure anymore, and it is very unclear what is
happening. So I pretty much copied the whole ISR to only have the
possibility to access my network device structure passed to the ISR.

With the use of macros like "ETH" naming collisions are bound to happen
sooner or later.

The CamelCase naming convention of the HAL just gives me a headache, but
that's a matter of taste I guess.

I know I am opening a can of worms, but I really could use some guidance
on if using the HAL for more complex drivers like Ethernet is the way to
go or if just making a clean implementation is better.

- Erwin

Zephyr-devel mailing list

Join to automatically receive all group messages.