This commit is contained in:
pvvx 2017-10-19 08:42:35 +03:00
parent b075b615b6
commit 8c8b03208e
28 changed files with 2887 additions and 2556 deletions

View file

@ -830,6 +830,45 @@
</configuration>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1640084941;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.421691648">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1725581254;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1413280155">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.15138288;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1929075018">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.128381215;cdt.managedbuild.tool.gnu.c.compiler.input.793217918">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.450606865;cdt.managedbuild.tool.gnu.c.compiler.input.1191704832">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.788201990;cdt.managedbuild.tool.gnu.cpp.compiler.input.399931222">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.117920953;cdt.managedbuild.tool.gnu.cpp.compiler.input.919033704">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.119146776;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1036286501">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.1328486011;cdt.managedbuild.tool.gnu.c.compiler.input.1770660294">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1390387922;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1624349386">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1871560757;cdt.managedbuild.tool.gnu.cpp.compiler.input.1539036791">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1154716753;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.188668818">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="all" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
@ -920,45 +959,14 @@
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="runsdram" path="" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>mingw32-make.exe</buildCommand>
<buildArguments>-s</buildArguments>
<buildTarget>runsdram</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
</buildTargets>
</storageModule>
<storageModule moduleId="scannerConfiguration">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1640084941;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.421691648">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1725581254;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.1413280155">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.15138288;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1929075018">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.release.128381215;cdt.managedbuild.tool.gnu.c.compiler.input.793217918">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.450606865;cdt.managedbuild.tool.gnu.c.compiler.input.1191704832">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.release.788201990;cdt.managedbuild.tool.gnu.cpp.compiler.input.399931222">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.117920953;cdt.managedbuild.tool.gnu.cpp.compiler.input.919033704">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.119146776;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1036286501">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.1328486011;cdt.managedbuild.tool.gnu.c.compiler.input.1770660294">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.1390387922;ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1624349386">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404;cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.;cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1871560757;cdt.managedbuild.tool.gnu.cpp.compiler.input.1539036791">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
<scannerConfigBuildInfo instanceId="cdt.managedbuild.config.gnu.mingw.exe.release.510381534;cdt.managedbuild.config.gnu.mingw.exe.release.510381534.;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.1154716753;ilg.gnuarmeclipse.managedbuild.cross.tool.cpp.compiler.input.188668818">
<autodiscovery enabled="true" problemReportingEnabled="true" selectedProfileId=""/>
</scannerConfigBuildInfo>
</storageModule>
</cproject>

View file

@ -20,20 +20,42 @@ clean:
clean_all:
@$(MAKE) -f $(SDK_PATH)sdkbuild.mk clean_all
.PHONY: flashburn runram reset test readfullflash flashwebfs
.PHONY: flashburn runram reset test readfullflash flashwebfs flashboot
flashboot:
@$(MAKE) -f $(SDK_PATH)flasher.mk flashboot
flashburn:
#JLinkGDB-WrFlash.bat
@$(MAKE) -f $(SDK_PATH)flasher.mk flashburn
flash_OTA:
@$(MAKE) -f $(SDK_PATH)flasher.mk flash_OTA
webfs:
@$(MAKE) -f webfs.mk
flashwebfs:
@$(MAKE) -f webfs.mk
@$(MAKE) -f $(SDK_PATH)flasher.mk flashwebfs
#JLinkGDB-WrWebFs.bat
runram:
#JLink-RunRAM.bat
@$(MAKE) --f $(SDK_PATH)flasher.mk runram
runsdram:
#JLink-RunRAM.bat
@$(MAKE) --f $(SDK_PATH)flasher.mk runsdram
reset:
#JLink-Reset.bat
@$(MAKE) -f $(SDK_PATH)flasher.mk reset
test:
JLink-RTL00ConsoleROM.bat
#@make -f flasher.mk test
readfullflash:
#JLink-RdFullFlash.bat
@$(MAKE) -f $(SDK_PATH)flasher.mk readfullflash

View file

@ -32,6 +32,7 @@
#include <skbuff.h>
#ifdef PLATFORM_FREERTOS
#include "freertos_service.h"
#include "osdep_service.h"
#elif defined(PLATFORM_CMSIS_RTOS)
#include "rtx_service.h"
#endif

View file

@ -135,14 +135,14 @@ struct video_device
/* device info */
char name[32];
int vfl_type; /* device type,usally assign the define VFL_TYPE_XXX value */
int vfl_dir; /* receiver, transmitter or m2m,usally assign the define VFL_DIR_XXX value */
int vfl_dir; /* +72(dec) receiver, transmitter or m2m,usally assign the define VFL_DIR_XXX value */
/* 'minor' is set to -1 if the registration failed */
int minor;
u16 num; /* record the registered video device node number */
/* use bitops to set/clear/test flags,usally assign the define VFL_FL_XXX value */
unsigned long flags;
/* attribute to differentiate multiple indices on one physical device */
int index;
int index; // +88(dec)
/* V4L2 file handles */
//spinlock_t fh_lock; /* Lock for all v4l2_fhs */

View file

@ -173,7 +173,7 @@ static size_t xMinimumEverFreeBytesRemaining = 0;
#include "section_config.h"
SRAM_HEAP_SECTION
#endif
unsigned char ucHeap[configTOTAL_HEAP_SIZE];
unsigned char ucHeap[16384]; //configTOTAL_HEAP_SIZE
//extern void * __sdram_bss_end__;
//extern void * __ram_heap1_start__, __ram_heap1_end__, __ram_heap2_start__, __sdram_data_start__;

View file

