This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Problem about using multi-target in a projrct

Hi,
I found a problem using multi-target in a project.

If I create 2 targets,and
1. in [Options for Target 'Target 1'] define APP1 in preprocessor symbols
2. in [Options for Target 'Target 2'] define APP2 in preprocessor symbols

and there is a c file in the project like:

version.c

#ifdef APP1
    const uint8_t Version[]="00000001";
#elif defined APP2
    const uint8_t Version[]="00000002";
#endif

Now if I build target1, and switch to target 2,then build this target using 'Bulid(F7)',the version.c will not be rebuild. So in the output HEX file, I can see the data of 'Version' is still "00000001".

After that I found if I use 'Rebuild' command,the output HEX file will be updated. But rebuild all takes too much time.

Is it a bug or not?

Parents
  • Now if I build target1, and switch to target 2,then build this target using 'Bulid(F7)',the version.c will not be rebuild.

    That indicates you didn't really put enough work into defining those two targets as separate entities. Most importantly, you really should not have them configured to be using the same folder for their object files. I.e. you should have two "version.obj" files, in different places, so one cannot accidentally be mistaken for the other.

Reply
  • Now if I build target1, and switch to target 2,then build this target using 'Bulid(F7)',the version.c will not be rebuild.

    That indicates you didn't really put enough work into defining those two targets as separate entities. Most importantly, you really should not have them configured to be using the same folder for their object files. I.e. you should have two "version.obj" files, in different places, so one cannot accidentally be mistaken for the other.

Children