initial commit

This commit is contained in:
2024-12-15 00:34:01 +06:00
commit 31efbc726f
1576 changed files with 657692 additions and 0 deletions

View File

@@ -0,0 +1,77 @@
#!/bin/sh
#===============================================================================
CURRENT_UTILITY_DIR=$(pwd)
GDBSCPTFILE="../../../component/soc/realtek/8195a/misc/gcc_utility/rtl_gdb_flash_write.txt"
#===============================================================================
RLXSTS=$(ps -W | grep "rlx_probe_driver.exe" | grep -v "grep" | wc -l)
echo $RLXSTS
JLKSTS=$(ps -W | grep "JLinkGDBServer.exe" | grep -v "grep" | wc -l)
echo $JLKSTS
echo $CURRENT_UTILITY_DIR
#===============================================================================
#make the new string for being written
if [ $RLXSTS = 1 ]
then
echo "probe get"
#-------------------------------------------
LINE_NUMBER=$(grep -n "monitor reset " $GDBSCPTFILE | awk -F":" '{print $1}')
DEFAULT_STR=$(grep -n "monitor reset " $GDBSCPTFILE | awk -F":" '{print $2}')
#echo $LINE_NUMBER
echo $DEFAULT_STR
STRLEN_DFT=$(expr length "$DEFAULT_STR")
DEFAULT_STR="#monitor reset 1"
echo $DEFAULT_STR
#-------------------------------------------
SED_PARA="$LINE_NUMBER""c""$DEFAULT_STR"
sed -i "$SED_PARA" $GDBSCPTFILE
#===========================================
LINE_NUMBER=$(grep -n "monitor sleep " $GDBSCPTFILE | awk -F":" '{print $1}')
DEFAULT_STR=$(grep -n "monitor sleep " $GDBSCPTFILE | awk -F":" '{print $2}')
#echo $LINE_NUMBER
echo $DEFAULT_STR
STRLEN_DFT=$(expr length "$DEFAULT_STR")
DEFAULT_STR="#monitor sleep 20"
echo $DEFAULT_STR
#-------------------------------------------
SED_PARA="$LINE_NUMBER""c""$DEFAULT_STR"
sed -i "$SED_PARA" $GDBSCPTFILE
else
if [ $JLKSTS = 1 ]
then
echo "jlink get"
#-------------------------------------------
LINE_NUMBER=$(grep -n "monitor reset " $GDBSCPTFILE | awk -F":" '{print $1}')
DEFAULT_STR=$(grep -n "monitor reset " $GDBSCPTFILE | awk -F":" '{print $2}')
#echo $LINE_NUMBER
echo $DEFAULT_STR
STRLEN_DFT=$(expr length "$DEFAULT_STR")
DEFAULT_STR="monitor reset 1"
echo $DEFAULT_STR
#-------------------------------------------
SED_PARA="$LINE_NUMBER""c""$DEFAULT_STR"
sed -i "$SED_PARA" $GDBSCPTFILE
#===========================================
LINE_NUMBER=$(grep -n "monitor sleep " $GDBSCPTFILE | awk -F":" '{print $1}')
DEFAULT_STR=$(grep -n "monitor sleep " $GDBSCPTFILE | awk -F":" '{print $2}')
#echo $LINE_NUMBER
echo $DEFAULT_STR
STRLEN_DFT=$(expr length "$DEFAULT_STR")
DEFAULT_STR="monitor sleep 20"
echo $DEFAULT_STR
#-------------------------------------------
SED_PARA="$LINE_NUMBER""c""$DEFAULT_STR"
sed -i "$SED_PARA" $GDBSCPTFILE
fi
fi
#===============================================================================

View File

@@ -0,0 +1,66 @@
# Main file for Ameba1 series Cortex-M3 parts
#
# !!!!!!
#
set CHIPNAME rtl8711b
set CHIPSERIES amebaz
# Adapt based on what transport is active.
source [find target/swj-dp.tcl]
adapter driver cmsis-dap
transport select swd
# Run with *real slow* clock by default since the
# boot rom could have been playing with the PLL, so
# we have no idea what clock the target is running at.
adapter speed 4
if { [info exists CHIPNAME] } {
set _CHIPNAME $CHIPNAME
} else {
error "CHIPNAME not set. Please do not include amebaz.cfg directly."
}
if { [info exists CHIPSERIES] } {
# Validate chip series is supported
if { $CHIPSERIES != "amebaz" } {
error "Unsupported chip series specified."
}
set _CHIPSERIES $CHIPSERIES
} else {
error "CHIPSERIES not set. Please do not include amebaz.cfg directly."
}
if { [info exists CPUTAPID] } {
# Allow user override
set _CPUTAPID $CPUTAPID
} else {
# Amebaz use a Cortex M4 core.
if { $_CHIPSERIES == "amebaz" } {
set _CPUTAPID 0x2ba01477
}
}
swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
set _TARGETNAME $_CHIPNAME.cpu
dap create $_CHIPNAME.dap -chain-position $_TARGETNAME
target create $_TARGETNAME cortex_m -dap $_CHIPNAME.dap
# Configure reset behavior
reset_config srst_only
# delays on reset lines
adapter srst delay 200
# Ameba1 (Cortex M3 core) support SYSRESETREQ
if {![using_hla]} {
# if srst is not fitted use SYSRESETREQ to
# perform a soft reset
cortex_m reset_config sysresetreq
}
#$_TARGETNAME configure -event reset-init {amebaz_init}

View File

@@ -0,0 +1,53 @@
# GDB script for loading ram.bin process
#===============================================================================
#set GDB connection
set remotetimeout 100000
target remote :3333
#===============================================================================
#Message display setting
#disable all messages
set verbose off
set complaints 0
set confirm off
set exec-done-display off
show exec-done-display
set trace-commands off
#set debug aix-thread off
#set debug dwarf2-die 0
set debug displaced off
set debug expression 0
set debug frame 0
set debug infrun 0
set debug observer 0
set debug overload 0
set pagination off
set print address off
set print symbol-filename off
set print symbol off
set print pretty off
set print object off
#set debug notification off
set debug parser off
set debug remote 0
#===============================================================================
monitor reset halt
monitor sleep 20
d
#===============================================================================
#Load flash download file
file ./application/Debug/bin/application.axf
#x /1xw 0x40000210
b main
c
#Load the file
#lo

View File

@@ -0,0 +1,55 @@
# GDB script for loading ram.bin process
#===============================================================================
#set GDB connection
set remotetimeout 100000
target remote :2331
#===============================================================================
#Message display setting
#disable all messages
set verbose off
set complaints 0
set confirm off
set exec-done-display off
show exec-done-display
set trace-commands off
#set debug aix-thread off
#set debug dwarf2-die 0
set debug displaced off
set debug expression 0
set debug frame 0
set debug infrun 0
set debug observer 0
set debug overload 0
set debugvarobj 0
set pagination off
set print address off
set print symbol-filename off
set print symbol off
set print pretty off
set print object off
#set debug notification off
set debug parser off
set debug remote 0
#===============================================================================
monitor reset 1
monitor sleep 20
monitor clrbp
#===============================================================================
#Load flash download file
file ./application/Debug/bin/application.axf
#x /1xw 0x40000210
b main
continue
clear main
#Load the file
#lo

View File

@@ -0,0 +1,58 @@
# GDB script for loading ram.bin process
#===============================================================================
#set GDB connection
set remotetimeout 100000
target remote :3333
#===============================================================================
#Message display setting
#disable all messages
set verbose off
set complaints 0
set confirm off
set exec-done-display off
show exec-done-display
set trace-commands off
#set debug aix-thread off
#set debug dwarf2-die 0
set debug displaced off
set debug expression 0
set debug frame 0
set debug infrun 0
set debug observer 0
set debug overload 0
set debugvarobj 0
set pagination off
set print address off
set print symbol-filename off
set print symbol off
set print pretty off
set print object off
#set debug notification off
set debug parser off
set debug remote 0
#===============================================================================
#monitor reset init
#monitor halt
monitor soft_reset_halt
monitor sleep 20
#===============================================================================
#Load flash download file
file ./application/Debug/bin/application.axf
#skip sdram init, it has been init in openocd config
set {int}0x40000210=0x211157
#x /1xw 0x40000210
b main
continue
clear main
#Load the file
#lo

View File

@@ -0,0 +1,34 @@
include $(MAKE_INCLUDE_GEN)
.PHONY: all clean
#*****************************************************************************#
# Object FILE LIST #
#*****************************************************************************#
OBJS =
#*****************************************************************************#
# RULES TO GENERATE TARGETS #
#*****************************************************************************#
# Define the Rules to build the core targets
all: CORE_TARGETS
make -C src all
#*****************************************************************************#
# GENERATE OBJECT FILE
#*****************************************************************************#
CORE_TARGETS: $(OBJS)
#*****************************************************************************#
# RULES TO CLEAN TARGETS #
#*****************************************************************************#
clean:
make -C src clean

View File

