From c6a2e996503bbdb74dbcfe50949391fad61a9d2c Mon Sep 17 00:00:00 2001 From: Johny Mattsson Date: Mon, 30 Aug 2021 16:51:48 +1000 Subject: [PATCH] Make LFS flash sig config specific. Loading an LFS from a different int/float combo build is bad, so let's not allow it in the first place. --- components/lua/lua-5.3/lundump.h | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/components/lua/lua-5.3/lundump.h b/components/lua/lua-5.3/lundump.h index 26eff4fe..3689f3b5 100644 --- a/components/lua/lua-5.3/lundump.h +++ b/components/lua/lua-5.3/lundump.h @@ -79,16 +79,21 @@ extern void *LFSregion; LUAI_FUNC void luaN_setabsolute(lu_int32 addr); #endif -#define FLASH_FORMAT_VERSION ( 2 << 8) -#define FLASH_SIG_B1 0x06 -#define FLASH_SIG_B2 0x02 -#define FLASH_SIG_PASS2 0x0F -#define FLASH_FORMAT_MASK 0xF00 -#define FLASH_SIG_B2_MASK 0x04 -#define FLASH_SIG_ABSOLUTE 0x01 -#define FLASH_SIG_IN_PROGRESS 0x08 -#define FLASH_SIG (0xfafaa050 | FLASH_FORMAT_VERSION) -#define FLASH_FORMAT_MASK 0xF00 +#define FLASH_FORMAT_VERSION ( 2 << 8) + +#if defined(CONFIG_LUA_NUMBER_INT64) +# define FLASH_SIG_B1 0x01 +#else +# define FLASH_SIG_B1 0x00 +#endif + +#if defined(CONFIG_LUA_NUMBER_DOUBLE) +# define FLASH_SIG_B2 0x02 +#else +# define FLASH_SIG_B2 0x00 +#endif + +#define FLASH_SIG (0xfafaa050 | FLASH_FORMAT_VERSION | FLASH_SIG_B1 | FLASH_SIG_B2) #endif