From 627d47f1395c3701a4d9ed4099a917b628febbc9 Mon Sep 17 00:00:00 2001 From: Ben Lye Date: Fri, 30 Oct 2020 11:21:39 +0000 Subject: [PATCH] C8 MCU flash size check (#461) --- Multiprotocol/Multiprotocol.h | 9 +++++++++ Multiprotocol/Multiprotocol.ino | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Multiprotocol/Multiprotocol.h b/Multiprotocol/Multiprotocol.h index a5dd1ff..83c4e33 100644 --- a/Multiprotocol/Multiprotocol.h +++ b/Multiprotocol/Multiprotocol.h @@ -732,6 +732,15 @@ enum { #define DSM_RX_EEPROM_OFFSET 877 // (4) TX ID + format, 5 bytes, end is 882 //#define CONFIG_EEPROM_OFFSET 882 // Current configuration of the multimodule +/* STM32 Flash Size */ +#ifndef DISABLE_FLASH_SIZE_CHECK + #ifdef MCU_STM32F103C8 + #define MCU_EXPECTED_FLASH_SIZE 64 // STM32F103C8 has 64KB of flash space + #else + #define MCU_EXPECTED_FLASH_SIZE 128 // STM32F103CB has 128KB of flash space + #endif +#endif + //**************************************** //*** MULTI protocol serial definition *** //**************************************** diff --git a/Multiprotocol/Multiprotocol.ino b/Multiprotocol/Multiprotocol.ino index 759774f..c3bf2af 100644 --- a/Multiprotocol/Multiprotocol.ino +++ b/Multiprotocol/Multiprotocol.ino @@ -374,7 +374,7 @@ void setup() #ifndef DISABLE_FLASH_SIZE_CHECK unsigned short *flashSize = (unsigned short *) (0x1FFFF7E0);// Address register debugln("Module Flash size: %dKB",(int)(*flashSize & 0xffff)); - if((int)(*flashSize & 0xffff) < 128) // Not supported by this project + if((int)(*flashSize & 0xffff) < MCU_EXPECTED_FLASH_SIZE) // Not supported by this project while (true) { //SOS for(uint8_t i=0; i<3;i++) {