forked from micropython/micropython
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stm32/mboot: Add mboot version string.
Adds a configurable version string to a known location at the end of mboot flash section. Also stores options mboot was built with. Signed-off-by: Victor Rajewski <victor@allumeenergy.com.au>
- Loading branch information
1 parent
406bccc
commit 7309e7b
Showing
5 changed files
with
124 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#include "mboot.h" | ||
#include "genhdr/mpversion.h" | ||
|
||
#ifdef MBOOT_VERSION_ALLOCATED_BYTES | ||
|
||
#ifndef MBOOT_VERSION | ||
#define MBOOT_VERSION "mboot-" MICROPY_GIT_TAG | ||
#endif | ||
|
||
#if MBOOT_VERSION_INCLUDE_OPTIONS // if this is defined, append a list of build options e.g. fat.lfs2 | ||
#define MBOOT_VERSION_USB MBOOT_VERSION "+usb" // USB is always included | ||
|
||
#if defined(MBOOT_I2C_SCL) | ||
#define MBOOT_VERSION_I2C MBOOT_VERSION_USB ".i2c" | ||
#else | ||
#define MBOOT_VERSION_I2C MBOOT_VERSION_USB | ||
#endif | ||
|
||
#if MBOOT_ADDRESS_SPACE_64BIT | ||
#define MBOOT_VERSION_64BIT MBOOT_VERSION_I2C ".64" | ||
#else | ||
#define MBOOT_VERSION_64BIT MBOOT_VERSION_I2C | ||
#endif | ||
|
||
#if MBOOT_VFS_FAT | ||
#define MBOOT_VERSION_FAT MBOOT_VERSION_64BIT ".fat" | ||
#else | ||
#define MBOOT_VERSION_FAT MBOOT_VERSION_64BIT | ||
#endif | ||
|
||
#if MBOOT_VFS_LFS1 | ||
#define MBOOT_VERSION_LFS1 MBOOT_VERSION_FAT ".lfs1" | ||
#else | ||
#define MBOOT_VERSION_LFS1 MBOOT_VERSION_FAT | ||
#endif | ||
|
||
#if MBOOT_VFS_LFS2 | ||
#define MBOOT_VERSION_LFS2 MBOOT_VERSION_LFS1 ".lfs2" | ||
#else | ||
#define MBOOT_VERSION_LFS2 MBOOT_VERSION_LFS1 | ||
#endif | ||
|
||
#if MBOOT_VFS_RAW | ||
#define MBOOT_VERSION_RAW MBOOT_VERSION_LFS2 ".raw" | ||
#else | ||
#define MBOOT_VERSION_RAW MBOOT_VERSION_LFS2 | ||
#endif | ||
|
||
#define MBOOT_VERSION_FINAL MBOOT_VERSION_RAW | ||
|
||
#else // MBOOT_VERSION_INCLUDE_OPTIONS | ||
|
||
#define MBOOT_VERSION_FINAL MBOOT_VERSION | ||
|
||
#endif // MBOOT_VERSION_INCLUDE_OPTIONS | ||
|
||
// Ensure we don't overrun the allocated space | ||
_Static_assert(sizeof(MBOOT_VERSION_FINAL) <= MBOOT_VERSION_ALLOCATED_BYTES + 1, "mboot version string is too long"); | ||
// Cuts off the null terminator | ||
const char mboot_version[sizeof(MBOOT_VERSION_FINAL) - 1] __attribute__((section(".mboot_version"))) __attribute__ ((__used__)) = MBOOT_VERSION_FINAL; | ||
|
||
#endif // MBOOT_VERSION |