startup: get rid of zero table and fix copy_table

This commit is contained in:
Marc Kleine-Budde 2022-11-17 11:55:29 +01:00 committed by fenugrec
parent ac24146664
commit 59896b65fd
2 changed files with 4 additions and 30 deletions

View File

@ -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)

View File

@ -1,5 +1,6 @@
#include <stdint.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
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; i<table->wlen; ++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; i<table->wlen; ++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();