@ -1,5 +1,5 @@
/*
* BootLoader Ver 0.2
* BootLoader Ver 0.3 (18/10/2017)
* Created on: 12/02/2017
* Author: pvvx
*/
@ -8,6 +8,7 @@
#include "rtl_bios_data.h"
#include "diag.h"
#include "rtl8195a/rtl8195a_sys_on.h"
#include "rtl8195a/rtl8195a_sdr.h"
#include "hal_spi_flash.h"
@ -30,7 +31,7 @@
#define DEFAULT_BOOT_CPU_CLOCK_SEL_VALUE (DEFAULT_BOOT_CLK_CPU-6)
#endif
#endif // DEFAULT_BOOT_CLK_CPU
#define FIX_SDR_CALIBRATION // for speed and low used SRAM
#define BOOT_RAM_TEXT_SECTION // __attribute__((section(".boot.text")))
//-------------------------------------------------------------------------
@ -65,7 +66,6 @@ extern _LONG_CALL_ VOID HalInitPlatformLogUartV02(VOID);
extern _LONG_CALL_ VOID HalInitPlatformTimerV02(VOID);
//extern _LONG_CALL_ VOID DramInit_rom(IN DRAM_DEVICE_INFO *DramInfo);
//extern _LONG_CALL_ u32 SdrCalibration_rom(VOID);
extern _LONG_CALL_ int SdrControllerInit_rom(PDRAM_DEVICE_INFO pDramInfo);
extern _LONG_CALL_ u32 SpicCmpDataForCalibrationRtl8195A(void); // compare read_data and golden_data
//extern _LONG_CALL_ VOID SpicWaitWipDoneRtl8195A(SPIC_INIT_PARA SpicInitPara); // wait spi-flash status register[0] = 0
//extern _LONG_CALL_ VOID SpicLoadInitParaFromClockRtl8195A(u8 CpuClkMode, u8 BaudRate, PSPIC_INIT_PARA pSpicInitPara);
@ -100,14 +100,14 @@ LOCAL void BOOT_RAM_TEXT_SECTION SetDebugFlgs() {
CfgSysDebugErr = -1;
ConfigDebugWarn = -1;
// ConfigDebugInfo = 0;
ConfigDebugErr = -1;
ConfigDebugErr = -1; // ~_DBG_SDR_;
#elif CONFIG_DEBUG_LOG > 0
// CfgSysDebugWarn = 0;
// CfgSysDebugInfo = 0;
CfgSysDebugErr = -1;
// ConfigDebugWarn = 0;
// ConfigDebugInfo = 0;
ConfigDebugErr = -1;
ConfigDebugErr = -1; // ~_DBG_SDR_;
#else
// CfgSysDebugWarn = 0;
// CfgSysDebugInfo = 0;
@ -125,15 +125,6 @@ LOCAL void BOOT_RAM_TEXT_SECTION JtagOn(void) {
HalPinCtrlRtl8195A(JTAG, 0, 1);
}
/* GetChipId() */
LOCAL uint8 INFRA_START_SECTION _Get_ChipId() {
uint8 ChipId = CHIP_ID_8710AF;
if (HALEFUSEOneByteReadROM(HAL_SYS_CTRL_READ32(REG_SYS_EFUSE_CTRL), 0xF8,
&ChipId, L25EOUTVOLTAGE) != 1)
DBG_8195A("Get Chip ID Failed\r");
return ChipId;
}
/*
* 16 bytes FIFO ... 16*11/38400 = 0.004583 sec
* (0.005/5)*166666666 = 166666.666 Tcpu
@ -281,11 +272,130 @@ LOCAL int BOOT_RAM_TEXT_SECTION InitSpic(uint8 SpicBitMode) {
}
ACTCK_FLASH_CCTRL(1);
SLPCK_FLASH_CCTRL(1);
HalPinCtrlRtl8195A(SPI_FLASH, 0, 1);
HalPinCtrlRtl8195A(SPI_FLASH, 0, ON);
InitSpicFlashType(&spic_table_flash);
return SetSpicBitMode(SpicBitMode);
}
#ifdef CONFIG_SDR_EN
/* GetChipId() */
LOCAL uint8 INFRA_START_SECTION _Get_ChipId() {
uint8 ChipId = CHIP_ID_8710AF;
if (HALEFUSEOneByteReadROM(HAL_SYS_CTRL_READ32(REG_SYS_EFUSE_CTRL), 0xF8,
&ChipId, L25EOUTVOLTAGE) != 1)
DBG_8195A("Get Chip ID Failed\r");
return ChipId;
}
LOCAL void INFRA_START_SECTION sdr_preinit(void) {
HAL_SYS_CTRL_WRITE32(REG_SYS_REGU_CTRL0,
((HAL_SYS_CTRL_READ32(REG_SYS_REGU_CTRL0) & 0xfffff) | BIT_SYS_REGU_LDO25M_ADJ(0x03))); // ROM: BIT_SYS_REGU_LDO25M_ADJ(0x0e)? HAL RAM BIT_SYS_REGU_LDO25M_ADJ(0x03)
LDO25M_CTRL(ON);
SRAM_MUX_CFG(0x2);
SDR_CLK_SEL(SDR_CLOCK_SEL_VALUE); // REG_PESOC_CLK_SEL
HalPinCtrlRtl8195A(SDR, 0, ON); // SDR_PIN_FCTRL(ON);
ACTCK_SDR_CCTRL(ON);
SLPCK_SDR_CCTRL(ON);
HAL_PERI_ON_WRITE32(REG_GPIO_PULL_CTRL4, 0);
MEM_CTRL_FCTRL(ON);
// HalDelayUs(1000);
}
#ifndef FIX_SDR_CALIBRATION
extern _LONG_CALL_ int SdrCalibration_rom(void);
extern _LONG_CALL_ unsigned int Rand(void);
extern _LONG_CALL_ int SdrControllerInit_rom(PDRAM_DEVICE_INFO pDramInfo);
LOCAL int INFRA_START_SECTION sdr_test(u32 LoopCnt) {
u32 LoopIndex = 0;
u32 Value32, Addr;
for (LoopIndex = 0; LoopIndex < LoopCnt; LoopIndex++) {
Value32 = Rand();
Addr = Rand();
Addr &= 0x1FFFFF;
Addr &= (~0x3);
HAL_SDRAM_WRITE32(Addr, Value32);
if (HAL_SDRAM_READ32(Addr) != Value32)
return 0;
}
return 1;
}
#endif
LOCAL int INFRA_START_SECTION sdr_init_from_flash(void) {
#define RdPipe 0
#if DEFAULT_BOOT_CLK_CPU < 6
#define TapCnt 0x11
#elif DEFAULT_BOOT_CLK_CPU == 7
#define TapCnt 0x23
#else
#define TapCnt 0x19
#endif
// set all_mode _idle
HAL_SDR_WRITE32(REG_SDR_CSR, 0x700);
// WRAP_MISC setting
HAL_SDR_WRITE32(REG_SDR_MISC, 0x00000001);
// PCTL setting
HAL_SDR_WRITE32(REG_SDR_DCR, 0x00000008);
HAL_SDR_WRITE32(REG_SDR_IOCR, RdPipe << PCTL_IOCR_RD_PIPE_BFO);
HAL_SDR_WRITE32(REG_SDR_EMR2, 0x00000000);
HAL_SDR_WRITE32(REG_SDR_EMR1, 0x00000006);
HAL_SDR_WRITE32(REG_SDR_MR, 0x00000022);
HAL_SDR_WRITE32(REG_SDR_DRR, 0x09030e07);
HAL_SDR_WRITE32(REG_SDR_TPR0, 0x00002652);
HAL_SDR_WRITE32(REG_SDR_TPR1, 0x00068873);
HAL_SDR_WRITE32(REG_SDR_TPR2, 0x00000042);
// start to init
HAL_SDR_WRITE32(REG_SDR_CCR, 0x01);
DBG_8195A("SDR calibration: %02x-%02x\n", RdPipe, TapCnt);
while ((HAL_SDR_READ32(REG_SDR_CCR) & 0x1) == 0x0);
// enter mem_mode
HAL_SDR_WRITE32(REG_SDR_CSR, 0x600);
#ifdef FIX_SDR_CALIBRATION
SDR_DDL_FCTRL(TapCnt); // SDR_DDL_FCTRL(0x11);
return 1;
#else
union { u8 b[8]; u16 s[4]; u32 l[2]; u64 d;} value;
// read calibration data from system data FLASH_SDRC_PARA_BASE
u32 reg = HAL_READ32(SYSTEM_CTRL_BASE, REG_SYS_SYSPLL_CTRL1);
u32 faddr = SPI_FLASH_BASE + FLASH_SDRC_PARA_BASE + ((reg & 0x70) >> 1) + ((reg & BIT17) >> 11) ; // step 8 in FLASH_SDRC_PARA_BASE[64 + 64 bytes]
value.d = *((volatile u64 *)faddr);
DBG_8195A("SDR flash calibration [%08x] %02x-%02x-%02x\n", faddr, value.b[0], value.b[4], value.b[6]);
if(value.s[0] == 0xFE01 && (value.b[4]^value.b[5]) == 0xFF && (value.b[6]^value.b[7]) == 0xFF) {
HAL_SDR_WRITE32(REG_SDR_IOCR, (HAL_SDR_READ32(REG_SDR_IOCR) & 0xff) | ((u32)value.b[4] << PCTL_IOCR_RD_PIPE_BFO));
SDR_DDL_FCTRL((u32)value.b[6]);
if(sdr_test(7))
return 1; // ok
else
DBG_8195A("Not valid SDR calibration in flash!\n");
} else
DBG_8195A("Error SDR calibration in flash!\n");
if(SdrCalibration_rom()) { // Внимание: дает завышенный TapCnt !
// DBG_8195A("SDR calibration: %02x-%02x-%02x\n", value.b[0], value.b[4], value.b[6]);
value.s[0] = 0xFE01;
value.b[4] = HAL_SDR_READ32(REG_SDR_IOCR) >> PCTL_IOCR_RD_PIPE_BFO;
value.b[5] = value.b[4] ^ 0xFF;
value.b[6] = HAL_PERI_ON_READ32(REG_PESOC_MEM_CTRL) >> BIT_SHIFT_PESOC_SDR_DDL_CTRL;
value.b[7] = value.b[6] ^ 0xFF;
// DBG_8195A("%08x: %02x-%02x-%02x)\n", faddr, value.b[0], value.b[4], value.b[6]);
if((*((volatile u16 *)(faddr)) & value.s[0]) == value.s[0]
&& (*((volatile u32 *)(faddr + 4)) & value.l[1]) == value.l[1]) {
*((volatile u32 *)(faddr + 4)) = value.l[1];
DBG_8195A("Write new calibration [%08x] %02x-%02x-%02x\n", faddr, value.b[0], value.b[4], value.b[6]);
HalDelayUs(1000);
*((volatile u16 *)(faddr)) = value.s[0];
} else {
DBG_8195A("Work recalibration: %02x-%02x-%02x!\n", value.b[0], value.b[4], value.b[6]);
}
return 2; // recalibration - ok
} else
DBG_8195A("SDR recalibration fail!\n");
return 0;
#endif // FIX_SDR_CALIBRATION
}
#endif // CONFIG_SDR_EN
/* SYSPlatformInit */
LOCAL void INFRA_START_SECTION SYSPlatformInit(void) {
@ -562,35 +672,36 @@ LOCAL void BOOT_RAM_TEXT_SECTION EnterImage15(int flg) {
else
DBG_8195A("\r===== Enter SRAM-Boot %d ====\n", flg);
#if CONFIG_DEBUG_LOG > 1
DBG_8195A("CPU CLK: %d Hz, SOC FUNC EN: %p\r\n", HalGetCpuClk(),
DBG_8195A("CPU CLK: %d Hz, SOC FUNC EN: %p\n", HalGetCpuClk(),
HAL_PERI_ON_READ32(REG_SOC_FUNC_EN));
#endif
#ifdef CONFIG_SDR_EN
uint8 ChipId = _Get_ChipId();
if (ChipId < CHIP_ID_8195AM) {
#endif
//----- SDRAM Off
SDR_PIN_FCTRL(OFF);
LDO25M_CTRL(OFF);
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) | BIT(21)); // Flag SDRAM Init
#ifdef CONFIG_SDR_EN
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) | BIT(21)); // Flag SDRAM Init or None
} else {
//----- SDRAM On
LDO25M_CTRL(ON);
HAL_SYS_CTRL_WRITE32(REG_SYS_REGU_CTRL0,
(HAL_SYS_CTRL_READ32(REG_SYS_REGU_CTRL0) & 0xfffff) | BIT_SYS_REGU_LDO25M_ADJ(0x0e));
SDR_PIN_FCTRL(ON);
sdr_preinit();
};
#endif
if (!InitSpic(SpicDualBitMode)) {
DBG_8195A("Spic Init Error!\n");
DBG_8195A("Spic Init fail!\n");
RtlConsolRam();
};
if ((HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) & BIT(21)) == 0) { // Flag SDRAM Init?
// extern DRAM_DEVICE_INFO SdrDramInfo_rom; // 50 MHz
if (!SdrControllerInit_rom(&SdrDramInfo)) { // 100 MHz
DBG_8195A("SDR Controller Init fail!\n");
#ifdef CONFIG_SDR_EN
if ((HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) & BIT(21)) == 0) { // Flag SDRAM No ReInit?
if(!sdr_init_from_flash()) {
DBG_8195A("SDR Init fail!\n");
RtlConsolRam();
}
#if 0 // Test SDRAM
#ifdef USE_SDRAM_TEST // Test SDRAM
else {
uint32 *ptr = SDR_SDRAM_BASE;
uint32 *ptr = (uint32 *)SDR_SDRAM_BASE;
uint32 tt = 0x55AA55AA;
for (int i = 0; i < 512 * 1024; i++) {
ptr[i] = tt++;
@ -601,23 +712,26 @@ LOCAL void BOOT_RAM_TEXT_SECTION EnterImage15(int flg) {
DBG_8195A("SDR err %p %p != %p!\n", &ptr[i], ptr[i], tt);
RtlConsolRam();
}
// ptr[i] = 0;
tt++;
};
DBG_8195A("SDR tst end\n");
DBG_8195A("SDR test ok\n");
};
#endif // Test SDRAM
#ifdef CONFIG_SDR_EN
// Тест и ожидание загрузки Jlink-ом sdram.bin (~7 sec)
if(flg && *((uint32 *)0x1FFF0000) == 0x12345678) {
*((volatile uint32 *)0x1FFF0000) = 0x87654321;
uint32 tt = 0x03ffffff; // ~7 sec
DBG_8195A("Waiting for SDRAM to load...\n");
// __asm__ __volatile__ ("cpsid f\n");
while(*((volatile uint32 *)0x1FFF0000) == 0x87654321 && tt--);
// __asm__ __volatile__ ("cpsie f\n");
if(*((volatile uint32 *)0x1FFF0000) == 1)
DBG_8195A("SDRAM load ok\n");
}
#endif // test
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) | BIT(21)); // Flag SDRAM Init
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) | BIT(21)); // Flag SDRAM No ReInit
};
#endif // CONFIG_SDR_EN
if (!flg)
loadUserImges(IsForceLoadDefaultImg2() + 1);

