Skip to content

Commit ae22762

Browse files
committed
Combine full version information into one const string in source code to optimize bootloader size, to make the bootloader for MKR VIDOR 4000 less than 8 KByte in size.
1 parent 277a965 commit ae22762

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

bootloaders/zero/sam_ba_monitor.c

+3-8
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
#include "board_driver_led.h"
3030
#include <stdlib.h>
3131

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

3636
/* Provides one common interface to handle both USART and USB-CDC */
3737
typedef struct
@@ -485,12 +485,7 @@ static void sam_ba_monitor_loop(void)
485485
}
486486
else if (command == 'V') // Read version information
487487
{
488-
sam_ba_putdata( ptr_monitor_if, "v", 1);
489-
sam_ba_putdata( ptr_monitor_if, (uint8_t *) RomBOOT_Version, strlen(RomBOOT_Version));
490-
sam_ba_putdata( ptr_monitor_if, " ", 1);
491-
sam_ba_putdata( ptr_monitor_if, (uint8_t *) RomBOOT_ExtendedCapabilities, strlen(RomBOOT_ExtendedCapabilities));
492-
ptr = (uint8_t*) &(" " __DATE__ " " __TIME__ "\n\r");
493-
sam_ba_putdata( ptr_monitor_if, ptr, strlen(ptr));
488+
sam_ba_putdata( ptr_monitor_if, ROMBoot_VersionInformation, sizeof(ROMBoot_VersionInformation) - 1);
494489
}
495490
else if (command == 'X') // Erase flash
496491
{

0 commit comments

Comments
 (0)