I need to embed a version string into the .xe file for my project.
The string is generated automatically with version and date information and it follows the format
"\0$VER: programname version.revision (dd.mm.yyyy) comment\0"
It can be located anywhere in the file, it is located later by the header \0$VER:
I have tried various combinations of static, const, and used without any luck.
Surely there is a simple way to embed this string into the .xecutable file.
Thanks!
LyleHaze
trouble embedding a string into .xe file
-
- Experienced Member
- Posts: 71
- Joined: Wed Apr 11, 2012 6:21 am
-
- Respected Member
- Posts: 318
- Joined: Tue Dec 15, 2009 12:46 am
The tools normally eliminate unreferenced code / data at link time to reduce the size of the binary, which is probably why the variables you declared didn't appear in the binary. I'd suggest creating an assembly file (e.g. version.S) with the following contents:
This section won't be eliminated by the tools since the data has not be placed in an elimination block using the .cc_top / .cc_bottom directives. The section won't be loaded into memory since the allocatable ('a') flag is not set so it won't consume any memory at runtime (i.e. it will only exist in the .xe file).
Code: Select all
.section .version, "", @progbits
.ascii "\0$VER: programname version.revision (dd.mm.yyyy) comment\0"
-
- Experienced Member
- Posts: 71
- Joined: Wed Apr 11, 2012 6:21 am
Marvelous!
Wonderful!
Various other expletives designating positive thoughts!
Works nicely.
Since most of our projects will have "matching" programs in the computer and the XMOS chip, it is my goal to get them to use the same version headers, so that they will match as the program develops.
I tried something like this:
without luck.. it complained of extra characters after the .ascii directive.
So I wrote a simple C program to read our format and write yours.
Working great.
Thanks very much for your help!
Wonderful!
Various other expletives designating positive thoughts!
Works nicely.
Since most of our projects will have "matching" programs in the computer and the XMOS chip, it is my goal to get them to use the same version headers, so that they will match as the program develops.
I tried something like this:
Code: Select all
// project_rev.h
#define VERSION 53
#define REVISION 2
#define DATE "13.8.2014"
#define VERS "X-Logger 53.2"
#define VSTRING "X-Logger 53.2 (13.8.2014)\r\n"
#define VERSTAG "\0$VER: X-Logger 53.2 (13.8.2014)"
Code: Select all
#include "project_rev.h"
.section .version, "", @progbits
.ascii VERSTAG
So I wrote a simple C program to read our format and write yours.
Working great.
Thanks very much for your help!