View file

@ -1,5 +1,5 @@
/*
* StartUp SDK
* StartUp USDK v0.2 (19/10/2017)
* Created on: 02/03/2017
* Author: pvvx
*/
@ -41,6 +41,7 @@ void SDIO_Device_Off(void);
//void VectorTableOverrideRtl8195A(u32 StackP);
void SYSPlatformInit(void);
#define FIX_SDR_CALIBRATION // for speed :)
//-------------------------------------------------------------------------
// Data declarations
extern u8 __bss_start__, __bss_end__;
@ -49,7 +50,63 @@ extern const unsigned char cus_sig[32]; // images name
IMAGE2_START_RAM_FUN_SECTION RAM_START_FUNCTION gImage2EntryFun0 =
{ InfraStart + 1 };
#ifdef CONFIG_SDR_EN
#ifdef FIX_SDR_CALIBRATION // for speed :)
#include "rtl8195a/rtl8195a_sdr.h"
LOCAL void sdr_init(void) {
HAL_SYS_CTRL_WRITE32(REG_SYS_REGU_CTRL0,
((HAL_SYS_CTRL_READ32(REG_SYS_REGU_CTRL0) & 0xfffff) | BIT_SYS_REGU_LDO25M_ADJ(0x03))); // ROM: BIT_SYS_REGU_LDO25M_ADJ(0x0e)? HAL RAM BIT_SYS_REGU_LDO25M_ADJ(0x03)
LDO25M_CTRL(ON);
SRAM_MUX_CFG(0x2);
SDR_CLK_SEL(SDR_CLOCK_SEL_VALUE); // REG_PESOC_CLK_SEL
HAL_PERI_ON_WRITE32(REG_GPIO_PULL_CTRL4, 0);
ACTCK_SDR_CCTRL(ON);
SLPCK_SDR_CCTRL(ON);
HalPinCtrlRtl8195A(SDR, 0, ON); // SDR_PIN_FCTRL(ON);
MEM_CTRL_FCTRL(ON);
// HalDelayUs(1000);
// read calibration data from system data FLASH_SDRC_PARA_BASE
union { u8 b[8]; u16 s[4]; u32 l[2]; u64 d;} value;
u32 faddr = SPI_FLASH_BASE + FLASH_SDRC_PARA_BASE + CPU_CLOCK_SEL_VALUE*8 + CPU_CLOCK_SEL_DIV5_3*8*8; // step 8 in FLASH_SDRC_PARA_BASE[64 + 64 bytes]
value.d = *((volatile u64 *)faddr);
if(value.s[0] == 0xFE01 && (value.b[4]^value.b[5]) == 0xFF && (value.b[6]^value.b[7]) == 0xFF) {
DBG_8195A("SDR flash calibration [%08x]: %02x-%02x ", faddr, value.b[4], value.b[6]);
} else {
value.b[4] = 0; // TapCnt
#if CONFIG_CPU_CLK < 6
value.b[6] = 0x11; // RdPipe
#elif CONFIG_CPU_CLK == 7
value.b[6] = 0x23; // RdPipe
#else
value.b[6] = 0x19; // RdPipe
#endif
DBG_8195A("Use fix SDR calibration: %02x-%02x ", value.b[4], value.b[6]);
}
// set all_mode _idle
HAL_SDR_WRITE32(REG_SDR_CSR, 0x700);
// WRAP_MISC setting
HAL_SDR_WRITE32(REG_SDR_MISC, 0x00000001);
// PCTL setting
HAL_SDR_WRITE32(REG_SDR_DCR, 0x00000008);
HAL_SDR_WRITE32(REG_SDR_IOCR, (u32)value.b[4] << PCTL_IOCR_RD_PIPE_BFO);
HAL_SDR_WRITE32(REG_SDR_EMR2, 0x00000000);
HAL_SDR_WRITE32(REG_SDR_EMR1, 0x00000006);
HAL_SDR_WRITE32(REG_SDR_MR, 0x00000022);
HAL_SDR_WRITE32(REG_SDR_DRR, 0x09030e07);
HAL_SDR_WRITE32(REG_SDR_TPR0, 0x00002652);
HAL_SDR_WRITE32(REG_SDR_TPR1, 0x00068873);
HAL_SDR_WRITE32(REG_SDR_TPR2, 0x00000042);
// start to init
HAL_SDR_WRITE32(REG_SDR_CCR, 0x01);
while ((HAL_SDR_READ32(REG_SDR_CCR) & 0x1) == 0x0)
DBG_8195A(".");
// enter mem_mode
HAL_SDR_WRITE32(REG_SDR_CSR, 0x600);
SDR_DDL_FCTRL((u32)value.b[6]);
DBG_8195A(" ok\n");
}
#endif // FIX_SDR_CALIBRATION
#endif // CONFIG_SDR_EN
/*
//----- HalNMIHandler_Patch
void HalNMIHandler_Patch(void) {
@ -167,30 +224,36 @@ extern HAL_GPIO_ADAPTER gBoot_Gpio_Adapter;
};
*/
// SpicFlashInitRtl8195A(SpicDualBitMode); // SpicReadIDRtl8195A(); SpicDualBitMode
#ifdef CONFIG_SDR_EN
//---- SDRAM
uint8 ChipId = HalGetChipId();
if (ChipId >= CHIP_ID_8195AM) {
#ifdef CONFIG_SDR_EN
if((HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) & BIT(21)) == 0) { // уже загружена?
if((HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) & BIT(21)) == 0) { // SDR not init?
#ifdef FIX_SDR_CALIBRATION // for speed :)
sdr_init();
#else // not FIX_SDR_CALIBRATION
SdrCtrlInit();
if(SdrControllerInit()) {
if(!SdrControllerInit()) {
DBG_8195A("SDR Controller Init fail!\n");
};
#endif // FIX_SDR_CALIBRATION
};
#endif
// clear SDRAM bss
extern uint8 __sdram_bss_start__[];
extern uint8 __sdram_bss_end__[];
if((uint32)__sdram_bss_end__-(uint32)__sdram_bss_start__ > 0)
memset(__sdram_bss_start__, 0, (uint32)__sdram_bss_end__-(uint32)__sdram_bss_start__);
}
else
else // if (ChipId < CHIP_ID_8195AM)
{
//----- SDRAM Off
SDR_PIN_FCTRL(OFF);
LDO25M_CTRL(OFF);
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) | BIT(21)); // Flag SDRAM Off
};
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) | BIT(21)); // Flag SDRAM Init or None
#else
HAL_PERI_ON_WRITE32(REG_SOC_FUNC_EN, HAL_PERI_ON_READ32(REG_SOC_FUNC_EN) & (~BIT(21))); // Flag SDRAM Not Init
#endif // CONFIG_SDR_EN
//----- Close Flash
SPI_FLASH_PIN_FCTRL(OFF);

