Skip to content

Commit 15e246f

Browse files
committed
Merge branch 'master' into K20D50
2 parents 6352603 + 82aa7b7 commit 15e246f

File tree

8 files changed

+70
-38
lines changed

8 files changed

+70
-38
lines changed

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CR/LPC11U24.ld

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ SECTIONS
145145
. = ALIGN(4) ;
146146
_ebss = .;
147147
PROVIDE(end = .);
148+
__end__ = .;
148149
} > RamLoc8
149150

150151
PROVIDE(_pvHeapStart = .);

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11UXX/TOOLCHAIN_GCC_CR/startup_LPC11xx.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern "C" {
99
void ResetISR (void);
1010
WEAK void NMI_Handler (void);
1111
WEAK void HardFault_Handler (void);
12-
WEAK void SVCall_Handler (void);
12+
WEAK void SVC_Handler (void);
1313
WEAK void PendSV_Handler (void);
1414
WEAK void SysTick_Handler (void);
1515
WEAK void IntDefaultHandler (void);
@@ -57,7 +57,7 @@ void (* const g_pfnVectors[])(void) = {
5757
0,
5858
0,
5959
0,
60-
SVCall_Handler,
60+
SVC_Handler,
6161
0,
6262
0,
6363
PendSV_Handler,
@@ -113,6 +113,8 @@ extern unsigned int __data_section_table;
113113
extern unsigned int __data_section_table_end;
114114
extern unsigned int __bss_section_table_end;
115115

116+
extern "C" void software_init_hook(void) __attribute__((weak));
117+
116118
AFTER_VECTORS void ResetISR(void) {
117119
unsigned int LoadAddr, ExeAddr, SectionLen;
118120
unsigned int *SectionTableAddr;
@@ -134,14 +136,18 @@ AFTER_VECTORS void ResetISR(void) {
134136
}
135137

136138
SystemInit();
137-
__libc_init_array();
138-
main();
139+
if (software_init_hook) // give control to the RTOS
140+
software_init_hook(); // this will also call __libc_init_array
141+
else {
142+
__libc_init_array();
143+
main();
144+
}
139145
while (1) {;}
140146
}
141147

142148
AFTER_VECTORS void NMI_Handler (void) {while(1){}}
143149
AFTER_VECTORS void HardFault_Handler(void) {while(1){}}
144-
AFTER_VECTORS void SVCall_Handler (void) {while(1){}}
150+
AFTER_VECTORS void SVC_Handler (void) {while(1){}}
145151
AFTER_VECTORS void PendSV_Handler (void) {while(1){}}
146152
AFTER_VECTORS void SysTick_Handler (void) {while(1){}}
147153
AFTER_VECTORS void IntDefaultHandler(void) {while(1){}}

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC11XX_11CXX/TOOLCHAIN_GCC_CR/startup_LPC11xx.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern "C" {
99
void ResetISR (void);
1010
WEAK void NMI_Handler (void);
1111
WEAK void HardFault_Handler (void);
12-
WEAK void SVCall_Handler (void);
12+
WEAK void SVC_Handler (void);
1313
WEAK void PendSV_Handler (void);
1414
WEAK void SysTick_Handler (void);
1515
WEAK void IntDefaultHandler (void);
@@ -57,7 +57,7 @@ void (* const g_pfnVectors[])(void) = {
5757
0,
5858
0,
5959
0,
60-
SVCall_Handler,
60+
SVC_Handler,
6161
0,
6262
0,
6363
PendSV_Handler,
@@ -113,6 +113,8 @@ extern unsigned int __data_section_table;
113113
extern unsigned int __data_section_table_end;
114114
extern unsigned int __bss_section_table_end;
115115

116+
extern "C" void software_init_hook(void) __attribute__((weak));
117+
116118
AFTER_VECTORS void ResetISR(void) {
117119
unsigned int LoadAddr, ExeAddr, SectionLen;
118120
unsigned int *SectionTableAddr;
@@ -134,14 +136,18 @@ AFTER_VECTORS void ResetISR(void) {
134136
}
135137

136138
SystemInit();
137-
__libc_init_array();
138-
main();
139+
if (software_init_hook) // give control to the RTOS
140+
software_init_hook(); // this will also call __libc_init_array
141+
else {
142+
__libc_init_array();
143+
main();
144+
}
139145
while (1) {;}
140146
}
141147

142148
AFTER_VECTORS void NMI_Handler (void) {while(1){}}
143149
AFTER_VECTORS void HardFault_Handler(void) {while(1){}}
144-
AFTER_VECTORS void SVCall_Handler (void) {while(1){}}
150+
AFTER_VECTORS void SVC_Handler (void) {while(1){}}
145151
AFTER_VECTORS void PendSV_Handler (void) {while(1){}}
146152
AFTER_VECTORS void SysTick_Handler (void) {while(1){}}
147153
AFTER_VECTORS void IntDefaultHandler(void) {while(1){}}

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CR/LPC1768.ld

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ SECTIONS
146146
. = ALIGN(4) ;
147147
_ebss = .;
148148
PROVIDE(end = .);
149+
__end__ = .;
149150
} > RamLoc32
150151

151152
PROVIDE(_pvHeapStart = .);

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC176X/TOOLCHAIN_GCC_CR/startup_LPC17xx.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ WEAK void HardFault_Handler (void);
2222
WEAK void MemManage_Handler (void);
2323
WEAK void BusFault_Handler (void);
2424
WEAK void UsageFault_Handler(void);
25-
WEAK void SVCall_Handler (void);
25+
WEAK void SVC_Handler (void);
2626
WEAK void DebugMon_Handler (void);
2727
WEAK void PendSV_Handler (void);
2828
WEAK void SysTick_Handler (void);
@@ -75,7 +75,7 @@ void (* const g_pfnVectors[])(void) = {
7575
0,
7676
0,
7777
0,
78-
SVCall_Handler,
78+
SVC_Handler,
7979
DebugMon_Handler,
8080
0,
8181
PendSV_Handler,
@@ -130,6 +130,8 @@ AFTER_VECTORS void bss_init(unsigned int start, unsigned int len) {
130130
for (loop = 0; loop < len; loop = loop + 4) *pulDest++ = 0;
131131
}
132132

133+
extern "C" void software_init_hook(void) __attribute__((weak));
134+
133135
AFTER_VECTORS void ResetISR(void) {
134136
unsigned int LoadAddr, ExeAddr, SectionLen;
135137
unsigned int *SectionTableAddr;
@@ -149,8 +151,12 @@ AFTER_VECTORS void ResetISR(void) {
149151
}
150152

151153
SystemInit();
152-
__libc_init_array();
153-
main();
154+
if (software_init_hook) // give control to the RTOS
155+
software_init_hook(); // this will also call __libc_init_array
156+
else {
157+
__libc_init_array();
158+
main();
159+
}
154160
while (1) {;}
155161
}
156162

@@ -159,7 +165,7 @@ AFTER_VECTORS void HardFault_Handler (void) {}
159165
AFTER_VECTORS void MemManage_Handler (void) {}
160166
AFTER_VECTORS void BusFault_Handler (void) {}
161167
AFTER_VECTORS void UsageFault_Handler(void) {}
162-
AFTER_VECTORS void SVCall_Handler (void) {}
168+
AFTER_VECTORS void SVC_Handler (void) {}
163169
AFTER_VECTORS void DebugMon_Handler (void) {}
164170
AFTER_VECTORS void PendSV_Handler (void) {}
165171
AFTER_VECTORS void SysTick_Handler (void) {}

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_GCC_CR/LPC407x_8x.ld

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ SECTIONS
156156
. = ALIGN(4) ;
157157
_ebss = .;
158158
PROVIDE(end = .);
159+
__end__ = .;
159160
} > RamLoc64
160161

161162
/* NOINIT section for RamPeriph32 */

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC408X/TOOLCHAIN_GCC_CR/startup_lpc407x_8x.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ extern unsigned int __bss_section_table_end;
259259
// Sets up a simple runtime environment and initializes the C/C++
260260
// library.
261261
//*****************************************************************************
262+
263+
extern "C" void software_init_hook(void) __attribute__((weak));
264+
262265
__attribute__ ((section(".after_vectors")))
263266
void
264267
ResetISR(void) {
@@ -319,21 +322,23 @@ ResetISR(void) {
319322
//#ifdef __USE_CMSIS
320323
SystemInit();
321324
//#endif
322-
325+
if (software_init_hook) // give control to the RTOS
326+
software_init_hook(); // this will also call __libc_init_array
327+
else {
323328
#if defined (__cplusplus)
324-
//
325-
// Call C++ library initialisation
326-
//
327-
__libc_init_array();
329+
//
330+
// Call C++ library initialisation
331+
//
332+
__libc_init_array();
328333
#endif
329334

330335
#if defined (__REDLIB__)
331-
// Call the Redlib library, which in turn calls main()
332-
__main() ;
336+
// Call the Redlib library, which in turn calls main()
337+
__main() ;
333338
#else
334-
main();
339+
main();
335340
#endif
336-
341+
}
337342
//
338343
// main() shouldn't return, but if it does, we'll just enter an infinite loop
339344
//

libraries/mbed/targets/cmsis/TARGET_NXP/TARGET_LPC43XX/TOOLCHAIN_GCC_CR/startup_LPC43xx.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ extern unsigned int __bss_section_table_end;
312312
// library.
313313
//
314314
// *****************************************************************************
315+
316+
extern "C" void software_init_hook(void) __attribute__((weak));
317+
315318
void
316319
ResetISR(void) {
317320

@@ -342,20 +345,23 @@ ResetISR(void) {
342345
bss_init(ExeAddr, SectionLen);
343346
}
344347

345-
#if defined(__cplusplus)
346-
//
347-
// Call C++ library initialisation
348-
//
349-
__libc_init_array();
350-
#endif
351-
352-
#if defined(__REDLIB__)
353-
// Call the Redlib library, which in turn calls main()
354-
__main();
355-
#else
356-
main();
357-
#endif
358-
348+
if (software_init_hook) // give control to the RTOS
349+
software_init_hook(); // this will also call __libc_init_array
350+
else {
351+
#if defined(__cplusplus)
352+
//
353+
// Call C++ library initialisation
354+
//
355+
__libc_init_array();
356+
#endif
357+
358+
#if defined(__REDLIB__)
359+
// Call the Redlib library, which in turn calls main()
360+
__main();
361+
#else
362+
main();
363+
#endif
364+
}
359365
//
360366
// main() shouldn't return, but if it does, we'll just enter an infinite loop
361367
//

0 commit comments

Comments
 (0)