Skip to content

Commit 694a35f

Browse files
authored
Merge pull request ARMmbed#23 from linlingao/dbghdr_arm
Added a section to store dbghdr to the linker files
2 parents 4625cec + f42b9df commit 694a35f

File tree

4 files changed

+40
-30
lines changed

4 files changed

+40
-30
lines changed

targets/TARGET_TI/TARGET_CC32XX/TARGET_CC3220SF/device/CC3220SF_LAUNCHXL.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ void CC3220SF_LAUNCHXL_initGeneral(void)
9393
0, PRCM_RUN_MODE_CLK );
9494
}
9595

96-
//TODO: Support other toolchains!
97-
//#if defined(__SF_DEBUG__)
98-
//#if defined TOOLCHAIN_ARM
99-
//__attribute__ ((section (FLASH_HDR)))
100-
//#elif defined TOOLCHAIN_IAR
101-
//#pragma data_location=".dbghdr"
102-
#if defined TOOLCHAIN_GCC_ARM
96+
#define __SF_DEBUG__
97+
#if defined(__SF_DEBUG__)
98+
#if defined TOOLCHAIN_ARM
99+
__attribute__((at(0x01000000)))
100+
#elif defined TOOLCHAIN_IAR
101+
#pragma default_variable_attributes = @ ".dbghdr"
102+
#elif defined TOOLCHAIN_GCC_ARM
103103
__attribute__ ((section (".dbghdr")))
104104
#endif
105105
const unsigned long ulDebugHeader[]=
@@ -108,4 +108,4 @@ const unsigned long ulDebugHeader[]=
108108
0x000FF800,
109109
0xEFA3247D
110110
};
111-
//#endif
111+
#endif

targets/TARGET_TI/TARGET_CC32XX/TARGET_CC3220SF/device/TOOLCHAIN_ARM_STD/CC3220SF.sct

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
#! armcc -E
22

33
/* Device specific values */
4-
5-
#define ROM_START 0x01000000
6-
#define ROM_SIZE 0x100000
7-
#define RAM_START 0x20000000
8-
#define RAM_SIZE 0x40000
9-
#define VECTORS 195 /* This value must match NVIC_NUM_VECTORS */
4+
#define ROM_START 0x01000000
5+
#define ROM_SIZE 0x100000
6+
#define FLASH_HDR_START ROM_START
7+
#define FLASH_HDR_SIZE 0x800
8+
#define RAM_START 0x20000000
9+
#define RAM_SIZE 0x40000
10+
#define VECTORS 195 /* This value must match NVIC_NUM_VECTORS */
1011

1112
/* Common - Do not change */
1213

1314
#if !defined(MBED_APP_START)
14-
#define MBED_APP_START ROM_START
15+
#define MBED_APP_START (ROM_START + FLASH_HDR_SIZE)
1516
#endif
1617

1718
#if !defined(MBED_APP_SIZE)
18-
#define MBED_APP_SIZE ROM_SIZE
19+
#define MBED_APP_SIZE (ROM_SIZE - FLASH_HDR_SIZE)
1920
#endif
2021

2122
/* Round up VECTORS_SIZE to 8 bytes */

targets/TARGET_TI/TARGET_CC32XX/TARGET_CC3220SF/device/TOOLCHAIN_GCC_ARM/gcc_arm.ld

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
#define ROM_START 0x01000000
44
#define ROM_SIZE 0x100000
55
#define FLASH_HDR_START ROM_START
6-
#define FLASH_HDR_SIZE 0x7FF
6+
#define FLASH_HDR_SIZE 0x800
77
#define RAM_START 0x20000000
88
#define RAM_SIZE 0x40000
99
#define VECTORS 195 /* This value must match NVIC_NUM_VECTORS */
1010

1111
/* Common - Do not change */
1212

1313
#if !defined(MBED_APP_START)
14-
#define MBED_APP_START (ROM_START + FLASH_HDR_SIZE + 1)
14+
#define MBED_APP_START (ROM_START + FLASH_HDR_SIZE)
1515
#endif
1616

