This commit is contained in:
pvvx 2017-03-06 02:22:35 +03:00
parent 05ec33236c
commit 9c9e8912a0
24 changed files with 2859 additions and 2451 deletions

View file

@ -8,6 +8,7 @@
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>

View file

@ -5,7 +5,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-948251149478650085" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-897121475649177215" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -16,7 +16,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-948251149478650085" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-897121475649177215" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>
@ -27,7 +27,7 @@
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-997554102294574118" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-950027335418731358" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD &quot;${INPUTS}&quot;" prefer-non-shared="true">
<language-scope id="org.eclipse.cdt.core.gcc"/>
<language-scope id="org.eclipse.cdt.core.g++"/>
</provider>

View file

@ -32,7 +32,7 @@ extern int inic_stop(void);
#define printf(...)
#endif
#define sscanf _sscanf
//#define sscanf _sscanf
#define SHOW_PRIVATE_OUT 1 // =0 - off, = 1 On
@ -62,6 +62,7 @@ extern int inic_stop(void);
* Variables Declarations
******************************************************/
extern struct netif xnetif[NET_IF_NUM];
/******************************************************
@ -70,7 +71,8 @@ extern struct netif xnetif[NET_IF_NUM];
static internal_scan_handler_t scan_result_handler_ptr = { 0, 0, 0, RTW_FALSE,
0, 0, 0, 0, 0 };
static internal_join_result_t* join_user_data;
extern rtw_mode_t wifi_mode;
rtw_mode_t wifi_mode = RTW_MODE_NONE;
//extern rtw_mode_t wifi_mode;
int error_flag = RTW_UNKNOWN;
uint32_t rtw_join_status;
#if ATCMD_VER == ATVER_2

View file

@ -9,7 +9,7 @@
#ifndef _RTL_STDLIB_H_
#define _RTL_STDLIB_H_
#if 0
#include <basic_types.h>
#include <strproc.h>
#include <diag.h>
@ -19,7 +19,7 @@
//
#define strlen(str) prvStrLen((const u8*)str)
#define strcmp(str1, str2) prvStrCmp((const u8*)str1, (const u8*)str2)
#define sscanf(src, format...) //TODO: Strtoul(src,0,16) / Strtoul(src,0,10)
//#define sscanf(src, format...) //TODO: Strtoul(src,0,16) / Strtoul(src,0,10)
#define strtok(str, delim) prvStrTok(str, delim)
#define strcpy(dst, src) prvStrCpy((u8 *)dst, (const u8*)src)
#define atoi(str) prvAtoi(str)
@ -37,5 +37,5 @@
//
#define malloc pvPortMalloc
#define free vPortFree
#endif
#endif //_RTL_STDLIB_H_

View file

@ -10,7 +10,7 @@
*/
#include "rtl_bios_data.h"
extern void * UartLogRomCmdTable;
/* ROM + startup.c */
RAM_DEDECATED_VECTOR_TABLE_SECTION IRQ_FUN NewVectorTable[64]; // 10000000
RAM_USER_IRQ_FUN_TABLE_SECTION IRQ_FUN UserIrqFunTable[64]; // 10000100
@ -37,9 +37,29 @@ INFRA_RAM_BSS_SECTION u32 _rand_z4, _rand_z3, _rand_z2, _rand_z1, _rand_first; /
/* ROM + RTL_CONSOL */
MON_RAM_BSS_SECTION u8 *ArgvArray[MAX_ARGV]; // 100006AC *ArgvArray[10] !
MON_RAM_BSS_SECTION u8 UartLogHistoryBuf[UART_LOG_HISTORY_LEN][UART_LOG_CMD_BUFLEN]; // 10000430 UartLogHistoryBuf[5][127] !
MON_RAM_BSS_SECTION volatile UART_LOG_CTL UartLogCtl; // 10000408
MON_RAM_BSS_SECTION volatile UART_LOG_CTL UartLogCtl; // 10000408
/*
= {
.NewIdx = 0,
.SeeIdx = 0,
.RevdNo = UART_LOG_HISTORY_LEN,
.EscSTS = 0,
.ExecuteCmd = 0,
.ExecuteEsc = 0,
.BootRdy = 0,
.Resvd = 0,
.pTmpLogBuf = &UartLogBuf,
.pfINPUT = (void*) &DiagPrintf,
.pCmdTbl = (PCOMMAND_TABLE) &UartLogRomCmdTable,
.CmdTblSz = 6,
.CRSTS = 0,
.pHistoryBuf = UartLogHistoryBuf,
.TaskRdy = 0
// .Sema
};
*/
MON_RAM_BSS_SECTION UART_LOG_BUF UartLogBuf; // 10000388
MON_RAM_BSS_SECTION volatile UART_LOG_CTL *pUartLogCtl; // 10000384
MON_RAM_BSS_SECTION volatile UART_LOG_CTL *pUartLogCtl = &UartLogCtl; // 10000384
/* ROM + LIB C */
LIBC_RAM_BSS_SECTION int __rtl_errno; // 10000bc4 __rtl_sread_v1_00(), __rtl_write_v1_00(), __rtl_lseek_v1_00(), __rtl_close_v1_00(), __rtl_sbrk_v1_00()..
LIBC_RAM_BSS_SECTION struct mallinfo __rtl_malloc_current_mallinfo; // 10000b9c __rom_mallocr_init_v1_00()