View file

@ -24,7 +24,7 @@
//2 REG_NOT_VALID
//2 REG_SOC_FUNC_EN
// BIT(21) SDRAM
// BIT(21) if 1 -> SDRAM No ReInit
#define BIT_SOC_SECURITY_ENGINE_EN BIT(20)
#define BIT_SOC_GTIMER_EN BIT(16)
#define BIT_SOC_GDMA1_EN BIT(14)

View file

@ -432,6 +432,7 @@ VOID
else {
return 1;
}
return 1;
}
@ -1060,15 +1061,15 @@ MemTest(
// Value32 = Sdr_Rand2();
// Addr = Sdr_Rand2();
Value32 = Rand();
Addr = Rand();
Addr &= 0x1FFFFF;
Addr &= (~0x3);
Addr = Rand() & 0x1FFFFC;
HAL_SDRAM_WRITE32(Addr, Value32);
u32 x = HAL_SDRAM_READ32(Addr);
// DBG_8195A("[%p] %p %p\n", Addr, Value32, x);
if (HAL_SDRAM_READ32(Addr) != Value32) {
if (x != Value32) {
DBG_8195A("Test %d: No match addr 0x%x => 0x%x != 0x%x\n", LoopIndex,
Addr, Value32, HAL_SDRAM_READ32(Addr));
Addr, Value32, x);
return _FALSE;
}
else {

View file

@ -177,6 +177,7 @@ SECTIONS
LONG(0)
UartLogRamCmdTable = .;
KEEP(*(SORT(.mon.tab*)))
KEEP(*(SORT(.sdram.mon.tab*)))
UartLogRamCmdTable_end = .;
LONG(0)
} > BD_RAM

View file

@ -122,6 +122,35 @@ SECTIONS
KEEP(*(.custom.validate.rodata*))
} > BD_RAM
.sdr_text :
{
__sdram_data_start__ = .;
INCLUDE "sdram_obj.txt"
*(.sdram.text*)
} > SDRAM_RAM
.sdr_rodata :
{
*(.sdram.rodata*)
} > SDRAM_RAM
.sdr_data :
{
*(.sdram.data*)
__sdram_data_end__ = .;
} > SDRAM_RAM
.sdr_bss :
{
__sdram_bss_start__ = .;
*(.uvc.ram.bss)
*(.sdram.bss*)
INCLUDE "sdram_bss.txt"
__sdram_bss_end__ = .;
. = ALIGN(8);
__sdram_heap_start__ = .;
} > SDRAM_RAM
.ram_image2.text :
{
*(.infra.ram.start*)
@ -226,32 +255,6 @@ SECTIONS
} > BD_RAM
__ram_heap2_end__ = 0x10070000;
.sdr_text :
{
__sdram_data_start__ = .;
*(.sdram.text*)
} > SDRAM_RAM
.sdr_rodata :
{
*(.sdram.rodata*)
} > SDRAM_RAM
.sdr_data :
{
*(.sdram.data*)
__sdram_data_end__ = .;
} > SDRAM_RAM
.sdr_bss :
{
__sdram_bss_start__ = .;
*(.uvc.ram.bss)
*(.sdram.bss*)
__sdram_bss_end__ = .;
. = ALIGN(8);
__sdram_heap_start__ = .;
} > SDRAM_RAM
__sdram_heap_end__ = 0x30200000;
.boot.head :

