[ion/n0110] Persist exam mode through reset

This commit is contained in:
Léa Saviot
2019-12-10 14:25:48 +01:00
committed by EmilieNumworks
parent 762f67d996
commit 9f592a0bc4
2 changed files with 18 additions and 5 deletions

View File

@@ -12,7 +12,8 @@
MEMORY {
INTERNAL_FLASH (rx) : ORIGIN = 0x00200000, LENGTH = 64K
SRAM (rw) : ORIGIN = 0x20000000, LENGTH = 256K
EXTERNAL_FLASH (rx) : ORIGIN = 0x90000000, LENGTH = 8M
EXTERNAL_FLASH_FIRST_SECTOR (rx) : ORIGIN = 0x90000000, LENGTH = 4K
EXTERNAL_FLASH_NEXT_SECTORS (rx) : ORIGIN = (0x90000000 + 4K), LENGTH = (8M - 4K)
/*
ITCM (rwx) : ORIGIN = 0x00000000, LENGTH = 16K
DTCM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
@@ -55,6 +56,13 @@ SECTIONS {
*(.text._ZL22jump_to_external_flashv)
} >INTERNAL_FLASH
.exam_mode_persistence ORIGIN(EXTERNAL_FLASH_FIRST_SECTOR): {
_exam_mode_persistence_start = .;
/* Note: We don't increment "." here, we set it. */
. = (ORIGIN(EXTERNAL_FLASH_FIRST_SECTOR) + LENGTH(EXTERNAL_FLASH_FIRST_SECTOR));
_exam_mode_persistence_end = .;
} >EXTERNAL_FLASH_FIRST_SECTOR
/* Use boot routine and required dependencies */
/* We're relying on symbols being in their own sub-section. On GCC, this is
* done with -fdata-sections -ffunction-sections */
@@ -120,12 +128,12 @@ SECTIONS {
. = ALIGN(4);
*(.text)
*(.text.*)
} >EXTERNAL_FLASH
} >EXTERNAL_FLASH_NEXT_SECTORS
.rodata.external : {
*(.rodata)
*(.rodata.*)
} >EXTERNAL_FLASH
} >EXTERNAL_FLASH_NEXT_SECTORS
.init_array : {
. = ALIGN(4);
@@ -202,3 +210,8 @@ NOCROSSREFS_TO(.text.external .isr_vector_table);
NOCROSSREFS_TO(.rodata.external .isr_vector_table);
NOCROSSREFS_TO(.text.external .header);
NOCROSSREFS_TO(.rodata.external .header);
NOCROSSREFS_TO(.exam_mode_persistence .text.internal);
NOCROSSREFS_TO(.exam_mode_persistence .rodata.internal);
NOCROSSREFS_TO(.exam_mode_persistence .isr_vector_table);
NOCROSSREFS_TO(.exam_mode_persistence .header);

View File

@@ -402,7 +402,7 @@ void MassErase() {
set_as_memory_mapped();
}
void EraseSector(int i) {
void __attribute__((noinline)) EraseSector(int i) {
assert(i >= 0 && i < Config::NumberOfSectors);
unset_memory_mapped_mode();
unlockFlash();
@@ -413,7 +413,7 @@ void EraseSector(int i) {
set_as_memory_mapped();
}
void WriteMemory(uint8_t * destination, const uint8_t * source, size_t length) {
void __attribute__((noinline)) WriteMemory(uint8_t * destination, const uint8_t * source, size_t length) {
if (Config::NumberOfSectors == 0) {
return;
}