View file

@ -16,10 +16,10 @@
#define DEFAULT_BAUDRATE UART_BAUD_RATE_38400
#define BOOT_RAM_TEXT_SECTION __attribute__((section(".ram.boot.text")))
//#define BOOT_RAM_RODATA_SECTION __attribute__((section(".ram.boot.rodata")))
//#define BOOT_RAM_DATA_SECTION __attribute__((section(".ram.boot.data")))
//#define BOOT_RAM_BSS_SECTION __attribute__((section(".ram.boot.bss")))
#define BOOT_RAM_TEXT_SECTION // __attribute__((section(".boot.text")))
//#define BOOT_RAM_RODATA_SECTION __attribute__((section(".boot.rodata")))
//#define BOOT_RAM_DATA_SECTION __attribute__((section(".boot.data")))
//#define BOOT_RAM_BSS_SECTION __attribute__((section(".boot.bss")))
//-------------------------------------------------------------------------
// Function declarations
@ -32,14 +32,11 @@ extern _LONG_CALL_ VOID VectorTableInitRtl8195A(u32 StackP);
extern _LONG_CALL_ VOID HalInitPlatformLogUartV02(VOID);
extern _LONG_CALL_ VOID HalInitPlatformTimerV02(VOID);
//#pragma arm section code = ".ram.boot.text";
//#pragma arm section rodata = ".ram.boot.rodata", rwdata = ".ram.boot.data", zidata = ".ram.boot.bss";
//#pragma arm section code = ".boot.text";
//#pragma arm section rodata = ".boot.rodata", rwdata = ".boot.data", zidata = ".boot.bss";
typedef void (*START_FUNC)(void);
PRAM_FUNCTION_START_TABLE __attribute__((section(".data.pRamStartFun"))) pRamStartFun =
(PRAM_FUNCTION_START_TABLE) 0x10000BC8;
/* Start table: */
START_RAM_FUN_SECTION RAM_FUNCTION_START_TABLE __ram_start_table_start__ = {
RtlBootToSram + 1, // StartFun(), Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )

View file

@ -18,7 +18,6 @@
#include "wifi_conf.h"
#include "rtl_consol.h"
//#define INFRA_START_SECTION __attribute__((section(".infra.ram.start")))
//-------------------------------------------------------------------------
@ -28,7 +27,7 @@ extern void HalWdgIntrHandle(void);
extern void xPortPendSVHandler(void);
extern void xPortSysTickHandler(void);
extern void vPortSVCHandler(void);
extern void ShowRamBuildInfo(void); // app_start.c: VOID ShowRamBuildInfo(VOID)
//extern void ShowRamBuildInfo(void); // app_start.c: VOID ShowRamBuildInfo(VOID)
void HalNMIHandler_Patch(void);
void SDIO_Device_Off(void);
void VectorTableOverrideRtl8195A(u32 StackP);
@ -37,11 +36,10 @@ void SYSPlatformInit(void);
//-------------------------------------------------------------------------
// Data declarations
extern u8 __bss_start__, __bss_end__;
//extern HAL_TIMER_OP HalTimerOp;
IMAGE2_START_RAM_FUN_SECTION RAM_START_FUNCTION gImage2EntryFun0 = { InfraStart
+ 1 };
// HAL_GPIO_ADAPTER PINMUX_RAM_DATA_SECTION gBoot_Gpio_Adapter;
IMAGE2_START_RAM_FUN_SECTION RAM_START_FUNCTION gImage2EntryFun0 =
{ InfraStart + 1 };
//----- HalNMIHandler_Patch
void HalNMIHandler_Patch(void) {
@ -50,21 +48,23 @@ void HalNMIHandler_Patch(void) {
HalWdgIntrHandle(); // ROM: HalWdgIntrHandle = 0x3485;
}
/*
//----- VectorTableOverrideRtl8195A
void INFRA_START_SECTION VectorTableOverrideRtl8195A(u32 StackP) {
NewVectorTable[2] = HalNMIHandler_Patch;
}
*/
//----- SYSPlatformInit
void INFRA_START_SECTION SYSPlatformInit(void) {
HAL_SYS_CTRL_WRITE32(REG_SYS_EFUSE_SYSCFG0,
(HAL_SYS_CTRL_READ32(REG_SYS_EFUSE_SYSCFG0)
& (~(BIT_MASK_SYS_EEROM_LDO_PAR_07_04 << BIT_SHIFT_SYS_EEROM_LDO_PAR_07_04)))
| BIT_SYS_EEROM_LDO_PAR_07_04(6)); // & 0xF0FFFFFF | 0x6000000
| BIT_SYS_EEROM_LDO_PAR_07_04(6)); // & 0xF0FFFFFF | 0x6000000
HAL_SYS_CTRL_WRITE32(REG_SYS_XTAL_CTRL1,
(HAL_SYS_CTRL_READ32(REG_SYS_XTAL_CTRL1)
& (~(BIT_MASK_SYS_XTAL_DRV_RF1 << BIT_SHIFT_SYS_XTAL_DRV_RF1)))
| BIT_SYS_XTAL_DRV_RF1(1)); // & 0xFFFFFFE7 | 8;
| BIT_SYS_XTAL_DRV_RF1(1)); // & 0xFFFFFFE7 | 8;
}
//----- SDIO_Device_Off
@ -80,22 +80,67 @@ void INFRA_START_SECTION SDIO_Device_Off(void) {
& (~(BIT_HCI_SDIOD_PIN_EN)));
}
__weak void __low_level_init(void) {
// weak function
}
// weak main function !
__weak int main(void) {
HalPinCtrlRtl8195A(JTAG, 0, 1);
DiagPrintf("\r\nRTL Console ROM: Start - press key 'Up', Help '?'\r\n");
while (pUartLogCtl->ExecuteEsc != 1);
pUartLogCtl->RevdNo = 0;
pUartLogCtl->BootRdy = 1;
DiagPrintf("\r<RTL8710AF>");
while (1) {
while (pUartLogCtl->ExecuteCmd != 1);
UartLogCmdExecute(pUartLogCtl);
DiagPrintf("\r<RTL8710AF>");
pUartLogCtl->ExecuteCmd = 0;
}
return 0;
}
//----- InfraStart
void INFRA_START_SECTION InfraStart(void) {
NewVectorTable[2] = HalNMIHandler_Patch;
HAL_SYS_CTRL_WRITE32(REG_SYS_CLK_CTRL0,
HAL_SYS_CTRL_READ32(REG_SYS_CLK_CTRL0) | BIT4);
if (HalCommonInit() != HAL_OK)
DBG_8195A("Hal Common Init Failed.\n");
#ifdef CONFIG_TIMER_MODULE
HalTimerOpInit_Patch((VOID*) (&HalTimerOp));
#endif
// HAL_SYS_CTRL_WRITE32(REG_SYS_CLK_CTRL0, HAL_SYS_CTRL_READ32(REG_SYS_CLK_CTRL0) | BIT4);
DBG_8195A("==!== Enter Image 2 ====\n");
ShowRamBuildInfo(); // app_start.c: VOID ShowRamBuildInfo(VOID)
// ShowRamBuildInfo(); // app_start.c: VOID ShowRamBuildInfo(VOID)
memset(&__bss_start__, 0, &__bss_end__ - &__bss_start__);
int clk = (HAL_SYS_CTRL_READ32(REG_SYS_CLK_CTRL0)
>> BIT_SHIFT_PESOC_OCP_CPU_CK_SEL) & 1;
if (clk) {
int flash_en = HAL_PERI_ON_READ32(REG_SOC_FUNC_EN)
& (1 << BIT_SOC_FLASH_EN);
if (flash_en) {
if(!SpicCmpDataForCalibrationRtl8195A()) {
DBG_8195A("ReInit SPIC...\n");
SpicInitRtl8195AV02(1,0);
// if(!SpicCmpDataForCalibrationRtl8195A()) {
// TODO: Spic Not Init!
// DBG_8195A("Spic error Init!\n");
// };
};
SpicNVMCalLoadAll();
SpicReadIDRtl8195A();
}
};
while(!(HAL_READ8(LOG_UART_REG_BASE, 0x14) & BIT6)); // иначе глючит LogUART, если переключение CLK приходится на вывод символов !
#if CPU_CLOCK_SEL_DIV5_3
// 6 - 200000000 Hz, 7 - 10000000 Hz, 8 - 50000000 Hz, 9 - 25000000 Hz, 10 - 12500000 Hz, 11 - 4000000 Hz
HalCpuClkConfig(CPU_CLOCK_SEL_VALUE);
*((int *)(SYSTEM_CTRL_BASE+REG_SYS_SYSPLL_CTRL1)) |= (1<<17);// REG_SYS_SYSPLL_CTRL1 |= BIT_SYS_SYSPLL_DIV5_3
#else
// 0 - 166666666 Hz, 1 - 83333333 Hz, 2 - 41666666 Hz, 3 - 20833333 Hz, 4 - 10416666 Hz, 5 - 4000000 Hz
*((int *) (SYSTEM_CTRL_BASE + REG_SYS_SYSPLL_CTRL1)) &= ~(1 << 17); // REG_SYS_SYSPLL_CTRL1 &= ~BIT_SYS_SYSPLL_DIV5_3
HalCpuClkConfig(CPU_CLOCK_SEL_VALUE);
#endif
HalReInitPlatformLogUartV02();
/* HAL_LOG_UART_ADAPTER pUartAdapter;
pUartAdapter.BaudRate = UART_BAUD_RATE_38400;
HalLogUartSetBaudRate(&pUartAdapter); */
SystemCoreClockUpdate();
SYSPlatformInit();
En32KCalibration();
@ -103,8 +148,22 @@ void INFRA_START_SECTION InfraStart(void) {
SDIO_Device_Off();
VectorTableInitForOSRtl8195A(&vPortSVCHandler, &xPortPendSVHandler,
&xPortSysTickHandler);
if (clk)
if (flash_en)
SpicDisableRtl8195A();
_AppStart();
#ifdef CONFIG_SDR_EN
// clear SDRAM bss
extern u8 __sdram_bss_start__[];
extern u8 __sdram_bss_end__[];
if((int)__sdram_bss_end__-(int)__sdram_bss_start__ > 0)
memset(__sdram_bss_start__, 0, (int)__sdram_bss_end__-(int)__sdram_bss_start__);
#endif
// force SP align to 8 byte not 4 byte (initial SP is 4 byte align)
__asm(
"mov r0, sp\n"
"bic r0, r0, #7\n"
"mov sp, r0\n"
);
__low_level_init();
main();
}

View file

@ -56,7 +56,7 @@ SECTIONS
{
/* __ram_start_table_start__ = .; */
__ram_image1_text_start__ = .;
KEEP(*(SORT(.start.ram.data*)))
KEEP(*(.boot.start.ram.data*))
/* __image1_validate_code__ = .; */
KEEP(*(.image1.validate.rodata))
@ -67,18 +67,21 @@ SECTIONS
KEEP(*(.libc.reent))
KEEP(*(.rom.unc.data))
KEEP(*(.sdr.rand2.data))
__ram_image_end__ = .;
/* 0x100020c0: end */
PROVIDE (__ram_image_end__ = .); /* 0x100020c0: end */
/* boot & images data */
KEEP(*(.hal.ram.data))
KEEP(*(.hal.flash.data))
/* KEEP(*(.data)); ? */
build/obj/RTL00_SDKV35a/component/soc/realtek/8195a/fwlib/ram_lib/rtl_bios_data.o (.rodata*)
KEEP(*(.ram.boot.text))
build/obj/RTL00_SDKV35a/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.o (.rodata*)
KEEP(*(.boot.rodata*))
KEEP(*(.boot.text*))
KEEP(*(.boot.data))
__image1_bss_start__ = .;
KEEP(*(.boot.bss*))
__image1_bss_end__ = .;
__ram_image1_text_end__ = .;
} > BOOT_RAM
.romheap :
@ -249,4 +252,5 @@ SECTIONS
{
KEEP(*(.loader.head*))
}
ASSERT(__ram_image_end__ != 0x100020c0, "Error rom-bios-boot code & data!")
}

