move rtl_libc_init() in startup, fix SpiFlash pin On

This commit is contained in:
pvvx 2017-03-07 00:03:58 +03:00
parent 9c9e8912a0
commit ca07317b5b
9 changed files with 2371 additions and 2364 deletions

View file

@ -27,6 +27,7 @@ extern void HalWdgIntrHandle(void);
extern void xPortPendSVHandler(void);
extern void xPortSysTickHandler(void);
extern void vPortSVCHandler(void);
extern void rtl_libc_init(void);
//extern void ShowRamBuildInfo(void); // app_start.c: VOID ShowRamBuildInfo(VOID)
void HalNMIHandler_Patch(void);
void SDIO_Device_Off(void);
@ -116,13 +117,17 @@ void INFRA_START_SECTION InfraStart(void) {
int flash_en = HAL_PERI_ON_READ32(REG_SOC_FUNC_EN)
& (1 << BIT_SOC_FLASH_EN);
if (flash_en) {
SPI_FLASH_PIN_FCTRL(ON);
if(!SpicCmpDataForCalibrationRtl8195A()) {
DBG_8195A("ReInit SPIC...\n");
SpicInitRtl8195AV02(1,0);
// if(!SpicCmpDataForCalibrationRtl8195A()) {
DBG_8195A("ReInit Spic DIO...\n");
SpicInitRtl8195AV02(1, SpicDualBitMode);
#if 0
SpicFlashInitRtl8195A(SpicDualBitMode);
if(!SpicCmpDataForCalibrationRtl8195A()) {
// TODO: Spic Not Init!
// DBG_8195A("Spic error Init!\n");
// };
DBG_8195A("Spic error Init!\n"); while(1);
};
#endif
};
SpicNVMCalLoadAll();
SpicReadIDRtl8195A();
@ -149,7 +154,8 @@ void INFRA_START_SECTION InfraStart(void) {
VectorTableInitForOSRtl8195A(&vPortSVCHandler, &xPortPendSVHandler,
&xPortSysTickHandler);
if (flash_en)
SpicDisableRtl8195A();
SpicFlashInitRtl8195A(SpicDualBitMode); // DIO
SPI_FLASH_PIN_FCTRL(OFF);
#ifdef CONFIG_SDR_EN
// clear SDRAM bss
extern u8 __sdram_bss_start__[];
@ -163,6 +169,7 @@ void INFRA_START_SECTION InfraStart(void) {
"bic r0, r0, #7\n"
"mov sp, r0\n"
);
rtl_libc_init();
__low_level_init();
main();
}

View file

@ -6,7 +6,7 @@
#include "rtl_bios_data.h"
#include "va_list.h"
#define NOT_CHECK_LIBC_INIT 1
#define CHECK_LIBC_INIT 0
//-------------------------------------------------------------------------
// Function declarations
@ -82,7 +82,7 @@ int rtl_snprintf(char *str, size_t size, const char *fmt, ...) {
int result;
int w;
FILE f;
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
@ -113,7 +113,7 @@ int rtl_snprintf(char *str, size_t size, const char *fmt, ...) {
//----- rtl_sprintf()
int rtl_sprintf(char *str, const char *fmt, ...) {
FILE f;
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
@ -134,7 +134,7 @@ int rtl_sprintf(char *str, const char *fmt, ...) {
//----- rtl_printf()
int rtl_printf(const char *fmt, ...) {
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
@ -150,7 +150,7 @@ int rtl_printf(const char *fmt, ...) {
//----- rtl_vprintf()
int rtl_vprintf(const char *fmt, void *param) {
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
@ -167,7 +167,7 @@ int rtl_vsnprintf(char *str, size_t size, const char *fmt, void *param) {
int w;
int v11;
FILE f;
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
@ -197,7 +197,7 @@ int rtl_vsnprintf(char *str, size_t size, const char *fmt, void *param) {
//----- rtl_vfprintf()
int rtl_vfprintf(FILE *fp, const char *fmt0, va_list ap) {
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}

View file

@ -7,7 +7,7 @@
#include "rtl_bios_data.h"
#include "va_list.h"
#define NOT_CHECK_LIBC_INIT 1
#define CHECK_LIBC_INIT 0
//-------------------------------------------------------------------------
// Function declarations
@ -76,7 +76,7 @@ int snprintf(char *str, size_t size, const char *fmt, ...) {
int result;
int w;
FILE f;
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
@ -108,7 +108,7 @@ int snprintf(char *str, size_t size, const char *fmt, ...) {
int sprintf(char *str, const char *fmt, ...) {
FILE f;
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
@ -129,7 +129,7 @@ int sprintf(char *str, const char *fmt, ...) {
//----- printf()
int printf(const char *fmt, ...) {
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
@ -146,7 +146,7 @@ int printf(const char *fmt, ...) {
//----- vprintf()
int vprintf(const char * fmt, __VALIST param) {
//int vprintf(const char *fmt, void *param) {
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
@ -163,7 +163,7 @@ int vsnprintf(char *str, size_t size, const char *fmt, __VALIST param) {
int w;
int v11;
FILE f;
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
@ -193,7 +193,7 @@ int vsnprintf(char *str, size_t size, const char *fmt, __VALIST param) {
//----- vfprintf()
int vfprintf(FILE *fp, const char *fmt0, va_list ap) {
#if NOT_CHECK_LIBC_INIT
#if CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff