Skip to content

Commit 56117a8

Browse files
authored
Merge pull request #7871 from juhoeskeli/NUCLEO_F207ZG_LINKER_MCC
Updated linker files (GCC_ARM, ARM, IAR) for NUCLEO_F207ZG and enabled bootloader functionality
2 parents 1e3e694 + d5b374b commit 56117a8

File tree

6 files changed

+39
-65
lines changed

6 files changed

+39
-65
lines changed

targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/device/TOOLCHAIN_ARM_STD/startup_stm32f207xx.S

+4-53
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
;* Author : MCD Application Team
44
;* Version : V2.1.1
55
;* Date : 20-November-2015
6-
;* Description : STM32F207xx devices vector table for MDK-ARM_STD toolchain.
6+
;* Description : STM32F207xx devices vector table for MDK-ARM_STD toolchain.
77
;* This module performs:
88
;* - Set the initial SP
99
;* - Set the initial PC == Reset_Handler
@@ -13,7 +13,7 @@
1313
;* After Reset the CortexM3 processor is in Thread mode,
1414
;* priority is Privileged, and the Stack is set to Main.
1515
;*******************************************************************************
16-
;
16+
;
1717
;* Redistribution and use in source and binary forms, with or without modification,
1818
;* are permitted provided that the following conditions are met:
1919
;* 1. Redistributions of source code must retain the above copyright notice,
@@ -35,33 +35,11 @@
3535
;* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
3636
;* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3737
;* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38-
;
38+
;
3939
;*******************************************************************************
4040

41-
; Amount of memory (in bytes) allocated for Stack
42-
; Tailor this value to your application needs
43-
; <h> Stack Configuration
44-
; <o> Stack Size (in Bytes) <0x0-0xFFFFFFFF:8>
45-
; </h>
46-
47-
Stack_Size EQU 0x00000400
48-
49-
AREA STACK, NOINIT, READWRITE, ALIGN=3
50-
Stack_Mem SPACE Stack_Size
5141
__initial_sp EQU 0x20020000
5242

53-
54-
; <h> Heap Configuration
55-
; <o> Heap Size (in Bytes) <0x0-0xFFFFFFFF:8>
56-
; </h>
57-
58-
Heap_Size EQU 0x00000200
59-
60-
AREA HEAP, NOINIT, READWRITE, ALIGN=3
61-
__heap_base
62-
Heap_Mem SPACE Heap_Size
63-
__heap_limit
64-
6543
PRESERVE8
6644
THUMB
6745

@@ -404,33 +382,6 @@ HASH_RNG_IRQHandler
404382
ENDP
405383

406384
ALIGN
407-
408-
;*******************************************************************************
409-
; User Stack and Heap initialization
410-
;*******************************************************************************
411-
IF :DEF:__MICROLIB
412-
413-
EXPORT __initial_sp
414-
EXPORT __heap_base
415-
EXPORT __heap_limit
416-
417-
ELSE
418-
419-
IMPORT __use_two_region_memory
420-
EXPORT __user_initial_stackheap
421-
422-
__user_initial_stackheap
423-
424-
LDR R0, = Heap_Mem
425-
LDR R1, =(Stack_Mem + Stack_Size)
426-
LDR R2, = (Heap_Mem + Heap_Size)
427-
LDR R3, = Stack_Mem
428-
BX LR
429-
430-
ALIGN
431-
432-
ENDIF
433-
434-
END
385+
END
435386

436387
;************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE*****

targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/device/TOOLCHAIN_ARM_STD/stm32f207xx.sct

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#! armcc -E
12
; Scatter-Loading Description File
23
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34
; Copyright (c) 2016, STMicroelectronics
@@ -27,8 +28,16 @@
2728
; OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2829
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2930