@@ -0,0 +1,75 @@
#!/bin/sh
#===============================================================================
CURRENT_UTILITY_DIR=$(pwd)
GDBSCPTFILE="../../../component/soc/realtek/8711b/misc/gnu_utility/flash_download/image/rtl_gdb_jtag_boot_com.txt"
#===============================================================================
RLXSTS=$(ps -W | grep "rlx_probe_driver.exe" | grep -v "grep" | wc -l)
echo $RLXSTS
JLKSTS=$(ps -W | grep "JLinkGDBServer.exe" | grep -v "grep" | wc -l)
echo $JLKSTS
#===============================================================================
#make the new string for being written
if [ $RLXSTS = 1 ]
then
echo "probe get"
#-------------------------------------------
LINE_NUMBER=$(grep -n "monitor reset " $GDBSCPTFILE | awk -F":" '{print $1}')
DEFAULT_STR=$(grep -n "monitor reset " $GDBSCPTFILE | awk -F":" '{print $2}')
#echo $LINE_NUMBER
echo $DEFAULT_STR
STRLEN_DFT=$(expr length "$DEFAULT_STR")
DEFAULT_STR="#monitor reset 1"
echo $DEFAULT_STR
#-------------------------------------------
SED_PARA="$LINE_NUMBER""c""$DEFAULT_STR"
sed -i "$SED_PARA" $GDBSCPTFILE
#===========================================
LINE_NUMBER=$(grep -n "monitor sleep " $GDBSCPTFILE | awk -F":" '{print $1}')
DEFAULT_STR=$(grep -n "monitor sleep " $GDBSCPTFILE | awk -F":" '{print $2}')
#echo $LINE_NUMBER
echo $DEFAULT_STR
STRLEN_DFT=$(expr length "$DEFAULT_STR")
DEFAULT_STR="#monitor sleep 20"
echo $DEFAULT_STR
#-------------------------------------------
SED_PARA="$LINE_NUMBER""c""$DEFAULT_STR"
sed -i "$SED_PARA" $GDBSCPTFILE
else
if [ $JLKSTS = 1 ]
then
echo "jlink get"
echo $CURRENT_UTILITY_DIR
#-------------------------------------------
LINE_NUMBER=$(grep -n "monitor reset " $GDBSCPTFILE | awk -F":" '{print $1}')
DEFAULT_STR=$(grep -n "monitor reset " $GDBSCPTFILE | awk -F":" '{print $2}')
#echo $LINE_NUMBER
echo $DEFAULT_STR
STRLEN_DFT=$(expr length "$DEFAULT_STR")
DEFAULT_STR="monitor reset 1"
echo $DEFAULT_STR
#-------------------------------------------
SED_PARA="$LINE_NUMBER""c""$DEFAULT_STR"
sed -i "$SED_PARA" $GDBSCPTFILE
#===========================================
LINE_NUMBER=$(grep -n "monitor sleep " $GDBSCPTFILE | awk -F":" '{print $1}')
DEFAULT_STR=$(grep -n "monitor sleep " $GDBSCPTFILE | awk -F":" '{print $2}')
#echo $LINE_NUMBER
echo $DEFAULT_STR
STRLEN_DFT=$(expr length "$DEFAULT_STR")
DEFAULT_STR="monitor sleep 20"
echo $DEFAULT_STR
#-------------------------------------------
SED_PARA="$LINE_NUMBER""c""$DEFAULT_STR"
sed -i "$SED_PARA" $GDBSCPTFILE
fi
fi
#===============================================================================

View File

@@ -0,0 +1,31 @@
#!/bin/sh
#===============================================================================
CURRENT_UTILITY_DIR=$(pwd)
FLASHDLIMGDIR=$1
IMAGE_TARGET_FOLDER=$CURRENT_UTILITY_DIR/image
echo "..."
echo $CURRENT_UTILITY_DIR
echo $IMAGE_TARGET_FOLDER
GDBSCPTFILE="$FLASHDLIMGDIR/rtl_gdb_flash_write.txt"
#===============================================================================
#set image2 code size
FLASHFILENAME="$IMAGE_TARGET_FOLDER/image2_all_ota1.bin"
FLASH_FILE_SIZE=$(stat -c %s $FLASHFILENAME)
sed -i "s#^set \$FlashFileSize =.*#set \$FlashFileSize =$FLASH_FILE_SIZE#g" $GDBSCPTFILE
#set boot code size
FLASHFILENAME="$IMAGE_TARGET_FOLDER/boot_all.bin"
FLASH_FILE_SIZE=$(stat -c %s $FLASHFILENAME)
sed -i "s#^set \$XIPBootSize =.*#set \$XIPBootSize =$FLASH_FILE_SIZE#g" $GDBSCPTFILE
#set system data size
FLASHFILENAME="$IMAGE_TARGET_FOLDER/system.bin"
FLASH_FILE_SIZE=$(stat -c %s $FLASHFILENAME)
sed -i "s#^set \$SysDataSize =.*#set \$SysDataSize =$FLASH_FILE_SIZE#g" $GDBSCPTFILE
#OTA2 size
FLASHFILENAME="$IMAGE_TARGET_FOLDER/image2_all_ota2.bin"
FLASH_FILE_SIZE=$(stat -c %s $FLASHFILENAME)
sed -i "s#^set \$OTA2Size =.*#set \$OTA2Size =$FLASH_FILE_SIZE#g" $GDBSCPTFILE

View File

@@ -0,0 +1,27 @@
#!/bin/sh
#===============================================================================
CURRENT_UTILITY_DIR=$(pwd)
echo "..."
echo $CURRENT_UTILITY_DIR
BOOTALLFILENAME="./application/Debug/bin/boot_all.bin"
RAMFILENAME="./application/Debug/bin/image2_all_ota1.bin"
echo $RAMFILENAME
#RAMFILENAME="ram_2.bin"
GDBSCPTFILE="../../../component/soc/realtek/8711b/misc/gcc_utility/flash_download/rtl_gdb_flash_write.txt"
#===============================================================================
#get file size
BOOTALL_FILE_SIZE=$(stat -c %s $BOOTALLFILENAME)
BOOTALL_FILE_SIZE_HEX=`echo "obase=16; $BOOTALL_FILE_SIZE"|bc`
RAM_FILE_SIZE=$(stat -c %s $RAMFILENAME)
RAM_FILE_SIZE_HEX=`echo "obase=16; $RAM_FILE_SIZE"|bc`
echo "size "$BOOTALL_FILE_SIZE" --> 0x"$BOOTALL_FILE_SIZE_HEX
echo "size "$RAM_FILE_SIZE" --> 0x"$RAM_FILE_SIZE_HEX
echo "set \$BOOTALLFILESize = 0x$BOOTALL_FILE_SIZE_HEX" > BTAsize.gdb
echo "set \$RamFileSize = 0x$RAM_FILE_SIZE_HEX" > fwsize.gdb
exit

View File

