Skip to content

[GCC_CR] fix runtime hang for baremetal build #2582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ AFTER_VECTORS void bss_init(unsigned int start, unsigned int len) {


/* Reset entry point*/
extern "C" void software_init_hook(void) __attribute__((weak));
extern "C" void software_init_hook(void);
extern "C" void pre_main(void) __attribute__((weak));

AFTER_VECTORS void ResetISR(void) {
unsigned int LoadAddr, ExeAddr, SectionLen;
Expand Down Expand Up @@ -169,9 +170,10 @@ AFTER_VECTORS void ResetISR(void) {


SystemInit();
if (software_init_hook)
software_init_hook();
else {
if (pre_main) { // give control to the RTOS
software_init_hook(); // this will also call __libc_init_array
}
else { // for BareMetal (non-RTOS) build
__libc_init_array();
main();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ extern unsigned int __data_section_table;
extern unsigned int __data_section_table_end;
extern unsigned int __bss_section_table_end;

extern "C" void software_init_hook(void) __attribute__((weak));
extern "C" void software_init_hook(void);
extern "C" void pre_main(void) __attribute__((weak));

AFTER_VECTORS void ResetISR(void) {
unsigned int LoadAddr, ExeAddr, SectionLen;
Expand All @@ -136,9 +137,10 @@ AFTER_VECTORS void ResetISR(void) {
}

SystemInit();
if (software_init_hook) // give control to the RTOS
if (pre_main) { // give control to the RTOS
software_init_hook(); // this will also call __libc_init_array
else {
}
else { // for BareMetal (non-RTOS) build
__libc_init_array();
main();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ extern unsigned int __data_section_table;
extern unsigned int __data_section_table_end;
extern unsigned int __bss_section_table_end;

extern "C" void software_init_hook(void) __attribute__((weak));
extern "C" void software_init_hook(void);
extern "C" void pre_main(void) __attribute__((weak));

AFTER_VECTORS void ResetISR(void) {
unsigned int LoadAddr, ExeAddr, SectionLen;
Expand All @@ -136,9 +137,10 @@ AFTER_VECTORS void ResetISR(void) {
}

SystemInit();
if (software_init_hook) // give control to the RTOS
if (pre_main) { // give control to the RTOS
software_init_hook(); // this will also call __libc_init_array
else {
}
else { // for BareMetal (non-RTOS) build
__libc_init_array();
main();
}
Expand All @@ -147,7 +149,7 @@ AFTER_VECTORS void ResetISR(void) {

AFTER_VECTORS void NMI_Handler (void) {while(1){}}
AFTER_VECTORS void HardFault_Handler(void) {while(1){}}
AFTER_VECTORS void SVC_Handler (void) {while(1){}}
AFTER_VECTORS void SVC_Handler (void) {while(1){}}
AFTER_VECTORS void PendSV_Handler (void) {while(1){}}
AFTER_VECTORS void SysTick_Handler (void) {while(1){}}
AFTER_VECTORS void IntDefaultHandler(void) {while(1){}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ AFTER_VECTORS void bss_init(unsigned int start, unsigned int len) {


/* Reset entry point*/
extern "C" void software_init_hook(void) __attribute__((weak));
extern "C" void software_init_hook(void);
extern "C" void pre_main(void) __attribute__((weak));

AFTER_VECTORS void ResetISR(void) {
unsigned int LoadAddr, ExeAddr, SectionLen;
Expand All @@ -187,9 +188,10 @@ AFTER_VECTORS void ResetISR(void) {
}

SystemInit();
if (software_init_hook)
software_init_hook();
else {
if (pre_main) { // give control to the RTOS
software_init_hook(); // this will also call __libc_init_array
}
else { // for BareMetal (non-RTOS) build
__libc_init_array();
main();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ AFTER_VECTORS void bss_init(unsigned int start, unsigned int len) {
for (loop = 0; loop < len; loop = loop + 4) *pulDest++ = 0;
}

extern "C" void software_init_hook(void) __attribute__((weak));
extern "C" void software_init_hook(void);
extern "C" void pre_main(void) __attribute__((weak));

AFTER_VECTORS void ResetISR(void) {
unsigned int LoadAddr, ExeAddr, SectionLen;
Expand All @@ -151,9 +152,10 @@ AFTER_VECTORS void ResetISR(void) {
}

SystemInit();
if (software_init_hook) // give control to the RTOS
if (pre_main) { // give control to the RTOS
software_init_hook(); // this will also call __libc_init_array
else {
}
else { // for BareMetal (non-RTOS) build
__libc_init_array();
main();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ extern unsigned int __bss_section_table_end;
// library.
//*****************************************************************************

extern "C" void software_init_hook(void) __attribute__((weak));
extern "C" void software_init_hook(void);
extern "C" void pre_main(void) __attribute__((weak));

__attribute__ ((section(".after_vectors")))
void
Expand Down Expand Up @@ -319,26 +320,15 @@ ResetISR(void) {
*pSCB_VTOR = (unsigned int)g_pfnVectors;
}

//#ifdef __USE_CMSIS
SystemInit();
//#endif
if (software_init_hook) // give control to the RTOS
software_init_hook(); // this will also call __libc_init_array
else {
#if defined (__cplusplus)
//
// Call C++ library initialisation
//
__libc_init_array();
#endif

#if defined (__REDLIB__)
// Call the Redlib library, which in turn calls main()
__main() ;
#else
main();
SystemInit();
if (pre_main) { // give control to the RTOS
software_init_hook(); // this will also call __libc_init_array
}
else { // for BareMetal (non-RTOS) build
__libc_init_array();
main();
#endif
}
}
//
// main() shouldn't return, but if it does, we'll just enter an infinite loop
//
Expand Down