View file

@ -6,6 +6,8 @@
#include "rtl_bios_data.h"
#include "va_list.h"
#define NOT_CHECK_LIBC_INIT 1
//-------------------------------------------------------------------------
// Function declarations
@ -70,6 +72,7 @@ int libc_has_init;
void rtl_libc_init(void) {
__rom_mallocr_init_v1_00();
init_rom_libgloss_ram_map();
libc_has_init = 1;
}
//----- rtl_snprintf()
@ -79,10 +82,11 @@ int rtl_snprintf(char *str, size_t size, const char *fmt, ...) {
int result;
int w;
FILE f;
#if NOT_CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
libc_has_init = 1;
}
#endif
if (size >= 0) {
f._flags = 520;
if (size)
@ -109,11 +113,11 @@ 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 (!libc_has_init) {
rtl_libc_init();
libc_has_init = 1;
}
#endif
f._flags = 520;
f._w = 0x7FFFFFFF;
f._bf._size = 0x7FFFFFFF;
@ -130,10 +134,11 @@ int rtl_sprintf(char *str, const char *fmt, ...) {
//----- rtl_printf()
int rtl_printf(const char *fmt, ...) {
#if NOT_CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
libc_has_init = 1;
}
#endif
va_list args;
va_start (args, fmt);
int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr,
@ -145,10 +150,11 @@ int rtl_printf(const char *fmt, ...) {
//----- rtl_vprintf()
int rtl_vprintf(const char *fmt, void *param) {
#if NOT_CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
libc_has_init = 1;
}
#endif
int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr,
_rtl_impure_ptr->_stdout, fmt, *(va_list *)param);
__rtl_fflush_r_v1_00(_rtl_impure_ptr, _rtl_impure_ptr->_stdout);
@ -161,11 +167,11 @@ 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 (!libc_has_init) {
rtl_libc_init();
libc_has_init = 1;
}
#endif
if (size >= 0) {
if (size)
w = size - 1;
@ -191,10 +197,11 @@ 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 (!libc_has_init) {
rtl_libc_init();
libc_has_init = 1;
}
#endif
return __rtl_vfprintf_r_v1_00(_rtl_impure_ptr, fp, fmt0, ap);
}

View file

@ -0,0 +1,311 @@
/*
* RTL871x1Ax: RAM libc
* Created on: 22/02/2017
* Author: pvvx
*/
#include "rtl_bios_data.h"
#include "va_list.h"
#define NOT_CHECK_LIBC_INIT 1
//-------------------------------------------------------------------------
// Function declarations
//void libc_init();
//int snprintf(char *str, size_t size, const char *fmt, ...);
//int sprintf(char *str, const char *fmt, ...);
//int printf(const char *fmt, ...);
//int vprintf(const char *fmt, void *param);
//int vsnprintf(char *str, size_t size, const char *fmt, void *param);
//int vfprintf(FILE *fp, const char *fmt0, va_list ap);
//int memchr(const void *src_void, int c, size_t length);
//int memcmp(const void *m1, const void *m2, size_t n);
//int memcpy(void *dst0, const void *src0, size_t len0);
//int memmove(void *dst_void, const void *src_void, size_t length);
//int memset(void *m, int c, size_t n);
//char * strcat(char *s1, const char *s2);
//char * strchr(const char *s1, int i);
//int strcmp(const char *s1, const char *s2);
//char * strcpy(char *dst0, const char *src0);
//int strlen(const char *str);
//char * strncat(char *s1, const char *s2, size_t n);
//int strncmp(const char *s1, const char *s2, size_t n);
//char * strncpy(char *dst0, const char *src0, size_t count);
//char * strstr(const char *searchee, const char *lookfor);
//char * strsep(char **source_ptr, const char *delim);
//char * strtok(char *s, const char *delim);
// Extern Calls:
// extern int init_rom_libgloss_ram_map(_DWORD)
// extern int _rom_mallocr_init_v1_00(void)
// extern int __rtl_vfprintf_r_v1_00(_DWORD, _DWORD, _DWORD)
// extern int __rtl_fflush_r_v1_00(_DWORD, _DWORD)
// extern int __rtl_memchr_v1_00(_DWORD, _DWORD, _DWORD)
// extern int __rtl_memcmp_v1_00(_DWORD, _DWORD, _DWORD)
// extern int __rtl_memcpy_v1_00(_DWORD, _DWORD, _DWORD)
// extern int __rtl_memmove_v1_00(_DWORD, _DWORD, _DWORD)
// extern int __rtl_memset_v1_00(_DWORD, _DWORD, _DWORD)
// extern int __rtl_strcat_v1_00(_DWORD, _DWORD)
// extern int __rtl_strchr_v1_00(_DWORD, _DWORD)
// extern int __rtl_strcmp_v1_00(_DWORD, _DWORD)
// extern int __rtl_strcpy_v1_00(_DWORD, _DWORD)
// extern int __rtl_strlen_v1_00(_DWORD)
// extern int __rtl_strncat_v1_00(_DWORD, _DWORD, _DWORD)
// extern int __rtl_strncmp_v1_00(_DWORD, _DWORD, _DWORD)
// extern int __rtl_strncpy_v1_00(_DWORD, _DWORD, _DWORD)
// extern int __rtl_strstr_v1_00(_DWORD, _DWORD)
// extern int __rtl_strsep_v1_00(_DWORD, _DWORD)
// extern int __rtl_strtok_v1_00(_DWORD, _DWORD)
//-------------------------------------------------------------------------
// Data declarations
extern struct _reent * _rtl_impure_ptr;
extern int libc_has_init;
// extern impure_ptr
// extern impure_ptr
//-------------------------------------------------------------------------
// Function
//----- snprintf()
int snprintf(char *str, size_t size, const char *fmt, ...) {
va_list args;
va_start (args, fmt);
int result;
int w;
FILE f;
#if NOT_CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
#endif
if (size >= 0) {
f._flags = 520;
if (size)
w = size - 1;
else
w = 0;
f._w = w; /* write space left for putc() */
f._bf._size = w;
f._file = -1; /* fileno, if Unix descriptor, else -1 */
f._p = str; /* current position in (some) buffer */
f._bf._base = str;
result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr, &f, fmt, args);
if (result + 1 < 0)
_rtl_impure_ptr->_errno = 139;
if (size)
*f._p = 0;
} else {
_rtl_impure_ptr->_errno = 139;
result = -1;
}
return result;
}
//----- sprintf()
int sprintf(char *str, const char *fmt, ...) {
FILE f;
#if NOT_CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
#endif
f._flags = 520;
f._w = 0x7FFFFFFF;
f._bf._size = 0x7FFFFFFF;
f._file = -1;
f._p = str;
f._bf._base = str;
va_list args;
va_start (args, fmt);
int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr, &f, fmt, args);
*f._p = 0;
// va_end (args);
return result;
}
//----- printf()
int printf(const char *fmt, ...) {
#if NOT_CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
#endif
va_list args;
va_start (args, fmt);
int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr,
_rtl_impure_ptr->_stdout, fmt, args);
__rtl_fflush_r_v1_00(_rtl_impure_ptr, _rtl_impure_ptr->_stdout);
// va_end (args);
return result;
}
//----- vprintf()
int vprintf(const char * fmt, __VALIST param) {
//int vprintf(const char *fmt, void *param) {
#if NOT_CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
#endif
int result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr,
_rtl_impure_ptr->_stdout, fmt, param);
__rtl_fflush_r_v1_00(_rtl_impure_ptr, _rtl_impure_ptr->_stdout);
return result;
}
//----- vsnprintf()
int vsnprintf(char *str, size_t size, const char *fmt, __VALIST param) {
int result;
int w;
int v11;
FILE f;
#if NOT_CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
#endif
if (size >= 0) {
if (size)
w = size - 1;
else
w = 0;
f._flags = 520;
f._p = str;
f._bf._base = str;
f._w = w;
f._bf._size = w;
f._file = -1;
result = __rtl_vfprintf_r_v1_00(_rtl_impure_ptr, &f, fmt, param);
if (result + 1 < 0)
_rtl_impure_ptr->_errno = 139;
if (size)
*f._p = 0;
} else {
_rtl_impure_ptr->_errno = 139;
result = -1;
}
return result;
}
//----- vfprintf()
int vfprintf(FILE *fp, const char *fmt0, va_list ap) {
#if NOT_CHECK_LIBC_INIT
if (!libc_has_init) {
rtl_libc_init();
}
#endif
return __rtl_vfprintf_r_v1_00(_rtl_impure_ptr, fp, fmt0, ap);
}
//----- memchr()
void * memchr(const void * src_void , int c , size_t length) {
return __rtl_memchr_v1_00(src_void, c, length);
}
//----- memcmp()
int memcmp(const void *m1, const void *m2, size_t n) {
return __rtl_memcmp_v1_00(m1, m2, n);
}
//----- memcpy()
void * memcpy(void *dst0, const void *src0, size_t len0) {
return __rtl_memcpy_v1_00(dst0, src0, len0);
}
//----- memmove()
void * memmove(void *dst_void, const void *src_void, size_t length) {
return __rtl_memmove_v1_00(dst_void, src_void, length);
}
//----- memset()
void * memset(void *m, int c, size_t n) {
return __rtl_memset_v1_00(m, c, n);
}
//----- strcat()
char * strcat(char *s1, const char *s2) {
return (char *) __rtl_strcat_v1_00(s1, s2);
}
//----- strchr()
char * strchr(const char *s1, int i) {
return (char *) __rtl_strchr_v1_00(s1, i);
}
//----- strcmp()
int strcmp(const char *s1, const char *s2) {
return __rtl_strcmp_v1_00(s1, s2);
}
//----- strcpy()
char * strcpy(char *dst0, const char *src0) {
return (char *) __rtl_strcpy_v1_00(dst0, src0);
}
//----- strlen()
size_t strlen(const char *str) {
return __rtl_strlen_v1_00(str);
}
//----- strncat()
char * strncat(char *s1, const char *s2, size_t n) {
return (char *) __rtl_strncat_v1_00(s1, s2, n);
}
//----- strncmp()
int strncmp(const char *s1, const char *s2, size_t n) {
return __rtl_strncmp_v1_00(s1, s2, n);
}
//----- strncpy()
char * strncpy(char *dst0, const char *src0, size_t count) {
return (char *) __rtl_strncpy_v1_00(dst0, src0, count);
}
//----- strstr()
char * strstr(const char *searchee, const char *lookfor) {
return (char *) __rtl_strstr_v1_00(searchee, lookfor);
}
//----- strsep()
char * strsep(char **source_ptr, const char *delim) {
return (char *) __rtl_strsep_v1_00(source_ptr, delim);
}
//----- strtok()
char * strtok(char *s, const char *delim) {
return (char *) __rtl_strtok_v1_00(s, delim);
}
int sscanf(const char *buf, const char *fmt, ...) {
va_list args;
int i;
va_start(args, fmt);
i = _vsscanf(buf, fmt, args);
va_end(args);
return i;
}
#define TOUPPER(CH) \
(((CH) >= 'a' && (CH) <= 'z') ? ((CH) - 'a' + 'A') : (CH))
int _stricmp (const char *s1, const char *s2)
{
while (*s2 != 0 && TOUPPER (*s1) == TOUPPER (*s2))
s1++, s2++;
return (int) (TOUPPER (*s1) - TOUPPER (*s2));
}
unsigned long long __aeabi_llsr(unsigned long long val, unsigned int shift)
{
u32 lo = ((u32)val >> shift) | ((u32)(val >> 32) << (32 - shift));
u32 hi = (u32)val >> shift;
return ((unsigned long long)hi << 32) | lo;
}

