Skip to content
Open
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
12 changes: 9 additions & 3 deletions cores/arduino/cortex_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include <variant.h>
#include <stdio.h>

/* libc */
void __libc_init_array(void);

/* RTOS Hooks */
extern void svcHook(void);
extern void pendSVHook(void);
Expand Down Expand Up @@ -146,16 +149,19 @@ void Reset_Handler(void)
pDest = &__data_start__;

if ((&__data_start__ != &__data_end__) && (pSrc != pDest)) {
for (; pDest < &__data_end__; pDest++, pSrc++)
for (; pDest < &__data_end__; pDest += sizeof(uint32_t), pSrc += sizeof(uint32_t))
*pDest = *pSrc;
}

/* Clear the zero section */
if ((&__data_start__ != &__data_end__) && (pSrc != pDest)) {
for (pDest = &__bss_start__; pDest < &__bss_end__; pDest++)
if ((&__bss_start__ != &__bss_end__)) {
for (pDest = &__bss_start__; pDest < &__bss_end__; pDest += sizeof(uint32_t))
*pDest = 0;
}

/* Initialize C library */
__libc_init_array();

SystemInit();

main();
Expand Down
5 changes: 0 additions & 5 deletions cores/arduino/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,13 @@ void initVariant() { }

extern USBDeviceClass USBDevice;

// Initialize C library
extern "C" void __libc_init_array(void);

/*
* \brief Main entry point of Arduino application
*/
int main( void )
{
init();

__libc_init_array();

initVariant();

delay(1);
Expand Down
Loading