mirror of
https://github.com/cesanta/mongoose.git
synced 2024-11-27 12:49:01 +08:00
commit
67e17d3bc3
@ -6118,9 +6118,10 @@ MG_IRAM static bool flash_page_start(volatile uint32_t *dst) {
|
||||
if ((p - base) % (16 * 1024 * flash_config) == 0) return true;
|
||||
} else if (p == base + 16 * 1024 * 4 * flash_config) {
|
||||
return true;
|
||||
} else if ((p - base) % (128 * 1024 * flash_config) == 0)
|
||||
} else if ((p - base) % (128 * 1024 * flash_config) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -6166,7 +6167,7 @@ MG_IRAM static void flash_clear_err(void) {
|
||||
MG_REG(MG_FLASH_BASE + MG_FLASH_SR) = 0xf2; // Clear all errors
|
||||
}
|
||||
|
||||
__attribute__((noinline)) MG_IRAM static bool mg_stm32f_erase(void *addr) {
|
||||
MG_IRAM static bool mg_stm32f_erase(void *addr) {
|
||||
bool ok = false;
|
||||
if (flash_page_start(addr) == false) {
|
||||
MG_ERROR(("%p is not on a sector boundary", addr));
|
||||
@ -6207,7 +6208,7 @@ MG_IRAM static bool mg_stm32f_swap(void) {
|
||||
|
||||
static bool s_flash_irq_disabled;
|
||||
|
||||
__attribute__((noinline)) MG_IRAM static bool mg_stm32f_write(void *addr,
|
||||
MG_IRAM static bool mg_stm32f_write(void *addr,
|
||||
const void *buf,
|
||||
size_t len) {
|
||||
if ((len % s_mg_flash_stm32f.align) != 0) {
|
||||
@ -6240,7 +6241,7 @@ __attribute__((noinline)) MG_IRAM static bool mg_stm32f_write(void *addr,
|
||||
}
|
||||
|
||||
// just overwrite instead of swap
|
||||
__attribute__((noinline)) MG_IRAM void single_bank_swap(char *p1, char *p2,
|
||||
MG_IRAM void single_bank_swap(char *p1, char *p2,
|
||||
size_t size) {
|
||||
// no stdlib calls here
|
||||
mg_stm32f_write(p1, p2, size);
|
||||
|
@ -2657,7 +2657,7 @@ void mg_rpc_list(struct mg_rpc_req *r);
|
||||
#else
|
||||
#ifndef MG_IRAM
|
||||
#if defined(__GNUC__)
|
||||
#define MG_IRAM __attribute__((section(".iram")))
|
||||
#define MG_IRAM __attribute__((noinline, section(".iram")))
|
||||
#else
|
||||
#define MG_IRAM
|
||||
#endif // compiler
|
||||
|
@ -23,7 +23,7 @@
|
||||
#else
|
||||
#ifndef MG_IRAM
|
||||
#if defined(__GNUC__)
|
||||
#define MG_IRAM __attribute__((section(".iram")))
|
||||
#define MG_IRAM __attribute__((noinline, section(".iram")))
|
||||
#else
|
||||
#define MG_IRAM
|
||||
#endif // compiler
|
||||
|
@ -120,7 +120,7 @@ MG_IRAM static void flash_clear_err(void) {
|
||||
MG_REG(MG_FLASH_BASE + MG_FLASH_SR) = 0xf2; // Clear all errors
|
||||
}
|
||||
|
||||
__attribute__((noinline)) MG_IRAM static bool mg_stm32f_erase(void *addr) {
|
||||
MG_IRAM static bool mg_stm32f_erase(void *addr) {
|
||||
bool ok = false;
|
||||
if (flash_page_start(addr) == false) {
|
||||
MG_ERROR(("%p is not on a sector boundary", addr));
|
||||
@ -161,7 +161,7 @@ MG_IRAM static bool mg_stm32f_swap(void) {
|
||||
|
||||
static bool s_flash_irq_disabled;
|
||||
|
||||
__attribute__((noinline)) MG_IRAM static bool mg_stm32f_write(void *addr,
|
||||
MG_IRAM static bool mg_stm32f_write(void *addr,
|
||||
const void *buf,
|
||||
size_t len) {
|
||||
if ((len % s_mg_flash_stm32f.align) != 0) {
|
||||
@ -194,7 +194,7 @@ __attribute__((noinline)) MG_IRAM static bool mg_stm32f_write(void *addr,
|
||||
}
|
||||
|
||||
// just overwrite instead of swap
|
||||
__attribute__((noinline)) MG_IRAM void single_bank_swap(char *p1, char *p2,
|
||||
MG_IRAM void single_bank_swap(char *p1, char *p2,
|
||||
size_t size) {
|
||||
// no stdlib calls here
|
||||
mg_stm32f_write(p1, p2, size);
|
||||
|
Loading…
Reference in New Issue
Block a user