Bootloader cosmetics

This commit is contained in:
Bertrand Songis
2020-06-13 14:59:13 +02:00
parent 18461a3b28
commit 24cd7611cf
10 changed files with 64 additions and 67 deletions
+11 -17
View File
@@ -60,35 +60,29 @@
* @return
*/
#if defined(STM32) && !defined(SIMU)
__SECTION_USED(".fwversiondata") const char firmware_version[] = "opentx-" FLAVOUR "-" DISPLAY_VERSION " (" GIT_STR ")";
__SECTION_USED(".bootversiondata") const char boot_version[] = "opentx-" FLAVOUR "-" DISPLAY_VERSION " (" GIT_STR ")";
__SECTION_USED(".fwversiondata") const char firmware_version[] = "opentx-" FLAVOUR "-" VERSION DISPLAY_VERSION " (" GIT_STR ")";
__SECTION_USED(".bootversiondata") const char boot_version[] = "opentx-" FLAVOUR "-" VERSION DISPLAY_VERSION " (" GIT_STR ")";
/**
* Tries to find opentx version in the first 1024 byte of either firmware/bootloader (the one not running) or the buffer
* @param buffer If non-null find the firmware version in the buffer instead
*/
const char * getOtherVersion(char* buffer)
const char * getFirmwareVersion(const char * buffer)
{
if (buffer == nullptr) {
#if defined(BOOT)
const char * startother = (char*)(FIRMWARE_ADDRESS+BOOTLOADER_SIZE);
buffer = (const char *)(FIRMWARE_ADDRESS + BOOTLOADER_SIZE);
#else
const char * startother = (char*)(FIRMWARE_ADDRESS);
buffer = (const char *)FIRMWARE_ADDRESS;
#endif
if (buffer != nullptr)
startother = buffer;
}
const char * other_str = nullptr;
for (int i=0; i<1024;i++) {
if (memcmp(startother+i, "opentx-", 7) == 0) {
other_str = startother + i;
break;
for (int i = 0; i < 1024; i++) {
if (memcmp(buffer + i, "opentx-", 7) == 0) {
return buffer + i;
}
}
if (other_str != nullptr)
return other_str;
else
return "no version found";
return "no version found";
}
#endif