@@ -0,0 +1,190 @@
# GDB script for loading ram.bin process
source ../../../component/soc/realtek/8711b/misc/gnu_utility/flash_download/image/rtl_gdb_jtag_boot_com.txt
#===============================================================================
#Macro define
set $FLASHDATBUFSIZE = 0x800
set $IMAGE_BOOT = 0x001
set $IMAGE_XIP1 = 0x002
set $IMAGE_XIP2 = 0x003
set $IMAGE_SYSD = 0x004
#===============================================================================
#register define
set $PERI_ON_BASE = 0x40000000
set $REG_SOC_PERI_FUNC0_EN = 0x0210
set $SPI_FLASH_BASE = 0x08000000
#===============================================================================
#Variables declaration (1)
#binary file size
set $BOOTALLFileSize = 0x0000
set $RamFileSize = 0x0000
source BTAsize.gdb
source fwsize.gdb
printf "-------------------------------\n"
printf "BOOTALLFileSize: %x\n",$BOOTALLFILESize
printf "RamFileSize: %x\n",$RamFileSize
printf "-------------------------------\n"
#===============================================================================
#Load flash download file
printf "Load flash loader.\n"
file ../../../component/soc/realtek/8711b/misc/gnu_utility/flash_download/image/target_FPGA.axf
#Load the file
#lo
#restore ./application/Debug/bin/rom.bin binary 0x0
restore ../../../component/soc/realtek/8711b/misc/gnu_utility/flash_download/image/flash_loader_ram_1.bin binary 0x10002000
#===============================================================================
#===============================================================================
#flash write function
define flash_write
printf "flash_write FileName:%x \n", $arg0
printf "flash_write FileSize:%d \n", $arg1
printf "flash_write FlashAddrForWrite:%x \n", FlashAddrForWrite
set $FileName = $arg0
set $FileSize = $arg1
set $Loopnumber = ($FileSize / $FLASHDATBUFSIZE)
set $TailSize = ($FileSize % $FLASHDATBUFSIZE)
printf "FileSize: %x\n",$FileSize
printf "Loopnumber = %d\n", $Loopnumber
printf "TailSize = %d\n", $TailSize
printf "global variables\n"
set $FILESTARTADDR = 0
set $FLASHDATSRC = FlashDatSrc
if( $FileSize < $FLASHDATBUFSIZE )
set FlashBlockWriteSize = $FileSize
else
set FlashBlockWriteSize = $FLASHDATBUFSIZE
end
printf "FlashDatSrc:%x\n", $FLASHDATSRC
printf "FlashBlockWriteSize "
printf "FlashBlockWriteSize:%x\n", FlashBlockWriteSize
printf "FlashAddrForWrite:%x", FlashAddrForWrite
printf "Flash write start...\n"
set $Loop = 0
while ($Loop < $Loopnumber)
set $FILESTARTADDR = $FLASHDATBUFSIZE * $Loop
printf "FILESTARTADDR"
p /x $FILESTARTADDR
p /x FlashAddrForWrite
p /x $Loop
if ($FileName == $IMAGE_XIP1)
restore ./application/Debug/bin/image2_all_ota1.bin binary ($FLASHDATSRC-$FILESTARTADDR) $FILESTARTADDR ($FILESTARTADDR + $FLASHDATBUFSIZE)
end
if ($FileName == $IMAGE_XIP2)
restore ./application/Debug/bin/image2_all_ota2.bin binary ($FLASHDATSRC-$FILESTARTADDR) $FILESTARTADDR ($FILESTARTADDR + $FLASHDATBUFSIZE)
end
if ($FileName == $IMAGE_BOOT)
restore ./application/Debug/bin/boot_all.bin binary ($FLASHDATSRC-$FILESTARTADDR) $FILESTARTADDR ($FILESTARTADDR + $FLASHDATBUFSIZE)
end
if ($FileName == $IMAGE_SYSD)
restore ./application/Debug/bin/system.bin binary ($FLASHDATSRC-$FILESTARTADDR) $FILESTARTADDR ($FILESTARTADDR + $FLASHDATBUFSIZE)
end
c
set $Loop = $Loop + 0x01
end
if ( $TailSize > 0)
set $FILESTARTADDR = $FLASHDATBUFSIZE * $Loop
printf "FILESTARTADDR"
p /x $FILESTARTADDR
p /x FlashAddrForWrite
p /x $Loop
if ($FileName == $IMAGE_XIP1)
restore ./application/Debug/bin/image2_all_ota1.bin binary ($FLASHDATSRC-$FILESTARTADDR) $FILESTARTADDR ($FILESTARTADDR + $TailSize)
end
if ($FileName == $IMAGE_XIP2)
restore ./application/Debug/bin/image2_all_ota2.bin binary ($FLASHDATSRC-$FILESTARTADDR) $FILESTARTADDR ($FILESTARTADDR + $TailSize)
end
if ($FileName == $IMAGE_BOOT)
restore ./application/Debug/bin/boot_all.bin binary ($FLASHDATSRC-$FILESTARTADDR) $FILESTARTADDR ($FILESTARTADDR + $TailSize)
end
if ($FileName == $IMAGE_SYSD)
restore ./application/Debug/bin/system.bin binary ($FLASHDATSRC-$FILESTARTADDR) $FILESTARTADDR ($FILESTARTADDR + $TailSize)
end
c
end
end
#===============================================================================
#Set rom boot BIT to flash loader
set $Temp = 0x0
set $Temp = {int}($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN)
p /x $Temp
set $Temp = ($Temp | (0x01 << 26))
set $Temp = ($Temp & ~(0x01 << 27))
set $Temp = ($Temp & ~(0x01 << 28))
p /x $Temp
set {int}($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN) = $Temp
printf "....\n"
printf "wakeup bit(%x):%x\n", ($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN), {int}($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN)
#===============================================================================
#===============================================================================
#b RtlFlashProgram:StartOfFlashBlockWrite
b rtl_flash_download.c:88
#continue
c
#===============================================================================
#===============================================================================
#flash write
#set $XIPBootSize =4324
set $XIPBootSize =$BOOTALLFILESize
set FlashAddrForWrite =0x00000
flash_write $IMAGE_BOOT $XIPBootSize
#dump binary memory dump.bin $SPI_FLASH_BASE ($SPI_FLASH_BASE + $XIPBootSize)
set $SysDataSize =32
set FlashAddrForWrite =0x09000
#flash_write $IMAGE_SYSD $SysDataSize
#set $FlashFileSize =299200
set $FlashFileSize =$RamFileSize
set FlashAddrForWrite =0x0B000
flash_write $IMAGE_XIP1 $FlashFileSize
set $OTA2Size =299200
set FlashAddrForWrite =0x80000
#flash_write $IMAGE_XIP2 $OTA2Size
#Tell flashloader complete flag
set FlashWriteComplete = 0x1
#===============================================================================
#===============================================================================
#dump image from flash
printf "dump for check\n"
info b
delete
info b
quit
c
#delete
quit
#===============================================================================

View File

@@ -0,0 +1,36 @@
# GDB script for loading ram.bin process
source gnu_utility/flash_download/image/rtl_gdb_jtag_boot_com.txt
#===============================================================================
#Load the file
file ./image/target.axf
#lo
#restore ./image/rom.bin binary 0x0
restore ./image/ram_1.bin binary 0x10002000
restore ./image/ram_2.bin binary 0x10005000
printf "Load image to sram.\n"
#set $dumpstartaddr = 0x00000000
#set $dumpendaddr = 0x10000
#dump binary memory rom.bin $dumpstartaddr $dumpendaddr
#===============================================================================
set $Temp = 0x0
set $Temp = {int}($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN)
p /x $Temp
set $Temp = ($Temp & ~(0x01 << 26))
set $Temp = ($Temp & ~(0x01 << 27))
set $Temp = ($Temp & ~(0x01 << 28))
set $Temp = ($Temp | (0x01 << 28))
p /x $Temp
set {int}($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN) = $Temp
printf "....\n"
printf "wakeup bit(%x):%x\n", ($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN), {int}($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN)
c
#quit

View File

@@ -0,0 +1,55 @@
# GDB script for loading ram.bin process
#===============================================================================
#set GDB connection
set remotetimeout 100000
target remote : 2331
#===============================================================================
#===============================================================================
#Message display setting
#disable all messages
set verbose off
set complaints 0
set confirm off
set exec-done-display off
show exec-done-display
set trace-commands off
#set debug aix-thread off
#set debug dwarf2-die 0
set debug displaced off
set debug expression 0
set debug frame 0
set debug infrun 0
set debug observer 0
set debug overload 0
#set debugvarobj 0
set pagination off
set print address off
set print symbol-filename off
set print symbol off
set print pretty off
set print object off
#set debug notification off
set debug parser off
set debug remote 0
#===============================================================================
#set JTAG and external SRAM
#source ../../utility/jtag_cfg/J-Link_with_JTAG_and_external_SRAM.txt
monitor reset 1
monitor sleep 20
#===============================================================================
set $FLASHDATBUFSIZE = 0x800
#===============================================================================
#define PERI_ON_BASE 0x40000000
set $PERI_ON_BASE = 0x40000000
#define REG_SOC_PERI_FUNC0_EN 0x0218
set $REG_SOC_PERI_FUNC0_EN = 0x0210
#define SPI_FLASH_BASE 0x4000000
set $SPI_FLASH_BASE = 0x08000000

View File

@@ -0,0 +1,55 @@
# GDB script for loading ram.bin process
#===============================================================================
#set GDB connection
set remotetimeout 100000
target remote : 2331
#===============================================================================
#===============================================================================
#Message display setting
#disable all messages
set verbose off
set complaints 0
set confirm off
set exec-done-display off
show exec-done-display
set trace-commands off
#set debug aix-thread off
#set debug dwarf2-die 0
set debug displaced off
set debug expression 0
set debug frame 0
set debug infrun 0
set debug observer 0
set debug overload 0
#set debugvarobj 0
set pagination off
set print address off
set print symbol-filename off
set print symbol off
set print pretty off
set print object off
#set debug notification off
set debug parser off
set debug remote 0
#===============================================================================
#set JTAG and external SRAM
#source ../../utility/jtag_cfg/J-Link_with_JTAG_and_external_SRAM.txt
monitor reset 1
monitor sleep 20
#===============================================================================
set $FLASHDATBUFSIZE = 0x800
#===============================================================================
#define PERI_ON_BASE 0x40000000
set $PERI_ON_BASE = 0x40000000
#define REG_SOC_PERI_FUNC0_EN 0x0218
set $REG_SOC_PERI_FUNC0_EN = 0x0210
#define SPI_FLASH_BASE 0x4000000
set $SPI_FLASH_BASE = 0x08000000

View File

@@ -0,0 +1,59 @@
# GDB script for loading ram.bin process
#===============================================================================
#set GDB connection
set remotetimeout 100000
target remote : 3333
#===============================================================================
#===============================================================================
#Message display setting
#disable all messages
set verbose off
set complaints 0
set confirm off
set exec-done-display off
show exec-done-display
set trace-commands off
#set debug aix-thread off
#set debug dwarf2-die 0
set debug displaced off
set debug expression 0
set debug frame 0
set debug infrun 0
set debug observer 0
set debug overload 0
#set debugvarobj 0
set pagination off
set print address off
set print symbol-filename off
set print symbol off
set print pretty off
set print object off
#set debug notification off
set debug parser off
set debug remote 0
#===============================================================================
#set JTAG and external SRAM
#source ../../utility/jtag_cfg/J-Link_with_JTAG_and_external_SRAM.txt
#monitor reset init
#monitor halt
monitor soft_reset_halt
monitor sleep 20
#===============================================================================
set $FLASHDATBUFSIZE = 0x800
#===============================================================================
#define PERI_ON_BASE 0x40000000
set $PERI_ON_BASE = 0x40000000
#define REG_SOC_PERI_FUNC0_EN 0x0218
set $REG_SOC_PERI_FUNC0_EN = 0x0210
#define SPI_FLASH_BASE 0x4000000
set $SPI_FLASH_BASE = 0x08000000

View File

@@ -0,0 +1,31 @@
# GDB script for loading ram.bin process
source gnu_utility/flash_download/image/rtl_gdb_jtag_boot_com.txt
#===============================================================================
#load rom.bin
#restore ./image/rom.bin binary 0x0
printf "Load image to sram.\n"
set $dumpstartaddr = 0x00000000
set $dumpendaddr = 0x10000
dump binary memory rom.bin $dumpstartaddr $dumpendaddr
#===============================================================================
set $Temp = 0x0
set $Temp = {int}($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN)
p /x $Temp
set $Temp = ($Temp & ~(0x01 << 26))
set $Temp = ($Temp & ~(0x01 << 27))
set $Temp = ($Temp & ~(0x01 << 28))
p /x $Temp
set {int}($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN) = $Temp
printf "....\n"
printf "wakeup bit(%x):%x\n", ($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN), {int}($PERI_ON_BASE+$REG_SOC_PERI_FUNC0_EN)
c
#quit