Binary file not shown.

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

View file

@ -4,6 +4,6 @@ r1
trst1
h
r
w4 0x40000210,0x00211157
w4 0x40000210,0x0211157
g
q

View file

@ -3,6 +3,6 @@ r
loadbin build/bin/ram_1.bin 0x10000bc8
loadbin build/bin/ram_2.bin 0x10006000
r
w4 0x40000210,0x20200113
w4 0x40000210,0x20111117
g
q

View file

@ -20,7 +20,7 @@
#include "lwip/tcp_impl.h"
rtw_mode_t wifi_mode = RTW_MODE_STA;
extern rtw_mode_t wifi_mode; // = RTW_MODE_STA;
mp3_server_setings mp3_serv = {0,{0}}; //{ PLAY_PORT, { PLAY_SERVER }};
@ -121,11 +121,18 @@ void fATWS(int argc, char *argv[]){
}
}
/* RAM/TCM/Heaps info */
extern void ShowMemInfo(void);
/*
void ShowMemInfo(void)
{
printf("\nCLK CPU\t\t%d Hz\nRAM heap\t%d bytes\nTCM heap\t%d bytes\n",
HalGetCpuClk(), xPortGetFreeHeapSize(), tcm_heap_freeSpace());
}
*/
// Mem info
// Mem info
void fATST(void){
printf("\nCLK CPU\t\t%d Hz\nRAM heap\t%d bytes\nTCM heap\t%d bytes\n",
HalGetCpuClk(), xPortGetFreeHeapSize(), tcm_heap_freeSpace());
void fATST(int argc, char *argv[]) {
ShowMemInfo();
#if 0 //CONFIG_DEBUG_LOG > 1
dump_mem_block_list();
tcm_heap_dump();
@ -151,7 +158,6 @@ void fATST(void){
}
}
#endif
}
void fATWC(int argc, char *argv[]){

View file

@ -38,7 +38,7 @@
//Priorities of the reader and the decoder thread. Higher = higher prio.
#define PRIO_MAD (tskIDLE_PRIORITY + 3 + PRIORITIE_OFFSET)
#define PRIO_READER (PRIO_MAD + 1)
#define PRIO_READER (PRIO_MAD)
#define mMIN(a, b) ((a < b)? a : b)
@ -467,7 +467,7 @@ void connect_start(void) {
//Fire up the reader task. The reader task will fire up the MP3 decoder as soon
//as it has read enough MP3 data.
tskreader_enable = 1;
if (xTaskCreate(tskreader, "tskreader", 300, NULL, PRIO_READER, NULL) != pdPASS) {
if (xTaskCreate(tskreader, "tskreader", 320, NULL, PRIO_READER, NULL) != pdPASS) {
#if DEBUG_MAIN_LEVEL > 0
DBG_8195A("\n%s xTaskCreate(tskreader) failed!\n", __FUNCTION__);
#endif
@ -481,6 +481,13 @@ void connect_start(void) {
#endif
}
/* RAM/TCM/Heaps info */
void ShowMemInfo(void)
{
printf("\nCLK CPU\t\t%d Hz\nRAM heap\t%d bytes\nTCM heap\t%d bytes\n",
HalGetCpuClk(), xPortGetFreeHeapSize(), tcm_heap_freeSpace());
}
/**
* @brief Main program.
* @param None
@ -496,22 +503,7 @@ void main(void)
CfgSysDebugInfo = -1;
CfgSysDebugWarn = -1;
#endif
if(HalGetCpuClk() != PLATFORM_CLOCK) {
#if CPU_CLOCK_SEL_DIV5_3
// 6 - 200000000 Hz, 7 - 10000000 Hz, 8 - 50000000 Hz, 9 - 25000000 Hz, 10 - 12500000 Hz, 11 - 4000000 Hz
HalCpuClkConfig(CPU_CLOCK_SEL_VALUE);
*((int *)(SYSTEM_CTRL_BASE+REG_SYS_SYSPLL_CTRL1)) |= (1<<17); // REG_SYS_SYSPLL_CTRL1 |= BIT_SYS_SYSPLL_DIV5_3
#else
// 0 - 166666666 Hz, 1 - 83333333 Hz, 2 - 41666666 Hz, 3 - 20833333 Hz, 4 - 10416666 Hz, 5 - 4000000 Hz
*((int *)(SYSTEM_CTRL_BASE+REG_SYS_SYSPLL_CTRL1)) &= ~(1<<17); // REG_SYS_SYSPLL_CTRL1 &= ~BIT_SYS_SYSPLL_DIV5_3
HalCpuClkConfig(CPU_CLOCK_SEL_VALUE);
#endif
HAL_LOG_UART_ADAPTER pUartAdapter;
pUartAdapter.BaudRate = UART_BAUD_RATE_38400;
HalLogUartSetBaudRate(&pUartAdapter);
SystemCoreClockUpdate();
En32KCalibration();
}
#ifdef CONFIG_WDG_ON_IDLE
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) & 0x1FFFFF);
WDGInitial(CONFIG_WDG_ON_IDLE * 1000); // 5 s
@ -526,13 +518,13 @@ void main(void)
#if DEBUG_MAIN_LEVEL > 0
vPortFree(pvPortMalloc(4)); // Init RAM heap
fATST(); // RAM/TCM/Heaps info
ShowMemInfo(); // RAM/TCM/Heaps info
#endif
start_init(); // in atcmd_user.c
/* pre-processor of application example */
pre_example_entry();
example_wlan_fast_connect(); // pre_example_entry();
/* wlan intialization */
#if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK)

View file

@ -12,8 +12,9 @@ CFLAGS += $(INCFLAGS)
SRC_O = $(patsubst %.c,%.o,$(patsubst sdk/%,$(SDK_PATH)%,$(ADD_SRC_C))) $(patsubst %.c,%.o,$(patsubst sdk/%,$(SDK_PATH)%,$(SRC_C)))
DRAM_O = $(patsubst %.c,%.o,$(patsubst sdk/%,$(SDK_PATH)%,$(DRAM_C)))
BOOT_O = $(patsubst %.c,%.o,$(patsubst sdk/%,$(SDK_PATH)%,$(BOOT_C)))
SRC_C_LIST = $(patsubst sdk/%,$(SDK_PATH)%,$(ADD_SRC_C)) $(patsubst sdk/%,$(SDK_PATH)%,$(SRC_C)) $(patsubst sdk/%,$(SDK_PATH)%,$(DRAM_C))
SRC_C_LIST = $(patsubst sdk/%,$(SDK_PATH)%,$(ADD_SRC_C)) $(patsubst sdk/%,$(SDK_PATH)%,$(SRC_C)) $(patsubst sdk/%,$(SDK_PATH)%,$(DRAM_C)) $(patsubst sdk/%,$(SDK_PATH)%,$(BOOT_C))
OBJ_LIST = $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%.o,$(SRC_C_LIST)))
DEPENDENCY_LIST = $(patsubst %.c,$(OBJ_DIR)/%.d,$(SRC_C_LIST))
@ -43,7 +44,7 @@ build_info:
@mv -f .ver project/inc/$@.h
.PHONY: application
application: build_info $(SRC_O) $(DRAM_O)
application: build_info $(SRC_O) $(DRAM_O) $(BOOT_O)
@echo "==========================================================="
@echo "Make BootLoader (ram_1.p.bin, ram_1.r.bin)"
# @echo "==========================================================="
@ -80,6 +81,13 @@ $(DRAM_O): %.o : %.c
@$(CC) $(CFLAGS) $(INCFLAGS) -c $< -o $(OBJ_DIR)/$@
@$(OBJCOPY) --prefix-alloc-sections .sdram $(OBJ_DIR)/$@
@$(CC) -MM $(CFLAGS) $(INCFLAGS) $< -MT $@ -MF $(OBJ_DIR)/$(patsubst %.o,%.d,$@)
$(BOOT_O): %.o : %.c
@echo $<
@mkdir -p $(OBJ_DIR)/$(dir $@)
@$(CC) $(CFLAGS) $(INCFLAGS) -c $< -o $(OBJ_DIR)/$@
@$(OBJCOPY) --prefix-alloc-sections .boot $(OBJ_DIR)/$@
@$(CC) -MM $(CFLAGS) $(INCFLAGS) $< -MT $@ -MF $(OBJ_DIR)/$(patsubst %.o,%.d,$@)
-include $(DEPENDENCY_LIST)

View file

@ -81,17 +81,24 @@ INCLUDES += sdk/component/common/application/xmodem
# -------------------------------------------------------------------
SRC_C =
DRAM_C =
BOOT_C =
#bootloader
SRC_C += sdk/component/soc/realtek/8195a/fwlib/ram_lib/rtl_bios_data.c
BOOT_C += sdk/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.c
#cmsis
SRC_C += sdk/component/soc/realtek/8195a/cmsis/device/system_8195a.c
#console
DRAM_C += sdk/component/common/api/at_cmd/atcmd_ethernet.c
DRAM_C += sdk/component/common/api/at_cmd/atcmd_lwip.c
DRAM_C += sdk/component/common/api/at_cmd/atcmd_sys.c
DRAM_C += sdk/component/common/api/at_cmd/atcmd_wifi.c
SRC_C += sdk/component/common/api/at_cmd/log_service.c
#DRAM_C += sdk/component/common/api/at_cmd/atcmd_ethernet.c
#DRAM_C += sdk/component/common/api/at_cmd/atcmd_lwip.c
#DRAM_C += sdk/component/common/api/at_cmd/atcmd_sys.c
#DRAM_C += sdk/component/common/api/at_cmd/atcmd_wifi.c
#SRC_C += sdk/component/common/api/at_cmd/log_service.c
#SRC_C += sdk/component/soc/realtek/8195a/misc/driver/low_level_io.c
#SRC_C += sdk/component/soc/realtek/8195a/misc/driver/rtl_consol.c
SRC_C += sdk/component/soc/realtek/8195a/misc/driver/rtl_console_new.c
#network - api
SRC_C += sdk/component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_eap_config.c
@ -346,7 +353,7 @@ SRC_C += sdk/component/common/application/xmodem/uart_fw_update.c
# -------------------------------------------------------------------
ADD_SRC_C =
# REVERSED
ADD_SRC_C += sdk/component/soc/realtek/8195a/cmsis/device/app_start.c
#ADD_SRC_C += sdk/component/soc/realtek/8195a/cmsis/device/app_start.c
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_dac.c
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_common.c
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_soc_ps_monitor.c
@ -363,8 +370,6 @@ ADD_SRC_C += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/ram_pvv
ADD_SRC_C += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/ram_libgloss_retarget.c
ADD_SRC_C += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/rtl_eabi_cast_ram.c
ADD_SRC_C += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/rtl_math_ram.c
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/ram_lib/rtl_bios_data.c
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.c
# -------------------------------------------------------------------
# SAMPLES
# -------------------------------------------------------------------
@ -372,10 +377,10 @@ ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/ram_lib/rtl_boot.c
#ADD_SRC_C += sdk/component/common/example/googlenest/example_google.c
#ADD_SRC_C += sdk/component/common/example/mdns/example_mdns.c
#ADD_SRC_C += sdk/component/common/example/socket_select/example_socket_select.c
ADD_SRC_C += sdk/component/common/example/uart_atcmd/example_uart_atcmd.c
ADD_SRC_C += sdk/component/common/example/wlan_fast_connect/example_wlan_fast_connect.c
#ADD_SRC_C += sdk/component/common/example/uart_atcmd/example_uart_atcmd.c
#ADD_SRC_C += sdk/component/common/example/xml/example_xml.c
ADD_SRC_C += sdk/component/common/example/example_entry.c
#ADD_SRC_C += sdk/component/common/example/example_entry.c
#ADD_SRC_C += sdk/component/common/drivers/sdio/realtek/sdio_host/src/sd.c
#ADD_SRC_C += sdk/component/common/drivers/sdio/realtek/sdio_host/src/sdio_host.c
#ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_sdio_host.c
@ -405,7 +410,6 @@ ADD_SRC_C += project/src/mad/stream.c
#driver
ADD_SRC_C += project/src/driver/i2s_freertos.c
ADD_SRC_C += project/src/driver/console_api.c
#include
INCLUDES += project/inc/mad