Determine Nut/OS Version

From Nutwiki
Revision as of 12:53, 2 August 2010 by AdrianPyka (Talk) (Test Environments)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Test Environments

Hardware Comments Nut/OS
4.6.3
Nut/OS
4.6.4
Nut/OS
4.7.4
Nut/OS
4.8.0
Nut/OS
4.8.7
Ethernut 1.3 H OK OK
Binaries
OK
Binaries
OK
Binaries
OK
Binaries
Compiler: AVR-GCC 4.3.2
Ethernut 2.1 B OK OK
Binaries
OK
Binaries
OK
Binaries
OK
Binaries
Compiler: AVR-GCC 4.3.2
Ethernut 3.0 E OK OK
Binaries
OK
Binaries
OK
Binaries
OK
Binaries
Compiler: ARM-GCC 4.3.3
EIR 1.0 C Set jumper JP1 to DEBUG mode. OK OK
Binaries
OK
Binaries
OK
Binaries
Compiler: ARM-GCC 4.2.2 ; AVR-GCC 4.3.0

Description

This example demonstrates how to obtain the Nut/OS version, an application was built with.

Source Code

<source lang="c">

  1. include <dev/board.h>
  2. include <sys/version.h>
  3. include <stdio.h>

int main(void) {

   u_long baud = 115200;
   NutRegisterDevice(&DEV_DEBUG, 0, 0);
   freopen(DEV_DEBUG_NAME, "w", stdout);
   _ioctl(_fileno(stdout), UART_SETSPEED, &baud);
   printf("Nut/OS version: %s\n", NutVersionString());
   for(;;);
   return 0;

}

</source>

Output

Nut/OS version: 4.6.4.0

Details

<source lang="c">

  1. include <sys/version.h>

</source> <source lang="c"> printf("Nut/OS version: %s\n", NutVersionString()); </source> Nut/OS provides the function NutVersionString(), which returns the Nut/OS version. The sys/version.h header file is required to use this function.

See also