diff --git a/arch/at91sam3x8e/startup.c b/arch/at91sam3x8e/startup.c index eb1b9b0..e2179e4 100644 --- a/arch/at91sam3x8e/startup.c +++ b/arch/at91sam3x8e/startup.c @@ -28,6 +28,7 @@ #include #include #include +#include #include /* from flash.ld */ @@ -46,19 +47,16 @@ void do_bootstrap(void); void isr_reset(void) { - uint32_t *src; - uint32_t *dest; - - /* copy .data to sram */ - dest = &_etext; - src = &_srelocate; - while (src < &_erelocate) - *dest++ = *src++; - - /** clear .bss */ - dest = &_szero; - while (dest <= &_ezero) - *dest++ = 0; + memcpy( + &_etext, + &_srelocate, + (size_t)(&_erelocate) - (size_t)(&_srelocate) + ); + memset( + &_szero, + 0, + (size_t)(&_ezero) - (size_t)(&_szero) + ); /* start the Kernel */ do_bootstrap();