View File

@@ -0,0 +1,16 @@
# GDB script for loading ram.bin process
source gnu_utility/flash_download/image/rtl_gdb_jtag_boot_com.txt
#===============================================================================
#Load the file
file ./image/target.axf
restore ./image/rom.bin binary 0x0
#dump binary memory dump.bin 0x00000000 0x00080000
#===============================================================================
#c
quit

View File

@@ -0,0 +1,35 @@
include $(MAKE_INCLUDE_GEN)
.PHONY: all clean
MODULE_IFLAGS = -I../include
#*****************************************************************************#
# Object FILE LIST #
#*****************************************************************************#
OBJS = rtl_flash_download.o rtl_flash_download_entry.o
#*****************************************************************************#
# RULES TO GENERATE TARGETS #
#*****************************************************************************#
# Define the Rules to build the core targets
all: CORE_TARGETS RENAME_LOADER_OBJS COPY_RAM_OBJS
#*****************************************************************************#
# GENERATE OBJECT FILE
#*****************************************************************************#
CORE_TARGETS: $(OBJS)
#*****************************************************************************#
# RULES TO CLEAN TARGETS #
#*****************************************************************************#
clean:
$(REMOVE) *.o
$(REMOVE) *.i
$(REMOVE) *.s
$(REMOVE) *.d

View File

@@ -0,0 +1,145 @@
#include "rtl8710b.h"
#include "build_info.h"
#define INH_PIN _PA_0
#define CTRL_PIN _PA_5
#define CHN_Y1 0
#define CHN_Y2 1
#define FLASHDATALEN 128*1024
BOOT_RAM_BSS_SECTION volatile u8* FlashDataBuf;
/* channel : the parameter can be CHN_Y1 or CHN_Y2 */
BOOT_RAM_TEXT_SECTION
static VOID SPDT_Switch(u32 channel)
{
GPIO_WriteBit(CTRL_PIN, channel);
}
BOOT_RAM_TEXT_SECTION
static VOID SPDT_Initial_Setup(VOID)
{
GPIO_InitTypeDef GPIO_InitStruct;
/* INH pin: enables or disables the switch. 0: Enable, 1: Disable */
GPIO_InitStruct.GPIO_Pin = INH_PIN;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
GPIO_Init(&GPIO_InitStruct);
/* Enable the switch */
GPIO_WriteBit(INH_PIN, 0);
/* CTRL pin: controls the switch. 0: Y1 channel is on, 1: Y2 channel is on */
GPIO_InitStruct.GPIO_Pin = CTRL_PIN;
GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_OUT;
GPIO_Init(&GPIO_InitStruct);
/* Default on-channel is Y1 */
SPDT_Switch(CHN_Y1);
}
BOOT_RAM_TEXT_SECTION
VOID BOOT_RAM_InitFlash(void)
{
u32 Value32;
/* disable cache first */
Cache_Enable(DISABLE); /* cahce enable becuase flash init will flush cahce */
RCC_PeriphClockCmd(APBPeriph_FLASH, APBPeriph_FLASH_CLOCK, DISABLE);
/* set 500MHz Div to gen spic clock 200MHz */
FLASH_ClockDiv(FLASH_CLK_DIV2P5);
RCC_PeriphClockCmd(APBPeriph_FLASH, APBPeriph_FLASH_CLOCK, ENABLE);
PinCtrl(PERIPHERAL_SPI_FLASH, S0, ON);
FLASH_StructInit(&flash_init_para);
flash_init_para.FLASH_cur_cmd = FLASH_CMD_READ;
flash_init_para.FLASH_baud_rate = 1;
flash_init_para.FLASH_baud_boot = 1;
FLASH_Init(SpicOneBitMode);
DBG_8195A("Init flash baudrate: %d\n", flash_init_para.FLASH_baud_rate);
/* enable cache before XIP */
Cache_Enable(ENABLE);
Cache_Flush();
}
BOOT_RAM_TEXT_SECTION
VOID BOOT_RAM_FlashtoFlash(VOID)
{
u32 addr = 0;
u32 image_size = 512; //test size is 512KB
u32 tail_size;
u32 times = image_size / (FLASHDATALEN / 1024);
int i = 0, j = 0;
BOOT_RAM_InitFlash();
DBG_8195A("Flash init done!\n");
FlashDataBuf = __image2_entry_func__;
DBG_8195A("Start copy data from source flash to destination flash...\n");
SPDT_Initial_Setup();
/* Erase Destination flash */
SPDT_Switch(CHN_Y2);
FLASH_Erase(EraseChip, 0);
DBG_8195A("Erase Destination flash done!\n");
for(; i < times; i++){
/* SPDT switch to Source flash */
SPDT_Switch(CHN_Y1);
_memcpy(FlashDataBuf, SPI_FLASH_BASE + addr, FLASHDATALEN);
/* SPDT switch to Destination flash */
SPDT_Switch(CHN_Y2);
for(j = 0; j < FLASHDATALEN; j += 8){
FLASH_TxData12B(addr + j, 8, FlashDataBuf + j);
}
addr += FLASHDATALEN;
DBG_8195A("128KB copied done!\n");
}
tail_size = image_size % (FLASHDATALEN / 1024);
if(tail_size != 0){
/* SPDT switch to Source flash */
SPDT_Switch(CHN_Y1);
_memcpy(FlashDataBuf, SPI_FLASH_BASE + addr, tail_size * 1024);
/* SPDT switch to Destination flash */
SPDT_Switch(CHN_Y2);
for(j = 0; j < tail_size * 1024; j += 4){
FLASH_TxData12B(addr + j, 4, FlashDataBuf + j);
}
addr += tail_size * 1024;
DBG_8195A("%d KB done!\n", tail_size);
}
DBG_8195A("Flash to flash done!\n");
while(1){}
}
IMAGE1_ENTRY_SECTION
RAM_FUNCTION_START_TABLE RamStartTable = {
.RamStartFun = BOOT_RAM_FlashtoFlash,
.RamWakeupFun = NULL, /* init in socps SOCPS_InitSYSIRQ */
.RamPatchFun0 = BOOT_RAM_FlashtoFlash,
.RamPatchFun1 = BOOT_RAM_FlashtoFlash,
.RamPatchFun2 = BOOT_RAM_FlashtoFlash,
.FlashStartFun = NULL
};

View File

@@ -0,0 +1,124 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
#include "rtl8710b.h"
#include "build_info.h"
#define FLASHDATALEN 2048
BOOT_RAM_BSS_SECTION volatile u8 FlashDataBuf[FLASHDATALEN];
BOOT_RAM_BSS_SECTION volatile u32 *pFlashDatSrc;
BOOT_RAM_BSS_SECTION volatile u32 FlashBlockWriteSize; //The maximum size of each block write is FLASHDATALEN,
//The actual value MUST be given by GDB.
BOOT_RAM_BSS_SECTION volatile u32 FlashAddrForWrite; //The flash address to be written.
//The actual value MUST be given by GDB.
BOOT_RAM_BSS_SECTION volatile u8 FlashWriteComplete;
BOOT_RAM_BSS_SECTION volatile u32 FlashDatSrc;
BOOT_RAM_BSS_SECTION u32 erase_sector_addr = 0;
extern u8 __rom_bss_start__[];
extern u8 __rom_bss_end__[];
extern u8 __ram_start_table_start__[];
extern u32 ConfigDebugErr;
extern u32 ConfigDebugInfo;
extern u32 ConfigDebugWarn;
void BOOT_RAM_TEXT_SECTION
RtlFlashProgram(VOID)
{
volatile u32 FlashWriteCnt = 0;
u8 flash_ID[3];
//2 Need Modify
VECTOR_TableInit(0x1003EFFC);
DBG_8195A("==========================================================\n");
DBG_8195A("Flash Downloader Build Time: "UTS_VERSION"\n");
DBG_8195A("==========================================================\n");
FlashDatSrc = (u32)&FlashDataBuf;
pFlashDatSrc = (u32 *)&FlashDataBuf;
FlashWriteComplete = 0;
FlashBlockWriteSize = 0;
FlashAddrForWrite = 0;
erase_sector_addr = 0;
Cache_Enable(DISABLE);
RCC_PeriphClockCmd(APBPeriph_FLASH, APBPeriph_FLASH_CLOCK, DISABLE);
FLASH_CalibrationNewCmd(DISABLE);
/* set 500MHz Div to gen spic clock 100MHz, flash baudrate = 50MHz */
FLASH_ClockDiv(FLASH_CLK_DIV5P0);
RCC_PeriphClockCmd(APBPeriph_FLASH, APBPeriph_FLASH_CLOCK, ENABLE);
PinCtrl(PERIPHERAL_SPI_FLASH,S0,ON);
DBG_8195A("Flash init start\n");
FLASH_StructInit(&flash_init_para);
FLASH_Init(SpicOneBitMode);
DBG_8195A("Flash init done\n");
FLASH_RxCmd(flash_init_para.FLASH_cmd_rd_id, 3, flash_ID);
if(flash_ID[0] == 0x20){
flash_init_para.FLASH_cmd_chip_e = 0xC7;}
//4 Erase the flash before writing it
//FLASH_Erase(EraseChip, 0);
DBG_8195A("Flash download start\n");
//4 Program the flash from memory data
while(1)
{
StartOfFlashBlockWrite:
asm("nop");
asm("nop");
asm("nop");
asm("nop");
FlashWriteCnt = 0;
pFlashDatSrc = (u32 *)&FlashDataBuf[0];
if (FlashWriteComplete == 1)
break;
while (FlashWriteCnt < FlashBlockWriteSize)
{
u32 sector_addr1 = FlashAddrForWrite & 0xFFFFF000; /* sector of first byte */
if(sector_addr1 >= erase_sector_addr) {
FLASH_Erase(EraseSector, sector_addr1);
erase_sector_addr = sector_addr1 + 0x1000; /* next sector we should erase */
}
FLASH_TxData12B(FlashAddrForWrite, 4, pFlashDatSrc);
FlashAddrForWrite += 4;
FlashWriteCnt += 4;
pFlashDatSrc+= 1;
}
goto StartOfFlashBlockWrite;
}
DBG_8195A("Flash download done\n");
while(1){
if (FlashWriteComplete == 1) {
FlashWriteComplete = 0;
}
}
}

