5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
25 #define DEFNUMSTR(s) STR2(s)
27 #define EEPROM_STR DEFNUMSTR(EEPROM_VER);
30 #define TAB "\037\075"
32 #define TAB "\037\033"
35 #if defined(FRSKY_RELEASE)
36 #define DISPLAY_VERSION "FrSky"
37 #elif defined(JUMPER_RELEASE)
38 #define DISPLAY_VERSION "JumperRC"
40 #define DISPLAY_VERSION VERSION
44 const char vers_stamp
[] = "VERS" TAB
": " "opentx-" FLAVOUR
"-" DISPLAY_VERSION
" (" GIT_STR
")";
45 const char date_stamp
[] = "DATE" TAB
": " DATE
;
46 const char time_stamp
[] = "TIME" TAB
": " TIME
;
47 const char eeprom_stamp
[] = "EEPR" TAB
": " EEPROM_STR
;
48 #elif defined(BOARD_NAME)
49 const char vers_stamp
[] = "FW" TAB
": opentx-" BOARD_NAME
"\036VERS" TAB
": " DISPLAY_VERSION
" (" GIT_STR
")" "\036DATE" TAB
": " DATE
" " TIME
"\036EEPR" TAB
": " EEPROM_STR
;
51 const char vers_stamp
[] = "FW" TAB
": opentx-" FLAVOUR
"\036VERS" TAB
": " DISPLAY_VERSION
" (" GIT_STR
")" "\036DATE" TAB
": " DATE
" " TIME
"\036EEPR" TAB
": " EEPROM_STR
;
55 * Retrieves the version of the bootloader or firmware
58 #if defined(STM32) && !defined(SIMU)
60 __SECTION_USED(".fwversiondata") const char firmware_version
[] = "opentx-" FLAVOUR
"-" DISPLAY_VERSION
" (" GIT_STR
")";
61 __SECTION_USED(".bootversiondata") const char boot_version
[] = "opentx-" FLAVOUR
"-" DISPLAY_VERSION
" (" GIT_STR
")";
64 * Tries to find opentx version in the first 1024 byte of either firmware/bootloader (the one not running) or the buffer
65 * @param buffer If non-null find the firmware version in the buffer instead
67 const char * getOtherVersion(char* buffer
)
70 const char * startother
= (char*)(FIRMWARE_ADDRESS
+BOOTLOADER_SIZE
);
72 const char * startother
= (char*)(FIRMWARE_ADDRESS
);
74 if (buffer
!= nullptr)
77 const char * other_str
= nullptr;
78 for (int i
=0; i
<1024;i
++) {
79 if (memcmp(startother
+i
, "opentx-", 7) == 0) {
80 other_str
= startother
+ i
;
85 if (other_str
!= nullptr)
88 return "no version found";