Skip to content

Commit

Permalink
Combine full version information into one const string in source code…
Browse files Browse the repository at this point in the history
… to optimize bootloader size, to make the bootloader for MKR VIDOR 4000 less than 8 KByte in size.
  • Loading branch information
ksmith3036 committed Dec 30, 2020
1 parent fbbb202 commit 7ef581b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions bootloaders/zero/sam_ba_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
#include "board_driver_led.h"
#include <stdlib.h>

const char RomBOOT_Version[] = SAM_BA_VERSION;
// X = Chip Erase, Y = Write Buffer, Z = Checksum Buffer, P = Secure Bit Aware
const char RomBOOT_ExtendedCapabilities[] = "[Arduino:XYZP]";
#define ROMBOOT_EXTENDEDCAPABILITIES "[Arduino:XYZP]"
const char ROMBoot_VersionInformation[] = "v" SAM_BA_VERSION " " ROMBOOT_EXTENDEDCAPABILITIES " " __DATE__ " " __TIME__ "\n\r";

/* Provides one common interface to handle both USART and USB-CDC */
typedef struct
Expand Down Expand Up @@ -485,12 +485,7 @@ static void sam_ba_monitor_loop(void)
}
else if (command == 'V') // Read version information
{
sam_ba_putdata( ptr_monitor_if, "v", 1);
sam_ba_putdata( ptr_monitor_if, (uint8_t *) RomBOOT_Version, strlen(RomBOOT_Version));
sam_ba_putdata( ptr_monitor_if, " ", 1);
sam_ba_putdata( ptr_monitor_if, (uint8_t *) RomBOOT_ExtendedCapabilities, strlen(RomBOOT_ExtendedCapabilities));
ptr = (uint8_t*) &(" " __DATE__ " " __TIME__ "\n\r");
sam_ba_putdata( ptr_monitor_if, ptr, strlen(ptr));
sam_ba_putdata( ptr_monitor_if, ROMBoot_VersionInformation, sizeof(ROMBoot_VersionInformation) - 1);
}
else if (command == 'X') // Erase flash
{
Expand Down

0 comments on commit 7ef581b

Please sign in to comment.