I’ve developed a custom board which is similar to the Nucleo F207 board but uses a Ti DP83825 PHY.
To get the DP83825 PHY working with STM32Ethernet I have had to make a number of modifications. Most of these can be handled elegantly using the custom boards approach and redefining weakly defined functions.
I have also had to modify stm32f2xx_hal_eth.c. At present, I have done this by editing stm32f2xx_hal_eth.c in .platformio/packages/framework-arduinoststm32/system/Drivers/STM32F2xx_HAL_Driver/Src/ but these mods will be gone if/when I do a stm32 platform upgrade.
What is the best approach to having a custom stm32f2xx_hal_eth.c?
You can just copy or upload your modified framework-arduinoststm32 folder somewhere then reference it as a the source of the framework-arduinoststm32 package per platform_packages — PlatformIO latest documentation.
I’ve copied my modified framework-arduinoststm32 folder to another location on my hard drive (C:\Frameworks\framework-arduinoststm32) and modified my platformio.ini file by adding the following section
That will make a copy of the folder into the PlatformIO packages folder (C:\Users\<user>\.platformio\packages\<package>). It’s more efficient to do a symbolic link, that’s zero-copy by using symlink://. See docs
The symlink would be a better approach but I’ve just given symlink:// a try and get an error message of
TypeError: expected str, bytes or os.PathLike object, not NoneType:
from platformio\builder\main.py. I’m on Windows 11.
Also, for additional context, I removed the [env:external_package] section from platformio.ini and added platform_packages into my [env:customboard] section.
Does this folder already contain a .piopm file? If yes that should be deleted. Also I used / instead of \ as my path separator, this should also work on Windows.
I think it’s PlatformIO’s package-manager (piopm) metadata file and the info inside it may have pointed to old info, wheres with file:// it may have been regenerated – though I really am not familiar with the code behind it.
In any case, just know that you can also point at git repositories and ZIP download links with platform_packages, so if you upload the framework folder somewhere and point to it in the platformio.ini, the project is 100% distributable to other computers without relying on local paths.