View file

@ -90,7 +90,7 @@ mp: OTA_IMAGE = $(BIN_DIR)/ota_mp.bin
TST_IMAGE = $(BIN_DIR)/ram_2.bin
.PHONY: genbin1 genbin23 flashburn reset test readfullflash flashwebfs flash_OTA
.PHONY: genbin1 genbin23 flashburn reset test readfullflash flashwebfs flash_OTA falshboot runsdram
.NOTPARALLEL: all mp genbin1 genbin23 flashburn reset test readfullflash _endgenbin flashwebfs flash_OTA
all: $(ELFFILE) $(OTA_IMAGE) $(FLASH_IMAGE) _endgenbin
@ -113,12 +113,14 @@ reset:
@$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed 1000 $(FLASHER_PATH)RTL_Reset.JLinkScript
runram:
@$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed 1000 $(FLASHER_PATH)RTL_RunRAM.JLinkScript
$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed 1000 $(FLASHER_PATH)RTL_RunRAM.JLinkScript
runsdram:
$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed 1000 $(FLASHER_PATH)RTL_RunRAM_SDR.JLinkScript
readfullflash:
@$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed 1000 $(FLASHER_PATH)RTL_FFlash.JLinkScript
flashburn:
@echo define call1>$(FLASHER_PATH)flash_file.jlink
@echo SetFirwareSize build/bin/ram_all.bin>>$(FLASHER_PATH)flash_file.jlink
@ -145,6 +147,18 @@ flashwebfs:
@$(GDB) -x $(FLASHER_PATH)gdb_wrfile.jlink
#@taskkill /F /IM $(JLINK_GDBSRV)
flashboot:
@echo define call1>$(FLASHER_PATH)file_info.jlink
@echo set '$$'ImageSize = $(shell printf '0x%X\n' $$(stat --printf="%s" $(RAM1P_IMAGE)))>>$(FLASHER_PATH)file_info.jlink
@echo set '$$'ImageAddr = 0x00000>>$(FLASHER_PATH)file_info.jlink
@echo end>>$(FLASHER_PATH)file_info.jlink
@echo define call2>>$(FLASHER_PATH)file_info.jlink
@echo FlasherWrite $(RAM1P_IMAGE) '$$'ImageAddr '$$'ImageSize>>$(FLASHER_PATH)file_info.jlink
@echo end>>$(FLASHER_PATH)file_info.jlink
@cmd /K start $(JLINK_PATH)$(JLINK_GDBSRV) -device Cortex-M3 -if SWD -ir -endian little -speed 1000
@$(GDB) -x $(FLASHER_PATH)gdb_wrfile.jlink
flashespfs:
@echo define call1>$(FLASHER_PATH)file_info.jlink
@echo set '$$'ImageSize = $(shell printf '0x%X\n' $$(stat --printf="%s" $(BIN_DIR)/webpages.espfs))>>$(FLASHER_PATH)file_info.jlink
@ -184,6 +198,12 @@ flashwebfs:
-c "rtl8710_flash_write $(BIN_DIR)/WEBFiles.bin 0xd0000" \
-c "rtl8710_reboot" -c "reset run" -c shutdown
flashboot:
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "transport select swd" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "adapter_khz $(FLASHER_SPEED)" -c "reset halt" \
-c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" \
-c "rtl8710_flash_write $(RAM1P_IMAGE) 0" \
-c "rtl8710_reboot" -c "reset run" -c shutdown
flashespfs:
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "transport select swd" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "adapter_khz $(FLASHER_SPEED)" -c "reset halt" \
-c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" \

