diff --git a/ldscripts/ldscript_base.inc b/ldscripts/ldscript_base.inc index 826a4bf..ea10369 100644 --- a/ldscripts/ldscript_base.inc +++ b/ldscripts/ldscript_base.inc @@ -75,13 +75,6 @@ SECTIONS __copy_table_end__ = .; } > FLASH - .zero.table : - { - . = ALIGN(4); - __zero_table_start__ = .; - __zero_table_end__ = .; - } > FLASH - __etext = ALIGN (4); .data : AT (__etext) diff --git a/src/startup.c b/src/startup.c index 0b90002..2da52d3 100644 --- a/src/startup.c +++ b/src/startup.c @@ -1,5 +1,6 @@ -#include #include +#include +#include typedef struct _copy_table_t { @@ -8,16 +9,8 @@ typedef struct _copy_table_t uint32_t wlen; } copy_table_t; -typedef struct _zero_table_t -{ - uint32_t* dest; - uint32_t wlen; -} zero_table_t; - extern const copy_table_t __copy_table_start__; extern const copy_table_t __copy_table_end__; -extern const zero_table_t __zero_table_start__; -extern const zero_table_t __zero_table_end__; void __initialize_hardware_early(void); void _start(void) __attribute__((noreturn)); @@ -26,20 +19,8 @@ void Reset_Handler(void) { __initialize_hardware_early(); - for (copy_table_t const* table = &__copy_table_start__; table < &__copy_table_end__; ++table) - { - for (size_t i=0; iwlen; ++i) - { - table->dest[i] = table->src[i]; - } - } - - for (zero_table_t const* table = &__zero_table_start__; table < &__zero_table_end__; ++table) - { - for (size_t i=0; iwlen; ++i) - { - table->dest[i] = 0u; - } + for (copy_table_t const* table = &__copy_table_start__; table < &__copy_table_end__; ++table) { + memcpy(table->dest, table->src, table->wlen); } _start();