Hello,
I am trying to implement some auto-versioning so that I don't have to manually check I am staying up to date with my software versions. To do this, I figured I would dynamically set a preprocessor macro with the current date and time.
In SmartSnippets, I can go to settings, C/C++ Build->Cross ARM C Compiler-> Preprocessor settings, then Defined symbols (-D) to add what I want. My exact syntax here is: BLACKORCA_SW_VERSION="\"C$(date +"%Y.%m.%d.%H.%M")\"" with the intention that "date" calls the shell command to get the current date and is subsequently formatted how I want. I also want the "C" prefix.
I have tested this syntax with gcc locally, and it works great. When I try to skirt around SmartSnippets and call "make" manually from a terminal (invoking the proper cross compiler instead of gcc) and from the project build folder, I can see the output of this correctly resolves to the current date and time. But, when I go through SmartSnippets and my Build Configuration, the macro is properly recognized to be defined (no compiler errors), but when I flash my board (I have a dev board and a custom board), the macro ends up being resolved to "C" only, and the rest of the string does not show up.
I know this is a super specific request, but if the macro resolves correctly for me when locally using gcc, and when using arm-none-eabi-gcc while manually calling make from a terminal, then there might be something SmartSnippets/Eclipse related that I need help with.
Any advice? If there is an easier way to implement this auto-versioning, please do let me know. Thanks.
仅仅是
Hi Merigh,
Thanks for your question online. Let me check it and I’ll get back to you.
Thanks, PM_Dialog
Hi again,
Another option may be to use the Pre-build steps in the Smart Snippets Project Settings. Currently this field is populated with the "Generate linker scripts" command(s). Is there an easy way to simply add a pre-build step? Or do I simply append text in the little box? Then, I can modify my sw_version.h file no problem from there. I think.
Thanks for any help,
M
Another update,
Adding raw text in the Pre-Build steps works great. Now I have another related question:
Does Dialog's SUOTA 1.1 specification require that the version string be 16 characters long? Or can I make it 18, for example? That is because I want CYYYY.MM.DD.HH.mm format.
Thanks, M