Skip to content

Conversation

@rleh
Copy link
Member

@rleh rleh commented Apr 16, 2021

Based on the awesome work done by @mikewolfram in #466, but now enabled (and debugged) for STM32F4.
Thanks to @jnewcomb and @kikass13 for giving hints and testing in #583!

I don't want the current solution with the modified linkerscript to get merged, but opening this Draft PR already to further discuss here about the options and later code.

@jnewcomb
Copy link

jnewcomb commented Apr 16, 2021

@rleh Are any updates required to stop lbuild from complaining?
modm\ext\aws\module.lb
modm\src\modm\platform\eth\stm32\module.lb

A copy of my 'rough' notes below covering the errors I got and the fixes I made.. (Sorry.. I'm presently learning how to use git!..)

Added to "C:\Projects\modm\modm\examples\nucleo_f429zi\freertos_plus_tcp\project.xml"
<module>modm:freertos:tcp:lan8720a</module>

lbuild gives us:
ERROR: Cannot resolve name 'modm:freertos:tcp:lan8720a' of type Module!

Current project configuration:
ConfigNode(filename='project.xml')
╰── ConfigNode(filename='../../../src/modm/board/nucleo_f429zi/board.xml')
    ╰── ConfigNode(filename='../../lbuild.xml')


THIS IS BECAUSE...
It is included in "C:\Projects\modm\modm\stm32f767zit6.txt"

    ├── Module(modm:freertos)   FreeRTOS
    │   ├── Option(frequency) = 1000 in [4 ... 1000]   Context switch frequency in Hz
    │   ╰── Module(modm:freertos:tcp)   FreeRTOS+TCP
    │       ╰── Module(modm:freertos:tcp:lan8720a)   a:FreeRTOS-Plus-TCP Ethernet via LAN8720A

But NOT in "C:\Projects\modm\modm\stm32f429zit6.txt"
    ├── Module(modm:freertos)   FreeRTOS
    │   ├── Option(frequency) = 1000 in [4 ... 1000]   Context switch frequency in Hz
    │   ╰── Module(modm:freertos:tcp)   FreeRTOS+TCP


The stm32f767zit6 generated code has this:
C:\Projects\modm\modm\examples\nucleo_f767zi\ethernet\modm\ext\freertos_plus_tcp


So...
Update module to allow F4 and F7
IN:
C:\Projects\modm\modm\ext\aws\module.lb
CHANGE:
if device.identifier.family not in ["f7"]:
TO:
if device.identifier.family not in ["f4", "f7"]:

This generates a different warning..
ERROR: Cannot resolve dependency ':platform:eth' of Module(modm:freertos:tcp:lan8720a)!
In file '../../../ext/aws/module.lb:22' in function 'prepare':
    def prepare(self, module, options):

THIS IS BECAUSE...
In:
C:\Projects\modm\modm\ext\aws\module.lb
There is a dependancy:
module.depends(":platform:eth", ":driver:lan8720a")
That is not included in the F4...

So..
Add ":platform:eth" for F4 platforms
IN:
"C:\Projects\modm\modm\src\modm\platform\eth\stm32\module.lb"
CHANGE:
if device.identifier.family not in ["f7"]:
TO:
if device.identifier["family"] not in ["f4", "f7"]:

@rleh
Copy link
Member Author

rleh commented Apr 16, 2021

C:\Projects\modm\modm\ext\aws\module.lb
CHANGE:
if device.identifier.family not in ["f7"]:
TO:
if device.identifier.family not in ["f4", "f7"]:
[...]
CHANGE:
if device.identifier.family not in ["f7"]:
TO:
if device.identifier["family"] not in ["f4", "f7"]:

That are exactly the changes done in commit 0d3be64 (in this pull request).
You should be able to git checkout (or with modern git: git switch) to my branch (or only cherry-pick the commit) if you ad the forked repo as an additional git remote.

@jnewcomb
Copy link

Doh, told you I was a git noob, thanks for the tips.
~TortoiseSVN is my 10-year crack habit .. and I know I should come off it!

I still can't see the edits to:
modm\ext\aws\modm_lan8720a.cpp
(or is that intentional / awaiting comments?)

It's possible to template and keep a conditional fastdata for F7 - other ports seem to do this.. I guess it reduces DMA arbitration if other DMAs transactions share the SRAM.
Not sure about 32 byte alignment.. I swapped to 4 in line with other DMA buffers.

@salkinium
Copy link
Member

Not sure about 32 byte alignment.. I swapped to 4 in line with other DMA buffers.

The 32-BYTE alignment is correct, but it seems like the STM32F7 only has a 64-bit bus, so it could possibly be 16B aligned too. It's probably best to leave it like that, potentially wasting 31B is not the issue with a few kB of buffer required for the Ethernet frames anyways.

@rleh rleh force-pushed the feature/ethernet_stm32f4 branch from 5e80bce to 0ae3cde Compare October 22, 2021 11:45
@rleh rleh marked this pull request as ready for review October 22, 2021 11:45
@rleh
Copy link
Member Author

rleh commented Oct 22, 2021

@salkinium I copied your changes that moves the stack into DMA capable memory from #743 into commit 51438e8.

@rleh
Copy link
Member Author

rleh commented Oct 22, 2021

The example now works on my Nucleo-F439ZI board 🥳

@rleh rleh requested a review from salkinium October 22, 2021 11:48
@rleh rleh force-pushed the feature/ethernet_stm32f4 branch from 0ae3cde to 6842454 Compare October 22, 2021 12:09
@salkinium salkinium added this to the 2021q4 milestone Oct 22, 2021
@salkinium salkinium linked an issue Oct 22, 2021 that may be closed by this pull request
Copy link
Member

@salkinium salkinium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please apply this patch to the linker change commit: salkinium@7f9e9db

@rleh rleh force-pushed the feature/ethernet_stm32f4 branch from 6842454 to 735fd68 Compare October 24, 2021 21:50
Copy link
Member

@salkinium salkinium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

@salkinium salkinium added the ci:hal Triggers the exhaustive HAL compile CI jobs label Oct 24, 2021
@salkinium salkinium merged commit 735fd68 into modm-io:develop Oct 24, 2021
@rleh rleh deleted the feature/ethernet_stm32f4 branch October 24, 2021 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

advanced 🤯 ci:hal Triggers the exhaustive HAL compile CI jobs example 🔑 feature 🚧

Development

Successfully merging this pull request may close these issues.

Ethernet freertos_tcp on f439zi nucleo not working

3 participants