From ca2529a9cec04bc3dfe339d8f1768ad6b0de2d55 Mon Sep 17 00:00:00 2001 From: Eugene Batalov Date: Mon, 4 Jul 2016 15:51:45 +0300 Subject: [PATCH] car_fmw: fix ld script and add comments It turned out that we can't use all the 192K SRAM on our MCU. See explanation inside. Also made fake debug and flash Makefile targets PHONY. --- car_fmw/Makefile | 2 +- car_fmw/src/stm32_flash.ld | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/car_fmw/Makefile b/car_fmw/Makefile index 74ad6e43e52..4e14ae5b122 100644 --- a/car_fmw/Makefile +++ b/car_fmw/Makefile @@ -69,4 +69,4 @@ clean: include $(LIB_DIR)/**/Makefile -.PHONY: clean +.PHONY: clean debug flash diff --git a/car_fmw/src/stm32_flash.ld b/car_fmw/src/stm32_flash.ld index c3e1c6d6fab..9a10d57b3c1 100644 --- a/car_fmw/src/stm32_flash.ld +++ b/car_fmw/src/stm32_flash.ld @@ -3,8 +3,8 @@ ** ** File : stm32_flash.ld ** -** Abstract : Linker script for STM32F207IG Device with -** 1024KByte FLASH, 112KByte RAM +** Abstract : Linker script for STM32F407VG Device with +** 1024KByte FLASH, 192KByte RAM ** ** Set heap size, stack size and stack location according ** to application requirements. @@ -32,8 +32,15 @@ /* Entry Point */ ENTRY(Reset_Handler) -/* Highest address of the user mode stack */ -_estack = 0x2001c000; /* end of 112K RAM */ +/* + * _estack is the highest address of user mode stack + * (sp initial value, stack grows down). + * We have 192K RAM on our MCU and _estack should be 0x20030000. + * But our MCU maps only 128K SRAM at 0x20000000 after boot. + * We need to perform some memory remapping to use more. + * This isn't implemented yet. + */ +_estack = 0x20020000; /* end of 128K SRAM region */ /* Generate a link error if heap and stack don't fit into RAM */ _Min_Heap_Size = 0; /* required amount of heap */ @@ -43,7 +50,7 @@ _Min_Stack_Size = 0x400; /* required amount of stack */ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K - RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K + RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K MEMORY_B1 (rx) : ORIGIN = 0x60000000, LENGTH = 0K }