View file

@ -7,6 +7,6 @@ r
loadbin build/bin/ram_1.r.bin 0x10000bc8
loadbin build/bin/ram_2.bin 0x10006000
r
w4 0x40000210,0x20111157
w4 0x40000210,0x20011113
g
q

View file

@ -38,37 +38,38 @@ set mem inaccessible-by-default off
# Setup GDB FOR FASTER DOWNLOADS
set remote memory-write-packet-size 8192
set remote memory-write-packet-size fixed
set $SPI_FLASH_BASE = 0x98000000
end
#############
# Boot_Flash
define SetBootFlash
printf "SetBoot = Flash:\n"
monitor long 0x40000210 = 0x211157
monitor long 0x40000210 = 0x00011113
end
# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )
define SetBootCall0
printf "SetBoot = Call0:\n"
monitor long 0x40000210 = 0x80111157
monitor long 0x40000210 = 0x80011113
end
# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 )
define SetBootCall1
printf "SetBoot = Call1:\n"
monitor long 0x40000210 = 0x20111157
monitor long 0x40000210 = 0x20011113
end
# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 )
define SetBootCall2
printf "SetBoot = Call2:\n"
monitor long 0x40000210 = 0x10111157
monitor long 0x40000210 = 0x10011113
end
# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 )
define SetBootCall3
printf "SetBoot = Call3:\n"
monitor long 0x40000210 = 0x8111157
monitor long 0x40000210 = 0x8011113
end
# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 )
define SetBootCall4
printf "SetBoot = Call4:\n"
monitor long 0x40000210 = 0x4111157
monitor long 0x40000210 = 0x4011113
end
# CPU CLK 166 MHz?
define SetClk166MHz
@ -89,8 +90,7 @@ monitor long 0x40000304 = 0x1FC00002
monitor long 0x40000250 = 0x400
monitor long 0x40000340 = 0x0
monitor long 0x40000230 = 0xdcc4
monitor long 0x40000210 = 0x11117
monitor long 0x40000210 = 0x11157
monitor long 0x40000210 = 0x11113
monitor long 0x400002c0 = 0x110011
monitor long 0x40000320 = 0xffffffff
end
@ -125,7 +125,6 @@ monitor long 0x40006018 = 0
monitor long 0x4000601C = 0
#disable DMA
monitor long 0x4000604C = 0
set $SPI_FLASH_BASE = 0x98000000
end
###################
# SetFirwareSize #
@ -154,7 +153,26 @@ if $Image1Size != 0 && $Image1Size < 0x1000000
printf "Image2Size = %d\n", $Image2Size
printf "Image2LoadAddr = 0x%08x\n", $Image2LoadAddr
set $FirmwareSize = $Image2Addr + $Image2Size
set $Image3Addr = $FirmwareSize
set $parms1 = $rambuffer - $FirmwareSize
set $parms3 = $Image3Addr + 0x08
restore $arg0 binary $parms1 $Image3Addr $parms3
set $Image3Size = {int}($rambuffer)
set $Image3LoadAddr = {int}($rambuffer+0x4)
if $Image3Size != 0xFFFFFFFF && $Image3Size != 0
set $Image3Size = $Image3Size + 16
printf "Image3Size = %d\n", $Image3Size
printf "Image3LoadAddr = 0x%08x\n", $Image3LoadAddr
set $FirmwareSize = $Image3Addr + $Image3Size
printf "FirmwareSize = %d\n", $FirmwareSize
else
set $Image3Size = 0
if $Image3LoadAddr == 0x30000000
set $FirmwareSize = $FirmwareSize + 8
end
printf "Image3 - None\n"
printf "FirmwareSize = %d\n", $FirmwareSize
end
else
set $Image2Size = 0
printf "Image2 - None\n"
@ -164,7 +182,9 @@ if $Image1Size != 0 && $Image1Size < 0x1000000
else
set $Image1Size = 0
set $Image2Size = 0
set $Image3Size = 0
set $Image2Addr = 0
set $Image3Addr = 0
set $FirmwareSize = 0
printf "Image not format Firmware!\n"
end
@ -173,6 +193,10 @@ end
# Flash Images Info #
#####################
define FlashImagesInfo
set $Image2Size = 0
set $Image3Size = 0
set $Image2Addr = 0
set $Image3Addr = 0
printf "Flash Info:\n"
set $Image1Size = {int}($SPI_FLASH_BASE + 0x10) + 32
set $Image1LoadAddr = {int}($SPI_FLASH_BASE + 0x14)
@ -181,16 +205,26 @@ printf "Image1 - None\n"
else
set $Image2FlashAddr = {short}($SPI_FLASH_BASE + 0x18) * 1024
if $Image2FlashAddr == 0
$Image2FlashAddr = $Image1Size
set $Image2FlashAddr = $Image1Size
end
set $Image2Size = {int}($Image2FlashAddr + $SPI_FLASH_BASE)
set $Image2LoadAddr = {int}($Image2FlashAddr + $SPI_FLASH_BASE + 0x4)
printf "Image1Size = %d\n", $Image1Size
printf "Image1LoadAddr = 0x%08x\n", $Image1LoadAddr
printf "Image2FlashAddr = 0x%08x\n", $Image2FlashAddr
if $Image2Size != 0xFFFFFFFF
if $Image2Size != 0xFFFFFFFF && $Image2Size != 0
printf "Image2Size = %d\n", $Image2Size
printf "Image2LoadAddr = 0x%08x\n", $Image2LoadAddr
set $Image3FlashAddr = $Image2FlashAddr + $Image2Size + 0x10
set $Image3Size = {int}($Image3FlashAddr + $SPI_FLASH_BASE)
set $Image3LoadAddr = {int}($Image3FlashAddr + $SPI_FLASH_BASE + 0x4)
if $Image3Size != 0xFFFFFFFF && $Image3Size !=0
printf "Image3FlashAddr = 0x%08x\n", $Image3FlashAddr
printf "Image3Size = %d\n", $Image3Size
printf "Image3LoadAddr = 0x%08x\n", $Image3LoadAddr
else
printf "Image3 - None\n"
end
else
printf "Image2 - None\n"
end

View file