View File

@@ -0,0 +1,33 @@
/******************************************************************************
*
* Copyright(c) 2007 - 2012 Realtek Corporation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
*
*
******************************************************************************/
#include "rtl8710b.h"
#include "build_info.h"
#include "rtl8711b_flash.h"
void RtlFlashProgram(VOID);
IMAGE1_ENTRY_SECTION
RAM_FUNCTION_START_TABLE RamStartTable = {
.RamStartFun = RtlFlashProgram,
.RamWakeupFun = RtlFlashProgram,
.RamPatchFun0 = RtlFlashProgram,
.RamPatchFun1 = RtlFlashProgram,
.RamPatchFun2 = RtlFlashProgram
};

View File

@@ -0,0 +1,22 @@
;; Memory information ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Used to define address zones within the ARM address space (Memory).
;;
;; Name may be almost anything
;; AdrSpace must be Memory
;; StartAdr start of memory block
;; EndAdr end of memory block
;; AccType type of access, read-only (R), read-write (RW) or SFR (W)
[Memory]
;; Name AdrSpace StartAdr EndAdr AccType Width
Memory = ROM Memory 0x00000000 0x003FFFFF RW
Memory = SRAM Memory 0x10000000 0x1003FFFF RW
Memory = SFR Memory 0x40000000 0x41FFFFFF RW
Memory = SFR_Bitband Memory 0x42000000 0x43FFFFFF RW
Memory = PPB Memory 0xE0000000 0xFFFFFFFF RW
TrustedRanges = true
UseSfrFilter = true
[SfrInclude]

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<flash_board>
<pass>
<range>CODE 0x10000bc0 0x10003FFF</range>
<loader>$PROJ_DIR$\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash</loader>
<abs_offset>0x00000000</abs_offset>
<args>--head</args>
</pass>
<pass>
<range>CODE 0x10004000 0x1006FFFF</range>
<loader>$PROJ_DIR$\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash</loader>
<abs_offset>0x00000000</abs_offset>
<args>--cascade</args>
</pass>
<pass>
<range>CODE 0x30000000 0x301FFFFF</range>
<loader>$PROJ_DIR$\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash</loader>
<abs_offset>0x00000000</abs_offset>
<args>--cascade</args>
</pass>
<ignore>CODE 0x00000000 0x000FFFFF</ignore>
<ignore>CODE 0x10000000 0x10000bbf</ignore>
</flash_board>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<flash_device>
<exe>$PROJ_DIR$\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.out</exe>
<flash_base>0x00000000</flash_base>
<page>4</page>
<block>256 0x1000</block>
<macro>$PROJ_DIR$\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.mac</macro>
<aggregate>1</aggregate>
</flash_device>

View File

@@ -0,0 +1,74 @@
setup()
{
__var tmp;
__hwResetWithStrategy(0, 2);
__hwReset(1);
__delay(200);
/*
tmp = __readMemory32(0x40000014,"Memory"); __delay(10);
__message "0x40000014=",tmp:%x;
__writeMemory32(0x21, 0x40000014, "Memory"); __delay(10);
__writeMemory32(0x1FC00002, 0x40000304, "Memory"); __delay(10);
__writeMemory32(0x400, 0x40000250, "Memory"); __delay(10);
__writeMemory32(0x0, 0x40000340, "Memory"); __delay(10);
__writeMemory32(0xc04, 0x40000230, "Memory"); __delay(10);
__writeMemory32(0x1157, 0x40000210, "Memory"); __delay(10);
__writeMemory32(0x110011, 0x400002c0, "Memory"); __delay(10);
__writeMemory32(0xffffffff, 0x40000320, "Memory"); __delay(10);
*/
/*
__writeMemory32(0x1, 0x40005224, "Memory"); __delay(10);
__writeMemory32(0x2c8, 0x40005004, "Memory"); __delay(10);
__writeMemory32(0xffffd000, 0x40005008, "Memory"); __delay(10);
__delay(3);
__writeMemory32(0x22, 0x40005020, "Memory"); __delay(10);
__delay(3);
__writeMemory32(0x09032001, 0x40005010, "Memory"); __delay(10);
__delay(3);
__writeMemory32(0x2611, 0x40005014, "Memory"); __delay(10);
__delay(3);
__writeMemory32(0x68413, 0x40005018, "Memory"); __delay(10);
__delay(3);
__writeMemory32(0x42, 0x4000501c, "Memory"); __delay(10);
__delay(3);
// Enable
__writeMemory32(0x700, 0x4000500c, "Memory"); __delay(10);
__delay(20);
__writeMemory32(0x1, 0x40005000, "Memory"); __delay(10);
__delay(100);
tmp = __readMemory32(0x40005000,"Memory"); __delay(10);
__writeMemory32(0x600, 0x4000500c, "Memory"); __delay(10);
__delay(30);
*/
}
execUserPreload()
{
__var tmp;
setup();
tmp = __readMemory32(0x40000210, "Memory")|(1<<28);
__writeMemory32(tmp, 0x40000210, "Memory");
}
execUserSetup()
{
//execUserPreload();
//__loadImage("$TARGET_PATH$ ", 0, 0);
//__writeMemory32(0x80000000, 0x40000218, "Memory");
}
execUserFlashInit() // Called by debugger before loading flash loader in RAM.
{
__var tmp;
__message "----- Prepare hardware for Flashloader -----\n";
setup();
tmp = __readMemory32(0x40000210, "Memory")|(1<<28);
__writeMemory32(tmp, 0x40000210, "Memory");
}

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<flash_board>
<pass>
<loader>$PROJ_DIR$\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash</loader>
<range>CODE 0x8000020 0x8003fff</range>
<abs_offset>0x20</abs_offset>
<args>--boot </args>
</pass>
<pass>
<loader>$PROJ_DIR$\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash</loader>
<range>CODE 0x10002000 0x10004fff</range>
<abs_offset>0x0</abs_offset>
<args>--concat
--boot </args>
</pass>
<ignore>CODE 0x00000000 0x0007ffff</ignore>
<ignore>CODE 0x10000000 0x10001fff</ignore>
<ignore>CODE 0x10005000 0x10006000</ignore>
</flash_board>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<flash_board>
<pass>
<range>CODE 0x200006b4 0x2002FFFF</range>
<loader>$PROJ_DIR$\flashloader\FlashRTL8195aQA.flash</loader>
<abs_offset>0x00000000</abs_offset>
</pass>
<pass>
<range>CODE 0x30000000 0x301FFFFF</range>
<loader>$PROJ_DIR$\flashloader\FlashRTL8195aQA.flash</loader>
<abs_offset>0x00010000</abs_offset>
<ignore>DATA_Z 0x30000000 0x301FFFFF</ignore>
</pass>
<pass>
<range>CODE 0x20080000 0x200BFFFF</range>
<loader>$PROJ_DIR$\flashloader\FlashRTL8195aQA.flash</loader>
<abs_offset>0x00020000</abs_offset>
<ignore>DATA_Z 0x20080000 0x200BFFFF</ignore>
</pass>
<pass>
<range>CODE 0x00000000 0x00000000</range>
<loader>$PROJ_DIR$\flashloader\FlashRTL8195aQA.flash</loader>
<abs_offset>0x00030000</abs_offset>
</pass>
<ignore>CODE 0x00000001 0x000BFFFF</ignore>
<ignore>CODE 0x20000000 0x200006b3</ignore>
</flash_board>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<flash_device>
<exe>$PROJ_DIR$\flashloader\FlashRTL8195aQA.out</exe>
<flash_base>0x00000000</flash_base>
<page>8</page>
<block>256 0x1000</block>
<macro>$PROJ_DIR$\flashloader\FlashRTL8195aQA.mac</macro>
<aggregate>1</aggregate>
</flash_device>

View File

