初始提交
This commit is contained in:
44
rom/riscv3/romlib/romlib_sec_init.c
Normal file
44
rom/riscv3/romlib/romlib_sec_init.c
Normal file
@@ -0,0 +1,44 @@
|
||||
/****************************************************************************
|
||||
*
|
||||
* Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
|
||||
*
|
||||
* This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
|
||||
* be copied by any method or incorporated into another program without
|
||||
* the express written consent of Aerospace C.Power. This Information or any portion
|
||||
* thereof remains the property of Aerospace C.Power. The Information contained herein
|
||||
* is believed to be accurate and Aerospace C.Power assumes no responsibility or
|
||||
* liability for its use in any way and conveys no license or title under
|
||||
* any patent or copyright and makes no representation or warranty that this
|
||||
* Information is free from patent or copyright infringement.
|
||||
*
|
||||
* ****************************************************************************/
|
||||
#include "os_types.h"
|
||||
#include "sections.h"
|
||||
|
||||
void* memcpy(void* aa, const void* bb, size_t n);
|
||||
|
||||
void* memset(void* s, int32_t c, uint32_t size);
|
||||
|
||||
static void romlib_data_init(void)
|
||||
{
|
||||
uint8_t *start = (uint8_t*)&_data_start;
|
||||
uint8_t *end = (uint8_t*)&_data_end;
|
||||
uint8_t *load = (uint8_t*)&_data_load_addr;
|
||||
int len = (end - start);
|
||||
|
||||
memcpy(start, load, len);
|
||||
}
|
||||
|
||||
static void romlib_bss_init(void)
|
||||
{
|
||||
uint8_t *start = (uint8_t*)&_bss_start;
|
||||
uint8_t *end = (uint8_t*)&_bss_end;
|
||||
int len = (end - start);
|
||||
|
||||
memset(start, 0x0, len);
|
||||
}
|
||||
|
||||
void romlib_section_init(void) {
|
||||
romlib_data_init();
|
||||
romlib_bss_init();
|
||||
}
|
||||
Reference in New Issue
Block a user