How to force a file to always build?

Discuss how to use the features of Atollic TrueSTUDIO, including the editor, assembler, C/C++ compiler, linker, debugger, static code analysis and team collaboration tools.

Moderators: Markus Girdland, Mattias Norlander

awneil
Posts: 8
Joined: Mon Mar 18, 2019 2:31 pm

How to force a file to always build?

Postby awneil » Mon Mar 18, 2019 2:37 pm

How can I force a particular file to always be compiled for every build - even when it & its dependencies has not been modified ?

I want to do this so that I can have a timestamp of the last build; eg,

Code: Select all

char build_date_str[] = __DATE__;
char build_time_str[] = __TIME__;


IDEs like Keil & IAR have this as a check-box on the file properties

(If I try to search the forum for "always build", it just searches for "always" - and says "build" is ignored!)
:roll:

rdamon
Posts: 10
Joined: Fri Mar 29, 2019 3:28 pm

Re: How to force a file to always build?

Postby rdamon » Fri Mar 29, 2019 4:10 pm

I use a build step to delete the object file output for that file, so it needs to be recompiled to link. For most tools I make it a pre-build step but with Atollic I seem to need to make it a post-build step as it seems that it has already determined what files to build before it runs the pre-build operation. (maybe a function of having enabled parallel builds).

awneil
Posts: 8
Joined: Mon Mar 18, 2019 2:31 pm

Re: How to force a file to always build?

Postby awneil » Mon Apr 01, 2019 10:00 am

I tried that, and it didn't work: it just caused the link to fail, without the source being re-compiled!

I'll have to try it again, and post more details ...

rdamon
Posts: 10
Joined: Fri Mar 29, 2019 3:28 pm

Re: How to force a file to always build?

Postby rdamon » Mon Apr 01, 2019 1:46 pm

As I said, with Atollic, I found I needed it to be a POST build step, so that after linking the object file was removed so it would be regenerated for the next build. When done as a Pre build step, it would alternate working or not, my guess being that the list of files to build were computed before that step completed.

awneil
Posts: 8
Joined: Mon Mar 18, 2019 2:31 pm

Re: How to force a file to always build?

Postby awneil » Mon Apr 01, 2019 2:08 pm

Ah - so you did!

Must read more carefully!

:oops:

I'll give that a go, then...

rdamon
Posts: 10
Joined: Fri Mar 29, 2019 3:28 pm

Re: How to force a file to always build?

Postby rdamon » Mon Apr 01, 2019 4:14 pm

One other nugget that I use is my date string is declared as:

Code: Select all

const char version_date[] = __DATE__ " " __TIME__;

So I have just a single string (using C's automatic string concatenation), and because it is declared const, can be put in flash.

swara31
Posts: 1
Joined: Thu Apr 25, 2019 11:22 am

Re: How to force a file to always build?

Postby swara31 » Thu Apr 25, 2019 12:15 pm

Informative thread..!!!

jconradt
Posts: 4
Joined: Mon May 06, 2019 9:50 am

Re: How to force a file to always build?

Postby jconradt » Mon May 06, 2019 10:10 am

Thank you for those suggestion; unfortunately, such a post-build step also does not work for me.

I have included
rm -rf ../Debug/Src/uart-ShowVersion.*
as POST-build step; and indeed the file vanishes after project build.
(that is the only <file>.o that I found in the project tree.

HOWEVER, when recompiling, I just see the message
Info: Nothing to build for <project name>


so it seems that Atollic does not realize that the object file was deleted.

I don't know why...

As additional test, when I delete the executeable (*.elf) by hand, and press "CTRL-B" to recompile, I see

Info: Internal Builder is used for build
arm-atollic-eabi-gcc -o Servo R2.elf Drivers\CMSIS\Device\ST\STM32L0xx [... lots of files ...]
arm-atollic-eabi-gcc: error: Src\uart-ShowVersion.o: No such file or directory
so indeed, TrueStudio does not notice that the *.o file is missing.

Any suggestions?
I am using an "auto-generated" project from CubeMX.

Thank you!

Jörg

awneil
Posts: 8
Joined: Mon Mar 18, 2019 2:31 pm

Re: How to force a file to always build?

Postby awneil » Mon May 06, 2019 10:44 am

it seems that Atollic does not realize that the object file was deleted


Yes - that's what I saw: viewtopic.php?f=3&t=1771#p4221

jconradt
Posts: 4
Joined: Mon May 06, 2019 9:50 am

Re: How to force a file to always build?

Postby jconradt » Mon May 06, 2019 11:34 am

Strange that after your observation and post, "rdamon" send a message that it has to be a POST command. You did not comment on the success of that anymore.

I have also tried POST-build, but no luck.

Maybe rdamon can be more precise on what (s)he does? Why does his/her project recognize the missing *.o; whereas our project does not?

Awneil, have you created your project through "CubeMX"? Maybe that has causes some incorrect project settings? ...

Jorg


Return to “Atollic TrueSTUDIO tool discussions”

Who is online

Users browsing this forum: No registered users and 6 guests