cancel
Showing results for 
Search instead for 
Did you mean: 

[solved] CubeIDE: using __date__/__time__ macros & force rebuild of files using them

RAltm
Senior

Hello,

I'm using the __date__/__time__ macros. Their values are only updated if the file using them is re-compiled. Cleaning up before building forces the values to be updated, but this is not feasible on bigger projects.

Is there a way to tell CubeIDE that a specific file always has to be rebuild? I only found solutions for makefiles, but CubeIDE is not using makefiles.

Regards

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

You can add a pre-build step in the C/C++ Build Settings. The pre-build step can be any command like touch or a shell script generating a version file etc..

View solution in original post

10 REPLIES 10
Pavel A.
Evangelist III

>  but CubeIDE is not using makefiles

Nevertheless if you touch a source file, eclipse usually recompiles it.

-- pa

KnarfB
Principal III

You can add a pre-build step in the C/C++ Build Settings. The pre-build step can be any command like touch or a shell script generating a version file etc..

RAltm
Senior

Hello Pavel & KnarfB,

okay, I'll check those ways. I'll have to figure out if Windows has a function similar to the touch command on Linux.

Thank you.

Regards

Hi RAltm,

copy/b test.txt +,,

does the trick in Windows. A real "touch" comes with the STM32CubeIDE plugins like:

C:\ST\STM32CubeIDE\STM32CubeIDE\plugins\com.st.stm32cube.ide.mcu.externaltools.make.win32_1.5.0.202011040924\tools\bin\busybox.exe touch test.txt

Your path may vary

hth

KnarfB

Actually much easier. Just make a small change in the file, undo, save. Or, delete corresponding object files.

-- pa

Well, I dont think so. For production builds, I would avoid any additional human action in favor of automatted tooling.

For production you would prefer full clean rebuild which will rebuild everything.

Actually quite easy to forget in the middle of debugging a rather tricky problem.

You are quite right.  Production builds should be done with a clean and full build.  It's surprising how many little problems can sneak through the IDE's checks which only bring up an error with a full build.