@@ -0,0 +1,60 @@
setup()
{
__var tmp;
__hwReset(1);
__writeMemory32(0x21, 0x40000014, "Memory"); __delay(10);
__writeMemory32(0x1FC00002, 0x40000304, "Memory"); __delay(10);
__writeMemory32(0x400, 0x40000250, "Memory"); __delay(10);
__writeMemory32(0x0, 0x40000340, "Memory"); __delay(10);
__writeMemory32(0xc04, 0x40000230, "Memory"); __delay(10);
__writeMemory32(0x1157, 0x40000210, "Memory"); __delay(10);
__writeMemory32(0x110011, 0x400002c0, "Memory"); __delay(10);
__writeMemory32(0xffffffff, 0x40000320, "Memory"); __delay(10);
__writeMemory32(0x1, 0x40005224, "Memory"); __delay(10);
__writeMemory32(0x2c8, 0x40005004, "Memory"); __delay(10);
__writeMemory32(0xffffd000, 0x40005008, "Memory"); __delay(10);
__delay(3);
__writeMemory32(0x22, 0x40005020, "Memory"); __delay(10);
__delay(3);
__writeMemory32(0x09032001, 0x40005010, "Memory"); __delay(10);
__delay(3);
__writeMemory32(0x2611, 0x40005014, "Memory"); __delay(10);
__delay(3);
__writeMemory32(0x68413, 0x40005018, "Memory"); __delay(10);
__delay(3);
__writeMemory32(0x42, 0x4000501c, "Memory"); __delay(10);
__delay(3);
// Enable
__writeMemory32(0x700, 0x4000500c, "Memory"); __delay(10);
__delay(20);
__writeMemory32(0x1, 0x40005000, "Memory"); __delay(10);
__delay(100);
tmp = __readMemory32(0x40005000,"Memory"); __delay(10);
__writeMemory32(0x600, 0x4000500c, "Memory"); __delay(10);
__delay(30);
}
execUserPreload()
{
__message "----- Prepare hardware for Flashloader -----\n";
setup();
__writeMemory32(0x80000000, 0x40000218, "Memory");
}
execUserSetup()
{
//execUserPreload();
//__loadImage("$TARGET_PATH$ ", 0, 0);
//__writeMemory32(0x80000000, 0x40000218, "Memory");
}
execUserFlashInit() // Called by debugger before loading flash loader in RAM.
{
__message "----- Prepare hardware for Flashloader -----\n";
setup();
__writeMemory32(0x80000000, 0x40000218, "Memory");
}

View File

@@ -0,0 +1,53 @@
@set /a tmp = %1-1
@call :toHex %tmp% end1
@set /a tmp2 = %2-1
@call :toHex %tmp2% end2
@set /a tmp3 = %3-1
@call :toHex %tmp3% end0
@echo echo image 2 start %1
@echo echo image 1 end 0x%end1%
@echo off
@echo ^<?xml version="1.0" encoding="iso-8859-1"?^> > tmp.board
@echo. >> tmp.board
@echo ^<flash_board^> >> tmp.board
@echo ^<pass^> >> tmp.board
@echo ^<range^>CODE %3 0x%end1%^</range^> >> tmp.board
@echo ^<loader^>$PROJ_DIR$\..\..\..\component\soc\realtek\8195a\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash^</loader^> >> tmp.board
@echo ^<abs_offset^>0x00000000^</abs_offset^> >> tmp.board
@echo ^<args^>--head^</args^> >> tmp.board
@echo ^</pass^> >> tmp.board
@echo ^<pass^> >> tmp.board
@echo ^<range^>CODE %1 0x%end2%^</range^> >> tmp.board
@echo ^<loader^>$PROJ_DIR$\..\..\..\component\soc\realtek\8195a\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash^</loader^> >> tmp.board
@echo ^<abs_offset^>0x00000000^</abs_offset^> >> tmp.board
@echo ^<args^>--cascade^</args^> >> tmp.board
@echo ^</pass^> >> tmp.board
@echo ^<pass^> >> tmp.board
@echo ^<range^>CODE 0x30000000 0x301FFFFF^</range^> >> tmp.board
@echo ^<loader^>$PROJ_DIR$\..\..\..\component\soc\realtek\8195a\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash^</loader^> >> tmp.board
@echo ^<abs_offset^>0x00000000^</abs_offset^> >> tmp.board
@echo ^<args^>--cascade^</args^> >> tmp.board
@echo ^</pass^> >> tmp.board
@echo ^<ignore^>CODE 0x00000000 0x000FFFFF^</ignore^> >> tmp.board
@echo ^<ignore^>CODE 0x10000000 0x%end0%^</ignore^> >> tmp.board
@echo ^<ignore^>CODE %2 0x1006FFFF^</ignore^> >> tmp.board
@echo ^</flash_board^> >> tmp.board >> tmp.board
exit
:toHex dec hex -- convert a decimal number to hexadecimal, i.e. -20 to FFFFFFEC or 26 to 0000001A
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set /a dec=%~1
set "hex="
set "map=0123456789ABCDEF"
for /L %%N in (1,1,8) do (
set /a "d=dec&15,dec>>=4"
for %%D in (!d!) do set "hex=!map:~%%D,1!!hex!"
)
( ENDLOCAL & REM RETURN VALUES
IF "%~2" NEQ "" (SET %~2=%hex%) ELSE ECHO.%hex%
)
EXIT /b

View File

@@ -0,0 +1,49 @@
@set /a tmp1 = %1
@call :toHex %tmp1% ram_start
@set /a tmp2 = %2-1
@call :toHex %tmp2% ram_end
@echo echo image 2 start %1
@echo echo image 2 end %2
@echo off
@echo ^<?xml version="1.0" encoding="iso-8859-1"?^> > tmp.board
@echo. >> tmp.board
@echo ^<flash_board^> >> tmp.board
@echo ^<pass^> >> tmp.board
@echo ^<range^>CODE 0x8000000 0x8004fff^</range^> >> tmp.board
@echo ^<loader^>$PROJ_DIR$\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash^</loader^> >> tmp.board
@echo ^<abs_offset^>0x00000000^</abs_offset^> >> tmp.board
@echo ^<args^>--noheader^</args^> >> tmp.board
@echo ^</pass^> >> tmp.board
@echo ^<pass^> >> tmp.board
@echo ^<range^>CODE 0x800b020 0x807ffff^</range^> >> tmp.board
@echo ^<loader^>$PROJ_DIR$\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash^</loader^> >> tmp.board
@echo ^<abs_offset^>0xb020^</abs_offset^> >> tmp.board
@echo ^</pass^> >> tmp.board
@echo ^<pass^> >> tmp.board
@echo ^<range^>CODE %1 0x%ram_end%^</range^> >> tmp.board
@echo ^<loader^>$PROJ_DIR$\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\flashloader\FlashRTL8195aMP.flash^</loader^> >> tmp.board
@echo ^<abs_offset^>0xb000^</abs_offset^> >> tmp.board
@echo ^<args^>--concat^</args^> >> tmp.board
@echo ^</pass^> >> tmp.board
@echo ^<ignore^>CODE %2 0x1003dfff^</ignore^> >> tmp.board
@echo ^</flash_board^> >> tmp.board >> tmp.board
exit
:toHex dec hex -- convert a decimal number to hexadecimal, i.e. -20 to FFFFFFEC or 26 to 0000001A
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set /a dec=%~1
set "hex="
set "map=0123456789ABCDEF"
for /L %%N in (1,1,8) do (
set /a "d=dec&15,dec>>=4"
for %%D in (!d!) do set "hex=!map:~%%D,1!!hex!"
)
( ENDLOCAL & REM RETURN VALUES
IF "%~2" NEQ "" (SET %~2=%hex%) ELSE ECHO.%hex%
)
EXIT /b

View File

