diff --git a/features/storage/kvstore/conf/kv_config.cpp b/features/storage/kvstore/conf/kv_config.cpp index 4f68173a753..88ee611a85a 100644 --- a/features/storage/kvstore/conf/kv_config.cpp +++ b/features/storage/kvstore/conf/kv_config.cpp @@ -51,7 +51,7 @@ #include "components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h" #if (STATIC_PINMAP_READY) -constexpr spi_pinmap_t static_spi_pinmap = get_spi_pinmap(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, NC); +const spi_pinmap_t static_spi_pinmap = get_spi_pinmap(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, NC); #endif #endif diff --git a/features/storage/system_storage/SystemStorage.cpp b/features/storage/system_storage/SystemStorage.cpp index 49adaf3a256..4499f8e2648 100644 --- a/features/storage/system_storage/SystemStorage.cpp +++ b/features/storage/system_storage/SystemStorage.cpp @@ -41,7 +41,7 @@ #include "components/storage/blockdevice/COMPONENT_SD/SDBlockDevice.h" #if (STATIC_PINMAP_READY) -constexpr spi_pinmap_t static_spi_pinmap = get_spi_pinmap(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, NC); +const spi_pinmap_t static_spi_pinmap = get_spi_pinmap(MBED_CONF_SD_SPI_MOSI, MBED_CONF_SD_SPI_MISO, MBED_CONF_SD_SPI_CLK, NC); #endif #endif diff --git a/tools/toolchains/mbed_toolchain.py b/tools/toolchains/mbed_toolchain.py index bf2718428fe..2c8f216ed43 100755 --- a/tools/toolchains/mbed_toolchain.py +++ b/tools/toolchains/mbed_toolchain.py @@ -899,51 +899,63 @@ def add_regions(self): return if self.config.has_regions: - regions = list(self.config.regions) - regions.sort(key=lambda x: x.start) - self.notify.info("Using ROM region%s %s in this build." % ( - "s" if len(regions) > 1 else "", - ", ".join(r.name for r in regions) - )) - self._add_all_regions(regions, "MBED_APP") + try: + regions = list(self.config.regions) + regions.sort(key=lambda x: x.start) + self.notify.info("Using ROM region%s %s in this build." % ( + "s" if len(regions) > 1 else "", + ", ".join(r.name for r in regions) + )) + self._add_all_regions(regions, "MBED_APP") + except ConfigException as error: + self.notify.info("Configuration error: %s" % str(error)) if self.config.has_ram_regions: - regions = list(self.config.ram_regions) - self.notify.info("Using RAM region%s %s in this build." % ( - "s" if len(regions) > 1 else "", - ", ".join(r.name for r in regions) - )) - self._add_all_regions(regions, None) + try: + regions = list(self.config.ram_regions) + self.notify.info("Using RAM region%s %s in this build." % ( + "s" if len(regions) > 1 else "", + ", ".join(r.name for r in regions) + )) + self._add_all_regions(regions, None) + except ConfigException as error: + self.notify.info("Configuration error: %s" % str(error)) Region = namedtuple("Region", "name start size") - - # Add all available ROM regions to build profile if not getattr(self.target, "static_memory_defines", False): - raise ConfigException() - rom_available_regions = self.config.get_all_active_memories( - ROM_ALL_MEMORIES - ) - for key, value in rom_available_regions.items(): - rom_start, rom_size = value - self._add_defines_from_region( - Region("MBED_" + key, rom_start, rom_size), - True, - suffixes=["_START", "_SIZE"] + self.notify.info("Configuration error: 'static_memory_defines' is not defined.") + return + + try: + # Add all available ROM regions to build profile + rom_available_regions = self.config.get_all_active_memories( + ROM_ALL_MEMORIES ) - # Add all available RAM regions to build profile - if not getattr(self.target, "static_memory_defines", False): - raise ConfigException() - ram_available_regions = self.config.get_all_active_memories( - RAM_ALL_MEMORIES - ) - for key, value in ram_available_regions.items(): - ram_start, ram_size = value - self._add_defines_from_region( - Region("MBED_" + key, ram_start, ram_size), - True, - suffixes=["_START", "_SIZE"] + for key, value in rom_available_regions.items(): + rom_start, rom_size = value + self._add_defines_from_region( + Region("MBED_" + key, rom_start, rom_size), + True, + suffixes=["_START", "_SIZE"] + ) + except ConfigException as error: + self.notify.info("Configuration error: %s" % str(error)) + + try: + # Add all available RAM regions to build profile + ram_available_regions = self.config.get_all_active_memories( + RAM_ALL_MEMORIES ) + for key, value in ram_available_regions.items(): + ram_start, ram_size = value + self._add_defines_from_region( + Region("MBED_" + key, ram_start, ram_size), + True, + suffixes=["_START", "_SIZE"] + ) + except ConfigException as error: + self.notify.info("Configuration error: %s" % str(error)) STACK_PARAM = "target.boot-stack-size" TFM_LVL_PARAM = "tfm.level"