Skip to content

Commit 7a7b634

Browse files
committed
Refine code with MBED_NONSECURE_ENTRY in flash IAP
1 parent 00147b5 commit 7a7b634

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

hal/TARGET_FLASH_CMSIS_ALGO/flash_common_algo.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,18 @@ static int32_t flash_check_nonsecure(flash_t *obj, uint32_t start_addr, uint32_t
123123
}
124124
#endif
125125

126-
MBED_NONSECURE_ENTRY
127-
int32_t flash_init(flash_t *obj)
126+
MBED_NONSECURE_ENTRY int32_t flash_init(flash_t *obj)
128127
{
129128
flash_set_target_config(obj);
130129
return 0;
131130
}
132131

133-
MBED_NONSECURE_ENTRY
134-
int32_t flash_free(flash_t *obj)
132+
MBED_NONSECURE_ENTRY int32_t flash_free(flash_t *obj)
135133
{
136134
return 0;
137135
}
138136

139-
MBED_NONSECURE_ENTRY
140-
int32_t flash_erase_sector(flash_t *obj, uint32_t address)
137+
MBED_NONSECURE_ENTRY int32_t flash_erase_sector(flash_t *obj, uint32_t address)
141138
{
142139
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
143140
if (cmse_nonsecure_caller()) {
@@ -166,8 +163,7 @@ int32_t flash_erase_sector(flash_t *obj, uint32_t address)
166163
return ret ? -1 : 0;
167164
}
168165

169-
MBED_NONSECURE_ENTRY
170-
int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size)
166+
MBED_NONSECURE_ENTRY int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data, uint32_t size)
171167
{
172168
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
173169
if (cmse_nonsecure_caller()) {
@@ -196,8 +192,7 @@ int32_t flash_program_page(flash_t *obj, uint32_t address, const uint8_t *data,
196192
return ret ? -1 : 0;
197193
}
198194

199-
MBED_NONSECURE_ENTRY
200-
uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
195+
MBED_NONSECURE_ENTRY uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
201196
{
202197
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
203198
if (cmse_nonsecure_caller()) {
@@ -232,8 +227,7 @@ uint32_t flash_get_sector_size(const flash_t *obj, uint32_t address)
232227
return MBED_FLASH_INVALID_SIZE;
233228
}
234229

235-
MBED_NONSECURE_ENTRY
236-
uint32_t flash_get_page_size(const flash_t *obj)
230+
MBED_NONSECURE_ENTRY uint32_t flash_get_page_size(const flash_t *obj)
237231
{
238232
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
239233
if (cmse_nonsecure_caller()) {
@@ -244,8 +238,7 @@ uint32_t flash_get_page_size(const flash_t *obj)
244238
return obj->target_config->page_size;
245239
}
246240

247-
MBED_NONSECURE_ENTRY
248-
uint32_t flash_get_start_address(const flash_t *obj)
241+
MBED_NONSECURE_ENTRY uint32_t flash_get_start_address(const flash_t *obj)
249242
{
250243
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
251244
if (cmse_nonsecure_caller()) {
@@ -256,8 +249,7 @@ uint32_t flash_get_start_address(const flash_t *obj)
256249
return obj->target_config->flash_start;
257250
}
258251

259-
MBED_NONSECURE_ENTRY
260-
uint32_t flash_get_size(const flash_t *obj)
252+
MBED_NONSECURE_ENTRY uint32_t flash_get_size(const flash_t *obj)
261253
{
262254
#if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3U)
263255
if (cmse_nonsecure_caller()) {

0 commit comments

Comments
 (0)