@ -7,7 +7,6 @@ set $rtl8710_flasher_auto_erase = 1
set $rtl8710_flasher_auto_verify = 1
set $rtl8710_flasher_firmware_ptr = 0x10001000
set $rtl8710_flasher_buffer = 0x10008000
#262144
set $rtl8710_flasher_buffer_size = 421888
set $rtl8710_flasher_sector_size = 4096
set $rtl8710_flasher_auto_erase_sector = 0xFFFFFFFF
@ -37,12 +36,11 @@ if $rtl8710_flasher_capacity == 0
monitor go
FlasherWait
set $id = {int}($rtl8710_flasher_buffer + 0x0C)
if ($id == 0x1420c2)
set $rtl8710_flasher_capacity = 1 << (($id >> 16) & 0x0ff)
if ($id == 0x1420c2)
printf "Flash ID = 0x%08x : MX25L8006E (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10
else
set $rtl8710_flasher_capacity = 1024*1024)
error "Flash ID = 0x%08x : ?\n", $id
printf "Flash ID = 0x%08x : (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10
end
printf "RTL8710 flasher initialized\n"
else
@ -108,9 +106,9 @@ while $offset < $size
end
set $flash_offset = $arg1 + $offset
printf "write offset 0x%08x\n", $flash_offset
set $parms1 = $rtl8710_flasher_buffer + 0x20 - $offset - $arg1
set $parms2 = $offset + $arg1
set $parms3 = $offset + $len + $arg1
set $parms1 = $rtl8710_flasher_buffer + 0x20 - $flash_offset
set $parms2 = $flash_offset
set $parms3 = $flash_offset + $len
restore $arg0 binary $parms1 $parms2 $parms3
if $rtl8710_flasher_auto_erase != 0
set $count_i = $flash_offset
@ -154,7 +152,12 @@ if $Image1Size != 0
#FlasherWrite $wr_flile 0 $Image1Size
call2
if $Image2Size != 0 && $Image2Addr >= $Image1Size
if $Image3Size != 0 && $Image3Addr > $Image2Size
set $Image2Size = $Image2Size + $Image3Size
printf "Write Image2&3 size %d to Flash addr 0x%08x:\n", $Image2Size, $Image2Addr
else
printf "Write Image2 size %d to Flash addr 0x%08x:\n", $Image2Size, $Image2Addr
end
#FlasherWrite $wr_flile $Image2Addr $Image2Size
call3
end

View file

@ -48,7 +48,12 @@ endif
# m c nosys gcc
PATHLIBS = sdk/component/soc/realtek/8195a/misc/bsp/lib/common/gcc
ifdef USE_SDRAM
CFLAGS += -DUSE_SDRAM=1
LDFILE ?= rlx8195A-symbol-v04-img3.ld
else
LDFILE ?= rlx8195A-symbol-v04-img2.ld
endif
BOOTS = sdk/component/soc/realtek/8195a/misc/bsp/image
# Include folder list
@ -138,8 +143,8 @@ SRC_C += sdk/component/common/api/wifi/wifi_simple_config.c
SRC_C += sdk/component/common/api/wifi/wifi_util.c
SRC_C += sdk/component/common/api/lwip_netconf.c
ifdef USE_WIFI_API
SRC_C += sdk/component/common/api/wifi_api.c
SRC_C += sdk/component/common/api/wifi_api_scan.c
DRAM_C += sdk/component/common/api/wifi_api.c
DRAM_C += sdk/component/common/api/wifi_api_scan.c
endif
#network - lwip
@ -179,9 +184,9 @@ SRC_C += sdk/component/common/network/lwip/$(LWIPDIR)/src/netif/etharp.c
SRC_C += sdk/component/common/network/lwip/$(LWIPDIR)/port/realtek/freertos/ethernetif.c
SRC_C += sdk/component/common/drivers/wlan/realtek/src/osdep/lwip_intf.c
SRC_C += sdk/component/common/network/lwip/$(LWIPDIR)/port/realtek/freertos/sys_arch.c
SRC_C += sdk/component/common/network/dhcp/dhcps.c
SRC_C += sdk/component/common/network/sntp/sntp.c
SRC_C += sdk/component/common/network/netbios/netbios.c
DRAM_C += sdk/component/common/network/dhcp/dhcps.c
DRAM_C += sdk/component/common/network/sntp/sntp.c
DRAM_C += sdk/component/common/network/netbios/netbios.c
#network - mdns
#SRC_C += sdk/component/common/network/mDNS/mDNSPlatform.c
@ -406,18 +411,18 @@ ADD_SRC_C =
# -------------------------------------------------------------------
ifdef USE_AT
INCLUDES += sdk/component/common/utilities
ADD_SRC_C += sdk/component/common/api/network/src/wlan_network.c
ADD_SRC_C += sdk/component/common/api/wifi_interactive_mode.c
ADD_SRC_C += sdk/component/common/api/network/src/ping_test.c
ADD_SRC_C += sdk/component/common/utilities/webserver.c
ADD_SRC_C += sdk/component/common/utilities/tcptest.c
ADD_SRC_C += sdk/component/common/utilities/update.c
DRAM_C += sdk/component/common/api/network/src/wlan_network.c
DRAM_C += sdk/component/common/api/wifi_interactive_mode.c
DRAM_C += sdk/component/common/api/network/src/ping_test.c
DRAM_C += sdk/component/common/utilities/webserver.c
DRAM_C += sdk/component/common/utilities/tcptest.c
DRAM_C += sdk/component/common/utilities/update.c
INCLUDES += sdk/component/common/example
INCLUDES += sdk/component/common/example/wlan_fast_connect
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/example_entry.c
ADD_SRC_C += sdk/component/common/application/xmodem/uart_fw_update.c
DRAM_C += sdk/component/common/example/wlan_fast_connect/example_wlan_fast_connect.c
DRAM_C += sdk/component/common/example/uart_atcmd/example_uart_atcmd.c
DRAM_C += sdk/component/common/example/example_entry.c
DRAM_C += sdk/component/common/application/xmodem/uart_fw_update.c
endif
#application
#INCLUDES += sdk/component/common/application/apple/WACServer/External/Curve25519

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

@ -7,6 +7,6 @@ r
loadbin build/bin/ram_1.r.bin 0x10000bc8
loadbin build/bin/ram_2.bin 0x10006000
r
w4 0x40000210,0x20111113
w4 0x40000210,0x20011113
g
q

View file