@@ -0,0 +1,140 @@
cd /D %2
set tooldir=%2\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\tools
set libdir=%2\..\..\..\component\soc\realtek\8711b\misc\bsp
del Debug\Exe\bootloader.map Debug\Exe\bootloader.asm *.bin
cmd /c "%tooldir%\nm Debug/Exe/bootloader.axf | %tooldir%\sort > Debug/Exe/bootloader.map"
cmd /c "%tooldir%\objdump -d Debug/Exe/bootloader.axf > Debug/Exe/bootloader.asm"
for /f "delims=" %%i in ('cmd /c "%tooldir%\grep IMAGE1 Debug/Exe/bootloader.map | %tooldir%\grep Base | %tooldir%\gawk '{print $1}'"') do set ram1_start=0x%%i
for /f "delims=" %%i in ('cmd /c "%tooldir%\grep IMAGE1 Debug/Exe/bootloader.map | %tooldir%\grep Limit | %tooldir%\gawk '{print $1}'"') do set ram1_end=0x%%i
for /f "delims=" %%i in ('cmd /c "%tooldir%\grep xip_image1 Debug/Exe/bootloader.map | %tooldir%\grep Base | %tooldir%\gawk '{print $1}'"') do set xip_image1_start=0x%%i
for /f "delims=" %%i in ('cmd /c "%tooldir%\grep xip_image1 Debug/Exe/bootloader.map | %tooldir%\grep Limit | %tooldir%\gawk '{print $1}'"') do set xip_image1_end=0x%%i
::echo ram1_start: %ram1_start% > tmp.txt
::echo ram1_end: %ram1_end% >> tmp.txt
::echo xip_image_start: %xip_image1_start% >> tmp.txt
::echo xip_image1_end: %xip_image1_end% >> tmp.txt
@echo off&setlocal enabledelayedexpansion
for /f "delims=:" %%i in ('findstr /n /c:"PLACEMENT" Debug\List\bootloader.map') do (
set skipline=%%i
)
@echo off&setlocal enabledelayedexpansion
for /f "delims=:" %%i in ('findstr /n /c:"Kind" Debug\List\bootloader.map') do (
set endline=%%i
)
set /a line=endline-skipline
@echo off&setlocal enabledelayedexpansion
set n=0
(for /f "skip=%skipline% delims=" %%a in (Debug\List\bootloader.map) do (
set /a n+=1
if !n! leq %line% echo %%a
))>bootloader1.txt
(for /f "delims=" %%a in (bootloader1.txt) do (
set /p="%%a"<nul | find /V "<Block>"
))>bootloader2.txt
@echo off&setlocal enabledelayedexpansion
set strstart={
set strend=}
set /a m=1
(for /f "delims=" %%a in (bootloader2.txt) do (
set /p="%%a"<nul
echo %%a | find "%strstart%" >nul && set /a m-=1
echo %%a | find "%strend%" >nul && set /a m+=1
if !m!==1 (echo.)
))>bootloader3.txt
findstr /rg "place" bootloader3.txt > tmp.txt
del bootloader1.txt
del bootloader2.txt
del bootloader3.txt
::findstr /rg "place" Debug\List\bootloader.map > tmp.txt
setlocal enabledelayedexpansion
for /f "delims=:" %%i in ('findstr /rg "IMAGE1" tmp.txt') do (
set "var=%%i"
set "sectname_ram1=!var:~1,2!"
)
for /f "delims=:" %%i in ('findstr /rg "xip_image1.text" tmp.txt') do (
set "var=%%i"
set "sectname_xip1=!var:~1,2!"
)
setlocal disabledelayedexpansion
del tmp.txt
::echo sectname_ram1: %sectname_ram1% sectname_xip: %sectname_xip1% >tmp.txt
:: pick ram_1.bin
%tooldir%\objcopy -j "%sectname_ram1% rw" -Obinary Debug/Exe/bootloader.axf Debug/Exe/ram_1.bin
:: add header
%tooldir%\pick %ram1_start% %ram1_end% Debug\Exe\ram_1.bin Debug\Exe\ram_1.p.bin boot
:: pick xip_image1.bin
%tooldir%\objcopy -j "%sectname_xip1% rw" -Obinary Debug/Exe/bootloader.axf Debug/Exe/xip_image1.bin
set maxbytesize=0
set file="Debug/Exe/ram_1.bin"
FOR /F "usebackq" %%A IN ('%file%') DO set size=%%~zA
if %size% EQU %maxbytesize% (
%tooldir%\objcopy -j "%sectname_ram1%" -Obinary Debug/Exe/bootloader.axf Debug/Exe/ram_1.bin
%tooldir%\pick %ram1_start% %ram1_end% Debug\Exe\ram_1.bin Debug\Exe\ram_1.p.bin boot
%tooldir%\objcopy -j "%sectname_xip1%" -Obinary Debug/Exe/bootloader.axf Debug/Exe/xip_image1.bin
)
:: add header
%tooldir%\pick %xip_image1_start% %xip_image1_end% Debug\Exe\xip_image1.bin Debug\Exe\xip_image1.p.bin boot
:: aggregate boot_all.bin
copy /b Debug\Exe\xip_image1.p.bin+Debug\Exe\ram_1.p.bin Debug\Exe\boot_all.bin
:: update boot_all.bin, raw file for application
copy Debug\Exe\boot_all.bin %libdir%\image\boot_all.bin
::padding boot_all.bin to 32K+4K+4K+4K, LOADER/RSVD/SYSTEM/CALIBRATION
::%tooldir%\padding 44k 0xFF Debug\Exe\boot_all.bin
:: create bootloader extern symbols
echo /* Bootloader symbol list */ > bootloader_symbol.icf
setlocal enabledelayedexpansion
for /f "tokens=1,2,3 delims= " %%i in ( Debug/Exe/bootloader.map ) do (
set "var=%%i"
if /i "!var:~7!"=="a" (
if %%j==T (echo %%k 0x!var:~0,7!b >> test1.txt)
) else (
if /i "!var:~7!"=="c" (
if %%j==T (echo %%k 0x!var:~0,7!d >> test1.txt)
) else (
if /i "!var:~7!"=="e" (
if %%j==T (echo %%k 0x!var:~0,7!f >> test1.txt)
) else (
set "n=!var:~7!"
set /a n+=1
if %%j==T (echo %%k 0x!var:~0,7!!n! >> test1.txt)
)
)
)
)
for /f "eol=. tokens=1,2" %%i in ( test1.txt ) do echo %%i %%j >> test2.txt
findstr /v "Region" "test2.txt">>test3.txt
for /f "eol=_ tokens=1,2" %%i in ( test3.txt ) do echo define exported symbol %%i = %%j; >> bootloader_symbol.icf
del test1.txt
del test2.txt
del test3.txt
del Debug\Exe\ram_1.bin
del Debug\Exe\ram_1.p.bin
del Debug\Exe\xip_image1.bin
del Debug\Exe\xip_image1.p.bin
exit

View File

@@ -0,0 +1,5 @@
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd /c "+WScript.Arguments.Item(1)+"\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\postbuild_img1.bat "+WScript.Arguments.Item(0)+" "+WScript.Arguments.Item(1), 0

View File

@@ -0,0 +1,149 @@
cd /D %2
set tooldir=%2\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\tools
set libdir=%2\..\..\..\component\soc\realtek\8711b\misc\bsp
set ota_bin_ver=0x%date:~0,4%%date:~5,2%%date:~8,2%
::echo input1=%1 >tmp.txt
::echo input2=%2 >>tmp.txt
::echo ota_bin_ver=%ota_bin_ver% >>tmp.txt
del Debug\Exe\target.map Debug\Exe\application.asm *.bin
cmd /c "%tooldir%\nm Debug/Exe/application.axf | %tooldir%\sort > Debug/Exe/application.map"
cmd /c "%tooldir%\objdump -d Debug/Exe/application.axf > Debug/Exe/application.asm"
for /f "delims=" %%i in ('cmd /c "%tooldir%\grep IMAGE2 Debug/Exe/application.map | %tooldir%\grep Base | %tooldir%\gawk '{print $1}'"') do set ram2_start=0x%%i
for /f "delims=" %%i in ('cmd /c "%tooldir%\grep IMAGE2 Debug/Exe/application.map | %tooldir%\grep Limit | %tooldir%\gawk '{print $1}'"') do set ram2_end=0x%%i
for /f "delims=" %%i in ('cmd /c "%tooldir%\grep xip_image2 Debug/Exe/application.map | %tooldir%\grep Base | %tooldir%\gawk '{print $1}'"') do set xip_image2_start=0x%%i
for /f "delims=" %%i in ('cmd /c "%tooldir%\grep xip_image2 Debug/Exe/application.map | %tooldir%\grep Limit | %tooldir%\gawk '{print $1}'"') do set xip_image2_end=0x%%i
::echo ram2_start: %ram2_start% > tmp.txt
::echo ram2_end: %ram2_end% >> tmp.txt
::echo xip_image2_start: %xip_image2_start% >> tmp.txt
::echo xip_image2_end: %xip_image2_end% >> tmp.txt
@echo off&setlocal enabledelayedexpansion
for /f "delims=:" %%i in ('findstr /n /c:"PLACEMENT" Debug\List\application.map') do (
set skipline=%%i
)
@echo off&setlocal enabledelayedexpansion
for /f "delims=:" %%i in ('findstr /n /c:"Kind" Debug\List\application.map') do (
set endline=%%i
)
set /a line=endline-skipline
@echo off&setlocal enabledelayedexpansion
set n=0
(for /f "skip=%skipline% delims=" %%a in (Debug\List\application.map) do (
set /a n+=1
if !n! leq %line% echo %%a
))>application1.txt
(for /f "delims=" %%a in (application1.txt) do (
set /p="%%a"<nul | find /V "<Block>"
))>application2.txt
@echo off&setlocal enabledelayedexpansion
set strstart={
set strend=}
set /a m=1
(for /f "delims=" %%a in (application2.txt) do (
set /p="%%a"<nul
echo %%a | find "%strstart%" >nul && set /a m-=1
echo %%a | find "%strend%" >nul && set /a m+=1
if !m!==1 (echo.)
))>application3.txt
findstr /rg "place" application3.txt > tmp.txt
del application1.txt
del application2.txt
del application3.txt
::findstr /rg "place" Debug\List\application.map > tmp.txt
setlocal enabledelayedexpansion
for /f "delims=:" %%i in ('findstr /rg "0x1000" tmp.txt') do (
set "var=%%i"
set "sectname_ram2=!var:~1,2!"
)
for /f "delims=:" %%i in ('findstr /rg /i "xip_image2.text 0x80f'ffff 0x080fffff" tmp.txt') do (
set "var=%%i"
set "sectname_xip=!var:~1,2!"
)
for /f "delims=:" %%i in ('findstr /rg /i "0x1003f000 0x1003'f000" tmp.txt') do (
set "var=%%i"
set "sectname_rdp=!var:~1,2!"
)
setlocal disabledelayedexpansion
del tmp.txt
::echo sectname_ram2: %sectname_ram2% sectname_xip: %sectname_xip% sectname_rdp: %sectname_rdp% >tmp1.txt
%tooldir%\objcopy -j "%sectname_ram2% rw" -Obinary Debug/Exe/application.axf Debug/Exe/ram_2.r.bin
%tooldir%\objcopy -j "%sectname_xip% rw" -Obinary Debug/Exe/application.axf Debug/Exe/xip_image2.bin
%tooldir%\objcopy -j "%sectname_rdp% rw" -Obinary Debug/Exe/application.axf Debug/Exe/rdp.bin
set maxbytesize=0
set file="Debug/Exe/ram_2.r.bin"
FOR /F "usebackq" %%A IN ('%file%') DO set size=%%~zA
::echo %size% > mark1.txt
if %size% EQU %maxbytesize% (
%tooldir%\objcopy -j "%sectname_ram2%" -Obinary Debug/Exe/application.axf Debug/Exe/ram_2.r.bin
%tooldir%\objcopy -j "%sectname_xip%" -Obinary Debug/Exe/application.axf Debug/Exe/xip_image2.bin
%tooldir%\objcopy -j "%sectname_rdp%" -Obinary Debug/Exe/application.axf Debug/Exe/rdp.bin
)
:: remove bss sections
%tooldir%\pick %ram2_start% %ram2_end% Debug\Exe\ram_2.r.bin Debug\Exe\ram_2.bin raw
del Debug\Exe\ram_2.r.bin
:: add header
%tooldir%\pick %ram2_start% %ram2_end% Debug\Exe\ram_2.bin Debug\Exe\ram_2.p.bin
%tooldir%\pick %xip_image2_start% %xip_image2_end% Debug\Exe\xip_image2.bin Debug\Exe\xip_image2.p.bin
:: get ota_idx and ota_offset from image2.icf
setlocal enabledelayedexpansion
findstr /rg "__ICFEDIT_region_XIP_OTA1_start__" image2.icf>test.txt
for /f "tokens=1,2,3,4,5*" %%i in ('findstr /rg "symbol" test.txt') do (
set "var=%%m"
set "ota_offset=!var:~0,10!"
)
setlocal disabledelayedexpansion
if "%ota_offset%"=="0x0800B000" (
set ota_idx=1
) else (
set ota_idx=2
)
del test.txt
::echo ota_idx=%ota_idx% >tmp.txt
::echo ota_offset=%ota_offset% >>tmp.txt
:: aggregate image2_all.bin and add checksum
if "%ota_idx%"=="2" (
copy /b Debug\Exe\xip_image2.p.bin+Debug\Exe\ram_2.p.bin Debug\Exe\image2_all_ota2.bin
%tooldir%\checksum Debug\Exe\image2_all_ota2.bin
%tooldir%\ota Debug\Exe\image2_all_ota1.bin 0x800B000 Debug\Exe\image2_all_ota2.bin %ota_offset% %ota_bin_ver% Debug\Exe\ota_all.bin
) else (
copy /b Debug\Exe\xip_image2.p.bin+Debug\Exe\ram_2.p.bin Debug\Exe\image2_all_ota1.bin
%tooldir%\checksum Debug\Exe\image2_all_ota1.bin
)
del Debug\Exe\ram_2.bin
del Debug\Exe\ram_2.p.bin
del Debug\Exe\xip_image2.bin
del Debug\Exe\xip_image2.p.bin
:: force update boot_all.bin
del Debug\Exe\boot_all.bin
:: check boot_all.bin exist, copy default
if not exist Debug\Exe\boot_all.bin (
copy %libdir%\image\boot_all.bin Debug\Exe\boot_all.bin
)
:: board generator
%tooldir%\..\gen_board_img2.bat %ram2_start% %ram2_end%
exit

