cancel
Showing results for 
Search instead for 
Did you mean: 

Patching STM32 FW package before build

OskarMe
Associate II

Hi!

I use STM32CubeIde + FreeRTOS + LWIP and quite often, especially for debugging, I change features through CubeMX. It causes reloading of several files that I would like to patch before build.  Examples are LWIP->tcpip.c or LWIP->cc.h.

I face an issue, that once they are reloaded, I need to apply changes manually. I looked into file templates, but it seems even worse idea to manipulate that. I know I could add my patched templates to the project, but it's some kind of CubeIDE feature I guess and could make it work properly. I'd like to just create a patch file and add "git apply" command to pre-build steps. However, it seems that reloading file from the Repository by CubeMX causes patch to be not relevant to the file since I get error that patch "does not apply". I used "git diff" for patch creation.

Any idea how to patch Repository files before building my application and maintain CubeMX "rebuild" functionality?

 

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

You could run a post-build step that patches them. Pre-build doesn't seem useful.

TDK_0-1738331652620.png

 

If you want to use git to patch, look into why "git apply" is failing. Probably the --reject flag would give the desired result.

Git - git-apply Documentation

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

2 REPLIES 2
TDK
Guru

You could run a post-build step that patches them. Pre-build doesn't seem useful.

TDK_0-1738331652620.png

 

If you want to use git to patch, look into why "git apply" is failing. Probably the --reject flag would give the desired result.

Git - git-apply Documentation

If you feel a post has answered your question, please click "Accept as Solution".
OskarMe
Associate II

Thanks, this is actually what I wanted. Putting a shell script into main folder and running after code generation patches files I needed.