@ -38,37 +38,38 @@ set mem inaccessible-by-default off
# Setup GDB FOR FASTER DOWNLOADS
set remote memory-write-packet-size 8192
set remote memory-write-packet-size fixed
set $SPI_FLASH_BASE = 0x98000000
end
#############
# Boot_Flash
define SetBootFlash
printf "SetBoot = Flash:\n"
monitor long 0x40000210 = 0x211157
monitor long 0x40000210 = 0x00011113
end
# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )
define SetBootCall0
printf "SetBoot = Call0:\n"
monitor long 0x40000210 = 0x80011117
monitor long 0x40000210 = 0x80011113
end
# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 )
define SetBootCall1
printf "SetBoot = Call1:\n"
monitor long 0x40000210 = 0x20011117
monitor long 0x40000210 = 0x20011113
end
# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 )
define SetBootCall2
printf "SetBoot = Call2:\n"
monitor long 0x40000210 = 0x10011117
monitor long 0x40000210 = 0x10011113
end
# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 )
define SetBootCall3
printf "SetBoot = Call3:\n"
monitor long 0x40000210 = 0x8011117
monitor long 0x40000210 = 0x8011113
end
# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 )
define SetBootCall4
printf "SetBoot = Call4:\n"
monitor long 0x40000210 = 0x4011117
monitor long 0x40000210 = 0x4011113
end
# CPU CLK 166 MHz?
define SetClk166MHz
@ -89,8 +90,7 @@ monitor long 0x40000304 = 0x1FC00002
monitor long 0x40000250 = 0x400
monitor long 0x40000340 = 0x0
monitor long 0x40000230 = 0xdcc4
monitor long 0x40000210 = 0x11117
monitor long 0x40000210 = 0x11157
monitor long 0x40000210 = 0x11113
monitor long 0x400002c0 = 0x110011
monitor long 0x40000320 = 0xffffffff
end
@ -125,7 +125,6 @@ monitor long 0x40006018 = 0
monitor long 0x4000601C = 0
#disable DMA
monitor long 0x4000604C = 0
set $SPI_FLASH_BASE = 0x98000000
end
###################
# SetFirwareSize #
@ -154,7 +153,26 @@ if $Image1Size != 0 && $Image1Size < 0x1000000
printf "Image2Size = %d\n", $Image2Size
printf "Image2LoadAddr = 0x%08x\n", $Image2LoadAddr
set $FirmwareSize = $Image2Addr + $Image2Size
set $Image3Addr = $FirmwareSize
set $parms1 = $rambuffer - $FirmwareSize
set $parms3 = $Image3Addr + 0x08
restore $arg0 binary $parms1 $Image3Addr $parms3
set $Image3Size = {int}($rambuffer)
set $Image3LoadAddr = {int}($rambuffer+0x4)
if $Image3Size != 0xFFFFFFFF && $Image3Size != 0
set $Image3Size = $Image3Size + 16
printf "Image3Size = %d\n", $Image3Size
printf "Image3LoadAddr = 0x%08x\n", $Image3LoadAddr
set $FirmwareSize = $Image3Addr + $Image3Size
printf "FirmwareSize = %d\n", $FirmwareSize
else
set $Image3Size = 0
if $Image3LoadAddr == 0x30000000
set $FirmwareSize = $FirmwareSize + 8
end
printf "Image3 - None\n"
printf "FirmwareSize = %d\n", $FirmwareSize
end
else
set $Image2Size = 0
printf "Image2 - None\n"
@ -164,7 +182,9 @@ if $Image1Size != 0 && $Image1Size < 0x1000000
else
set $Image1Size = 0
set $Image2Size = 0
set $Image3Size = 0
set $Image2Addr = 0
set $Image3Addr = 0
set $FirmwareSize = 0
printf "Image not format Firmware!\n"
end
@ -173,6 +193,10 @@ end
# Flash Images Info #
#####################
define FlashImagesInfo
set $Image2Size = 0
set $Image3Size = 0
set $Image2Addr = 0
set $Image3Addr = 0
printf "Flash Info:\n"
set $Image1Size = {int}($SPI_FLASH_BASE + 0x10) + 32
set $Image1LoadAddr = {int}($SPI_FLASH_BASE + 0x14)
@ -181,16 +205,26 @@ printf "Image1 - None\n"
else
set $Image2FlashAddr = {short}($SPI_FLASH_BASE + 0x18) * 1024
if $Image2FlashAddr == 0
$Image2FlashAddr = $Image1Size
set $Image2FlashAddr = $Image1Size
end
set $Image2Size = {int}($Image2FlashAddr + $SPI_FLASH_BASE)
set $Image2LoadAddr = {int}($Image2FlashAddr + $SPI_FLASH_BASE + 0x4)
printf "Image1Size = %d\n", $Image1Size
printf "Image1LoadAddr = 0x%08x\n", $Image1LoadAddr
printf "Image2FlashAddr = 0x%08x\n", $Image2FlashAddr
if $Image2Size != 0xFFFFFFFF
if $Image2Size != 0xFFFFFFFF && $Image2Size != 0
printf "Image2Size = %d\n", $Image2Size
printf "Image2LoadAddr = 0x%08x\n", $Image2LoadAddr
set $Image3FlashAddr = $Image2FlashAddr + $Image2Size + 0x10
set $Image3Size = {int}($Image3FlashAddr + $SPI_FLASH_BASE)
set $Image3LoadAddr = {int}($Image3FlashAddr + $SPI_FLASH_BASE + 0x4)
if $Image3Size != 0xFFFFFFFF && $Image3Size !=0
printf "Image3FlashAddr = 0x%08x\n", $Image3FlashAddr
printf "Image3Size = %d\n", $Image3Size
printf "Image3LoadAddr = 0x%08x\n", $Image3LoadAddr
else
printf "Image3 - None\n"
end
else
printf "Image2 - None\n"
end

View file

@ -152,7 +152,12 @@ if $Image1Size != 0
#FlasherWrite $wr_flile 0 $Image1Size
call2
if $Image2Size != 0 && $Image2Addr >= $Image1Size
if $Image3Size != 0 && $Image3Addr > $Image2Size
set $Image2Size = $Image2Size + $Image3Size
printf "Write Image2&3 size %d to Flash addr 0x%08x:\n", $Image2Size, $Image2Addr
else
printf "Write Image2 size %d to Flash addr 0x%08x:\n", $Image2Size, $Image2Addr
end
#FlasherWrite $wr_flile $Image2Addr $Image2Size
call3
end

View file

@ -1,6 +1,7 @@
#=============================================
# SDK CONFIG
#=============================================
#USE_SDRAM = 1
#USE_AT = 1
#USE_FATFS = 1
#USE_SDIOH = 1
@ -27,8 +28,8 @@ CFLAGS += -DLOGUART_STACK_SIZE=1024
#user main
ADD_SRC_C += project/src/user/main.c
# components
ADD_SRC_C += project/src/user/wifi_console.c
ADD_SRC_C += project/src/user/atcmd_user.c
DRAM_C += project/src/user/wifi_console.c
DRAM_C += project/src/user/atcmd_user.c
ADD_SRC_C += project/src/user/spiram_fifo.c
#lib mad

View file

@ -145,7 +145,7 @@
#define CONFIG_EFUSE_NORMAL 1
#undef CONFIG_EFUSE_TEST
#define CONFIG_EFUSE_MODULE 1
#ifdef RTL8711AM
#if defined(RTL8711AM) || defined(USE_SDRAM)
#define CONFIG_SDR_EN 1
#endif
#define CONFIG_SDR_NORMAL 1