View File

@@ -0,0 +1,5 @@
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd /c "+WScript.Arguments.Item(1)+"\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\postbuild_img2.bat "+WScript.Arguments.Item(0)+" "+WScript.Arguments.Item(1), 0

View File

@@ -0,0 +1,52 @@
cd /D %1
set ota_idx=%2
set ota_offset=%3
:: Generate build_info.h
::echo off
::echo %date:~0,10%-%time:~0,8%
::echo %USERNAME%
for /f "usebackq" %%i in (`hostname`) do set hostname=%%i
::echo %hostname%
echo #define RTL_FW_COMPILE_TIME RTL8195AFW_COMPILE_TIME > ..\inc\build_info.h
echo #define RTL_FW_COMPILE_DATE RTL8195AFW_COMPILE_DATE >> ..\inc\build_info.h
echo #define UTS_VERSION "%date:~0,10%-%time:~0,8%" >> ..\inc\build_info.h
echo #define RTL8195AFW_COMPILE_TIME "%date:~0,10%-%time:~0,8%" >> ..\inc\build_info.h
echo #define RTL8195AFW_COMPILE_DATE "%date:~0,10%" >> ..\inc\build_info.h
echo #define RTL8195AFW_COMPILE_BY "%USERNAME%" >> ..\inc\build_info.h
echo #define RTL8195AFW_COMPILE_HOST "%hostname%" >> ..\inc\build_info.h
echo #define RTL8195AFW_COMPILE_DOMAIN >> ..\inc\build_info.h
echo #define RTL8195AFW_COMPILER "IAR compiler" >> ..\inc\build_info.h
if "%ota_idx%"=="0" (
goto :end
)
set cf=image2.icf
if "%ota_idx%"=="2" (
set dt=%ota_offset%
) else (
set dt=0x0800B000
)
findstr /rg "__ICFEDIT_region_XIP_OTA1_start__" %cf%>ttst.txt
setlocal enabledelayedexpansion
for /f "tokens=1,2,3,4,5*" %%i in ('findstr /rg "symbol" ttst.txt') do (
set "var=%%m"
set "st=!var:~0,10!"
)
setlocal disabledelayedexpansion
del ttst.txt
echo /*###ICF### Section handled by ICF editor, don't touch! ****/>root.txt
setlocal enabledelayedexpansion
for /f "skip=1 tokens=1,2* delims=@" %%i in ('findstr ".*" %cf%') do (
set txt=%%i
echo !txt:%st%=%dt%!>>root.txt
)
move /y root.txt image2.icf
:end
exit

View File

@@ -0,0 +1,5 @@
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "cmd /c "+WScript.Arguments.Item(0)+"\..\..\..\component\soc\realtek\8711b\misc\iar_utility\common\prebuild.bat "+WScript.Arguments.Item(0)+" "+WScript.Arguments.Item(1)+" "+WScript.Arguments.Item(2), 0

View File

@@ -0,0 +1,100 @@
//DRAM_INFO
__var DeviceType;
__var Page;
__var Bank;
__var DqWidth;
//DRAM_MODE_REG_INFO
__var BstLen;
__var BstType;
__var Mode0Cas;
__var Mode0Wr;
__var Mode1DllEnN;
__var Mode1AllLat;
__var Mode2Cwl;
//DRAM_TIMING_INFO, additional parameter, to config DRAM_TIMING INFO
__var DramTimingTref;
__var DramRowNum;
__var Tck;
//DRAM_TIMING_INFO
__var TrfcPs;
__var TrefiPs;
__var WrMaxTck;
__var TrcdPs;
__var TrpPs;
__var TrasPs;
__var TrrdTck;
__var TwrPs;
__var TwtrTck;
__var TmrdTck;
__var TrtpTck;
__var TccdTck;
__var TrcPs;
//DRAM_DEVICE_INFO
__var DdrPeriodPs;
__var DfiRate;
__mem_test(){
__var i;
__var vaddr;
__var tmp;
i=0;
while(i<10){
vaddr = 0x30000000+((i*23)&0x1FFFFC);
__writeMemory32(0x55AA55AA, vaddr, "Memory");
tmp = __readMemory32(vaddr,"Memory");
if(tmp!=0x55AA55AA)
return 1;
i=i+1;
}
return 0;
}
__var ok_pipe_id0;
__var ok_pipe_id1;
__var ok_tpc_min0;
__var ok_tpc_max0;
__var ok_tpc_min1;
__var ok_tpc_max1;
__var tpc0_cnt;
__var tpc1_cnt;
__setup_system()
{
__var tmp;
__hwReset(1);
}
execUserPreload()
{
__message "User execUserPreload....";
__setup_system();
}
execUserSetup()
{
//__var tmp;
//__message "User Setup....";
// if use normal reset, please unmark those 2 lines
//execUserPreload();
//__setup_system();
//__message "User __loadImage....";
//__loadImage("$TARGET_PATH$ ", 0, 0);
}
execUserReset()
{
__var tmp;
__message "User Reset....";
tmp = __readMemory32(0x40000210, "Memory")&(~(1<<28));
tmp = tmp & (~(1<<21));
__writeMemory32(tmp, 0x40000210, "Memory");
}

View File

@@ -0,0 +1,60 @@
#ifndef _FREERTOS_PMU_8710B_H_
#define _FREERTOS_PMU_8710B_H_
#define PMU_DEVICE_TIMER_DEFAULT_INTERVAL 2000
#define PMU_DEVICE_TIMER_MAX_INTERVAL (1000*30) /* max 30sec */
typedef struct
{
u32 nDeviceId;
PSM_HOOK_FUN sleep_hook_fun;
void* sleep_param_ptr;
PSM_HOOK_FUN wakeup_hook_fun;
void* wakeup_param_ptr;
}PSM_DD_HOOK_INFO;
typedef struct
{
u32 nDeviceId;
PSM_HOOK_FUN late_resume_hook_fun;
void* late_resume_param_ptr;
}PSM_DD_DELAY_HOOK_INFO;
/**
* @brief init system active timer for PMU.
* @param none.
* @retval status value:
* - 0: _FAIL
* - 1: _SUCCESS
* @note can just used in late resume or later, can not used in wakeup_hook_fun.
*/
uint32_t pmu_yield_os_check(void);
uint32_t pmu_sysactive_timer_init(void);
void pmu_register_delay_callback(u32 nDeviceId, PSM_HOOK_FUN late_resume_hook_fun, void* late_resume_param_ptr);
void pmu_unregister_delay_callback(u32 nDeviceId);
u32 pmu_exec_sleep_hook_funs(void);
void pmu_exec_wakeup_hook_funs(u32 nDeviceIdMax);
uint32_t pmu_set_sleep_type(uint32_t type);
uint32_t pmu_set_delta_tick(float value);
void pmu_yield_os_set(int yield_flag);
#if CONFIG_LWIP_LAYER
extern uint32_t LWIP_Get_Dynamic_Sleep_Interval();
#endif
void pmu_set_broadcast_awake(u32 NewStatus);
void pmu_set_broadcast_awake_port(u32 AwakePort);
u32 pmu_get_broadcast_awake_port(void);
/**
* @brief set roaming awake or not
* @param enable/threshhold:
1: enable roaming awake and set the threshhold
0: disable roaming awake and ignore the threshhold
* @retval none
*/
void pmu_set_roaming_awake(u8 enable, u8 threshhold);
extern u32 tickless_debug;
extern u32 tick_last_tcp;
#endif

File diff suppressed because it is too large Load Diff