Skip to content

Commit 92d937d

Browse files
committed
Replace with MBED_NONSECURE_ENTRY for all-toolchain secure gateway functions in flash IAP
1 parent 1b7b94e commit 92d937d

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

hal/TARGET_FLASH_CMSIS_ALGO/flash_common_algo.c

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "flash_api.h"
1818
#include "flash_data.h"
1919
#include "mbed_critical.h"
20+
#include "mbed_toolchain.h"
2021

2122
#ifndef __DOMAIN_NS
2223

@@ -88,26 +89,20 @@ static int32_t flash_algo_uninit(flash_t *obj, uint32_t address, uint32_t functi
8889
return ((flash_algo_jump_t)(((uint32_t)&jump_to_flash_algo) | 1))(&arguments);
8990
}
9091

91-
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
92-
__attribute__((cmse_nonsecure_entry))
93-
#endif
92+
MBED_NONSECURE_ENTRY
9493
int32_t flash_init(flash_t *obj)
9594
{
9695
flash_set_target_config(obj);
9796
return 0;
9897
}
9998

100-
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
101-
__attribute__((cmse_nonsecure_entry))
102-
#endif
99+
MBED_NONSECURE_ENTRY
103100
int32_t flash_free(flash_t *obj)
104101
{
105102
return 0;
106103
}
107104

108-
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
109-
__attribute__((cmse_nonsecure_entry))
110-
#endif
105+
MBED_NONSECURE_ENTRY
111106
int32_t flash_erase_sector(flash_t *obj, uint32_t address)
112107
{
113108
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
@@ -138,9 +133,7 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
138133
return ret ? -1 : 0;
139134
}
140135

141-
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
142-
__attribute__((cmse_nonsecure_entry))
143-
#endif
136+
MBED_NONSECURE_ENTRY
144137
int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size)
145138
{
146139
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
@@ -178,9 +171,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
178171
return ret ? -1 : 0;
179172
}
180173

181-
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
182-
__attribute__((cmse_nonsecure_entry))
183-
#endif
174+
MBED_NONSECURE_ENTRY
184175
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
185176
{
186177
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
@@ -216,9 +207,7 @@ uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
216207
return MBED_FLASH_INVALID_SIZE;
217208
}
218209

219-
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
220-
__attribute__((cmse_nonsecure_entry))
221-
#endif
210+
MBED_NONSECURE_ENTRY
222211
uint32_t flash_get_page_size(const flash_t *obj)
223212
{
224213
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
@@ -230,9 +219,7 @@ uint32_t flash_get_page_size(const flash_t *obj)
230219
return obj->target_config->page_size;
231220
}
232221

233-
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
234-
__attribute__((cmse_nonsecure_entry))
235-
#endif
222+
MBED_NONSECURE_ENTRY
236223
uint32_t flash_get_start_address(const flash_t *obj)
237224
{
238225
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
@@ -244,9 +231,7 @@ uint32_t flash_get_start_address(const flash_t *obj)
244231
return obj->target_config->flash_start;
245232
}
246233

247-
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
248-
__attribute__((cmse_nonsecure_entry))
249-
#endif
234+
MBED_NONSECURE_ENTRY
250235
uint32_t flash_get_size(const flash_t *obj)
251236
{
252237
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)

0 commit comments

Comments
 (0)