Programmatic check of Netburner version number?

Discussion to talk about software related topics only.
Post Reply
RFneff
Posts: 4
Joined: Mon Nov 25, 2013 12:09 pm

Programmatic check of Netburner version number?

Post by RFneff »

I was hoping, but cannot find, a way to check the version of Netburner tools being used from inside our project code? I see that there's the file /nburn/release_tag, but that's a text file outside of the project.

For our purposes, we wanted to add a #warn compiler directive, in case somebody downloads the wrong version of the tools, or is new to Netburner and doesn't realize that whatever is in C:\nburn is the version used for compiling, regardless of what was last installed or where your project lives.

We're using SVN, and we probably can tie our code changes to a specific nburn release using the SVN "externals" property, but it's more foolproof to build it into the code.
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: Programmatic check of Netburner version number?

Post by pbreed »

const char * GetReleaseTag();

Does what you want .
Its in the header #include <system.h>

This will get you the first line of the release tag file...

PAul
User avatar
tod
Posts: 587
Joined: Sat Apr 26, 2008 8:27 am
Location: Southern California
Contact:

Re: Programmatic check of Netburner version number?

Post by tod »

You could also make the check part of the Eclipse build process. One way would be to add a Pre-build step (Project Properties->C/C++Build->Settings then select the Build Steps tab). You could invoke a simple bat file from here, let's call it condCompile.bat and put it in the same location as the release_tag file. In the Command: text box of the pre-build step you would have

Code: Select all

${NBROOT}\condCompile.bat
Then condCompile.bat could be:

Code: Select all

@findstr "Rel_2_6_0" c:\nburn\release_tag
@IF ERRORLEVEL == 1 (
  @echo "Invalid NNDK- Compilation halted."
  @exit
)
If the NNDK isn't 2.6.0 then the users sees the "Invalid NNDK - Compilation halted" message in the console. Otherwise it just builds. I'm not even sure why @exit works here, the docs state the build will continue regardless of the result of the pre build step but I just tested it and it works.

Actually if you wanted to just keep people from downloading and installing an invalid NNDK just putting an empty .bat file in the nburn directory and invoking it from the command line would work. If the .bat file is missing the build process stops. Of course in that case you just get a somefilename.bat Launching Failed error message.
I wish you had asked this sooner, I could have added this little trick to part 2 of my Eclipse course.
RFneff
Posts: 4
Joined: Mon Nov 25, 2013 12:09 pm

Re: Programmatic check of Netburner version number?

Post by RFneff »

Thanks guys. Those both look like good suggestions :)
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Programmatic check of Netburner version number?

Post by sblair »

I'm in the midst of migrating from NNDK 2.6.7 to 2.7.0 and am finding there are a LOT of places where changes in the libs are biting me and I need to do a conditional compile of my code based on what NNDK it is being compiled under to handle the library changes.

GetVersionTag(); is a runtime call. Is there a #define somewhere that will give me the NNDK version so I can do a proper conditional compile?

I've got multiple developers in different countries and an automated build system involved so I need to be able to do something as easy as a #ifdef without depending on any custom Eclipse config.

Thanks.
Scott
roland.ames

Re: Programmatic check of Netburner version number?

Post by roland.ames »

sblair wrote:I'm in the midst of migrating from NNDK 2.6.7 to 2.7.0 and am finding there are a LOT of places where changes in the libs are biting me and I need to do a conditional compile of my code based on what NNDK it is being compiled under to handle the library changes.

GetVersionTag(); is a runtime call. Is there a #define somewhere that will give me the NNDK version so I can do a proper conditional compile?

I've got multiple developers in different countries and an automated build system involved so I need to be able to do something as easy as a #ifdef without depending on any custom Eclipse config.

Thanks.
Scott
there are some #defines at the end of nburn\include\predef.h that seem to be intended to serve this purpose, but they haven't been changed since rel22_rc2!!.
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Programmatic check of Netburner version number?

Post by sblair »

Yeah that's what I'm looking for but unfortunately useless since those aren't being maintained.

Anyone from Netburner? Are there current NNDK #defines somewhere?

Thanks.
Scott
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: Programmatic check of Netburner version number?

Post by pbreed »

I just fixed this and put the following in predef.h....

#define NB_VERSION_2_7
#define NB_MINOR_VERSION (7)
#define NB_VERSION_TEXT "2.7"

Do the same and it should track...
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Programmatic check of Netburner version number?

Post by sblair »

That will help going forward, but what about tracking between 2.7.1 and let's say 2.7.4?

There often seem to be changes made in the Patch (Major.Minor.Patch) releases that could be critical to differentiate between too as there seem to be reasonably impactful changes that can happen in those as well.

For example this is one of the fun changes I'm finding right now I have to track below. It would be considered a rather insignificant change, but since I have to hook to it I have to be able to handle the change regardless of which NNDK is building it since I've got multiple guys spread out geographically and a central build system it all feeds into.

#ifdef NNDK_2_6_7
sim2.fec[0] .smacl0 = 0x0013B210;
sim2.fec[0] .smacu0 = 0xFFFF0000;
#else
sim2.fec[0] .smac[0].l = 0x0013B210;
sim2.fec[0] .smac[0].u = 0xFFFF0000;
#endif

Thanks.
Scott
Post Reply