30-
LR_IROM1 0x08000000 0x00100000 { ; load region size_region
31-
ER_IROM1 0x08000000 0x00100000 { ; load address = execution address
31+
#if !defined(MBED_APP_START)
32+
#define MBED_APP_START 0x08000000
33+
#endif
34+
35+
#if !defined(MBED_APP_SIZE)
36+
#define MBED_APP_SIZE 0x100000
37+
#endif
38+
39+
LR_IROM1 MBED_APP_START MBED_APP_SIZE { ; load region size_region
40+
ER_IROM1 MBED_APP_START MBED_APP_SIZE { ; load address = execution address
3241
*.o (RESET, +First)
3342
*(InRoot$$Sections)
3443
.ANY (+RO)

targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/device/TOOLCHAIN_GCC_ARM/STM32F207ZGTx_FLASH.ld

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
1+
#if !defined(MBED_APP_START)
2+
#define MBED_APP_START 0x8000000
3+
#endif
4+
5+
#if !defined(MBED_APP_SIZE)
6+
#define MBED_APP_SIZE 1024k
7+
#endif
8+
19
/* Linker script to configure memory regions. */
210
/* 97 vectors * 4 bytes = 388 bytes to reserve (0x184) */
311
MEMORY
4-
{
5-
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
12+
{
13+
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
614
RAM (rwx) : ORIGIN = 0x20000184, LENGTH = 128K - 0x184
715
}
816

917
/* Linker script to place sections and symbol values. Should be used together
1018
* with other linker script that defines memory regions FLASH and RAM.
1119
* It references following symbols, which must be defined in code:
1220
* Reset_Handler : Entry of reset handler
13-
*
21+
*
1422
* It defines following symbols, which code can use without definition:
1523
* __exidx_start
1624
* __exidx_end

targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/device/TOOLCHAIN_IAR/stm32f207xx.icf

+9-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
if (!isdefinedsymbol(MBED_APP_START)) { define symbol MBED_APP_START = 0x08000000; }
2+
if (!isdefinedsymbol(MBED_APP_SIZE)) { define symbol MBED_APP_SIZE = 0x100000; }
3+
14
/* [ROM = 1024kb = 0x100000] */
2-
define symbol __intvec_start__ = 0x08000000;
5+
define symbol __intvec_start__ = MBED_APP_START;
36
define symbol __region_ROM_start__ = 0x08000000;
4-
define symbol __region_ROM_end__ = 0x080FFFFF;
7+
define symbol __region_ROM_end__ = MBED_APP_START + MBED_APP_SIZE - 1;
58

69
/* [RAM = 128kb = 0x20000] Vector table dynamic copy: 97 vectors = 388 bytes (0x184) to be reserved in RAM */
710
define symbol __NVIC_start__ = 0x20000000;
@@ -15,9 +18,10 @@ define region ROM_region = mem:[from __region_ROM_start__ to __region_ROM_end__]
1518
define region RAM_region = mem:[from __region_RAM_start__ to __region_RAM_end__];
1619

1720
/* Stack and Heap */
18-
/*Heap 1/4 of ram and stack 1/8*/
19-
define symbol __size_cstack__ = 0x4000;
20-
define symbol __size_heap__ = 0x8000;
21+
/* Stack: 1024B */
22+
/* Heap: 64kB */
23+
define symbol __size_cstack__ = 0x400;
24+
define symbol __size_heap__ = 0x10000;
2125
define block CSTACK with alignment = 8, size = __size_cstack__ { };
2226
define block HEAP with alignment = 8, size = __size_heap__ { };
2327
define block STACKHEAP with fixed order { block HEAP, block CSTACK };

targets/TARGET_STM/TARGET_STM32F2/TARGET_NUCLEO_F207ZG/device/system_clock.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
**/
3131

3232
#include "stm32f2xx.h"
33+
#include "nvic_addr.h"
3334
#include "mbed_error.h"
3435

3536
/*!< Uncomment the following line if you need to relocate your vector Table in
@@ -88,7 +89,7 @@ void SystemInit(void)
8889
#ifdef VECT_TAB_SRAM
8990
SCB->VTOR = SRAM_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal SRAM */
9091
#else
91-
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
92+
SCB->VTOR = NVIC_FLASH_VECTOR_ADDRESS; /* Vector Table Relocation in Internal FLASH */
9293
#endif
9394

9495
}

targets/targets.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,7 @@
979979
"device_has_remove": ["LPTICKER"],
980980
"release_versions": ["2", "5"],
981981
"device_name": "STM32F207ZG",
982+
"bootloader_supported": true,
982983
"overrides": {
983984
"network-default-interface-type": "ETHERNET"
984985
}
@@ -4461,7 +4462,7 @@
44614462
"mbed_rom_start": "0x10040000",
44624463
"mbed_rom_size": "0x40000",
44634464
"mbed_ram_start": "0x30008000",
4464-
"mbed_ram_size": "0x10000",
4465+
"mbed_ram_size": "0x10000",
44654466
"inherits": ["Target"],
44664467
"device_has": ["USTICKER", "LPTICKER", "RTC", "ANALOGIN", "I2C", "I2CSLAVE", "I2C_ASYNCH", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "PWMOUT", "SERIAL", "SERIAL_ASYNCH", "SERIAL_FC", "STDIO_MESSAGES", "SLEEP", "SPI", "SPISLAVE", "SPI_ASYNCH", "TRNG", "FLASH"],
44674468
"detect_code": ["1305"],

0 commit comments

Comments
 (0)