refactor: IWDG driver and EM trigger (#3846)

This commit is contained in:
Raphael Coeffic
2023-12-04 07:14:25 +10:00
committed by GitHub
parent e18a2a90a4
commit 5153aaeea0
89 changed files with 1204 additions and 3202 deletions
@@ -0,0 +1,27 @@
/*
Generic bootloader linker script for STM32
*/
INCLUDE definitions.ld
/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
/* The program code and other data goes into FLASH */
.text :
{
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
KEEP(*(.version))
KEEP(*(.bootversiondata))
INCLUDE common_text.ld
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} >FLASH
INCLUDE common_sections.ld
}
@@ -0,0 +1,66 @@
/* C/C++ Exception handling (not used) */
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > FLASH
.ARM :
{
PROVIDE(__exidx_start = .);
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
PROVIDE(__exidx_end = .);
} > FLASH
.reboot_buffer(NOLOAD) :
{
. = ALIGN(4);
*(.reboot*)
} > REGION_DATA
/* Initialized data sections goes into RAM, load LMA copy after code */
.data :
{
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data .data*) /* .data sections */
. = ALIGN(4);
_edata = .; /* define a global symbol at data end */
} > REGION_DATA AT> FLASH
/* used by the startup to initialize data */
_sidata = LOADADDR(.data);
/* Uninitialized data section */
.bss(NOLOAD) :
{
. = ALIGN(4);
/* This is used by the startup in order to initialize the .bss secion */
_sbss = .; /* define a global symbol at bss start */
*(.bss .bss*)
*(COMMON)
. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
} > REGION_BSS
/* collect all uninitialized .ram sections (force DMA accessible) */
.ram (NOLOAD) :
{
. = ALIGN(4);
_sram = .;
*(.ram)
. = ALIGN(4);
_eram = .;
} > REGION_RAM
INCLUDE extra_sections.ld
/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
@@ -0,0 +1,48 @@
/* .text sections (code) */
*(.text .text* .gnu.linkonce.t.*)
*(.rodata .rodata* .gnu.linkonce.r.*)
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)
*(.data.__global_locale)
/*
C++ Runtime: initializers for static variables.
C Runtime: designated constructors
*/
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
/*
C++ runtime: destructors for static variables.
C runtime: designated finializers
*/
. = ALIGN(4);
KEEP(*(.fini))
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
/*
C++ runtime: static constructors
*/
. = ALIGN(4);
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
@@ -0,0 +1,13 @@
INCLUDE layout.ld
/* Entry Point */
ENTRY(Reset_Handler)
/* Stack address */
_estack = STACK_ADDRESS;
/* Main stack end */
_main_stack_start = _estack - MAIN_STACK_SIZE;
/* Higest heap address */
_heap_end = HEAP_ADDRESS;
@@ -0,0 +1,36 @@
/*
Generic firmware linker script for STM32
*/
INCLUDE definitions.ld
/* Define output sections */
SECTIONS
{
/* The startup code goes first into FLASH */
/* The program code and other data goes into FLASH */
.text :
{
FILL(0xFFFF)
CREATE_OBJECT_SYMBOLS
/* Bootloader code */
KEEP(*(.bootloader))
. = BOOTLOADER_SIZE; /* Set the start of the main program */
_stext = .; /* Provide the name for the start of this section */
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
KEEP(*(.fwversiondata))
INCLUDE common_text.ld
. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} > FLASH
INCLUDE common_sections.ld
}
@@ -0,0 +1,8 @@
.ccm (NOLOAD) :
{
. = ALIGN(4);
_sccm = .;
*(.ccm)
. = ALIGN(4);
_eccm = .;
} > CCM
@@ -0,0 +1,11 @@
PROVIDE(_heap_start = _eram);
/* Reserve stack and heap space in RAM */
.stack(NOLOAD) :
{
. = ALIGN(4);
. = . + MIN_HEAP_SIZE;
. = . + MAIN_STACK_SIZE;
. = ALIGN(4);
} > REGION_RAM
@@ -0,0 +1,26 @@
/* Highest address of the user mode stack */
STACK_ADDRESS = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */
/* Required amount of stack for interrupt stack (Main stack) */
MAIN_STACK_SIZE = 1024;
/* Maximum bootloader code size */
BOOTLOADER_SIZE = 0x8000;
/* Minimum Heap Size (indicative) */
MIN_HEAP_SIZE = 0;
/* Highest heap address */
HEAP_ADDRESS = STACK_ADDRESS - MAIN_STACK_SIZE;
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
}
REGION_ALIAS("REGION_DATA", RAM);
REGION_ALIAS("REGION_BSS", RAM);
REGION_ALIAS("REGION_RAM", RAM);
@@ -0,0 +1,20 @@
PROVIDE(_heap_start = _eram);
INCLUDE section_ccm.ld
/* Reserve heap space in RAM */
._user_heap(NOLOAD) :
{
. = ALIGN(4);
. = . + MIN_HEAP_SIZE;
. = ALIGN(4);
} > REGION_RAM
/* Reserve stack space in CCM */
.stack(NOLOAD) :
{
. = ALIGN(4);
. = . + MAIN_STACK_SIZE;
. = ALIGN(4);
} > CCM
@@ -0,0 +1,30 @@
/* Highest address of the user mode stack */
STACK_ADDRESS = ORIGIN(CCM) + LENGTH(CCM); /* end of CCM */
/* Required amount of stack for interrupt stack (Main stack) */
MAIN_STACK_SIZE = 1024;
/* Maximum bootloader code size */
BOOTLOADER_SIZE = 0x8000;
/* Minimum Heap Size (indicative) */
MIN_HEAP_SIZE = 0;
/* Highest heap address */
HEAP_ADDRESS = ORIGIN(RAM) + LENGTH(RAM);
/* Specify the memory areas */
MEMORY
{
FLASH (rx) :
ORIGIN = 0x08000000,
LENGTH = DEFINED(__flash_size) ? __flash_size : 512K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
CCM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
}
REGION_ALIAS("REGION_DATA", CCM);
REGION_ALIAS("REGION_BSS", CCM);
REGION_ALIAS("REGION_RAM", RAM);
@@ -0,0 +1,11 @@
PROVIDE(_heap_start = _eram);
/* Reserve stack and heap space in RAM */
.stack(NOLOAD) :
{
. = ALIGN(4);
. = . + MIN_HEAP_SIZE;
. = . + MAIN_STACK_SIZE;
. = ALIGN(4);
} > REGION_RAM
@@ -0,0 +1,26 @@
/* Highest address of the user mode stack */
STACK_ADDRESS = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */
/* Required amount of stack for interrupt stack (Main stack) */
MAIN_STACK_SIZE = 1024;
/* Maximum bootloader code size */
BOOTLOADER_SIZE = 0x8000;
/* Minimum Heap Size (indicative) */
MIN_HEAP_SIZE = 0;
/* Highest heap address */
HEAP_ADDRESS = STACK_ADDRESS - MAIN_STACK_SIZE;
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
}
REGION_ALIAS("REGION_DATA", RAM);
REGION_ALIAS("REGION_BSS", RAM);
REGION_ALIAS("REGION_RAM", RAM);
@@ -0,0 +1,28 @@
INCLUDE section_ccm.ld
/* Reserve stack space in CCM */
.stack(NOLOAD) :
{
. = ALIGN(4);
. = . + MAIN_STACK_SIZE;
. = ALIGN(4);
} > CCM
.sdram(NOLOAD) :
{
. = ALIGN(4);
*(.sdram)
*(.sdram*)
*(.sdram_rodata)
*(.sdram_rodata*)
. = ALIGN(4);
_esdram = .;
/* Reserve heap space in RAM */
. = . + MIN_HEAP_SIZE;
. = ALIGN(4);
} > SDRAM
PROVIDE(_heap_start = _esdram);
@@ -0,0 +1,32 @@
/* Highest address of the user mode stack */
STACK_ADDRESS = 0x10010000; /* end of 64K CCM */
/* Required amount of stack for interrupt stack (Main stack) */
MAIN_STACK_SIZE = 8192;
/* Maximum bootloader code size */
BOOTLOADER_SIZE = 0x20000;
/* Minimum Heap Size (indicative) */
MIN_HEAP_SIZE = 4096K;
/* SDRAM definitions */
SDRAM_START = DEFINED(__SDRAM_START__) ? __SDRAM_START__ : 0xD0000000;
SDRAM_SIZE = DEFINED(__SDRAM_SIZE__) ? __SDRAM_SIZE__ : 8192K;
/* Highest heap address */
HEAP_ADDRESS = SDRAM_START + SDRAM_SIZE;
/* Specify the memory areas */
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 192K
CCM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K
SDRAM(xrw) : ORIGIN = SDRAM_START, LENGTH = SDRAM_SIZE
}
REGION_ALIAS("REGION_DATA", CCM);
REGION_ALIAS("REGION_BSS", RAM);
REGION_ALIAS("REGION_RAM", RAM);