Merge pull request #2951 from cesanta/inline

MG_IRAM -> noinline
This commit is contained in:
Sergio R. Caprile 2024-11-01 16:26:05 -03:00 committed by GitHub
commit 67e17d3bc3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 10 additions and 9 deletions

View File

@ -6118,8 +6118,9 @@ MG_IRAM static bool flash_page_start(volatile uint32_t *dst) {
if ((p - base) % (16 * 1024 * flash_config) == 0) return true; if ((p - base) % (16 * 1024 * flash_config) == 0) return true;
} else if (p == base + 16 * 1024 * 4 * flash_config) { } else if (p == base + 16 * 1024 * 4 * flash_config) {
return true; return true;
} else if ((p - base) % (128 * 1024 * flash_config) == 0) } else if ((p - base) % (128 * 1024 * flash_config) == 0) {
return true; return true;
}
} }
return false; 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 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; bool ok = false;
if (flash_page_start(addr) == false) { if (flash_page_start(addr) == false) {
MG_ERROR(("%p is not on a sector boundary", addr)); 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; 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, const void *buf,
size_t len) { size_t len) {
if ((len % s_mg_flash_stm32f.align) != 0) { 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 // 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) { size_t size) {
// no stdlib calls here // no stdlib calls here
mg_stm32f_write(p1, p2, size); mg_stm32f_write(p1, p2, size);

View File

@ -2657,7 +2657,7 @@ void mg_rpc_list(struct mg_rpc_req *r);
#else #else
#ifndef MG_IRAM #ifndef MG_IRAM
#if defined(__GNUC__) #if defined(__GNUC__)
#define MG_IRAM __attribute__((section(".iram"))) #define MG_IRAM __attribute__((noinline, section(".iram")))
#else #else
#define MG_IRAM #define MG_IRAM
#endif // compiler #endif // compiler

View File

@ -23,7 +23,7 @@
#else #else
#ifndef MG_IRAM #ifndef MG_IRAM
#if defined(__GNUC__) #if defined(__GNUC__)
#define MG_IRAM __attribute__((section(".iram"))) #define MG_IRAM __attribute__((noinline, section(".iram")))
#else #else
#define MG_IRAM #define MG_IRAM
#endif // compiler #endif // compiler

View File

@ -120,7 +120,7 @@ MG_IRAM static void flash_clear_err(void) {
MG_REG(MG_FLASH_BASE + MG_FLASH_SR) = 0xf2; // Clear all errors 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; bool ok = false;
if (flash_page_start(addr) == false) { if (flash_page_start(addr) == false) {
MG_ERROR(("%p is not on a sector boundary", addr)); 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; 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, const void *buf,
size_t len) { size_t len) {
if ((len % s_mg_flash_stm32f.align) != 0) { 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 // 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) { size_t size) {
// no stdlib calls here // no stdlib calls here
mg_stm32f_write(p1, p2, size); mg_stm32f_write(p1, p2, size);