1717
#if !defined(MBED_APP_SIZE)
18-
#define MBED_APP_SIZE (ROM_SIZE - FLASH_HDR_SIZE - 1)
18+
#define MBED_APP_SIZE (ROM_SIZE - FLASH_HDR_SIZE)
1919
#endif
2020

2121
/* Round up VECTORS_SIZE to 8 bytes */
2222
#define VECTORS_SIZE (((VECTORS * 4) + 7) & 0xFFFFFFF8)
2323

2424
MEMORY
2525
{
26-
FLASH_HDR (rx) : ORIGIN = ROM_START, LENGTH = 0x7FF
26+
FLASH_HDR (rx) : ORIGIN = ROM_START, LENGTH = 0x800
2727
FLASH (rx) : ORIGIN = MBED_APP_START, LENGTH = MBED_APP_SIZE
2828
RAM (rwx) : ORIGIN = RAM_START + VECTORS_SIZE, LENGTH = RAM_SIZE - VECTORS_SIZE
2929
}
Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
/* Device specific values */
22

3-
define symbol ROM_START = 0x01000000;
4-
define symbol ROM_SIZE = 0x100000;
5-
define symbol RAM_START = 0x20000000;
6-
define symbol RAM_SIZE = 0x40000;
7-
define symbol VECTORS = 195; /* This value must match NVIC_NUM_VECTORS */
8-
define symbol HEAP_SIZE = 0x8000;
3+
define symbol ROM_START = 0x01000000;
4+
define symbol ROM_SIZE = 0x100000;
5+
define symbol FLASH_HDR_START = ROM_START;
6+
define symbol FLASH_HDR_SIZE = 0x800;
7+
define symbol RAM_START = 0x20000000;
8+
define symbol RAM_SIZE = 0x40000;
9+
define symbol VECTORS = 195; /* This value must match NVIC_NUM_VECTORS */
10+
define symbol HEAP_SIZE = 0x8000;
911

1012
/* Common - Do not change */
1113

1214
if (!isdefinedsymbol(MBED_APP_START)) {
13-
define symbol MBED_APP_START = ROM_START;
15+
define symbol MBED_APP_START = (ROM_START + FLASH_HDR_SIZE);
1416
}
1517

1618
if (!isdefinedsymbol(MBED_APP_SIZE)) {
17-
define symbol MBED_APP_SIZE = ROM_SIZE;
19+
define symbol MBED_APP_SIZE = (ROM_SIZE - FLASH_HDR_SIZE);
1820
}
1921

2022
/* Round up VECTORS_SIZE to 8 bytes */
@@ -24,9 +26,16 @@ define symbol RAM_REGION_SIZE = RAM_SIZE - VECTORS_SIZE;
2426
define symbol ISR_STACK_SIZE = 0x400;
2527

2628
define memory mem with size = 4G;
27-
define region ROM_region = mem:[from MBED_APP_START size MBED_APP_SIZE];
29+
define region FLASH_HDR_region = mem:[from FLASH_HDR_START size FLASH_HDR_SIZE];
30+
define region FLASH_region = mem:[from MBED_APP_START size MBED_APP_SIZE];
2831
define region RAM_region = mem:[from RAM_REGION_START size RAM_REGION_SIZE];
2932

33+
//
34+
// Keep the debug header
35+
//
36+
keep {section .dbghdr};
37+
place at start of FLASH_HDR_region { readonly section .dbghdr };
38+
3039
define block CSTACK with alignment = 8, size = ISR_STACK_SIZE { };
3140
define block HEAP with alignment = 8, size = HEAP_SIZE { };
3241

@@ -35,6 +44,6 @@ do not initialize { section .noinit };
3544

3645
place at address mem: MBED_APP_START { readonly section .intvec };
3746

38-
place in ROM_region { readonly };
47+
place in FLASH_region { readonly };
3948
place in RAM_region { readwrite,
4049
block CSTACK, block HEAP };

0 commit comments

Comments
 (0)