mirror of
https://github.com/candle-usb/candleLight_fw.git
synced 2025-01-28 06:02:52 +08:00
startup: get rid of zero table and fix copy_table
This commit is contained in:
parent
ac24146664
commit
59896b65fd
@ -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)
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user