app linker settings for bl

This commit is contained in:
Matthew Kennedy 2020-12-02 16:01:54 -08:00
parent d7c1e3b350
commit a318bedcfe
3 changed files with 63 additions and 10 deletions

View File

@ -20,12 +20,12 @@ endif
# Enable this if you want the linker to remove unused code and data.
ifeq ($(USE_LINK_GC),)
USE_LINK_GC = yes
USE_LINK_GC = no
endif
# Linker extra options here.
ifeq ($(USE_LDOPT),)
USE_LDOPT =
USE_LDOPT =
endif
# Enable this if you want link time optimizations (LTO).
@ -111,7 +111,7 @@ include $(CHIBIOS)/tools/mk/autobuild.mk
include $(CHIBIOS)/os/hal/lib/streams/streams.mk
# Define linker script file here
LDSCRIPT= $(CONFDIR)/STM32F042x6.ld
LDSCRIPT= $(CONFDIR)/app.ld
# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
@ -169,7 +169,7 @@ UINCDIR =
ULIBDIR =
# List all user libraries here
ULIBS =
ULIBS = bootloader/build/wideband_bootloader.o
#
# End of user section

View File

@ -14,13 +14,15 @@
limitations under the License.
*/
/*
* STM32F042x6 memory setup.
*/
/*INCLUDE wideband_layout.ld*/
blsize = 8k;
MEMORY
{
/* bootloader (rx) : org = 0x08000000, len = 8k */
flash0 (rx) : org = 0x08000000, len = 24k
blflash (rx) : org = 0x08000000, len = blsize
appflash (rx) : org = 0x08000000 + blsize, len = 32k - blsize
flash1 (rx) : org = 0x00000000, len = 0
flash2 (rx) : org = 0x00000000, len = 0
flash3 (rx) : org = 0x00000000, len = 0
@ -28,7 +30,8 @@ MEMORY
flash5 (rx) : org = 0x00000000, len = 0
flash6 (rx) : org = 0x00000000, len = 0
flash7 (rx) : org = 0x00000000, len = 0
ram0 (wx) : org = 0x20000000, len = 6k
ram_vectors (wx) : org = 0x20000000, len = 256
ram0 (wx) : org = 0x20000200, len = 6k - 256
ram1 (wx) : org = 0x00000000, len = 0
ram2 (wx) : org = 0x00000000, len = 0
ram3 (wx) : org = 0x00000000, len = 0
@ -38,6 +41,13 @@ MEMORY
ram7 (wx) : org = 0x00000000, len = 0
}
__appflash_start__ = ORIGIN(appflash);
__ram_vectors_start__ = ORIGIN(ram_vectors);
__ram_vectors_size__ = LENGTH(ram_vectors);
REGION_ALIAS("flash0", appflash);
/* For each data/text section two region are defined, a virtual region
and a load region (_LMA suffix).*/
@ -82,5 +92,17 @@ REGION_ALIAS("BSS_RAM", ram0);
/* RAM region to be used for the default heap.*/
REGION_ALIAS("HEAP_RAM", ram0);
/* Bootloader section */
SECTIONS
{
.bl : ALIGN(4)
{
. = ALIGN(4);
*(.bl)
*(.bl.*)
. = ALIGN(4);
} > blflash AT > blflash
}
/* Generic rules inclusion.*/
INCLUDE rules.ld

View File

@ -0,0 +1,31 @@
/*
* STM32F042x6 memory setup.
*/
blsize = 8k;
MEMORY
{
blflash (rx) : org = 0x08000000, len = blsize
appflash (rx) : org = 0x08000000 + blsize, len = 32k - blsize
flash1 (rx) : org = 0x00000000, len = 0
flash2 (rx) : org = 0x00000000, len = 0
flash3 (rx) : org = 0x00000000, len = 0
flash4 (rx) : org = 0x00000000, len = 0
flash5 (rx) : org = 0x00000000, len = 0
flash6 (rx) : org = 0x00000000, len = 0
flash7 (rx) : org = 0x00000000, len = 0
ram_vectors (wx) : org = 0x20000000, len = 256
ram0 (wx) : org = 0x20000200, len = 6k - 256
ram1 (wx) : org = 0x00000000, len = 0
ram2 (wx) : org = 0x00000000, len = 0
ram3 (wx) : org = 0x00000000, len = 0
ram4 (wx) : org = 0x00000000, len = 0
ram5 (wx) : org = 0x00000000, len = 0
ram6 (wx) : org = 0x00000000, len = 0
ram7 (wx) : org = 0x00000000, len = 0
}
__appflash_start__ = ORIGIN(appflash);
__ram_vectors_start__ = ORIGIN(ram_vectors);
__ram_vectors_size__ = LENGTH(ram_vectors);