Tweakable Framework for nucleo-H743zi2 board

Hello,
I would like to tweak framework-arduinostm32 per project basis for nucleo-h743zi2 board. Main problem is I would like to use LwIP ethernet stack on an h7 and it is already problematic in stm32cubeide because of mpu configuration and linker script modification. The problem is also in the buggy ethernet drivers that I would like also be able to tweak.

I would like somehow be able to experiment in specific project on the actual stm32h7 driver and arduino files, so they are decoupled more or less from the .platformio folder. This way it would be simpler to maintain them independently of platformio registry. Because otherwise in case of some platform-ststm32 update all the work is gone. My local framework changes should stay untouched.

My naive and hacky solution by now is to use following functions in platformio.ini:

[platformio]
packages_dir = packages/

[env:nucleo_h743zi]
platform = ststm32
board = nucleo_h743zi
framework = arduino
platform_packages =
    framework-arduinoststm32 @ file://packages/framework-arduinoststm32

(the framework files are copied from .platformio/packages to a local project folder called packages/)

problem is that now I could accidentally overwrite framework files with an update of platform-ststm32 files, although I specified it in platform_packages. Other problem that arise if I comment out packages_dir is, that the framework files from packages dir are copied only the first time I compile the project to .platformio/packages dir. Second time I compile the project it takes automatically files from .platformio/packages/framework-arduinostm32 dir and not from local project directory called packages/

Is it a right way? Or should I dig deeper and tweak board and platform files?

With regards
Ivan

Source the framework-arduinoststm32 from a different directory as to where your packages_dir live, this is safe.

Yes, I agree. This way it is safe, but from what I have so far observed the copying from folder defined in platform_packages is happening once. Only if the .platformio/packages don’t have the same folder yet. If I then change files locally (in folder defined in platform_packages) it is not recopying. How to force to do it always?