Skip to content

Commit

Permalink
Separating linker script for F722 and F767
Browse files Browse the repository at this point in the history
  • Loading branch information
juribeparada committed Nov 4, 2017
1 parent 6bbc716 commit a921df7
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Makefile
Expand Up @@ -91,6 +91,8 @@ endif
ifndef $(OSC)
ifeq ($(MAKECMDGOALS),pi)
OSC=$(CLK_MMDVM_PI)
else ifeq ($(MAKECMDGOALS),pi-f722)
OSC=$(CLK_MMDVM_PI)
else
OSC=$(CLK_NUCLEO)
endif
Expand Down Expand Up @@ -133,7 +135,8 @@ CXXFLAGS_F7=-c $(MCFLAGS_F7) $(INCLUDES_F7)

# Linker flags
LDFLAGS_F4 =-T stm32f4xx_link.ld $(MCFLAGS_F4) --specs=nosys.specs $(INCLUDES_LIBS_F4)
LDFLAGS_F7 =-T stm32f7xx_link.ld $(MCFLAGS_F7) --specs=nosys.specs $(INCLUDES_LIBS_F7)
LDFLAGS_F767 =-T stm32f767_link.ld $(MCFLAGS_F7) --specs=nosys.specs $(INCLUDES_LIBS_F7)
LDFLAGS_F722 =-T stm32f722_link.ld $(MCFLAGS_F7) --specs=nosys.specs $(INCLUDES_LIBS_F7)

# Common flags
CFLAGS=-Os -ffunction-sections -fdata-sections -fno-builtin -Wno-implicit -DCUSTOM_NEW -DNO_EXCEPTIONS
Expand All @@ -155,7 +158,7 @@ pi: release_f4
pi-f722: GitVersion.h
pi-f722: CFLAGS+=$(CFLAGS_F7) $(DEFS_PI_F722)
pi-f722: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_PI_F722)
pi-f722: LDFLAGS+=$(LDFLAGS_F7)
pi-f722: LDFLAGS+=$(LDFLAGS_F722)
pi-f722: release_f7

f4m: GitVersion.h
Expand All @@ -179,7 +182,7 @@ dis: release_f4
f767: GitVersion.h
f767: CFLAGS+=$(CFLAGS_F7) $(DEFS_NUCLEO_F767)
f767: CXXFLAGS+=$(CXXFLAGS_F7) $(DEFS_NUCLEO_F767)
f767: LDFLAGS+=$(LDFLAGS_F7)
f767: LDFLAGS+=$(LDFLAGS_F767)
f767: release_f7

release_f4: $(BINDIR)
Expand Down
137 changes: 137 additions & 0 deletions stm32f722_link.ld
@@ -0,0 +1,137 @@
/*
* Copyright (C) 2017 by Andy Uribe CA6JAU
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

/* Required amount of heap and stack */
_min_heap_size = 0x1000;
_min_stack_size = 0x0800;

/* The entry point in the interrupt vector table */
ENTRY(Reset_Handler)

/* Memory areas */
MEMORY
{
ROM (rx) : ORIGIN = 0x08000000, LENGTH = 512K /* FLASH */
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K /* Main RAM */
}

/* Stack start address (end of 256K RAM) */
_estack = ORIGIN(RAM) + LENGTH(RAM);

SECTIONS
{
.text :
{
/* The interrupt vector table */
. = ALIGN(4);
KEEP(*(.isr_vector .isr_vector.*))

/* The program code */
. = ALIGN(4);
*(.text .text*)
*(.rodata .rodata*)

/* ARM-Thumb code */
*(.glue_7) *(.glue_7t)

. = ALIGN(4);
KEEP(*(.init))
KEEP(*(.fini))

/* EABI C++ global constructors support */
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;

/* EABI C++ global constructors support */
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;

/* EABI C++ global constructors support */
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;

} > ROM

/* ARM sections containing exception unwinding information */
.ARM.extab : {
__extab_start = .;
*(.ARM.extab* .gnu.linkonce.armextab.*)
__extab_end = .;
} > ROM

/* ARM index entries for section unwinding */
.ARM.exidx : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} > ROM

/* Start address for the initialization values of the .data section */
_sidata = .;

/* The .data section (initialized data) */
.data : AT ( _sidata )
{
. = ALIGN(4);
_sdata = . ; /* Start address for the .data section */
*(.data .data*)

. = ALIGN(4);
_edata = . ; /* End address for the .data section */
} > RAM

/* The .bss section (uninitialized data) */
.bss :
{
. = ALIGN(4);
_sbss = .; /* Start address for the .bss section */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)

. = ALIGN(4);
_ebss = . ; /* End address for the .bss section */
__bss_end__ = _ebss;
} > RAM

/* Space for heap and stack */
.heap_stack :
{
end = . ; /* 'end' symbol defines heap location */
_end = end ;
. = . + _min_heap_size; /* Additional space for heap and stack */
. = . + _min_stack_size;
} > RAM

/* Remove information from the standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
}
File renamed without changes.

0 comments on commit a921df7

Please sign in to comment.