From 424fd781611044918e36d751135d56005717a47a Mon Sep 17 00:00:00 2001 From: 0xc0170 Date: Sun, 26 Mar 2017 17:59:40 +0100 Subject: [PATCH] flash: fix flash algo generated - protect with DEVICE_FLASH --- targets/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/flash_api.c | 4 ++++ .../TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/flash_api.c | 4 ++++ .../TARGET_STM32F4/TARGET_STM32F429xI/device/flash_api.c | 4 ++++ .../TARGET_STM32F4/TARGET_STM32F439xI/device/flash_api.c | 4 ++++ .../TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/flash_api.c | 4 ++++ tools/flash_algo/c_blob_mbed.tmpl | 3 +++ 6 files changed, 23 insertions(+) diff --git a/targets/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/flash_api.c b/targets/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/flash_api.c index 8671ad6158..8639eba4a9 100644 --- a/targets/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/flash_api.c +++ b/targets/TARGET_Freescale/TARGET_KLXX/TARGET_KL46Z/flash_api.c @@ -20,6 +20,8 @@ // This file is automagically generated +#if DEVICE_FLASH + // This is a flash algo binary blob. It is PIC (position independent code) that should be stored in RAM static uint32_t FLASH_ALGO[] = { 0xb5104935, 0x60084449, 0x21004834, 0x48356001, 0x44484a33, 0x22016002, 0x04926041, 0x02926082, @@ -99,3 +101,5 @@ void flash_set_target_config(flash_t *obj) obj->flash_algo = &flash_algo_config; obj->target_config = &flash_target_config; } + +#endif diff --git a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/flash_api.c b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/flash_api.c index a7c585515a..d5da4f1afd 100644 --- a/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/flash_api.c +++ b/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/flash_api.c @@ -20,6 +20,8 @@ // This file is automagically generated +#if DEVICE_FLASH + // This is a flash algo binary blob. It is PIC (position independent code) that should be stored in RAM static uint32_t FLASH_ALGO[] = { 0xb5104938, 0x60084449, 0xf24c4837, 0x81c15120, 0x1128f64d, 0x880181c1, 0x0101f021, 0x48348001, @@ -85,3 +87,5 @@ void flash_set_target_config(flash_t *obj) obj->flash_algo = &flash_algo_config; obj->target_config = &flash_target_config; } + +#endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/flash_api.c b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/flash_api.c index b88f51714a..584c0ea989 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/flash_api.c +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F429xI/device/flash_api.c @@ -20,6 +20,8 @@ // This file is automagically generated +#if DEVICE_FLASH + // This is a flash algo binary blob. It is PIC (position independent code) that should be stored in RAM static uint32_t FLASH_ALGO[] = { 0xf3c04601, 0x28203007, 0x2204bf24, 0x1050eb02, 0x2810d205, 0x2203bf26, 0x1010eb02, 0xf4110880, @@ -72,3 +74,5 @@ void flash_set_target_config(flash_t *obj) obj->flash_algo = &flash_algo_config; obj->target_config = &flash_target_config; } + +#endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/flash_api.c b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/flash_api.c index b88f51714a..584c0ea989 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/flash_api.c +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_STM32F439xI/device/flash_api.c @@ -20,6 +20,8 @@ // This file is automagically generated +#if DEVICE_FLASH + // This is a flash algo binary blob. It is PIC (position independent code) that should be stored in RAM static uint32_t FLASH_ALGO[] = { 0xf3c04601, 0x28203007, 0x2204bf24, 0x1050eb02, 0x2810d205, 0x2203bf26, 0x1010eb02, 0xf4110880, @@ -72,3 +74,5 @@ void flash_set_target_config(flash_t *obj) obj->flash_algo = &flash_algo_config; obj->target_config = &flash_target_config; } + +#endif diff --git a/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/flash_api.c b/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/flash_api.c index b88f51714a..584c0ea989 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/flash_api.c +++ b/targets/TARGET_STM/TARGET_STM32F4/TARGET_UBLOX_EVK_ODIN_W2/flash_api.c @@ -20,6 +20,8 @@ // This file is automagically generated +#if DEVICE_FLASH + // This is a flash algo binary blob. It is PIC (position independent code) that should be stored in RAM static uint32_t FLASH_ALGO[] = { 0xf3c04601, 0x28203007, 0x2204bf24, 0x1050eb02, 0x2810d205, 0x2203bf26, 0x1010eb02, 0xf4110880, @@ -72,3 +74,5 @@ void flash_set_target_config(flash_t *obj) obj->flash_algo = &flash_algo_config; obj->target_config = &flash_target_config; } + +#endif diff --git a/tools/flash_algo/c_blob_mbed.tmpl b/tools/flash_algo/c_blob_mbed.tmpl index 32f6af7e1c..52111f1406 100644 --- a/tools/flash_algo/c_blob_mbed.tmpl +++ b/tools/flash_algo/c_blob_mbed.tmpl @@ -20,6 +20,8 @@ // This file is automagically generated +#if DEVICE_FLASH + // This is a flash algo binary blob. It is PIC (position independent code) that should be stored in RAM static uint32_t FLASH_ALGO[] = { {{algo.format_algo_data(4, 8, "c")}} @@ -54,3 +56,4 @@ void flash_set_target_config(flash_t *obj) obj->target_config = &flash_target_config; } +#endif