initial commit

This commit is contained in:
Tautvydas Belgeras 2018-06-05 16:16:17 +03:00
commit 60a7afcc83
2528 changed files with 1001987 additions and 0 deletions

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,48 @@
@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 ^</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,86 @@
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
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
:: 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,98 @@
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
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 "xip_image2.text" tmp.txt') do (
set "var=%%i"
set "sectname_xip=!var:~1,2!"
)
for /f "delims=:" %%i in ('findstr /rg "0x1003f000" 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
:: 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,50 @@
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 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,107 @@
//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);
tmp = __readMemory32(0x40000210, "Memory")|(1<<28);
__writeMemory32(tmp, 0x40000210, "Memory");
__message "User Preload....";
__loadImage("$TARGET_PATH$ ", 0, 0);
__message "User Preload end....";
}
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");
}