для установки предела адреса для кеширования использую переменную, которая не учитывает данные rodata

This commit is contained in:
KLASSENTS 2025-05-30 15:54:48 +07:00
parent 5acf627e2c
commit cad2582733
2 changed files with 3 additions and 5 deletions

View File

@ -21,13 +21,12 @@
#define FLASH_END_OFFSET 0x1000 #define FLASH_END_OFFSET 0x1000
// values from ld script // values from ld script
extern uint8_t __TEXT_START__[]; extern uint8_t __RODATA__[];
extern uint8_t __TEXT_END__[];
// RAM-function for updating flash cache limit by app size to improve performance // RAM-function for updating flash cache limit by app size to improve performance
__attribute__((section(".ram_text"))) void updateCacheLimit(void) __attribute__((section(".ram_text"))) void updateCacheLimit(void)
{ {
uint32_t new_limit = (uintptr_t)__TEXT_END__ - (uintptr_t)__TEXT_START__ + 128; // 128 byte for margin uint32_t new_limit = (uintptr_t)__RODATA__ - SPIFI_BASE_ADDRESS;
// limit cache size by flash size with margin // limit cache size by flash size with margin
if (new_limit > (FLASH_SIZE - FLASH_END_OFFSET)) if (new_limit > (FLASH_SIZE - FLASH_END_OFFSET))
new_limit = FLASH_SIZE - FLASH_END_OFFSET; new_limit = FLASH_SIZE - FLASH_END_OFFSET;

View File

@ -21,11 +21,10 @@ SECTIONS {
*crt0.S.o(.text .text.*) *crt0.S.o(.text .text.*)
*(.text.smallsysteminit) *(.text.smallsysteminit)
*(.text.SmallSystemInit) *(.text.SmallSystemInit)
/*. = ORIGIN(rom) + 0xC0;*/
/*KEEP(*crt0.S.o(.trap_text))*/
*(.text) *(.text)
*(.text.*) *(.text.*)
PROVIDE(__RODATA__ = .);
*(.rodata) *(.rodata)
*(.rodata.*) *(.rodata.*)
. = ALIGN(CL_SIZE); . = ALIGN(CL_SIZE);