-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
114 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,61 @@ | ||
ENTRY(Reset_Handler) | ||
|
||
/* memory layout for an STM32L476RG */ | ||
MEMORY | ||
{ | ||
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 0x100000 | ||
SRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 0x18000 | ||
} | ||
/* End of SRAM for top of stack */ | ||
_sram_end = 0x20000000 + 0x18000; | ||
|
||
/* output sections */ | ||
/* Sections */ | ||
SECTIONS | ||
{ | ||
/* program code into FLASH */ | ||
.isr_vector : | ||
{ | ||
. = ALIGN(4); | ||
KEEP(*(.isr_vector)) | ||
. = ALIGN(4); | ||
} >FLASH | ||
|
||
.text : | ||
{ | ||
*(.vector_table) /* Vector table */ | ||
*(.text) /* Program code */ | ||
. = ALIGN(4); | ||
*(.text) /* .text sections (code) */ | ||
*(.text*) /* .text sections (code) */ | ||
*(.rodata) /* .rodata sections (constants, strings, etc.) */ | ||
*(.rodata*) /* .rodata sections (constants, strings, etc.) */ | ||
. = ALIGN(4); | ||
} >FLASH | ||
|
||
/* uninitialized global and static variables into SRAM */ | ||
.rodata : | ||
{ | ||
. = ALIGN(4); | ||
*(.rodata) /* .rodata sections (constants, strings, etc.) */ | ||
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */ | ||
. = ALIGN(4); | ||
} >FLASH | ||
|
||
_sidata = LOADADDR(.data); | ||
.data : | ||
{ | ||
*(.data) | ||
. = ALIGN(4); | ||
_sdata = .; /* create a global symbol at data start */ | ||
*(.data) /* .data sections */ | ||
*(.data*) /* .data* sections */ | ||
. = ALIGN(4); | ||
_edata = .; /* define a global symbol at data end */ | ||
} >SRAM AT> FLASH | ||
|
||
.bss : | ||
{ | ||
. = ALIGN(4); | ||
_sbss = .; | ||
*(.bss) | ||
*(.bss*) | ||
*(COMMON) | ||
. = ALIGN(4); | ||
_ebss = .; | ||
} >SRAM | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
set -e | ||
arm-none-eabi-gcc --specs=nosys.specs -std=gnu11 -Wall -pedantic -g -O2 -mlittle-endian -mthumb -mthumb-interwork -mcpu=cortex-m4 -fsingle-precision-constant -Wdouble-promotion -c main.c -o main.o | ||
arm-none-eabi-ld -o main.elf -T linker.ld main.o | ||
arm-none-eabi-gcc --specs=nosys.specs -std=gnu11 -Wall -pedantic -g -O2 -mlittle-endian -mthumb -mthumb-interwork -mcpu=cortex-m4 -fsingle-precision-constant -Wdouble-promotion -c boot.s -o boot.o | ||
arm-none-eabi-ld -o main.elf -T linker.ld boot.o main.o | ||
arm-none-eabi-objcopy -O binary main.elf main.bin | ||
st-flash write main.bin 0x8000000 |