Application Version

From Nutwiki
Jump to: navigation, search

Test Environments

Ethernut 1.3 H OK
Ethernut 2.1 B OK
Ethernut 3.0 E OK
EIR 1.0 C Set jumper JP1 to DEBUG mode.
Compiler: ARM-GCC 4.2.2 ; AVR-GCC 4.3.0


This example shows an easy and common way to store a string (e.g. for the application version) and printing it out.

Source Code

<source lang="c">

  1. include <dev/board.h>
  2. include <stdio.h>

int main(void) {

   char *version = "1.0";
   u_long baud = 115200;
   NutRegisterDevice(&DEV_DEBUG, 0, 0);
   freopen(DEV_DEBUG_NAME, "w", stdout);
   _ioctl(_fileno(stdout), UART_SETSPEED, &baud);
   printf("Application version: %s\n", version);
   return 0;




Application version: 1.0


<source lang="c"> char *version = "1.0"; </source>

defines a pointer to the type char, which points to an adress in memory where the string "1.0" is stored.

<source lang="c"> printf("Application version: %s\n", version); </source>

now prints out the string stored at the adress, the version pointer provides.Template:Languages