Determine Nut/OS Version
From Nutwiki
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">
- include <dev/board.h>
- include <sys/version.h>
- 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">
- 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.