diff --git a/.cproject b/.cproject index d1a8f39..6e1bb40 100644 --- a/.cproject +++ b/.cproject @@ -14,12 +14,15 @@ + + + - + @@ -161,6 +164,9 @@ + + + @@ -658,10 +664,10 @@ false false - - make + + mingw32-make.exe -s - flashburn + flash_images true true false @@ -714,10 +720,10 @@ true true - + mingw32-make.exe -s - flashwebfs + flash_webfs true true true @@ -738,10 +744,10 @@ true false - + mingw32-make.exe -s - flashboot + flash_boot true true true diff --git a/.project b/.project index 52d209e..6710017 100644 --- a/.project +++ b/.project @@ -13,7 +13,6 @@ org.eclipse.cdt.managedbuilder.core.genmakebuilder - clean,full,incremental, diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 8203842..419d8cb 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -5,7 +5,7 @@ - + @@ -16,7 +16,7 @@ - + @@ -27,7 +27,7 @@ - + diff --git a/.settings/org.eclipse.cdt.core.prefs b/.settings/org.eclipse.cdt.core.prefs index 4fa9638..2ab22b6 100644 --- a/.settings/org.eclipse.cdt.core.prefs +++ b/.settings/org.eclipse.cdt.core.prefs @@ -13,7 +13,7 @@ environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.18534 environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/PATH/value=${TL_PATH}\\bin;${MINGW_HOME}\\mingw64\\bin;${MINGW_HOME}\\bin;${MSYS_HOME}\\bin;${OCD_PATH};C\:/Program Files (x86)/Java/jre1.8.0_101/bin/client;C\:/Program Files (x86)/Java/jre1.8.0_101/bin;C\:/Program Files (x86)/Java/jre1.8.0_101/lib/i386;C\:\\MinGW\\mingw64\\bin;C\:\\MinGW\\msys\\1.0\\bin;C\:\\MinGW\\bin;D\:\\MCU\\STMicroelectronics\\st_toolset\\asm;C\:\\Python27;C\:\\Utils\\FarUtils;C\:\\Utils\\FarUtils\\HIEW810;C\:\\Windows;C\:\\Windows\\system32;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0;D\:\\MCU\\Microchip\\xc32\\v1.42\\bin;D\:\\MCU\\Microchip\\mplabc30\\v3.31\\bin;D\:\\MCU\\Microchip\\MPLAB C32 Suite\\bin;D\:\\MCU\\Microchip\\mplabc32\\v1.12\\bin;D\:\\MCU\\Microchip\\mcc18\\mpasm;D\:\\MCU\\Microchip\\mcc18\\bin;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\binC\:\\Program Files (x86)\\Git\\cmd;C\:\\Program Files (x86)\\Borland\\Delphi7\\Bin;C\:\\Program Files (x86)\\Borland\\Delphi7\\Projects\\Bpl\\;C\:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C\:\\Program Files (x86)\\Common Files\\Acronis\\SnapAPI;C\:\\Program Files (x86)\\Windows Live\\Shared;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit;C\:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.0;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn;C\:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn;C\:\\Program Files\\Microsoft DNX\\Dnvm;C\:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\X86\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\X86\\bin;C\:\\Users\\PVV\\.dnx\\bin;C\:\\ProgramData\\chocolatey\\bin;C\:\\ProgramData\\Oracle\\Java\\javapath;C\:\\Program Files (x86)\\QuickTime\\QTSystem;C\:\\Program Files\\nodejs;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\bin;C\:\\Program Files (x86)\\Git\\cmd;D\:\\MentorGraphics\\Sourcery_CodeBench_Lite_for_MIPS_ELF\\bin;C\:\\Eclipse environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/TL_PATH/delimiter=; environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/TL_PATH/operation=replace -environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/TL_PATH/value=D\:\\MCU\\GNU_Tools_ARM_Embedded\\6.2017-q1-update +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/TL_PATH/value=D\:\\MCU\\GNU_Tools_ARM_Embedded\\7.2017-q4-major environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/append=true environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235/appendContributed=true environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/MINGW_HOME/delimiter=; @@ -30,7 +30,7 @@ environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/PATH/ environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/PATH/value=${TL_PATH}\\bin;${MINGW_HOME}\\mingw64\\bin;${MINGW_HOME}\\bin;${MSYS_HOME}\\bin;${OCD_PATH};C\:/Program Files (x86)/Java/jre1.8.0_101/bin/client;C\:/Program Files (x86)/Java/jre1.8.0_101/bin;C\:/Program Files (x86)/Java/jre1.8.0_101/lib/i386;C\:\\MinGW\\mingw64\\bin;C\:\\MinGW\\msys\\1.0\\bin;C\:\\MinGW\\bin;D\:\\MCU\\STMicroelectronics\\st_toolset\\asm;C\:\\Python27;C\:\\Utils\\FarUtils;C\:\\Utils\\FarUtils\\HIEW810;C\:\\Windows;C\:\\Windows\\system32;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0;D\:\\MCU\\Microchip\\xc32\\v1.42\\bin;D\:\\MCU\\Microchip\\mplabc30\\v3.31\\bin;D\:\\MCU\\Microchip\\MPLAB C32 Suite\\bin;D\:\\MCU\\Microchip\\mplabc32\\v1.12\\bin;D\:\\MCU\\Microchip\\mcc18\\mpasm;D\:\\MCU\\Microchip\\mcc18\\bin;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\binC\:\\Program Files (x86)\\Git\\cmd;C\:\\Program Files (x86)\\Borland\\Delphi7\\Bin;C\:\\Program Files (x86)\\Borland\\Delphi7\\Projects\\Bpl\\;C\:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C\:\\Program Files (x86)\\Common Files\\Acronis\\SnapAPI;C\:\\Program Files (x86)\\Windows Live\\Shared;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit;C\:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.0;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn;C\:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn;C\:\\Program Files\\Microsoft DNX\\Dnvm;C\:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\X86\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\X86\\bin;C\:\\Users\\PVV\\.dnx\\bin;C\:\\ProgramData\\chocolatey\\bin;C\:\\ProgramData\\Oracle\\Java\\javapath;C\:\\Program Files (x86)\\QuickTime\\QTSystem;C\:\\Program Files\\nodejs;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\bin;C\:\\Program Files (x86)\\Git\\cmd;D\:\\MentorGraphics\\Sourcery_CodeBench_Lite_for_MIPS_ELF\\bin;C\:\\Eclipse environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/TL_PATH/delimiter=; environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/TL_PATH/operation=replace -environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/TL_PATH/value=D\:\\MCU\\GNU_Tools_ARM_Embedded\\6.2017-q1-update +environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/TL_PATH/value=D\:\\MCU\\GNU_Tools_ARM_Embedded\\7.2017-q4-major environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/append=true environment/project/cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404/appendContributed=true environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/MINGW_HOME/delimiter=; @@ -47,6 +47,6 @@ environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/PATH environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/PATH/value=${TL_PATH}\\bin;${MINGW_HOME}\\mingw64\\bin;${MINGW_HOME}\\bin;${MSYS_HOME}\\bin;${OCD_PATH};C\:/Program Files (x86)/Java/jre1.8.0_101/bin/client;C\:/Program Files (x86)/Java/jre1.8.0_101/bin;C\:/Program Files (x86)/Java/jre1.8.0_101/lib/i386;C\:\\MinGW\\mingw64\\bin;C\:\\MinGW\\msys\\1.0\\bin;C\:\\MinGW\\bin;D\:\\MCU\\STMicroelectronics\\st_toolset\\asm;C\:\\Python27;C\:\\Utils\\FarUtils;C\:\\Utils\\FarUtils\\HIEW810;C\:\\Windows;C\:\\Windows\\system32;C\:\\Windows\\System32\\Wbem;C\:\\Windows\\System32\\WindowsPowerShell\\v1.0;D\:\\MCU\\Microchip\\xc32\\v1.42\\bin;D\:\\MCU\\Microchip\\mplabc30\\v3.31\\bin;D\:\\MCU\\Microchip\\MPLAB C32 Suite\\bin;D\:\\MCU\\Microchip\\mplabc32\\v1.12\\bin;D\:\\MCU\\Microchip\\mcc18\\mpasm;D\:\\MCU\\Microchip\\mcc18\\bin;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\binC\:\\Program Files (x86)\\Git\\cmd;C\:\\Program Files (x86)\\Borland\\Delphi7\\Bin;C\:\\Program Files (x86)\\Borland\\Delphi7\\Projects\\Bpl\\;C\:\\Program Files (x86)\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files (x86)\\ATI Technologies\\ATI.ACE\\Core-Static;C\:\\Program Files (x86)\\Common Files\\Acronis\\SnapAPI;C\:\\Program Files (x86)\\Windows Live\\Shared;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files (x86)\\Windows Kits\\8.1\\Windows Performance Toolkit;C\:\\Program Files (x86)\\Microsoft SDKs\\TypeScript\\1.0;C\:\\Program Files (x86)\\IVI Foundation\\VISA\\WinNT\\Bin;C\:\\Program Files\\Microsoft SQL Server\\110\\Tools\\Binn;C\:\\Program Files\\Common Files\\Microsoft Shared\\Windows Live;C\:\\Program Files\\Microsoft SQL Server\\120\\Tools\\Binn;C\:\\Program Files\\Microsoft DNX\\Dnvm;C\:\\Program Files\\IVI Foundation\\VISA\\Win64\\Bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SKWorkshop\\Marco\\X86\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\HMI\\bin;D\:\\Automation\\Samcoon\\SK035AE\\SKWorkshop\\Marco\\X86\\bin;C\:\\Users\\PVV\\.dnx\\bin;C\:\\ProgramData\\chocolatey\\bin;C\:\\ProgramData\\Oracle\\Java\\javapath;C\:\\Program Files (x86)\\QuickTime\\QTSystem;C\:\\Program Files\\nodejs;D\:\\WRK\\TortoiseGit\\bin;C\:\\Utils\\TortoiseSVN\\bin;C\:\\Program Files (x86)\\Git\\cmd;D\:\\MentorGraphics\\Sourcery_CodeBench_Lite_for_MIPS_ELF\\bin;C\:\\Eclipse environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/TL_PATH/delimiter=; environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/TL_PATH/operation=replace -environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/TL_PATH/value=D\:\\MCU\\GNU_Tools_ARM_Embedded\\6.2017-q1-update +environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/TL_PATH/value=D\:\\MCU\\GNU_Tools_ARM_Embedded\\7.2017-q4-major environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/append=true environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/appendContributed=true diff --git a/DAPLink-RTL00Console.bat b/DAPLink-RTL00Console.bat index bc0d13c..2031e41 100644 --- a/DAPLink-RTL00Console.bat +++ b/DAPLink-RTL00Console.bat @@ -1,6 +1,6 @@ @echo off call paths.bat -cd flasher +cd USDK\flasher openocd -f interface/cmsis-dap.cfg -c "adapter_khz 1000" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "load_ram_binary RTL00Console_ROM.bin 0x10000BA8" -c "exit" rem -c "shutdown" diff --git a/DAPLink-RdFullFlash.bat b/DAPLink-RdFullFlash.bat index dfd0c9e..4e435f0 100644 --- a/DAPLink-RdFullFlash.bat +++ b/DAPLink-RdFullFlash.bat @@ -1,7 +1,7 @@ @echo off call paths.bat -cd flasher -openocd -f interface/cmsis-dap.cfg -c "adapter_khz 1000" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "adapter_khz 1000" -c "rtl8710_flash_read ../fullflash.bin 0 2097152" -c "shutdown" +cd USDK\flasher +openocd -f interface/cmsis-dap.cfg -c "adapter_khz 1000" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "adapter_khz 1000" -c "rtl8710_flash_read ../../fullflash.bin 0 2097152" -c "shutdown" echo flash read fullflash.bin pause diff --git a/DAPLink-Reset.bat b/DAPLink-Reset.bat index aceee70..2dcb247 100644 --- a/DAPLink-Reset.bat +++ b/DAPLink-Reset.bat @@ -1,6 +1,6 @@ @echo off call paths.bat -@cd flasher +@cd USDK\flasher openocd -f interface/cmsis-dap.cfg -c "adapter_khz 1000" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "restart_from_falsh" -c "shutdown" rem diff --git a/DAPLink_WrFullFlash.bat b/DAPLink_WrFullFlash.bat index bd1cf72..eea9b0b 100644 --- a/DAPLink_WrFullFlash.bat +++ b/DAPLink_WrFullFlash.bat @@ -1,6 +1,6 @@ @echo off call paths.bat -cd flasher -openocd -f interface/cmsis-dap.cfg -c "adapter_khz 3500" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" -c "rtl8710_flash_write fullflash.bin 0" -c "shutdown" +cd USDK\flasher +openocd -f interface/cmsis-dap.cfg -c "adapter_khz 3500" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" -c "rtl8710_flash_write ../../fullflash.bin 0" -c "shutdown" pause diff --git a/ExampleHTM/dygraph/ws_adc2.htm b/ExampleHTM/dygraph/ws_adc2.htm index c74702a..8031c43 100644 --- a/ExampleHTM/dygraph/ws_adc2.htm +++ b/ExampleHTM/dygraph/ws_adc2.htm @@ -15,7 +15,7 @@
Window: ? sec, Sample Rate: ? smps -
+
+ -
-
-

+

+
- + - -
- Window: ? sec
- Sample Rate: ? smps -

-
+ + +
+ Window: ? sec, Sample Rate: ? smps +
- - +function convertArrayOfObjectsToCSV(value){ + var result, ctr, keys, columnDelimiter, lineDelimiter, data; + data = value.data || null; + if (data == null || !data.length) {return null;} + columnDelimiter = value.columnDelimiter || ';'; + lineDelimiter = value.lineDelimiter || '\n'; + keys = Object.keys(data[1]); + result = ''; + result += keys.join(columnDelimiter); + result += lineDelimiter; + data.forEach(function(item){ + ctr = 0; + keys.forEach(function(key){ + if (ctr > 0) + result += columnDelimiter; + result += item[key]; + ctr++; + }); + result += lineDelimiter; + }); + return result; +} +$("butSave").onclick = function() { + var csv = convertArrayOfObjectsToCSV({data: datau}); + if (!csv.match(/^data:text\/csv/i)) {csv = 'data:text/csv;charset=utf-8,' + csv;} + var encodedUri = encodeURI(csv); + var link = document.createElement('a'); + link.setAttribute('href', encodedUri); + link.setAttribute('download',"data.csv"); + link.click(); +} +if(window.innerHeight > 320) $('div_v').style.height = (window.innerHeight-100) + 'px'; +window.onresize = function(){ + if(window.innerHeight > 320) $('div_v').style.height = (window.innerHeight-100) + 'px'; +// $('div_v').style.width = (window.innerWidth-50) + 'px'; +} + diff --git a/ExampleHTM/dygraph/wso_adcs.htm b/ExampleHTM/dygraph/wso_adcs.htm index 6644753..cb6dcfe 100644 --- a/ExampleHTM/dygraph/wso_adcs.htm +++ b/ExampleHTM/dygraph/wso_adcs.htm @@ -78,7 +78,7 @@ function draw() { frend++; requestAnimationFrame(draw); } -var wsUri = 'ws://rtl871x1/web.cgi' +var wsUri = 'ws://rtl871x0/web.cgi' //var wsUri = "ws://"+window.location.host.toString()+"/web.cgi"; ws = new WebSocket(wsUri); ws.binaryType = 'arraybuffer'; diff --git a/ExampleHTM/dygraph/wso_audio.htm b/ExampleHTM/dygraph/wso_audio.htm index f330740..737e09a 100644 --- a/ExampleHTM/dygraph/wso_audio.htm +++ b/ExampleHTM/dygraph/wso_audio.htm @@ -89,7 +89,7 @@ function draw() { frend++; requestAnimationFrame(draw); } -var wsUri = 'ws://rtl871x1/web.cgi' +var wsUri = 'ws://rtl871x0/web.cgi' //var wsUri = "ws://"+window.location.host.toString()+"/web.cgi"; ws = new WebSocket(wsUri); ws.binaryType = 'arraybuffer'; diff --git a/FarMenu.ini b/FarMenu.ini new file mode 100644 index 0000000..294faea Binary files /dev/null and b/FarMenu.ini differ diff --git a/JLink-RTL00ConsoleROM.bat b/JLink-RTL00ConsoleROM.bat index d8488c6..ab1aae7 100644 --- a/JLink-RTL00ConsoleROM.bat +++ b/JLink-RTL00ConsoleROM.bat @@ -1,3 +1,3 @@ @echo off call paths.bat -start JLink.exe -Device CORTEX-M3 -If SWD -Speed 4000 flasher\RTL00ConsoleROM.JLinkScript +start JLink.exe -Device CORTEX-M3 -If SWD -Speed 4000 USDK\flasher\RTL00ConsoleROM.JLinkScript diff --git a/JLink-RdFullFlash.bat b/JLink-RdFullFlash.bat index de5d955..f77b324 100644 --- a/JLink-RdFullFlash.bat +++ b/JLink-RdFullFlash.bat @@ -1,3 +1,3 @@ @echo off call paths.bat -JLink.exe -Device CORTEX-M3 -If SWD -Speed 10000 flasher/RTL_FFlash.JLinkScript +JLink.exe -Device CORTEX-M3 -If SWD -Speed 10000 USDK/flasher/RTL_FFlash.JLinkScript diff --git a/JLink-Reset.bat b/JLink-Reset.bat index 51ea2a8..b5ed584 100644 --- a/JLink-Reset.bat +++ b/JLink-Reset.bat @@ -1,3 +1,3 @@ @echo off call paths.bat -JLink.exe -Device CORTEX-M3 -If SWD -Speed 1000 flasher\RTL_Reset.JLinkScript +JLink.exe -Device CORTEX-M3 -If SWD -Speed 1000 USDK\flasher\RTL_Reset.JLinkScript diff --git a/Makefile b/Makefile index a70728c..a3b6b6f 100644 --- a/Makefile +++ b/Makefile @@ -20,13 +20,12 @@ clean: clean_all: @$(MAKE) -f $(SDK_PATH)sdkbuild.mk clean_all -.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 +.PHONY: flash_images runram reset test readfullflash flash_webfs flash_boot +flash_boot: + @$(MAKE) -f $(SDK_PATH)flasher.mk flash_boot + +flash_images: + @$(MAKE) -f $(SDK_PATH)flasher.mk flash_images flash_OTA: @$(MAKE) -f $(SDK_PATH)flasher.mk flash_OTA @@ -34,11 +33,10 @@ flash_OTA: webfs: @$(MAKE) -f webfs.mk -flashwebfs: - @$(MAKE) -f webfs.mk - @$(MAKE) -f $(SDK_PATH)flasher.mk flashwebfs +flash_webfs: webfs + @$(MAKE) -f $(SDK_PATH)flasher.mk flash_webfs #JLinkGDB-WrWebFs.bat - + runram: #JLink-RunRAM.bat @$(MAKE) --f $(SDK_PATH)flasher.mk runram diff --git a/USDK/Makefile b/USDK/Makefile index a70728c..d32b241 100644 --- a/USDK/Makefile +++ b/USDK/Makefile @@ -20,42 +20,29 @@ clean: clean_all: @$(MAKE) -f $(SDK_PATH)sdkbuild.mk clean_all -.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 +.PHONY: flash_images runram reset test readfullflash flash_webfs flash_boot +flash_boot: + @$(MAKE) -f $(SDK_PATH)flasher.mk flash_boot + +flash_images: + @$(MAKE) -f $(SDK_PATH)flasher.mk flash_images 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 diff --git a/USDK/component/common/api/wifi/wifi_conf.c b/USDK/component/common/api/wifi/wifi_conf.c index fc42bfb..f3172fa 100644 --- a/USDK/component/common/api/wifi/wifi_conf.c +++ b/USDK/component/common/api/wifi/wifi_conf.c @@ -518,7 +518,7 @@ int wifi_connect( struct { u8 bssid[ETH_ALEN + 2]; void * p; - } bs = { 0 }; + } bs; memcpy(bs.bssid, pWifi->bssid.octet, ETH_ALEN); for(int i = 0; i < ETH_ALEN; i++) { flg += bs.bssid[i]; @@ -529,6 +529,9 @@ int wifi_connect( } else { use_bssid = 1; + bs.bssid[ETH_ALEN] = 0; + bs.bssid[ETH_ALEN+1] = 0; + bs.p = 0; wext_set_bssid(WLAN0_NAME, bs.bssid); } } diff --git a/USDK/component/common/mbed/hal_ext/spi_ex_api.h b/USDK/component/common/mbed/hal_ext/spi_ex_api.h index 55616fa..51e234d 100644 --- a/USDK/component/common/mbed/hal_ext/spi_ex_api.h +++ b/USDK/component/common/mbed/hal_ext/spi_ex_api.h @@ -75,7 +75,8 @@ int32_t spi_master_write_stream(spi_t *obj, char *tx_buffer, uint32_t length); int32_t spi_master_write_read_stream(spi_t *obj, char *tx_buffer, char *rx_buffer, uint32_t length); int32_t spi_slave_read_stream_timeout(spi_t *obj, char *rx_buffer, uint32_t length, uint32_t timeout_ms); - +void spi_flush_rx_fifo (spi_t *obj); +void spi_set_tmod(spi_t *obj, SSI_CTRLR0_TMOD tmod); // 0 Read & Write, 1 Write only, 2 Read Only #ifdef CONFIG_GDMA_EN int32_t spi_slave_read_stream_dma(spi_t *obj, char *rx_buffer, uint32_t length); int32_t spi_slave_write_stream_dma(spi_t *obj, char *tx_buffer, uint32_t length); diff --git a/USDK/component/common/mbed/targets/hal/rtl8195a/spdio_api.c b/USDK/component/common/mbed/targets/hal/rtl8195a/spdio_api.c index 2a432c3..285e168 100644 --- a/USDK/component/common/mbed/targets/hal/rtl8195a/spdio_api.c +++ b/USDK/component/common/mbed/targets/hal/rtl8195a/spdio_api.c @@ -28,7 +28,7 @@ s8 spdio_tx_done_cb(void *padapter, u8 *data, u16 offset, u16 pktsize, u8 type){ s8 spdio_tx(struct spdio_t *obj, struct spdio_buf_t *pbuf){ -extern s8 HalSdioRxCallback(PHAL_SDIO_ADAPTER pSDIODev, VOID *pData, u16 Offset, u16 PktSize, u8 CmdType); +//extern s8 HalSdioRxCallback(PHAL_SDIO_ADAPTER pSDIODev, VOID *pData, u16 Offset, u16 PktSize, u8 CmdType); return HalSdioRxCallback((u8 *)pbuf, 0, pbuf->buf_size, pbuf->type); // ????????? } diff --git a/USDK/component/common/mbed/targets/hal/rtl8195a/spi_api.c b/USDK/component/common/mbed/targets/hal/rtl8195a/spi_api.c index eaef734..562c3ff 100644 --- a/USDK/component/common/mbed/targets/hal/rtl8195a/spi_api.c +++ b/USDK/component/common/mbed/targets/hal/rtl8195a/spi_api.c @@ -554,6 +554,7 @@ int32_t spi_master_write_stream(spi_t *obj, char *tx_buffer, uint32_t length) pHalSsiOp = &obj->spi_op; obj->state |= SPI_STATE_TX_BUSY; + /* as Master mode, sending data will receive data at sametime, so we need to drop those received dummy data */ if ((ret=pHalSsiOp->HalSsiWriteInterrupt(pHalSsiAdaptor, (u8 *) tx_buffer, length)) != HAL_OK) { @@ -562,6 +563,14 @@ int32_t spi_master_write_stream(spi_t *obj, char *tx_buffer, uint32_t length) return ret; } +VOID HalSsiTModRtl8195a(VOID *Adaptor, SSI_CTRLR0_TMOD tmod); +// SSI_CTRLR0_TMOD tmod +void spi_set_tmod(spi_t *obj, SSI_CTRLR0_TMOD tmod) +{ + PHAL_SSI_ADAPTOR pHalSsiAdaptor = &obj->spi_adp; + HalSsiTModRtl8195a(pHalSsiAdaptor, tmod); +} + // Master mode write a sequence of data by interrupt mode // The length unit is byte, for both 16-bits and 8-bits mode int32_t spi_master_write_read_stream(spi_t *obj, char *tx_buffer, diff --git a/USDK/component/common/network/sntp/sntp.c b/USDK/component/common/network/sntp/sntp.c index 0a914b3..ed7856c 100644 --- a/USDK/component/common/network/sntp/sntp.c +++ b/USDK/component/common/network/sntp/sntp.c @@ -165,9 +165,9 @@ time_t sntp_gen_system_time(int timezone) sntp_get_lasttime(&update_sec, &update_usec, &update_tick); - unsigned int current_tick = xTaskGetTickCount(); if(update_tick) { + unsigned int current_tick = xTaskGetTickCount(); long tick_diff_sec, tick_diff_ms; tick_diff_sec = (current_tick - update_tick) / configTICK_RATE_HZ; @@ -176,10 +176,9 @@ time_t sntp_gen_system_time(int timezone) update_usec += (tick_diff_ms * 1000); current_sec = update_sec + update_usec / 1000000 + timezone * 3600; } - else { +// else { // current_sec = current_tick / configTICK_RATE_HZ; - current_sec = update_usec; - } +// } return current_sec; /* current_tm = *(localtime(¤t_sec)); diff --git a/USDK/component/soc/realtek/8195a/fwlib/bitband_io.h b/USDK/component/soc/realtek/8195a/fwlib/bitband_io.h index 45d75c3..771fced 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/bitband_io.h +++ b/USDK/component/soc/realtek/8195a/fwlib/bitband_io.h @@ -13,27 +13,27 @@ /* * in hal_platform.h -#define BITBAND_REG_BASE 0x40001000 +#define GPIO_REG_BASE 0x40001000 */ /* * in rtl8195a_gpio.h * -#define BITBAND_PORTA_DR 0x00 // data register -#define BITBAND_PORTA_DDR 0x04 // data direction -#define BITBAND_PORTA_CTRL 0x08 // data source control, we should keep it as default: data source from software +#define REG_PORTA_DR 0x00 // data register +#define REG_PORTA_DDR 0x04 // data direction +#define REG_PORTA_CTRL 0x08 // data source control, we should keep it as default: data source from software -#define BITBAND_PORTB_DR 0x0c // data register -#define BITBAND_PORTB_DDR 0x10 // data direction -#define BITBAND_PORTB_CTRL 0x14 // data source control, we should keep it as default: data source from software +#define REG_PORTB_DR 0x0c // data register +#define REG_PORTB_DDR 0x10 // data direction +#define REG_PORTB_CTRL 0x14 // data source control, we should keep it as default: data source from software -#define BITBAND_PORTC_DR 0x18 // data register -#define BITBAND_PORTC_DDR 0x1c // data direction -#define BITBAND_PORTC_CTRL 0x20 // data source control, we should keep it as default: data source from software +#define REG_PORTC_DR 0x18 // data register +#define REG_PORTC_DDR 0x1c // data direction +#define REG_PORTC_CTRL 0x20 // data source control, we should keep it as default: data source from software -#define BITBAND_EXT_PORTA 0x50 // GPIO IN read or OUT read back -#define BITBAND_EXT_PORTB 0x54 // GPIO IN read or OUT read back -#define BITBAND_EXT_PORTC 0x58 // GPIO IN read or OUT read back +#define REG_EXT_PORTA 0x50 // GPIO IN read or OUT read back +#define REG_EXT_PORTB 0x54 // GPIO IN read or OUT read back +#define REG_EXT_PORTC 0x58 // GPIO IN read or OUT read back */ #define BITBAND_PERI_REF 0x40000000 @@ -147,7 +147,8 @@ volatile uint8_t * BitBandAddr(void *addr, uint8_t bit); volatile uint8_t * BitBandPeriAddr(void *addr, uint8_t bit); volatile uint8_t * GetOutPinBitBandAddr(PinName pin); +#define GetDirPinBitBandAddr(pin) (GetOutPinBitBandAddr(pin) + 4*32) volatile uint8_t * GetInPinBitBandAddr(PinName pin); -volatile uint8_t * HardSetPin(PinName pin, HAL_GPIO_PIN_MODE pmode, uint8_t val); +volatile uint8_t * HardSetPin(PinName pin, HAL_GPIO_PIN_MODE pmode, uint8_t val); /* return pointer bit out register */ #endif // _BITBAND_IO_H_ diff --git a/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_ssi.c b/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_ssi.c index 2fd1d2f..9a804a7 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_ssi.c +++ b/USDK/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_ssi.c @@ -794,6 +794,15 @@ VOID HalSsiTxFIFOThresholdRtl8195a(VOID *Adaptor, u32 txftl) HAL_SSI_WRITE32(Index, REG_DW_SSI_TXFTLR, TxftlrValue); } +VOID HalSsiTModRtl8195a(VOID *Adaptor, SSI_CTRLR0_TMOD tmod) +{ + PHAL_SSI_ADAPTOR pHalSsiAdaptor = (PHAL_SSI_ADAPTOR) Adaptor; + u8 Index = pHalSsiAdaptor->Index; + /* REG_DW_SSI_CTRLR0 */ + u32 Ctrlr0Value = HAL_SSI_READ32(Index, REG_DW_SSI_CTRLR0) & BIT_INVC_CTRLR0_TMOD; + Ctrlr0Value |= BIT_CTRLR0_TMOD(pHalSsiAdaptor->TransferMode); + HAL_SSI_WRITE32(Index, REG_DW_SSI_CTRLR0, Ctrlr0Value); +} HAL_Status HalSsiIntWriteRtl8195a( diff --git a/USDK/component/soc/realtek/8195a/fwlib/src/bitband_io.c b/USDK/component/soc/realtek/8195a/fwlib/src/bitband_io.c index c39c5fd..5254ffd 100644 --- a/USDK/component/soc/realtek/8195a/fwlib/src/bitband_io.c +++ b/USDK/component/soc/realtek/8195a/fwlib/src/bitband_io.c @@ -45,14 +45,15 @@ volatile uint8_t * HardSetPin(PinName pin, HAL_GPIO_PIN_MODE pmode, uint8_t val) extern HAL_GPIO_ADAPTER gBoot_Gpio_Adapter; _pHAL_Gpio_Adapter = &gBoot_Gpio_Adapter; } - if(_pHAL_Gpio_Adapter->Gpio_Func_En == 0) GPIO_FuncOn_8195a(); - wait_us(100); - // delayMicroseconds(100); + if(_pHAL_Gpio_Adapter->Gpio_Func_En == 0) { + GPIO_FuncOn_8195a(); + HalDelayUs(100); // delayMicroseconds(100); wait_us(100); + } // paddr = 0x42000000 + (0x40001000 + 0x0c * (ippin >> 5) - 0x40000000) * 32 + ((ippin & 0x1f) * 4); #if CONFIG_DEBUG_LOG > 3 GpioFunctionChk(ippin, ENABLE); #endif - GPIO_PullCtrl_8195a(ippin, HAL_GPIO_HIGHZ); // Make the pin pull control default as High-Z + GPIO_PullCtrl_8195a(pin, HAL_GPIO_HIGHZ); // Make the pin pull control default as High-Z paddr = BitBandPeriAddr((void *)(GPIO_REG_BASE + GPIO_PORTB_DR * (ippin >> 5)), ippin & 0x1f); *paddr = val; // data register HAL_GPIO_PIN gpio; @@ -61,7 +62,7 @@ volatile uint8_t * HardSetPin(PinName pin, HAL_GPIO_PIN_MODE pmode, uint8_t val) HAL_GPIO_Init_8195a(&gpio); *paddr = val; // data register // paddr[(GPIO_PORTB_DDR - GPIO_PORTB_DR) * 32] = pmode == DOUT_PUSH_PULL; // data direction -// GPIO_PullCtrl_8195a(ippin, pmode); // set GPIO_PULL_CTRLx +// GPIO_PullCtrl_8195a(pin, pmode); // set GPIO_PULL_CTRLx // paddr[(GPIO_PORTB_CTRL - GPIO_PORTB_DR) * 32] = 0; // data source control, we should keep it as default: data source from software } return paddr; diff --git a/USDK/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/ram_libgloss_retarget.c b/USDK/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/ram_libgloss_retarget.c index 90a7d97..a7a5c3e 100644 --- a/USDK/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/ram_libgloss_retarget.c +++ b/USDK/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/ram_libgloss_retarget.c @@ -2,9 +2,10 @@ * ram_libgloss_retarget.o * pvvx 2016 */ - +#ifdef SWO_DEBUG_OUT_ENA +#include "device.h" +#endif #include "rtl_bios_data.h" - //------------------------------------------------------------------------- // Function declarations @@ -86,6 +87,15 @@ char *ram_libgloss_sbrk(int incr) { return prev_heap_end; } +#ifdef SWO_DEBUG_OUT_ENA +//----- ram_libgloss_write() +int ram_libgloss_write(int file, const char *ptr, int len) { + int i; + for (i = 0; i < len; ++i) + ITM_SendChar(ptr[i]); + return len; +} +#else //----- ram_libgloss_write() int ram_libgloss_write(int file, const char *ptr, int len) { int i; @@ -93,6 +103,7 @@ int ram_libgloss_write(int file, const char *ptr, int len) { HalSerialPutcRtl8195a(ptr[i]); return len; } +#endif //----- ram_libgloss_open() int ram_libgloss_open(char *file, int flags, int mode) { @@ -115,6 +126,9 @@ int ram_libgloss_open(char *file, int flags, int mode) { //----- init_rom_libgloss_ram_map() void init_rom_libgloss_ram_map(void) { +#ifdef SWO_DEBUG_OUT_ENA +//#error @TODO: Not init SWO! +#endif rom_libgloss_ram_map.libgloss_close = ram_libgloss_close; rom_libgloss_ram_map.libgloss_fstat = ram_libgloss_fstat; rom_libgloss_ram_map.libgloss_isatty = ram_libgloss_isatty; diff --git a/USDK/flasher.mk b/USDK/flasher.mk index 75305b0..fce1628 100644 --- a/USDK/flasher.mk +++ b/USDK/flasher.mk @@ -4,81 +4,33 @@ include userset.mk include $(SDK_PATH)paths.mk include project.mk #--------------------------- -#FLASHER = stlink-v2-1 -#FLASHER = stlink-v2 -FLASHER ?= Jlink -JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/ -#--------------------------- # Default #--------------------------- -# TARGET dirs -TARGET ?= build -OBJ_DIR ?= build/obj -BIN_DIR ?= build/bin -ELFFILE ?= $(OBJ_DIR)/$(TARGET).axf +FLASHER_TYPE ?= Jlink +FLASHER_PATH ?= $(SDK_PATH)flasher/ +FLASHER_SPEED ?= 1000 # Start speed 1000 kHz #--------------------------- -# Compilation tools -CROSS_COMPILE ?= $(GCC_PATH)arm-none-eabi- -AR ?= $(CROSS_COMPILE)ar -CC ?= $(CROSS_COMPILE)gcc -AS ?= $(CROSS_COMPILE)as -NM ?= $(CROSS_COMPILE)nm -LD ?= $(CROSS_COMPILE)gcc -GDB ?= $(CROSS_COMPILE)gdb -SIZE ?= $(CROSS_COMPILE)size -OBJCOPY ?= $(CROSS_COMPILE)objcopy -OBJDUMP ?= $(CROSS_COMPILE)objdump - # Make bunary tools -TOOLS_PATH ?= component/soc/realtek/8195a/misc/iar_utility/common/tools/ -ifneq ($(shell uname), Linux) -EXE = .exe -endif -PICK = $(TOOLS_PATH)pick$(EXE) -PADDING = $(TOOLS_PATH)padding$(EXE) -CHCKSUM = $(TOOLS_PATH)checksum$(EXE) -IMAGETOOL = $(TOOLS_PATH)rtlaimage$(EXE) - +IMAGETOOL ?= $(PYTHON) $(SDK_PATH)rtlaimage.py +#--------------------------- # openocd tools -OPENOCD = $(OPENOCD_PATH)openocd.exe - -JLINK_GDB ?= JLinkGDBServer.exe +OPENOCD ?= d:/MCU/OpenOCD/bin/openocd.exe +#--------------------------- +# jlink tools +JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/ JLINK_EXE ?= JLink.exe - -ifeq ($(FLASHER), Jlink) -# Jlink FLASHER_SPEED ..4000 kHz -FLASHER_SPEED ?= 3500 -else -ifeq ($(FLASHER),stlink-v2) -# stlink-v2 FLASHER_SPEED ..1800 kHz -FLASHER_SPEED ?= 1800 -else -# over FLASHER_SPEED ..1000 kHz ? -FLASHER_SPEED ?= 1000 -endif -endif - -# COMPILED_BOOT if defined -> extract image1, boot head in elf -COMPILED_BOOT=1 -# COMPILED_BOOT_BIN if !defined -> use source startup boot -#COMPILED_BOOT_BIN=1 -# PADDINGSIZE defined -> image2 OTA -PADDINGSIZE =44k +JLINK_GDB ?= JLinkGDBServer.exe NMAPFILE = $(OBJ_DIR)/$(TARGET).nmap -#FLASHER_PATH ?= flasher/ - -#RAM_IMAGE?= $(BIN_DIR)/ram.bin - RAM1_IMAGE ?= $(BIN_DIR)/ram_1.bin RAM1P_IMAGE ?= $(BIN_DIR)/ram_1.p.bin -RAM2_IMAGE = $(BIN_DIR)/ram_2.bin -RAM2P_IMAGE = $(BIN_DIR)/ram_2.p.bin +RAM2_IMAGE ?= $(BIN_DIR)/ram_2.bin +RAM2P_IMAGE ?= $(BIN_DIR)/ram_2.p.bin -RAM3_IMAGE = $(BIN_DIR)/sdram.bin -RAM3P_IMAGE = $(BIN_DIR)/sdram.p.bin +RAM3_IMAGE ?= $(BIN_DIR)/sdram.bin +RAM3P_IMAGE ?= $(BIN_DIR)/sdram.p.bin FLASH_IMAGE = $(BIN_DIR)/ram_all.bin OTA_IMAGE = $(BIN_DIR)/ota.bin @@ -89,8 +41,8 @@ mp: FLASH_IMAGE = $(BIN_DIR)/ram_all_mp.bin mp: OTA_IMAGE = $(BIN_DIR)/ota_mp.bin -.PHONY: genbin flashburn reset test readfullflash flashboot flashwebfs flash_OTA runram runsdram -.NOTPARALLEL: all mp genbin flashburn reset test readfullflash _endgenbin flashwebfs flash_OTA +.PHONY: genbin flashburn reset test readfullflash flash_boot flash_webfs flash_OTA flash_images runram runsdram +.NOTPARALLEL: all mp genbin flashburn reset test readfullflash _endgenbin flash_webfs flash_OTA flash_images all: $(ELFFILE) $(FLASH_IMAGE) _endgenbin mp: $(ELFFILE) $(FLASH_IMAGE) _endgenbin @@ -110,9 +62,6 @@ $(NMAPFILE): $(ELFFILE) $(FLASH_IMAGE):$(ELFFILE) @echo "===========================================================" $(IMAGETOOL) -a -r -o $(BIN_DIR)/ $(ELFFILE) -ifdef USE_SDRAM - @cat $(RAM3P_IMAGE) >> $(RAM2P_IMAGE) -endif _endgenbin: @echo "-----------------------------------------------------------" @@ -123,16 +72,58 @@ _endgenbin: ifeq ($(FLASHER_TYPE), Jlink) reset: - @$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed 1000 $(FLASHER_PATH)RTL_Reset.JLinkScript + @$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed $(FLASHER_SPEED) $(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 $(FLASHER_SPEED) $(FLASHER_PATH)RTL_RunRAM.JLinkScript runsdram: - $(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed 1000 $(FLASHER_PATH)RTL_RunRAM_SDR.JLinkScript + @$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed $(FLASHER_SPEED) $(FLASHER_PATH)RTL_RunRAM_SDR.JLinkScript readfullflash: - @$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed 1000 $(FLASHER_PATH)RTL_FFlash.JLinkScript + @$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed $(FLASHER_SPEED) $(FLASHER_PATH)RTL_FFlash.JLinkScript + + +flash_boot: + @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 = 0x000000>>$(FLASHER_PATH)file_info.jlink + @echo end>>$(FLASHER_PATH)file_info.jlink + @echo define call2>>$(FLASHER_PATH)file_info.jlink + @echo FlasherWrite $(RAM2P_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 $(FLASHER_SPEED) + @$(GDB) -x $(FLASHER_PATH)gdb_wrfile.jlink + +flash_images: + @cmd /K start $(JLINK_PATH)$(JLINK_GDBSRV) -device Cortex-M3 -if SWD -ir -endian little -speed $(FLASHER_SPEED) + @$(GDB) -x $(FLASHER_PATH)gdb_images.jlink + +flash_OTA: + @cmd /K start $(JLINK_PATH)$(JLINK_GDBSRV) -device Cortex-M3 -if SWD -ir -endian little -speed $(FLASHER_SPEED) + @$(GDB) -x $(FLASHER_PATH)gdb_ota.jlink + +flash_webfs: + @echo define call1>$(FLASHER_PATH)file_info.jlink + @echo set '$$'ImageSize = $(shell printf '0x%X\n' $$(stat --printf="%s" $(BIN_DIR)/WEBFiles.bin))>>$(FLASHER_PATH)file_info.jlink + @echo set '$$'ImageAddr = 0x0D0000>>$(FLASHER_PATH)file_info.jlink + @echo end>>$(FLASHER_PATH)file_info.jlink + @echo define call2>>$(FLASHER_PATH)file_info.jlink + @echo FlasherWrite $(BIN_DIR)/WEBFiles.bin '$$'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 $(FLASHER_SPEED) + @$(GDB) -x $(FLASHER_PATH)gdb_wrfile.jlink + +flash_espfs: + @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 + @echo set '$$'ImageAddr = 0x0D0000>>$(FLASHER_PATH)file_info.jlink + @echo end>>$(FLASHER_PATH)file_info.jlink + @echo define call2>>$(FLASHER_PATH)file_info.jlink + @echo FlasherWrite $(BIN_DIR)/webpages.espfs '$$'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 $(FLASHER_SPEED) + @$(GDB) -x $(FLASHER_PATH)gdb_wrfile.jlink flashburn: @@ -145,119 +136,75 @@ flashburn: @echo define call3>>$(FLASHER_PATH)flash_file.jlink @echo FlasherWrite build/bin/ram_all.bin '$$'Image2Addr '$$'Image2Size>>$(FLASHER_PATH)flash_file.jlink @echo end>>$(FLASHER_PATH)flash_file.jlink - @cmd /K start $(JLINK_PATH)$(JLINK_GDBSRV) -device Cortex-M3 -if SWD -ir -endian little -speed 1000 + @cmd /K start $(JLINK_PATH)$(JLINK_GDBSRV) -device Cortex-M3 -if SWD -ir -endian little -speed $(FLASHER_SPEED) @$(GDB) -x $(FLASHER_PATH)gdb_wrflash.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" $(BIN_DIR)/ram_1.p.bin))>>$(FLASHER_PATH)file_info.jlink - @echo set '$$'ImageAddr = 0x000000>>$(FLASHER_PATH)file_info.jlink - @echo end>>$(FLASHER_PATH)file_info.jlink - @echo define call2>>$(FLASHER_PATH)file_info.jlink - @echo FlasherWrite $(BIN_DIR)/ram_1.p.bin '$$'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 - -flashwebfs: - @echo define call1>$(FLASHER_PATH)file_info.jlink - @echo set '$$'ImageSize = $(shell printf '0x%X\n' $$(stat --printf="%s" $(BIN_DIR)/WEBFiles.bin))>>$(FLASHER_PATH)file_info.jlink - @echo set '$$'ImageAddr = 0x0D0000>>$(FLASHER_PATH)file_info.jlink - @echo end>>$(FLASHER_PATH)file_info.jlink - @echo define call2>>$(FLASHER_PATH)file_info.jlink - @echo FlasherWrite $(BIN_DIR)/WEBFiles.bin '$$'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 - #@taskkill /F /IM $(JLINK_GDBSRV) - -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 - @echo set '$$'ImageAddr = 0x0D0000>>$(FLASHER_PATH)file_info.jlink - @echo end>>$(FLASHER_PATH)file_info.jlink - @echo define call2>>$(FLASHER_PATH)file_info.jlink - @echo FlasherWrite $(BIN_DIR)/webpages.espfs '$$'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 - #@taskkill /F /IM $(JLINK_GDBSRV) - - -flash_OTA: - @cmd /K start $(JLINK_PATH)$(JLINK_GDBSRV) -device Cortex-M3 -if SWD -ir -endian little -speed 1000 - @$(GDB) -x $(FLASHER_PATH)gdb_ota.jlink - #@taskkill /F /IM $(JLINK_GDBSRV) - else -ifeq ($(FLASHER_TYPE),cmsis-dap) -FLASHER:=cmsis-dap -flashboot: - @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ +flash_boot: + @$(OPENOCD) -f interface/$(FLASHER_TYPE).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \ -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 -flashburn: - @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ +flash_images: + @$(OPENOCD) -f interface/$(FLASHER_TYPE).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \ -c 'rtl8710_flash_auto_erase 1' -c 'rtl8710_flash_auto_verify 1' \ - -c 'rtl8710_flash_write $(RAM1P_IMAGE) 0' \ - -c 'rtl8710_flash_write $(RAM2P_IMAGE) 0xb000' \ - -c 'rtl8710_reboot' -c 'reset run' -c shutdown - -flashimage2p: - @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ - -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \ - -c 'rtl8710_flash_auto_erase 1' -c 'rtl8710_flash_auto_verify 1' \ - -c 'rtl8710_flash_write $(RAM2P_IMAGE) 0xb000' \ + -c 'rtl8710_flash_write $(OTA_IMAGE) 0x0b000' \ -c 'rtl8710_reboot' -c 'reset run' -c shutdown flash_OTA: - @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ + @$(OPENOCD) -f interface/$(FLASHER_TYPE).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \ -c 'rtl8710_flash_auto_erase 1' -c 'rtl8710_flash_auto_verify 1' \ - -c 'rtl8710_flash_write $(RAM2P_IMAGE) 0x80000' \ + -c 'rtl8710_flash_write $(OTA_IMAGE) 0x80000' \ -c 'rtl8710_reboot' -c 'reset run' -c shutdown -flashwebfs: - @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ +flash_webfs: + @$(OPENOCD) -f interface/$(FLASHER_TYPE).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \ -c 'rtl8710_flash_auto_erase 1' -c 'rtl8710_flash_auto_verify 1' \ -c 'rtl8710_flash_write $(BIN_DIR)/WEBFiles.bin 0xd0000' \ -c 'rtl8710_reboot' -c 'reset run' -c shutdown flashespfs: - @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ + @$(OPENOCD) -f interface/$(FLASHER_TYPE).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \ -c 'rtl8710_flash_auto_erase 1' -c 'rtl8710_flash_auto_verify 1' \ -c 'rtl8710_flash_write $(BIN_DIR)/webpages.espfs 0xd0000' \ -c 'rtl8710_reboot' -c 'reset run' -c shutdown reset: - @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ + @$(OPENOCD) -f interface/$(FLASHER_TYPE).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \ -c 'mww 0x40000210 0x111157' -c 'rtl8710_reboot' -c shutdown runram: - $(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ + @$(OPENOCD) -f interface/$(FLASHER_TYPE).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \ -c 'load_image $(RAM1_IMAGE) 0x10000bc8 bin' \ -c 'load_image $(RAM2_IMAGE) 0x10006000 bin' \ -c 'mww 0x40000210 0x20111157' -c 'rtl8710_reboot' -c shutdown runsdram: - @$(OPENOCD) -f interface/$(FLASHER).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ + @$(OPENOCD) -f interface/$(FLASHER_TYPE).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \ -c 'load_image $(RAM1_IMAGE) 0x10000bc8 bin' \ -c 'load_image $(RAM2_IMAGE) 0x10006000 bin' \ -c 'boot_load_srdam $(RAM3_IMAGE) 0x30000000' \ -c shutdown -endif +flashburn: + @$(OPENOCD) -f interface/$(FLASHER_TYPE).cfg -c 'transport select swd' -c 'adapter_khz 1000' \ + -f $(FLASHER_PATH)rtl8710.ocd -c 'init' -c 'reset halt' -c 'adapter_khz $(FLASHER_SPEED)' \ + -c 'rtl8710_flash_auto_erase 1' -c 'rtl8710_flash_auto_verify 1' \ + -c 'rtl8710_flash_write $(RAM1P_IMAGE) 0' \ + -c 'rtl8710_flash_write $(OTA_IMAGE) 0xb000' \ + -c 'rtl8710_reboot' -c 'reset run' -c shutdown + endif clean: diff --git a/USDK/flasher/add_sample_bat/DAPLink-RTL00Console.bat b/USDK/flasher/add_sample_bat/DAPLink-RTL00Console.bat index bc0d13c..2031e41 100644 --- a/USDK/flasher/add_sample_bat/DAPLink-RTL00Console.bat +++ b/USDK/flasher/add_sample_bat/DAPLink-RTL00Console.bat @@ -1,6 +1,6 @@ @echo off call paths.bat -cd flasher +cd USDK\flasher openocd -f interface/cmsis-dap.cfg -c "adapter_khz 1000" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "load_ram_binary RTL00Console_ROM.bin 0x10000BA8" -c "exit" rem -c "shutdown" diff --git a/USDK/flasher/add_sample_bat/DAPLink-RdFullFlash.bat b/USDK/flasher/add_sample_bat/DAPLink-RdFullFlash.bat index 5861662..4e435f0 100644 --- a/USDK/flasher/add_sample_bat/DAPLink-RdFullFlash.bat +++ b/USDK/flasher/add_sample_bat/DAPLink-RdFullFlash.bat @@ -1,7 +1,7 @@ @echo off call paths.bat -cd flasher -openocd -f interface/cmsis-dap.cfg -c "adapter_khz 1000" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "adapter_khz 5000" -c "rtl8710_flash_read ../fullflash.bin 0 1048576" -c "shutdown" +cd USDK\flasher +openocd -f interface/cmsis-dap.cfg -c "adapter_khz 1000" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "adapter_khz 1000" -c "rtl8710_flash_read ../../fullflash.bin 0 2097152" -c "shutdown" echo flash read fullflash.bin pause diff --git a/USDK/flasher/add_sample_bat/DAPLink-Reset.bat b/USDK/flasher/add_sample_bat/DAPLink-Reset.bat index aceee70..2dcb247 100644 --- a/USDK/flasher/add_sample_bat/DAPLink-Reset.bat +++ b/USDK/flasher/add_sample_bat/DAPLink-Reset.bat @@ -1,6 +1,6 @@ @echo off call paths.bat -@cd flasher +@cd USDK\flasher openocd -f interface/cmsis-dap.cfg -c "adapter_khz 1000" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "restart_from_falsh" -c "shutdown" rem diff --git a/USDK/flasher/add_sample_bat/DAPLink_WrFullFlash.bat b/USDK/flasher/add_sample_bat/DAPLink_WrFullFlash.bat index bd1cf72..eea9b0b 100644 --- a/USDK/flasher/add_sample_bat/DAPLink_WrFullFlash.bat +++ b/USDK/flasher/add_sample_bat/DAPLink_WrFullFlash.bat @@ -1,6 +1,6 @@ @echo off call paths.bat -cd flasher -openocd -f interface/cmsis-dap.cfg -c "adapter_khz 3500" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" -c "rtl8710_flash_write fullflash.bin 0" -c "shutdown" +cd USDK\flasher +openocd -f interface/cmsis-dap.cfg -c "adapter_khz 3500" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" -c "rtl8710_flash_write ../../fullflash.bin 0" -c "shutdown" pause diff --git a/USDK/flasher/add_sample_bat/JLink-RTL00ConsoleROM.bat b/USDK/flasher/add_sample_bat/JLink-RTL00ConsoleROM.bat index d8488c6..ab1aae7 100644 --- a/USDK/flasher/add_sample_bat/JLink-RTL00ConsoleROM.bat +++ b/USDK/flasher/add_sample_bat/JLink-RTL00ConsoleROM.bat @@ -1,3 +1,3 @@ @echo off call paths.bat -start JLink.exe -Device CORTEX-M3 -If SWD -Speed 4000 flasher\RTL00ConsoleROM.JLinkScript +start JLink.exe -Device CORTEX-M3 -If SWD -Speed 4000 USDK\flasher\RTL00ConsoleROM.JLinkScript diff --git a/USDK/flasher/add_sample_bat/JLink-RdFullFlash.bat b/USDK/flasher/add_sample_bat/JLink-RdFullFlash.bat index de5d955..f77b324 100644 --- a/USDK/flasher/add_sample_bat/JLink-RdFullFlash.bat +++ b/USDK/flasher/add_sample_bat/JLink-RdFullFlash.bat @@ -1,3 +1,3 @@ @echo off call paths.bat -JLink.exe -Device CORTEX-M3 -If SWD -Speed 10000 flasher/RTL_FFlash.JLinkScript +JLink.exe -Device CORTEX-M3 -If SWD -Speed 10000 USDK/flasher/RTL_FFlash.JLinkScript diff --git a/USDK/flasher/add_sample_bat/JLink-Reset.bat b/USDK/flasher/add_sample_bat/JLink-Reset.bat index 51ea2a8..b5ed584 100644 --- a/USDK/flasher/add_sample_bat/JLink-Reset.bat +++ b/USDK/flasher/add_sample_bat/JLink-Reset.bat @@ -1,3 +1,3 @@ @echo off call paths.bat -JLink.exe -Device CORTEX-M3 -If SWD -Speed 1000 flasher\RTL_Reset.JLinkScript +JLink.exe -Device CORTEX-M3 -If SWD -Speed 1000 USDK\flasher\RTL_Reset.JLinkScript diff --git a/USDK/flasher/add_sample_bat/JLinkGDBServer.bat b/USDK/flasher/add_sample_bat/JLinkGDBServer.bat index c356ac1..ae628ec 100644 --- a/USDK/flasher/add_sample_bat/JLinkGDBServer.bat +++ b/USDK/flasher/add_sample_bat/JLinkGDBServer.bat @@ -1,6 +1,6 @@ @echo off call paths.bat start JLinkGDBServer.exe -device Cortex-M3 -if SWD -ir -endian little -speed 1000 -arm-none-eabi-gdb.exe -x flasher/gdb_init.jlink +arm-none-eabi-gdb.exe -x USDK/flasher/gdb_init.jlink taskkill /F /IM JLinkGDBServer.exe diff --git a/USDK/flasher/add_sample_bat/JlinkOpenOCD.bat b/USDK/flasher/add_sample_bat/JlinkOpenOCD.bat index 6e354f6..7662518 100644 --- a/USDK/flasher/add_sample_bat/JlinkOpenOCD.bat +++ b/USDK/flasher/add_sample_bat/JlinkOpenOCD.bat @@ -1,4 +1,4 @@ @echo off call paths.bat taskkill /F /IM openocd.exe -start openocd -f interface\Jlink.cfg -f flasher\ameba1.cfg +start openocd -f USDK\interface\Jlink.cfg -f flasher\ameba1.cfg diff --git a/USDK/flasher/add_sample_bat/paths.bat b/USDK/flasher/add_sample_bat/paths.bat index 374f93e..67df59b 100644 --- a/USDK/flasher/add_sample_bat/paths.bat +++ b/USDK/flasher/add_sample_bat/paths.bat @@ -1 +1 @@ -PATH=D:\MCU\GNU_Tools_ARM_Embedded\5.4_2016q2\bin;D:\MCU\SEGGER\JLink_V612i;%PATH% \ No newline at end of file +PATH=D:\MCU\GNU_Tools_ARM_Embedded\7.2017-q4-major\bin;D:\MCU\SEGGER\JLink_V630g;D:\MCU\OpenOCD\bin;%PATH% \ No newline at end of file diff --git a/USDK/paths.mk b/USDK/paths.mk index 8f83cba..2166b1d 100644 --- a/USDK/paths.mk +++ b/USDK/paths.mk @@ -1,19 +1,22 @@ #--------------------------- -# User defined (in userset.mk) +# Set Paths & Tools #--------------------------- -SDK_PATH ?= ../SDKRTLA/USDK/ -#GCC_PATH = d:/MCU/GNU_Tools_ARM_Embedded/6.2017-q1-update/bin/# + or set in PATH -OPENOCD_PATH = d:/MCU/OpenOCD/bin/ -TOOLS_PATH ?= $(SDK_PATH)component/soc/realtek/8195a/misc/iar_utility/common/tools/ +SDK_PATH ?= ../RTL00_WEB/USDK/ +#GCC_PATH ?= d:/MCU/GNU_Tools_ARM_Embedded/7.2017-q4-major/bin/# + or set in PATH +TOOLS_PATH ?= $(SDK_PATH) + FLASHER_TYPE ?= Jlink -PYTHON27_PATH ?= c:/Python27/ -#FLASHER_TYPE ?= OCD -FLASHER_PATH ?= $(SDK_PATH)flasher/ -JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/ -JLINK_GDBSRV ?= JLinkGDBServer.exe -#--------------------------- -# Default -#--------------------------- + +ifneq ($(shell uname), Linux) +PYTHON ?= C:/Python27/python +OPENOCD ?= d:/MCU/OpenOCD/bin/openocd.exe +JLINK_PATH ?= D:/MCU/SEGGER/JLink_V630g/ +else +PYTHON ?= python +OPENOCD ?= /mnt/d/MCU/OpenOCD/bin/openocd.exe +JLINK_PATH ?= /mnt/d/MCU/SEGGER/JLink_V630g/ +endif + # Compilation tools CROSS_COMPILE = $(GCC_PATH)arm-none-eabi- AR = $(CROSS_COMPILE)ar @@ -32,15 +35,4 @@ OBJ_DIR ?= $(TARGET)/obj BIN_DIR ?= $(TARGET)/bin ELFFILE ?= $(OBJ_DIR)/$(TARGET).axf -# Make bunary tools -ifneq ($(shell uname), Linux) -EXE = .exe -endif -PICK = $(TOOLS_PATH)pick$(EXE) -PADDING = $(TOOLS_PATH)padding$(EXE) -CHCKSUM = $(TOOLS_PATH)checksum$(EXE) -PYTHON = $(PYTHON27)python$(EXE) - -# openocd tools -OPENOCD = $(OPENOCD_PATH)openocd diff --git a/USDK/sdkbuild.mk b/USDK/sdkbuild.mk index 51b918d..24bfab7 100644 --- a/USDK/sdkbuild.mk +++ b/USDK/sdkbuild.mk @@ -18,11 +18,6 @@ SRC_C_LIST = $(patsubst sdk/%,$(SDK_PATH)%,$(ADD_SRC_C)) $(patsubst sdk/%,$(SDK_ OBJ_LIST = $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%.o,$(SRC_C_LIST))) DEPENDENCY_LIST = $(patsubst %.c,$(OBJ_DIR)/%.d,$(SRC_C_LIST)) -TARGET ?= build -OBJ_DIR ?= $(TARGET)/obj -BIN_DIR ?= $(TARGET)/bin -ELFFILE ?= $(OBJ_DIR)/$(TARGET).axf - all: prerequirement application mp: prerequirement application diff --git a/USDK/sdkset.mk b/USDK/sdkset.mk index 938e093..3b331ed 100644 --- a/USDK/sdkset.mk +++ b/USDK/sdkset.mk @@ -52,7 +52,7 @@ all: LIBS +=_rtsp _usbh _usbd mp: LIBS +=_rtsp _usbh _usbd endif # m c nosys gcc -PATHLIBS = sdk/component/soc/realtek/8195a/misc/bsp/lib/common/gcc +PATHLIBS = sdk/component/soc/realtek/8195a/misc/bsp/lib/common/GCC ifdef USE_SDRAM CFLAGS += -DUSE_SDRAM=1 @@ -412,6 +412,10 @@ SRC_C += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/ram_libc.c SRC_C += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/ram_libgloss_retarget.c SRC_C += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/rtl_eabi_cast_ram.c SRC_C += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/rtl_math_ram.c +ifdef SWO_DEBUG_OUT_ENA +INCLUDES += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd +SRC_C += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/swo.c +endif #if +- nostdlib.. ifndef USE_GCC_LIB SRC_C += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/lib_rtlstd/ram_pvvx_libc.c diff --git a/WEBFiles/protect2/debug.htm b/WEBFiles/protect2/debug.htm index 7c2b7c5..85ea632 100644 --- a/WEBFiles/protect2/debug.htm +++ b/WEBFiles/protect2/debug.htm @@ -8,7 +8,8 @@

Debug and Tests

-Chart 'heap', ST-AP RSSI, ADC Audio

+Chart: 'Heap', 'ST-AP RSSI', 'INA219'
+WebSocket: 'ADC Audio', 'INA219'
System Restart

Counter erase the last flash sector config: ~sys_rdec0x980FE000~

diff --git a/WEBFiles/ws_ina219.htm b/WEBFiles/ws_ina219.htm new file mode 100644 index 0000000..3b89f08 --- /dev/null +++ b/WEBFiles/ws_ina219.htm @@ -0,0 +1,158 @@ + + + + + Get data INA219 + + + +
+
+ + + + + +
+ Window: ? sec, Sample Rate: ? smps +
+
+ + diff --git a/flasher/RTL00ConsoleROM.JLinkScript b/flasher/RTL00ConsoleROM.JLinkScript deleted file mode 100644 index 2754aa8..0000000 --- a/flasher/RTL00ConsoleROM.JLinkScript +++ /dev/null @@ -1,6 +0,0 @@ -h -loadbin flasher/RTL00Console_ROM.bin 0x10000ba8 -r -w4 0x40000210,0x4011113 -g -q \ No newline at end of file diff --git a/flasher/RTL00Console_ROM.bin b/flasher/RTL00Console_ROM.bin deleted file mode 100644 index e83cb16..0000000 Binary files a/flasher/RTL00Console_ROM.bin and /dev/null differ diff --git a/flasher/RTL8710.jflash b/flasher/RTL8710.jflash deleted file mode 100644 index a5d0547..0000000 --- a/flasher/RTL8710.jflash +++ /dev/null @@ -1,119 +0,0 @@ - AppVersion = 47812 -[GENERAL] - ConnectMode = 0 - CurrentFile = "fullflash.bin" - DataFileSAddr = 0x98000000 - GUIMode = 0 - HostName = "" - TargetIF = 1 - USBPort = 0 - USBSerialNo = 0x00000000 -[JTAG] - IRLen = 0 - MultipleTargets = 0 - NumDevices = 0 - Speed0 = 400 - Speed1 = 12000 - TAP_Number = 0 - UseAdaptive0 = 0 - UseAdaptive1 = 0 - UseMaxSpeed0 = 0 - UseMaxSpeed1 = 0 -[CPU] - CheckCoreID = 0 - ChipName = "RTL8710AF" - ClockSpeed = 0x00000000 - Core = 0x030000FF - CoreID = 0x00000000 - CoreIDMask = 0x0F000FFF - DeviceFamily = 0x00000003 - EndianMode = 0 - HasInternalFlash = 0 - InitStep0_Action = "Reset" - InitStep0_Comment = "Reset and Halt" - InitStep0_Value0 = 0x00000000 - InitStep0_Value1 = 0x00000005 - InitStep1_Action = "Go" - InitStep1_Comment = "" - InitStep1_Value0 = 0x00000000 - InitStep1_Value1 = 0x00000000 - InitStep2_Action = "Reset" - InitStep2_Comment = "Reset and halt target" - InitStep2_Value0 = 0x00000000 - InitStep2_Value1 = 0x00000005 - InitStep3_Action = "Write Register" - InitStep3_Comment = "Only T=1" - InitStep3_Value0 = 0x00000010 - InitStep3_Value1 = 0x01000000 - InitStep4_Action = "Write 32bit" - InitStep4_Comment = "Setup SystemCoreClock" - InitStep4_Value0 = 0x40000014 - InitStep4_Value1 = 0x00000001 - InitStep5_Action = "Delay" - InitStep5_Comment = "" - InitStep5_Value0 = 0x00000000 - InitStep5_Value1 = 0x00000005 - InitStep6_Action = "Write 32bit" - InitStep6_Comment = "Write Page Size" - InitStep6_Value0 = 0x1FFFFFF0 - InitStep6_Value1 = 0x00000100 - InitStep7_Action = "Write 32bit" - InitStep7_Comment = "Write Sector Size" - InitStep7_Value0 = 0x1FFFFFF4 - InitStep7_Value1 = 0x00001000 - InitStep8_Action = "Write 32bit" - InitStep8_Comment = "Write Block Size" - InitStep8_Value0 = 0x1FFFFFF8 - InitStep8_Value1 = 0x00010000 - InitStep9_Action = "Write 32bit" - InitStep9_Comment = "Write Block Count" - InitStep9_Value0 = 0x1FFFFFFC - InitStep9_Value1 = 0x00000010 - NumExitSteps = 0 - NumInitSteps = 10 - RAMAddr = 0x10000000 - RAMSize = 0x00010000 - ScriptFile = "" - UseAutoSpeed = 0x00000001 - UseRAM = 1 - UseScriptFile = 0 -[FLASH] - aSectorSel[0] = - AutoDetect = 1 - BankName = "" - BankSelMode = 1 - BaseAddr = 0x98000000 - CheckId = 3 - CustomRAMCode = "RTL8710AF.hex" - DeviceName = "Auto detected flash memory" - EndBank = 8191 - NumBanks = 1 - OrgNumBits = 16 - OrgNumChips = 1 - StartBank = 0 - UseCustomRAMCode = 1 -[PRODUCTION] - AutoPerformsErase = 1 - AutoPerformsHardLock = 0 - AutoPerformsHardUnlock = 0 - AutoPerformsProgram = 1 - AutoPerformsSecure = 0 - AutoPerformsSoftLock = 0 - AutoPerformsSoftUnlock = 1 - AutoPerformsStartApp = 0 - AutoPerformsUnsecure = 0 - AutoPerformsVerify = 1 - EnableProductionMode = 0 - EnableTargetPower = 0 - EraseType = 2 - ProductionDelay = 0x000001F4 - ProductionThreshold = 0x00000BB8 - ProgramSN = 0 - SerialFile = "" - SNAddr = 0x00000000 - SNInc = 0x00000001 - SNLen = 0x00000004 - SNListFile = "" - SNValue = 0x00000001 - TargetPowerDelay = 0x00000014 - VerifyType = 1 diff --git a/flasher/RTL8710AF.hex b/flasher/RTL8710AF.hex deleted file mode 100644 index fd2dc4c..0000000 --- a/flasher/RTL8710AF.hex +++ /dev/null @@ -1,130 +0,0 @@ -:100000007D0439057F05FF056506D506D706000086 -:10001000D44908707047D44800680005FBD0D14827 -:100020000078C0B2704710B5D048006850F44070F6 -:10003000CE490860CE48006850F01000CC490860F6 -:10004000CC480468062000F0B7F934F00600C9492E -:100050000860C848006850F00100C64908600020E8 -:10006000C54908600020C54908600120C4490860EE -:100070000220C44908600020C34908600020C34929 -:1000800008600020C249086010BD2DE9F04104005D -:100090000D001600B6B2002E01D1002048E0B6B225 -:1000A000112E01DB102006004FF4407000F084F99F -:1000B00080465FF4401000F07FF95FF4403000F0BC -:1000C0007BF95FF4402000F077F9032010FA08F084 -:1000D00010F44070AF490860B6B2AF480660032024 -:1000E000FFF796FF200CC0B2FFF792FF200AC0B2C4 -:1000F000FFF78EFF2000C0B2FFF78AFF01209E4964 -:100100000860002007003800310080B289B28842C0 -:1001100005D2FFF780FFBFB2E8557F1CF3E79F4889 -:100120000068C007FBD4002093490860300080B20B -:10013000BDE8F08138B54FF4407000F03DF905009E -:100140005FF4401000F038F95FF4403000F034F90B -:100150005FF4402000F030F90320A84010F4407014 -:100160008C49086003208C4908600120824908609E -:100170009F20FFF74DFFFFF74EFF0400FFF74BFFF7 -:1001800054EA00200400FFF746FF54EA0040040050 -:1001900082480068C007FBD400207749086020002F -:1001A00032BD38B54FF4407000F006F905005FF439 -:1001B000401000F001F95FF4403000F0FDF85FF40A -:1001C000402000F0F9F80320A84010F44070714975 -:1001D0000860012070490860012067490860052017 -:1001E000FFF716FFFFF717FF04006C480068C00711 -:1001F000FBD40020604908602000C0B232BD38B591 -:1002000004004FF4407000F0D7F805005FF4401090 -:1002100000F0D2F85FF4403000F0CEF85FF44020F8 -:1002200000F0CAF80120A84010F440705949086055 -:100230000120514908602000C0B2FFF7E9FE57488D -:100240000068C007FBD400204B49086031BD38B5B9 -:1002500004004FF4407000F0AFF805005FF4401068 -:1002600000F0AAF85FF4403000F0A6F85FF44020F8 -:1002700000F0A2F80120A84010F440704549086041 -:1002800001203D4908602020FFF7C2FE200CC0B2CB -:10029000FFF7BEFE200AC0B2FFF7BAFE2000C0B2D0 -:1002A000FFF7B6FE3D480068C007FBD40020324986 -:1002B000086031BD2DE9F04104000D001600B6B212 -:1002C000002E01D100204BE0B6B2B6F5807F02DDF2 -:1002D0004FF4807006004FF4407000F06DF88046D7 -:1002E0005FF4401000F068F85FF4403000F064F80C -:1002F0005FF4402000F060F8012010FA08F010F4DC -:1003000040702449086001201B4908600220FFF763 -:100310007FFE200CC0B2FFF77BFE200AC0B2FFF7C1 -:1003200077FE2000C0B2FFF773FE00200700380000 -:10033000310080B289B2884205D2BFB2E85DFFF7D2 -:1003400067FE7F1CF3E7154800684007FBD513489C -:100350000068C007FBD4002007490860300080B265 -:10036000BDE8F08160600040246000403002004041 -:1003700010020040C0020040086000402C600040B5 -:100380001060004014600040186000401C60004095 -:100390004C60004000600040046000402860004065 -:1003A00080B5FFF7FEFEC007FBD401BD80B5FFF7A7 -:1003B000F8FE8007FBD501BD90FAA0F0B0FA80F0FE -:1003C00070470000010051EA510151EA910151EAE0 -:1003D000111151EA112151EA1141064A7A441432AD -:1003E000DFF8B03203FB01F3DB0E52F823201000DC -:1003F000704700BF80030000DFF89C02006850F0E7 -:100400004070DFF894120860DFF89002006850F442 -:100410008070DFF888120860FF20DFF8841208601F -:10042000FF20DFF880120860704780B500F054F9B3 -:1004300001BD0120DFF870120860704780B571B609 -:1004400072B6FFF7F6FFFFF7D7FFFFF7EEFF01BD2C -:1004500080B5FFF7E8FDFFF7A3FFFFF76BFEFFF79F -:100460009FFF92480068FFF7ADFF914908609148EF -:100470000068FFF7A7FF9049086001BDF8B50400C8 -:100480000D0016008D4800688D49884204D18D48C2 -:1004900000688D49884209D08948884908608A489F -:1004A00088490860FFF7CAFFFFF7D2FF814800685C -:1004B00086490968864A12685143B1FBF0F27368B5 -:1004C00040271F807A4F3F689F700027DF70012709 -:1004D0001F7101275F7100279F710127DF710127BD -:1004E0001F7200275F7201279F7201271F6100277B -:1004F000DFF8DCC1DCF800C067451CD2DFF8CCC1F6 -:10050000DCF800C00CFB07FC5FF00C0E0EFB07FED6 -:100510009E44CEF814C05FF00C0C0CFB07FC9C440E -:10052000CCF818205FF00C0C0CFB07FC9C44CCF8BA -:100530001C007F1CDCE7F1BD2DE9F04704000D0035 -:1005400016007769D6F81080D6F80490002F14D0E2 -:10055000200000F0C0F8112F02D35FF0100A00E075 -:10056000BA46524692B249464046FFF78EFD1AEB14 -:100570000808D144B7EB0A07E8E7BDE8F0872DE9A2 -:10058000F84F04000D0016000020286077694848E5 -:100590000068B84638FA00F8D6F810904448006869 -:1005A00039FA00F9D6F804A0B8F1000F25D0B7F554 -:1005B000807F02D94FF4807B00E0BB46FFF7F0FE5E -:1005C0000620FFF71CFEFFF7F1FE5A4692B2514695 -:1005D0003648006800FB09F0FFF76CFEFFF7E0FE0D -:1005E0000420FFF70CFEFFF7DBFEDA44B7EB0B0746 -:1005F000B8F1010819F10109D6E7BDE8F18F2DE93D -:10060000F84304000D00160030692B490968C84002 -:10061000070070698046002028602648006800FBBB -:1006200007F08146B8F1000F1AD0200000F053F80F -:10063000FFF7B6FE0620FFF7E2FDFFF7B7FE4846DC -:10064000FFF705FEFFF7ACFE0420FFF7D8FDFFF72C -:10065000A7FE1848006810EB0909B8F10108E1E7A6 -:10066000BDE8F18310B504001448006814498842BD -:1006700004D1144800681449884209D010480F4931 -:10068000086011480F490860FFF7D8FEFFF7E0FE49 -:1006900010BD0000DDACC407300200401C02004069 -:1006A000200300402403004014000040F0FFFF1F1F -:1006B000E0FFFF1FF4FFFF1FE4FFFF1FE8FFFF1F26 -:1006C000AA55AA55ECFFFF1F55AA55AAF8FFFF1F10 -:1006D000FCFFFF1F7047704710B51E48006850F4BC -:1006E00040501C4908601C48006850F480501A496A -:1006F00008601A4800684006FBD5194804685FF492 -:100700004000FFF759FE34F44000154908601448D2 -:10071000006850F4801012490860002011490860F8 -:100720001148006850F080000F49086044200F49CC -:10073000086000200B49086003240320FFF73CFEFB -:1007400014FA00F010F0030007490860002008497F -:10075000086010BD3002004010020040143000401C -:10076000C0020040043000400C3000400030004027 -:1007700008300040000000000900000001000000F7 -:100780000A0000000D00000015000000020000003B -:100790001D0000000B0000000E0000001000000013 -:1007A0001200000016000000190000000300000005 -:1007B0001E000000080000000C00000014000000F3 -:1007C0001C0000000F0000001100000018000000D5 -:1007D00007000000130000001B00000017000000CD -:1007E000060000001A0000000500000004000000E0 -:0407F0001F000000E6 -:0400000500000000F7 -:00000001FF diff --git a/flasher/RTL_FFlash.JLinkScript b/flasher/RTL_FFlash.JLinkScript deleted file mode 100644 index a9ed900..0000000 --- a/flasher/RTL_FFlash.JLinkScript +++ /dev/null @@ -1,17 +0,0 @@ -h -r -w4 0x40000230,0x0000D3C4 -w4 0x40000210,0x00200113 -w4 0x400002C0,0x00110001 -w4 0x40006008,0 -w4 0x4000602C,0 -w4 0x40006010,1 -w4 0x40006014,2 -w4 0x40006018,0 -w4 0x4000601C,0 -w4 0x4000604C,0 -savebin fullflash.bin 0x98000000 0x100000 -w4 0x40000210,0x211157 -r -g -q \ No newline at end of file diff --git a/flasher/RTL_Reset.JLinkScript b/flasher/RTL_Reset.JLinkScript deleted file mode 100644 index 6c89309..0000000 --- a/flasher/RTL_Reset.JLinkScript +++ /dev/null @@ -1,9 +0,0 @@ -r0 -trst0 -r1 -trst1 -h -r -w4 0x40000210,0x0011113 -g -q \ No newline at end of file diff --git a/flasher/RTL_RunRAM.JLinkScript b/flasher/RTL_RunRAM.JLinkScript deleted file mode 100644 index 3652c70..0000000 --- a/flasher/RTL_RunRAM.JLinkScript +++ /dev/null @@ -1,12 +0,0 @@ -r0 -trst0 -r1 -trst1 -h -r -loadbin build/bin/ram_1.bin 0x10000bc8 -loadbin build/bin/ram_2.bin 0x10006000 -r -w4 0x40000210,0x20011113 -g -q \ No newline at end of file diff --git a/flasher/RTL_RunRAM_SDR.JLinkScript b/flasher/RTL_RunRAM_SDR.JLinkScript deleted file mode 100644 index 27e839d..0000000 --- a/flasher/RTL_RunRAM_SDR.JLinkScript +++ /dev/null @@ -1,18 +0,0 @@ -r0 -trst0 -r1 -trst1 -r -h -loadbin build/bin/ram_1.bin 0x10000bc8 -loadbin build/bin/ram_2.bin 0x10006000 -r -w4 0x40000210,0x20011113 -w4 0x1FFF0000,0x12345678 -g -sleep 1000 -h -loadbin build/bin/sdram.bin 0x30000000 -w4 0x1FFF0000,1 -g -q \ No newline at end of file diff --git a/flasher/ameba1.cfg b/flasher/ameba1.cfg deleted file mode 100644 index f3ee2db..0000000 --- a/flasher/ameba1.cfg +++ /dev/null @@ -1,124 +0,0 @@ -# Main file for Ameba1 series Cortex-M3 parts -# -# !!!!!! -# - -set CHIPNAME rtl8195a -set CHIPSERIES ameba1 - -# Adapt based on what transport is active. -source [find target/swj-dp.tcl] - -if { [info exists CHIPNAME] } { - set _CHIPNAME $CHIPNAME -} else { - error "CHIPNAME not set. Please do not include ameba1.cfg directly." -} - -if { [info exists CHIPSERIES] } { - # Validate chip series is supported - if { $CHIPSERIES != "ameba1" } { - error "Unsupported chip series specified." - } - set _CHIPSERIES $CHIPSERIES -} else { - error "CHIPSERIES not set. Please do not include ameba1.cfg directly." -} - -if { [info exists CPUTAPID] } { - # Allow user override - set _CPUTAPID $CPUTAPID -} else { - # Ameba1 use a Cortex M3 core. - if { $_CHIPSERIES == "ameba1" } { - if { [using_jtag] } { - set _CPUTAPID 0x4ba00477 - } { - set _CPUTAPID 0x2ba01477 - } - } -} - -swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID - -set _TARGETNAME $_CHIPNAME.cpu -target create $_TARGETNAME cortex_m -chain-position $_TARGETNAME - - -# 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_khz 1000 - -# delays on reset lines -adapter_nsrst_delay 200 -if {[using_jtag]} { - jtag_ntrst_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 {ameba1_init} - -# Ameba1 SDRAM enable -proc ameba1_init { } { - # init System - mww 0x40000014 0x00000021 - sleep 10 - mww 0x40000304 0x1fc00002 - sleep 10 - mww 0x40000250 0x00000400 - sleep 10 - mww 0x40000340 0x00000000 - sleep 10 - mww 0x40000230 0x0000dcc4 - sleep 10 - mww 0x40000210 0x00011117 - sleep 10 - mww 0x40000210 0x00011157 - sleep 10 - mww 0x400002c0 0x00110011 - sleep 10 - mww 0x40000320 0xffffffff - sleep 10 - # init SDRAM - mww 0x40000040 0x00fcc702 - sleep 10 - mdw 0x40000040 - mww 0x40005224 0x00000001 - sleep 10 - mww 0x40005004 0x00000208 - sleep 10 - mww 0x40005008 0xffffd000 - sleep 13 - mww 0x40005020 0x00000022 - sleep 13 - mww 0x40005010 0x09006201 - sleep 13 - mww 0x40005014 0x00002611 - sleep 13 - mww 0x40005018 0x00068413 - sleep 13 - mww 0x4000501c 0x00000042 - sleep 13 - mww 0x4000500c 0x700 ;# set Idle - sleep 20 - mww 0x40005000 0x1 ;# start init - sleep 100 - mdw 0x40005000 - mww 0x4000500c 0x600 ;# enter memory mode - sleep 30 - - mww 0x40005008 0x00000000 ;# 0xf00 - ;# mww 0x40005008 0x00000f00 - sleep 3 - mww 0x40000300 0x0006005e ;# 0x5e - ;# mww 0x40000300 0x0000005e - sleep 3 -} diff --git a/flasher/cortex.ocd b/flasher/cortex.ocd deleted file mode 100644 index 44e99ad..0000000 --- a/flasher/cortex.ocd +++ /dev/null @@ -1,100 +0,0 @@ -proc cortex_bootstrap {start} { - # disable interrupts - reg faultmask 0x01 - set vectors "" - mem2array vectors 32 $start 2 - reg sp $vectors(0) - reg pc $vectors(1) - resume -} - -proc cortex_reboot {} { - set ddd [ format "0x%08x" [ rtl8710_flasher_mrw [ expr 0x40000210 ] ] ] -# set aaa [ format "0x%08x" [ expr 0x40000210 ] ] - echo "CLK_CTRL1 = $ddd" -# echo "# Set processor clock to default before system reset" - set ddd [ format "0x%08x" [ rtl8710_flasher_mrw [ expr 0x40000014 ] ] ] -# set aaa [ format "0x%08x" [ expr 0x40000014 ] ] - echo "SOC_FUNC_EN = $ddd" -# mww 0x40000014 0x00000021 - sleep 10 - echo "# Reboot (system reset)" - mww 0xE000ED0C 0x05FA0007 -} - -proc init_system {} { -# Set processor clock to default before system reset -# CLK_CTRL1 -# mww 0x40000014 0x00000011 - mww 0x40000014 0x00000021 - sleep 10 -# PESOC_SOC_CTRL -# mww 0x40000304 0x1fc00001 - mww 0x40000304 0x1fc00002 - sleep 10 -# PESOC_CLK_SEL - mww 0x40000250 0x00000400 - sleep 10 -# GPIO_PULL_CTRL4 - mww 0x40000340 0x00000000 - sleep 10 -# PESOC_CLK_CTRL -# mww 0x40000230 0x0000d3c4 - mww 0x40000230 0x0000dcc4 - sleep 10 -# SOC_FUNC_EN: FUN|OCP|LXBUS|FLASH|CPU|LOG_UART|GTIMER|SECURITY_ENGINE -# mww 0x40000210 0x00211117 - mww 0x40000210 0x00011117 - sleep 10 -# SOC_FUNC_EN: FUN|OCP|LXBUS|FLASH|CPU|LOG_UART|GTIMER|SECURITY_ENGINE + MEM_CTRL - mww 0x40000210 0x00011157 - sleep 10 -# CPU_PERIPHERAL_CTRL SPI_FLASH_PIN_EN|SDR_PIN_EN|SWD_PIN_EN|LOG_UART_PIN_EN ? -# mww 0x400002c0 0x00110000 - mww 0x400002c0 0x00110011 - sleep 10 -# GPIO_SHTDN_CTRL -# mww 0x40000320 0x00000033 - mww 0x40000320 0xffffffff - sleep 10 - - mww 0x40005008 0x00000000 - sleep 10 -# PESOC_MEM_CTRL - mww 0x40000300 0x0006005e - sleep 10 - - # set baudrate to 38400 -# mww 0x40003010 0x00000080 -# mww 0x40003008 0x00000022 -# mww 0x4000300C 0x00000000 -# mww 0x40003010 0x00000000 -} - -proc boot_from_flash {} { - echo "# skip sdram init, it has been init in openocd config" - mww 0x40000210 0x211157 -} - -proc boot_from_ram {} { - echo "# boot from ram, igonore loading flash" - mww 0x40000210 0x8011157 -} - -proc restart_from_falsh {} { - init - init_system - boot_from_flash - cortex_reboot -} - -proc load_ram_binary { local_filename address } { -# set address 0x10000BC8 - init - reset halt - set size [file size $local_filename] - load_image $local_filename $address bin $address $size - boot_from_ram - resume -} - diff --git a/flasher/flash_file.jlink b/flasher/flash_file.jlink deleted file mode 100644 index 83b04c0..0000000 --- a/flasher/flash_file.jlink +++ /dev/null @@ -1,9 +0,0 @@ -define call1 -SetFirwareSize build/bin/ram_all.bin -end -define call2 -FlasherWrite build/bin/ram_all.bin 0 $Image1Size -end -define call3 -FlasherWrite build/bin/ram_all.bin $Image2Addr $Image2Size -end diff --git a/flasher/gdb_flasher.jlink b/flasher/gdb_flasher.jlink deleted file mode 100644 index d6f2c97..0000000 --- a/flasher/gdb_flasher.jlink +++ /dev/null @@ -1,232 +0,0 @@ -#################################### -# J-LINK GDB SERVER initialization # -#################################### -define InitJlink -printf "Jlink Init:\n" -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 -target remote localhost:2331 -set remotetimeout 10000 -monitor device Cortex-M3 -monitor endian little -monitor reset -# Set max speed -monitor speed 4000 -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 = 0x00011113 -end -# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 ) -define SetBootCall0 -printf "SetBoot = Call0:\n" -monitor long 0x40000210 = 0x80011113 -end -# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 ) -define SetBootCall1 -printf "SetBoot = Call1:\n" -monitor long 0x40000210 = 0x20011113 -end -# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 ) -define SetBootCall2 -printf "SetBoot = Call2:\n" -monitor long 0x40000210 = 0x10011113 -end -# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 ) -define SetBootCall3 -printf "SetBoot = Call3:\n" -monitor long 0x40000210 = 0x8011113 -end -# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 ) -define SetBootCall4 -printf "SetBoot = Call4:\n" -monitor long 0x40000210 = 0x4011113 -end -# CPU CLK 166 MHz? -define SetClk166MHz -printf "SetCLK 166.66MHz:\n" -monitor long 0x40000014 = 0x00000011 -end -# CPU CLK 83 MHz? -define SetClk83MHz -printf "SetCLK 83.33MHz:\n" -monitor long 0x40000014 = 0x00000021 -end -############### -# System Init # -############### -define SystemInit -printf "System Init:\n" -monitor long 0x40000304 = 0x1FC00002 -monitor long 0x40000250 = 0x400 -monitor long 0x40000340 = 0x0 -monitor long 0x40000230 = 0xdcc4 -monitor long 0x40000210 = 0x11113 -monitor long 0x400002c0 = 0x110011 -monitor long 0x40000320 = 0xffffffff -end -############ -# SPI Init # -############ -define SPI_Init -printf "Init SPI:\n" -#enable spi flash peripheral clock -set $Temp = {int}(0x40000230) -set $Temp = ($Temp | 0x300) -set {int}(0x40000230) = $Temp -#enable spi flash peripheral -set $Temp = {int}(0x40000210) -set $Temp = ($Temp | 0x10) -set {int}(0x40000210) = $Temp -#select spi flash pinout (0 - internal), enable spi flash pins -set $Temp = {int}(0x400002C0) -set $Temp = (($Temp & 0xFFFFFFF8) | 1) -set {int}(0x400002C0) = $Temp -#disable SPI FLASH operation -monitor long 0x40006008 = 0 -#disable all interrupts -monitor long 0x4000602C = 0 -#use first "slave select" pin -monitor long 0x40006010 = 1 -#baud rate, default value -monitor long 0x40006014 = 2 -#tx fifo threshold -monitor long 0x40006018 = 0 -#rx fifo threshold -monitor long 0x4000601C = 0 -#disable DMA -monitor long 0x4000604C = 0 -end -################### -# SetFirwareSize # -################### -define SetFirwareSize -set $rambuffer = 0x10000300 -printf "Get ImagesSize:\n" -restore $arg0 binary $rambuffer 0 0x20 -set $Image1Size = {int}($rambuffer+0x10) + 32 -set $Image1LoadAddr = {int}($rambuffer+0x14) -set $Image2Addr = {short}($rambuffer+0x18) * 1024 -if $Image1Size != 0 && $Image1Size < 0x1000000 - if $Image2Addr == 0 - set $Image2Addr = $Image1Size - end - printf "Image1Size = %d\n", $Image1Size - printf "Image1LoadAddr = 0x%08x\n", $Image1LoadAddr - printf "Image2FlashAddr = 0x%08x\n", $Image2Addr - set $parms1 = $rambuffer - $Image2Addr - set $parms3 = $Image2Addr + 0x08 - restore $arg0 binary $parms1 $Image2Addr $parms3 - set $Image2Size = {int}($rambuffer) - set $Image2LoadAddr = {int}($rambuffer+0x4) - if $Image2Size != 0xFFFFFFFF && $Image2Size != 0 - set $Image2Size = $Image2Size + 16 - 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" - set $FirmwareSize = $Image1Size - printf "FirmwareSize = %d\n", $FirmwareSize - end -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 -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) -if $Image1LoadAddr == 0xFFFFFFFF -printf "Image1 - None\n" -else -set $Image2FlashAddr = {short}($SPI_FLASH_BASE + 0x18) * 1024 -if $Image2FlashAddr == 0 -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 && $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 -end -end diff --git a/flasher/gdb_init.jlink b/flasher/gdb_init.jlink deleted file mode 100644 index 7ba6f46..0000000 --- a/flasher/gdb_init.jlink +++ /dev/null @@ -1,30 +0,0 @@ -# -# J-LINK GDB SERVER initialization -# -target remote localhost:2331 -set remotetimeout 10000 -monitor device Cortex-M3 -monitor endian little -monitor reset -# Set max speed -monitor speed 4000 -set mem inaccessible-by-default off -# Setup GDB FOR FASTER DOWNLOADS -#set remote memory-write-packet-size 4096 -#set remote memory-write-packet-size fixed -# Boot Flash -monitor long 0x40000210 = 0x00011113 -# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 ) -#monitor long 0x40000210 = 0x80011113 -# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 ) -#monitor long 0x40000210 = 0x20011113 -# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 ) -#monitor long 0x40000210 = 0x10011113 -# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 ) -#monitor long 0x40000210 = 0x8011113 -# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 ) -monitor long 0x40000210 = 0x4011113 -# CPU CLK 166 MHz? -# monitor long 0x40000014 = 0x00000011 -# CPU CLK 83 MHz? -#monitor long 0x40000014 = 0x00000021 diff --git a/flasher/gdb_ota.jlink b/flasher/gdb_ota.jlink deleted file mode 100644 index 9a4cf89..0000000 --- a/flasher/gdb_ota.jlink +++ /dev/null @@ -1,373 +0,0 @@ -#################################### -# J-LINK GDB SERVER initialization # -#################################### -define InitJlink -printf "Jlink Init:\n" -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 -target remote localhost:2331 -set remotetimeout 10000 -monitor device Cortex-M3 -monitor endian little -monitor reset -# Set max speed -monitor speed 4000 -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 -end -############# -# Boot_Flash -define SetBootFlash -printf "SetBoot = Flash:\n" -monitor long 0x40000210 = 0x011113 -end -# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 ) -define SetBootCall0 -printf "SetBoot = Call0:\n" -monitor long 0x40000210 = 0x80011113 -end -# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 ) -define SetBootCall1 -printf "SetBoot = Call1:\n" -monitor long 0x40000210 = 0x20011113 -end -# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 ) -define SetBootCall2 -printf "SetBoot = Call2:\n" -monitor long 0x40000210 = 0x10011113 -end -# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 ) -define SetBootCall3 -printf "SetBoot = Call3:\n" -monitor long 0x40000210 = 0x8011113 -end -# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 ) -define SetBootCall4 -printf "SetBoot = Call4:\n" -monitor long 0x40000210 = 0x4011113 -end -# CPU CLK 166 MHz? -define SetClk166MHz -printf "SetCLK 166.66MHz:\n" -monitor long 0x40000014 = 0x00000011 -end -# CPU CLK 83 MHz? -define SetClk83MHz -printf "SetCLK 83.33MHz:\n" -monitor long 0x40000014 = 0x00000021 -end -############### -# System Init # -############### -define SystemInit -printf "System Init:\n" -monitor long 0x40000304 = 0x1FC00002 -monitor long 0x40000250 = 0x400 -monitor long 0x40000340 = 0x0 -monitor long 0x40000230 = 0xdcc4 -monitor long 0x40000210 = 0x11113 -monitor long 0x400002c0 = 0x110011 -monitor long 0x40000320 = 0xffffffff -end -############ -# SPI Init # -############ -define SPI_Init -printf "Init SPI:\n" -#enable spi flash peripheral clock -set $Temp = {int}(0x40000230) -set $Temp = ($Temp | 0x300) -set {int}(0x40000230) = $Temp -#enable spi flash peripheral -set $Temp = {int}(0x40000210) -set $Temp = ($Temp | 0x10) -set {int}(0x40000210) = $Temp -#select spi flash pinout (0 - internal), enable spi flash pins -set $Temp = {int}(0x400002C0) -set $Temp = (($Temp & 0xFFFFFFF8) | 1) -set {int}(0x400002C0) = $Temp -#disable SPI FLASH operation -monitor long 0x40006008 = 0 -#disable all interrupts -monitor long 0x4000602C = 0 -#use first "slave select" pin -monitor long 0x40006010 = 1 -#baud rate, default value -monitor long 0x40006014 = 2 -#tx fifo threshold -monitor long 0x40006018 = 0 -#rx fifo threshold -monitor long 0x4000601C = 0 -#disable DMA -monitor long 0x4000604C = 0 -set $SPI_FLASH_BASE = 0x98000000 -end -################### -# GetOtaSize # -################### -define GetOtaSize -set $rambuffer = 0x10000300 -printf "Get ImagesSize:\n" -set $ImageOtaSize = 0 -restore $arg0 binary $rambuffer 0 4 -set $ImageAddSize = {int}($rambuffer+0) -if $ImageAddSize != 0 - printf "Image2Size = %d\n", $ImageAddSize - set $ImageOtaSize = $ImageOtaSize + $ImageAddSize + 16 - set $parms1 = $rambuffer - $ImageOtaSize - set $parms3 = $ImageOtaSize + 4 - restore $arg0 binary $parms1 $ImageOtaSize $parms3 - set $ImageAddSize = {int}($rambuffer+0) - if $ImageAddSize < 0x200000 - printf "ImageSdramSize = %d\n", $ImageAddSize - set $ImageOtaSize = $ImageOtaSize + $ImageAddSize + 20 - end -else - printf "Image2Size = %d !\n", $ImageOtaSize -end -end -##################### -# Flash Images Info # -##################### -define FlashImagesInfo -printf "Flash Info:\n" -set $Image1Size = {int}($SPI_FLASH_BASE + 0x10) + 32 -set $Image1LoadAddr = {int}($SPI_FLASH_BASE + 0x14) -if $Image1LoadAddr == 0xFFFFFFFF -printf "Image1 - None\n" -else -set $Image2FlashAddr = {short}($SPI_FLASH_BASE + 0x18) * 1024 -if $Image2FlashAddr == 0 -$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 -printf "Image2Size = %d\n", $Image2Size -printf "Image2LoadAddr = 0x%08x\n", $Image2LoadAddr -else -printf "Image2 - None\n" -end -end -set $ImageOtaAddr = {int}($SPI_FLASH_BASE + 0x9000) -if $ImageOtaAddr != 0x80000 -printf "ImageOtaAddr = 0x%08x - Invalid!\n", $ImageOtaAddr -else -printf "ImageOtaAddr = 0x%08x\n", $ImageOtaAddr -end -end -############### -# FlasherInit # -############### -define FlasherInit -set $rtl8710_flasher_capacity = 0 -set $rtl8710_flasher_auto_erase = 1 -set $rtl8710_flasher_auto_verify = 1 -set $rtl8710_flasher_firmware_ptr = 0x10001000 -set $rtl8710_flasher_buffer = 0x10008000 -set $rtl8710_flasher_buffer_size = 421888 -set $rtl8710_flasher_sector_size = 4096 -set $rtl8710_flasher_auto_erase_sector = 0xFFFFFFFF -end -############### -# FlasherWait # -############### -define FlasherWait -set $fresult = {int}($rtl8710_flasher_buffer) -while ($fresult != 0) -set $fresult = {int}($rtl8710_flasher_buffer) -end -end -############### -# FlasherLoad # -############### -define FlasherLoad -if $rtl8710_flasher_capacity == 0 - printf "initializing RTL8710 flasher\n" - restore $arg0 binary $rtl8710_flasher_firmware_ptr 0 968 - monitor reset - set $pc = $rtl8710_flasher_firmware_ptr - set $sp = 0x1ffffffc - set {int}($rtl8710_flasher_buffer + 0x08) = 0 - set {int}($rtl8710_flasher_buffer + 0x00) = 1 - #continue - monitor go - FlasherWait - set $id = {int}($rtl8710_flasher_buffer + 0x0C) - 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 - printf "Flash ID = 0x%08x : (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10 - end - printf "RTL8710 flasher initialized\n" -else -printf "reinitializing RTL8710 flasher\n" -end -end -################## -# FlasherRdBlock # -################## -define FlasherRdBlock -#printf "FlashRdBlock 0x%08x, 0x%08x\n", $arg0, $arg1 -set {int}($rtl8710_flasher_buffer + 0x04) = 3 -set {int}($rtl8710_flasher_buffer + 0x08) = 0 -set {int}($rtl8710_flasher_buffer + 0x10) = $arg0 -set {int}($rtl8710_flasher_buffer + 0x14) = $arg1 -set {int}($rtl8710_flasher_buffer + 0x00) = 1 -FlasherWait -set $status = {int}($rtl8710_flasher_buffer + 0x08) -if $status > 0 - error "read error, offset 0x%08x", $arg0 -end -end -################## -# FlasherWrBlock # -################## -define FlasherWrBlock -#printf "FlashWrBlock 0x%08x, 0x%08x\n", $arg0, $arg1 -set {int}($rtl8710_flasher_buffer + 0x04) = 4 -set {int}($rtl8710_flasher_buffer + 0x08) = 0 -set {int}($rtl8710_flasher_buffer + 0x10) = $arg0 -set {int}($rtl8710_flasher_buffer + 0x14) = $arg1 -set {int}($rtl8710_flasher_buffer + 0x00) = 1 -FlasherWait -set $status = {int}($rtl8710_flasher_buffer + 0x08) -if $status > 0 - error "write error, offset 0x%08x", $arg0 -end -end -################## -# FlasherVrBlock # -################## -define FlasherVrBlock -#printf "FlashVrBlock 0x%08x, 0x%08x\n", $arg0, $arg1 -set {int}($rtl8710_flasher_buffer + 0x04) = 5 -set {int}($rtl8710_flasher_buffer + 0x08) = 0 -set {int}($rtl8710_flasher_buffer + 0x10) = $arg0 -set {int}($rtl8710_flasher_buffer + 0x14) = $arg1 -set {int}($rtl8710_flasher_buffer + 0x00) = 1 -FlasherWait -set $status = {int}($rtl8710_flasher_buffer + 0x08) -if $status > 0 - set $status = {int}($rtl8710_flasher_buffer + 0x0C) - set $status = {int}($status + $arg0) - error "verify error, offset 0x%08x", $status -end -end -################# -# FlashSecErase # -################# -define FlashSecErase -#printf "FlashSecErase 0x%08x, 0x%08x\n", $rtl8710_flasher_buffer, $arg0 -set {int}($rtl8710_flasher_buffer + 0x04) = 2 -set {int}($rtl8710_flasher_buffer + 0x08) = 0 -set {int}($rtl8710_flasher_buffer + 0x10) = $arg0 -set {int}($rtl8710_flasher_buffer + 0x00) = 1 -FlasherWait -end -################ -# FlasherWrite # -################ -define FlasherWrite -set $sector = 0 -set $offset = 0 -set $size = $arg2 -while $offset < $size - set $len = $size - $offset - if $len > $rtl8710_flasher_buffer_size - set $len = $rtl8710_flasher_buffer_size - end - set $flash_offset = $arg1 + $offset - printf "write offset 0x%08x\n", $flash_offset - set $parms1 = $rtl8710_flasher_buffer + 0x20 - $offset - set $parms2 = $offset - set $parms3 = $offset + $len - restore $arg0 binary $parms1 $parms2 $parms3 - if $rtl8710_flasher_auto_erase != 0 - set $count_i = $flash_offset - while $count_i < ($flash_offset + $len) - set $sector = $count_i/$rtl8710_flasher_sector_size - if $rtl8710_flasher_auto_erase_sector != $sector - set $parms1 = $sector * $rtl8710_flasher_sector_size - printf "erase sector %d at 0x%08x\n", $sector, $parms1 - FlashSecErase $parms1 - set $rtl8710_flasher_auto_erase_sector = $sector - end - set $count_i = $count_i + 1 - end - end - FlasherWrBlock $flash_offset $len - printf "write %d bytes at 0x%08x\n", $len, $flash_offset - if $rtl8710_flasher_auto_verify != 0 - printf "verify offset 0x%08x len %d\n", $flash_offset, $len - FlasherVrBlock $flash_offset $len - end - set $offset = $offset + $rtl8710_flasher_buffer_size -end -end -######################################### -InitJlink -SystemInit -SetClk166MHz -SPI_Init -GetOtaSize build/bin/ota.bin -if $ImageOtaSize != 0 - FlasherInit - FlasherLoad flasher/rtl8710_flasher.bin - set $FixOtaAddr = 0x80000 - set $pbuffer = $rtl8710_flasher_buffer + 0x20 - FlasherRdBlock 0x9000 0x1000 - set $ImageOtaAddr = {int}($pbuffer) - if $ImageOtaAddr != $FixOtaAddr - printf "ImageOtaAddr = 0x%08x - Invalid!\n", $ImageOtaAddr - set {int}($pbuffer) = $FixOtaAddr - set $Temp = $ImageOtaAddr & $FixOtaAddr - if $Temp != $FixOtaAddr - printf "FlashSecErase at 0x9000\n" - FlashSecErase 0x9000 - printf "Write offset 0x9000 4096 bytes\n" - FlasherWrBlock 0x9000 0x1000 - else - printf "Write offset 0x9000 4 bytes\n" - FlasherWrBlock 0x9000 0x0004 - end - end - FlasherWrite build/bin/ota.bin $FixOtaAddr $ImageOtaSize - restore build/bin/ota.bin binary $pbuffer 0 0x1000 - set {int}($pbuffer + 0x08) = 0x35393138 - set {int}($pbuffer + 0x0C) = 0x31313738 - FlasherWrBlock $FixOtaAddr 0x10 - FlashImagesInfo -end -monitor reset -SetBootFlash -monitor go -quit diff --git a/flasher/gdb_rdflash.jlink b/flasher/gdb_rdflash.jlink deleted file mode 100644 index 949d3e9..0000000 --- a/flasher/gdb_rdflash.jlink +++ /dev/null @@ -1,16 +0,0 @@ -# GDB Jlink read fullflash -# Init -source -v flasher/gdb_flasher.jlink -InitJlink -SystemInit -SPI_Init -#FlashInfo -# Read FullFlash -printf "Read FullFlash:\n" -set $dumpstartaddr = $SPI_FLASH_BASE -set $dumpendaddr = $SPI_FLASH_BASE + 0x100000 -printf "Start addr of dumping = 0x%08x\n", $dumpstartaddr -printf "End addr of dumping = 0x%08x\n", $dumpendaddr -dump binary memory ./build/bin/fullflash.bin $dumpstartaddr $dumpendaddr -printf "FullFlash saved in ./build/bin/fullflash.bin - OK.\n" -quit diff --git a/flasher/gdb_run_ram.jlink b/flasher/gdb_run_ram.jlink deleted file mode 100644 index ad6a86d..0000000 --- a/flasher/gdb_run_ram.jlink +++ /dev/null @@ -1,11 +0,0 @@ -# -# J-LINK GDB SERVER initialization -# -source -v flasher/gdb_flasher.jlink -InitJlink -load build/obj/build.axf -SetBootCall4 -monitor reset -monitor go -quit - diff --git a/flasher/gdb_wrfile.jlink b/flasher/gdb_wrfile.jlink deleted file mode 100644 index b81e8c4..0000000 --- a/flasher/gdb_wrfile.jlink +++ /dev/null @@ -1,156 +0,0 @@ -############### -# FlasherInit # -############### -define FlasherInit -set $rtl8710_flasher_capacity = 0 -set $rtl8710_flasher_auto_erase = 1 -set $rtl8710_flasher_auto_verify = 1 -set $rtl8710_flasher_firmware_ptr = 0x10001000 -set $rtl8710_flasher_buffer = 0x10008000 -set $rtl8710_flasher_buffer_size = 421888 -set $rtl8710_flasher_sector_size = 4096 -set $rtl8710_flasher_auto_erase_sector = 0xFFFFFFFF -end -############### -# FlasherWait # -############### -define FlasherWait -set $fresult = {int}($rtl8710_flasher_buffer) -while ($fresult != 0) -set $fresult = {int}($rtl8710_flasher_buffer) -end -end -############### -# FlasherLoad # -############### -define FlasherLoad -if $rtl8710_flasher_capacity == 0 - printf "initializing RTL8710 flasher\n" - restore $arg0 binary $rtl8710_flasher_firmware_ptr 0 968 - monitor reset - set $pc = $rtl8710_flasher_firmware_ptr - set $sp = 0x1ffffffc - set {int}($rtl8710_flasher_buffer + 0x08) = 0 - set {int}($rtl8710_flasher_buffer + 0x00) = 1 - #continue - monitor go - FlasherWait - set $id = {int}($rtl8710_flasher_buffer + 0x0C) - 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 - printf "Flash ID = 0x%08x : (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10 - end - printf "RTL8710 flasher initialized\n" -else -printf "reinitializing RTL8710 flasher\n" -end -end -################## -# FlasherWrBlock # -################## -define FlasherWrBlock -#printf "FlashWrBlock 0x%08x, 0x%08x\n", $arg0, $arg1 -set {int}($rtl8710_flasher_buffer + 0x04) = 4 -set {int}($rtl8710_flasher_buffer + 0x08) = 0 -set {int}($rtl8710_flasher_buffer + 0x10) = $arg0 -set {int}($rtl8710_flasher_buffer + 0x14) = $arg1 -set {int}($rtl8710_flasher_buffer + 0x00) = 1 -FlasherWait -set $status = {int}($rtl8710_flasher_buffer + 0x08) -if $status > 0 - error "write error, offset 0x%08x", $arg0 -end -end -################## -# FlasherVrBlock # -################## -define FlasherVrBlock -#printf "FlashVrBlock 0x%08x, 0x%08x\n", $arg0, $arg1 -set {int}($rtl8710_flasher_buffer + 0x04) = 5 -set {int}($rtl8710_flasher_buffer + 0x08) = 0 -set {int}($rtl8710_flasher_buffer + 0x10) = $arg0 -set {int}($rtl8710_flasher_buffer + 0x14) = $arg1 -set {int}($rtl8710_flasher_buffer + 0x00) = 1 -FlasherWait -set $status = {int}($rtl8710_flasher_buffer + 0x08) -if $status > 0 - set $status = {int}($rtl8710_flasher_buffer + 0x0C) - set $status = {int}($status + $arg0) - error "verify error, offset 0x%08x", $status -end -end -################# -# FlashSecErase # -################# -define FlashSecErase -#printf "FlashSecErase 0x%08x, 0x%08x\n", $rtl8710_flasher_buffer, $arg0 -set {int}($rtl8710_flasher_buffer + 0x04) = 2 -set {int}($rtl8710_flasher_buffer + 0x08) = 0 -set {int}($rtl8710_flasher_buffer + 0x10) = $arg0 -set {int}($rtl8710_flasher_buffer + 0x00) = 1 -FlasherWait -end -################ -# FlasherWrite # -################ -define FlasherWrite -set $sector = 0 -set $offset = 0 -set $size = $arg2 -while $offset < $size - set $len = $size - $offset - if $len > $rtl8710_flasher_buffer_size - set $len = $rtl8710_flasher_buffer_size - end - set $flash_offset = $arg1 + $offset - printf "write offset 0x%08x\n", $flash_offset - set $parms1 = $rtl8710_flasher_buffer + 0x20 - $offset - set $parms2 = $offset - set $parms3 = $offset + $len - restore $arg0 binary $parms1 $parms2 $parms3 - if $rtl8710_flasher_auto_erase != 0 - set $count_i = $flash_offset - while $count_i < ($flash_offset + $len) - set $sector = $count_i/$rtl8710_flasher_sector_size - if $rtl8710_flasher_auto_erase_sector != $sector - set $parms1 = $sector * $rtl8710_flasher_sector_size - printf "erase sector %d at 0x%08x\n", $sector, $parms1 - FlashSecErase $parms1 - set $rtl8710_flasher_auto_erase_sector = $sector - end - set $count_i = $count_i + 1 - end - end - FlasherWrBlock $flash_offset $len - printf "wrote %d bytes at 0x%08x\n", $len, $flash_offset - if $rtl8710_flasher_auto_verify != 0 - printf "verify offset 0x%08x len %d\n", $flash_offset, $len - FlasherVrBlock $flash_offset $len - end - set $offset = $offset + $rtl8710_flasher_buffer_size -end -end -######################################### -source -v flasher/gdb_flasher.jlink -source -v flasher/file_info.jlink -InitJlink -SystemInit -SetClk83MHz -SPI_Init -FlasherInit -FlasherLoad flasher/rtl8710_flasher.bin -call1 -if $ImageSize != 0 -set $ImageEnd = $ImageSize + $ImageAddr + 0x4000 -if $rtl8710_flasher_capacity >= $ImageEnd - printf "Write Image size %d to Flash addr 0x%08x:\n", $ImageSize, $ImageAddr - call2 -else - printf "Error: Image size is too big!\n" -end -else - printf "Error: Image size is zero!\n" -end -quit diff --git a/flasher/gdb_wrflash.jlink b/flasher/gdb_wrflash.jlink deleted file mode 100644 index 0bceeb0..0000000 --- a/flasher/gdb_wrflash.jlink +++ /dev/null @@ -1,169 +0,0 @@ -############### -# FlasherInit # -############### -define FlasherInit -set $rtl8710_flasher_capacity = 0 -set $rtl8710_flasher_auto_erase = 1 -set $rtl8710_flasher_auto_verify = 1 -set $rtl8710_flasher_firmware_ptr = 0x10001000 -set $rtl8710_flasher_buffer = 0x10008000 -set $rtl8710_flasher_buffer_size = 421888 -set $rtl8710_flasher_sector_size = 4096 -set $rtl8710_flasher_auto_erase_sector = 0xFFFFFFFF -end -############### -# FlasherWait # -############### -define FlasherWait -set $fresult = {int}($rtl8710_flasher_buffer) -while ($fresult != 0) -set $fresult = {int}($rtl8710_flasher_buffer) -end -end -############### -# FlasherLoad # -############### -define FlasherLoad -if $rtl8710_flasher_capacity == 0 - printf "initializing RTL8710 flasher\n" - restore $arg0 binary $rtl8710_flasher_firmware_ptr 0 968 - monitor reset - set $pc = $rtl8710_flasher_firmware_ptr - set $sp = 0x1ffffffc - set {int}($rtl8710_flasher_buffer + 0x08) = 0 - set {int}($rtl8710_flasher_buffer + 0x00) = 1 - #continue - monitor go - FlasherWait - set $id = {int}($rtl8710_flasher_buffer + 0x0C) - 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 - printf "Flash ID = 0x%08x : (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10 - end - printf "RTL8710 flasher initialized\n" -else -printf "reinitializing RTL8710 flasher\n" -end -end -################## -# FlasherWrBlock # -################## -define FlasherWrBlock -#printf "FlashWrBlock 0x%08x, 0x%08x\n", $arg0, $arg1 -set {int}($rtl8710_flasher_buffer + 0x04) = 4 -set {int}($rtl8710_flasher_buffer + 0x08) = 0 -set {int}($rtl8710_flasher_buffer + 0x10) = $arg0 -set {int}($rtl8710_flasher_buffer + 0x14) = $arg1 -set {int}($rtl8710_flasher_buffer + 0x00) = 1 -FlasherWait -set $status = {int}($rtl8710_flasher_buffer + 0x08) -if $status > 0 - error "write error, offset 0x%08x", $arg0 -end -end -################## -# FlasherVrBlock # -################## -define FlasherVrBlock -#printf "FlashVrBlock 0x%08x, 0x%08x\n", $arg0, $arg1 -set {int}($rtl8710_flasher_buffer + 0x04) = 5 -set {int}($rtl8710_flasher_buffer + 0x08) = 0 -set {int}($rtl8710_flasher_buffer + 0x10) = $arg0 -set {int}($rtl8710_flasher_buffer + 0x14) = $arg1 -set {int}($rtl8710_flasher_buffer + 0x00) = 1 -FlasherWait -set $status = {int}($rtl8710_flasher_buffer + 0x08) -if $status > 0 - set $status = {int}($rtl8710_flasher_buffer + 0x0C) - set $status = {int}($status + $arg0) - error "verify error, offset 0x%08x", $status -end -end -################# -# FlashSecErase # -################# -define FlashSecErase -#printf "FlashSecErase 0x%08x, 0x%08x\n", $rtl8710_flasher_buffer, $arg0 -set {int}($rtl8710_flasher_buffer + 0x04) = 2 -set {int}($rtl8710_flasher_buffer + 0x08) = 0 -set {int}($rtl8710_flasher_buffer + 0x10) = $arg0 -set {int}($rtl8710_flasher_buffer + 0x00) = 1 -FlasherWait -end -################ -# FlasherWrite # -################ -define FlasherWrite -set $sector = 0 -set $offset = 0 -set $size = $arg2 -while $offset < $size - set $len = $size - $offset - if $len > $rtl8710_flasher_buffer_size - set $len = $rtl8710_flasher_buffer_size - end - set $flash_offset = $arg1 + $offset - printf "write offset 0x%08x\n", $flash_offset - 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 - while $count_i < ($flash_offset + $len) - set $sector = $count_i/$rtl8710_flasher_sector_size - if $rtl8710_flasher_auto_erase_sector != $sector - set $parms1 = $sector * $rtl8710_flasher_sector_size - printf "erase sector %d at 0x%08x\n", $sector, $parms1 - FlashSecErase $parms1 - set $rtl8710_flasher_auto_erase_sector = $sector - end - set $count_i = $count_i + 1 - end - end - FlasherWrBlock $flash_offset $len - printf "wrote %d bytes at 0x%08x\n", $len, $flash_offset - if $rtl8710_flasher_auto_verify != 0 - printf "verify offset 0x%08x len %d\n", $flash_offset, $len - FlasherVrBlock $flash_offset $len - end - set $offset = $offset + $rtl8710_flasher_buffer_size -end -end -######################################### -source -v flasher/gdb_flasher.jlink -source -v flasher/flash_file.jlink -InitJlink -SystemInit -SetClk166MHz -SPI_Init -FlashImagesInfo -#SetFirwareSize $wr_flile -call1 -if $FirmwareSize == 0 - error "FirmwareSize = 0!" -end -FlasherInit -FlasherLoad flasher/rtl8710_flasher.bin -if $Image1Size != 0 - printf "Write Image1 size %d to Flash addr 0x00000000:\n", $Image1Size - #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 -end -FlashImagesInfo -monitor reset -SetBootFlash -monitor go -quit diff --git a/flasher/rtl8710.ocd b/flasher/rtl8710.ocd deleted file mode 100644 index c3d94ec..0000000 --- a/flasher/rtl8710.ocd +++ /dev/null @@ -1,356 +0,0 @@ -# -# OpenOCD script for RTL8710 -# Copyright (C) 2016 Rebane, rebane@alkohol.ee -# -set CHIPNAME rtl8195a -set CHIPSERIES ameba1 - -# Adapt based on what transport is active. - -source [find target/swj-dp.tcl] - -if { [info exists CHIPNAME] } { - set _CHIPNAME $CHIPNAME -} else { - set _CHIPNAME rtl8710 -} - -if { [info exists ENDIAN] } { - set _ENDIAN $ENDIAN -} else { - set _ENDIAN little -} - -if { [info exists WORKAREASIZE] } { - set _WORKAREASIZE $WORKAREASIZE -} else { - set _WORKAREASIZE 0x800 -} - -if { [info exists CPUTAPID] } { - set _CPUTAPID $CPUTAPID -} else { - set _CPUTAPID 0x2ba01477 -} - -swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID - -set _TARGETNAME $_CHIPNAME.cpu -target create $_TARGETNAME cortex_m -endian $_ENDIAN -chain-position $_TARGETNAME - -$_TARGETNAME configure -work-area-phys 0x10001000 -work-area-size $_WORKAREASIZE -work-area-backup 0 - -# adapter_khz 500 -adapter_nsrst_delay 100 - -if {![using_hla]} { - cortex_m reset_config sysresetreq vectreset -} - -set rtl8710_flasher_firmware_ptr 0x10001000 -set rtl8710_flasher_buffer 0x10008000 -set rtl8710_flasher_buffer_size 262144 -set rtl8710_flasher_sector_size 4096 - -array set rtl8710_flasher_code { - 0 0xB671B57F 1 0x25FF4B58 2 0x6B196B1A 3 0x7040F042 4 0x69D96318 5 0xF4414E55 - 6 0x69D97480 7 0xF8D361DC 8 0xF8C32120 9 0xF8D35120 10 0xF8C31124 11 0x47B05124 - 12 0x47B04E4F 13 0x47984B4F 14 0x60104A4F 15 0x484F47B0 16 0x60012100 17 0x2C006804 - 18 0x4D4DD0FC 19 0xB93E682E 20 0x60264C49 21 0x47B04E46 22 0x47984B46 23 0xE7ED6020 - 24 0x2B01682B 25 0x4E42D109 26 0x4C4647B0 27 0x47A02006 28 0x47904A45 29 0x47A020C7 - 30 0x682AE00D 31 0xD10E2A02 32 0x47B04E3B 33 0x20064C3F 34 0x483F47A0 35 0x493F4780 - 36 0x68084D3F 37 0x47B047A8 38 0x47A02004 39 0x6828E7CE 40 0xD1132803 41 0x47A04C32 - 42 0x24004838 43 0x4E396805 44 0x68311960 45 0xD206428C 46 0x4B384A37 47 0x221018A1 - 48 0x34104798 49 0x4D2AE7F3 50 0xE7B847A8 51 0x29046829 52 0x2400D11B 53 0x6806482F - 54 0xD2B042B4 55 0x47A84D24 56 0x20064E28 57 0x4B2847B0 58 0x49284798 59 0x680A4B2A - 60 0x18A018E1 61 0xF44F4B2A 62 0x47987280 63 0x200447A8 64 0xF50447B0 65 0x47A87480 - 66 0x682CE7E4 67 0xD1232C05 68 0x47984B17 69 0x4D1F2400 70 0x4294682A 71 0x481BD28F - 72 0x68012210 73 0x18604E1D 74 0x47B04669 75 0x1B19682B 76 0xBF282910 77 0x23002110 - 78 0xD011428B 79 0xF81D4A16 80 0x18A05003 81 0x42B55CC6 82 0x3301D101 83 0x4A15E7F4 - 84 0x60112101 85 0xE7726054 86 0x25014E12 87 0xE76E6035 88 0x47A84D03 89 0xE7D63410 - 90 0x40000200 91 0x100011BD 92 0x100013DD 93 0x10001289 94 0x1000800C 95 0x10008000 - 96 0x10008004 97 0x1000130D 98 0x100013ED 99 0x10008010 100 0x10001335 101 0x10008014 - 102 0x10008020 103 0x10001221 104 0x10001375 105 0x10008008 106 0x6A5A4B03 107 0xD0FB0512 - 108 0x0060F893 109 0xBF004770 110 0x40006000 111 0x6B194B17 112 0xF4416B1A 113 0x63187040 - 114 0x69186919 115 0x0110F041 116 0xF8D36119 117 0x220000C0 118 0x0106F020 119 0x00C0F8D3 - 120 0x10C0F8C3 121 0x00C0F8D3 122 0x0101F040 123 0x00C0F8D3 124 0x10C0F8C3 125 0x43BCF503 - 126 0x609A6899 127 0x20016AD9 128 0x691962DA 129 0x69596118 130 0x61592102 131 0x619A6999 - 132 0x61DA69D9 133 0x64DA6CD9 134 0xBF004770 135 0x40000200 136 0x460EB570 137 0xB34A4614 - 138 0xF3C04B15 139 0x681A4507 140 0x7240F44F 141 0x685A601A 142 0xF3C02103 143 0x2C102207 - 144 0x2410BF28 145 0x605CB2C0 146 0x1060F883 147 0x5060F883 148 0xF8832101 149 0xF8832060 - 150 0x689A0060 151 0x60992500 152 0x47984B08 153 0x35015570 154 0x42A2B2AA 155 0x4804D3F8 - 156 0xF0116A81 157 0xD1FA0301 158 0x60836881 159 0xBD704620 160 0x40006000 161 0x100011A9 - 162 0x4C10B5F8 163 0x68232003 164 0x7340F44F 165 0x68636023 166 0x60602101 167 0x68A3229F - 168 0x60A14D0B 169 0x2060F884 170 0x460647A8 171 0x460747A8 172 0x040347A8 173 0x2707EA43 - 174 0x0006EA47 175 0x4B036AA1 176 0x0201F011 177 0x6899D1FA 178 0xBDF8609A 179 0x40006000 - 180 0x100011A9 181 0x4C0BB510 182 0x68232001 183 0x7340F44F 184 0x68636023 185 0x60602105 - 186 0x60A068A2 187 0xF8844A06 188 0x47901060 189 0x4B036AA1 190 0x0201F011 191 0x6899D1FA - 192 0xBD10609A 193 0x40006000 194 0x100011A9 195 0x21014B08 196 0xF44F681A 197 0x601A7280 - 198 0x6099689A 199 0x0060F883 200 0x48036A9A 201 0x0101F012 202 0x6883D1FA 203 0x47706081 - 204 0x40006000 205 0x21014B0E 206 0xF44F681A 207 0x601A7280 208 0x2220689A 209 0xF8836099 - 210 0xF3C02060 211 0xF3C04107 212 0xB2C02207 213 0x1060F883 214 0x2060F883 215 0x0060F883 - 216 0x4A036A99 217 0x0001F011 218 0x6893D1FA 219 0x47706090 220 0x40006000 221 0xB36AB530 - 222 0x25014B17 223 0xF44F681C 224 0x601C7480 225 0x2402689C 226 0xF883609D 227 0xF3C04060 - 228 0xF3C04507 229 0xB2C02407 230 0x5060F883 231 0x7F80F5B2 232 0xF44FBF28 233 0xF8837280 - 234 0xF8834060 235 0x20000060 236 0x4C095C0D 237 0xF8843001 238 0xB2855060 239 0xD3F74295 - 240 0x07496A99 241 0x6AA0D5FC 242 0xF0104B03 243 0xD1FA0101 244 0x60996898 245 0xBD304610 - 246 0x40006000 247 0x4B02B508 248 0x07C04798 249 0xBD08D4FB 250 0x100012D5 251 0x4B04B508 - 252 0xF0004798 253 0xB2C10002 254 0xD0F82900 255 0xBF00BD08 256 0x100012D5 -} - -set rtl8710_flasher_command_read_id 0 -set rtl8710_flasher_command_mass_erase 1 -set rtl8710_flasher_command_sector_erase 2 -set rtl8710_flasher_command_read 3 -set rtl8710_flasher_command_write 4 -set rtl8710_flasher_command_verify 5 - -set rtl8710_flasher_ready 0 -set rtl8710_flasher_capacity 0 -set rtl8710_flasher_auto_erase 0 -set rtl8710_flasher_auto_verify 0 -set rtl8710_flasher_auto_erase_sector 0xFFFFFFFF - -proc rtl8710_flasher_init {} { - global rtl8710_flasher_firmware_ptr - global rtl8710_flasher_buffer - global rtl8710_flasher_capacity - global rtl8710_flasher_ready - global rtl8710_flasher_code - - if {[expr {$rtl8710_flasher_ready == 0}]} { - echo "initializing RTL8710 flasher" - halt - mww [expr {$rtl8710_flasher_buffer + 0x08}] 0x00000000 - mww [expr {$rtl8710_flasher_buffer + 0x00}] 0x00000001 - array2mem rtl8710_flasher_code 32 $rtl8710_flasher_firmware_ptr [array size rtl8710_flasher_code] - reg faultmask 0x01 - reg sp 0x20000000 - reg pc $rtl8710_flasher_firmware_ptr - resume - rtl8710_flasher_wait - set id [rtl8710_flasher_mrw [expr {$rtl8710_flasher_buffer + 0x0C}]] - set rtl8710_flasher_capacity [expr {2 ** [expr {($id >> 16) & 0xFF}]}] - set rtl8710_flasher_ready 1 - echo "RTL8710 flasher initialized" - } - return "" -} - -proc rtl8710_flasher_mrw {reg} { - set value "" - mem2array value 32 $reg 1 - return $value(0) -} - -proc rtl8710_flasher_wait {} { - global rtl8710_flasher_buffer - while {[rtl8710_flasher_mrw [expr {$rtl8710_flasher_buffer + 0x00}]]} { } -} - -proc rtl8710_flasher_load_block {local_filename offset len} { - global rtl8710_flasher_buffer - load_image $local_filename [expr {$rtl8710_flasher_buffer + 0x20 - $offset}] bin [expr {$rtl8710_flasher_buffer + 0x20}] $len -} - -proc rtl8710_flasher_read_block {offset len} { - global rtl8710_flasher_buffer - global rtl8710_flasher_command_read - mww [expr {$rtl8710_flasher_buffer + 0x04}] $rtl8710_flasher_command_read - mww [expr {$rtl8710_flasher_buffer + 0x08}] 0x00000000 - mww [expr {$rtl8710_flasher_buffer + 0x10}] $offset - mww [expr {$rtl8710_flasher_buffer + 0x14}] $len - mww [expr {$rtl8710_flasher_buffer + 0x00}] 0x00000001 - rtl8710_flasher_wait - set status [rtl8710_flasher_mrw [expr {$rtl8710_flasher_buffer + 0x08}]] - if {[expr {$status > 0}]} { - error "read error, offset $offset" - } -} - -proc rtl8710_flasher_write_block {offset len} { - global rtl8710_flasher_buffer - global rtl8710_flasher_command_write - mww [expr {$rtl8710_flasher_buffer + 0x04}] $rtl8710_flasher_command_write - mww [expr {$rtl8710_flasher_buffer + 0x08}] 0x00000000 - mww [expr {$rtl8710_flasher_buffer + 0x10}] $offset - mww [expr {$rtl8710_flasher_buffer + 0x14}] $len - mww [expr {$rtl8710_flasher_buffer + 0x00}] 0x00000001 - rtl8710_flasher_wait - set status [rtl8710_flasher_mrw [expr {$rtl8710_flasher_buffer + 0x08}]] - if {[expr {$status > 0}]} { - error "write error, offset $offset" - } -} - -proc rtl8710_flasher_verify_block {offset len} { - global rtl8710_flasher_buffer - global rtl8710_flasher_command_verify - mww [expr {$rtl8710_flasher_buffer + 0x04}] $rtl8710_flasher_command_verify - mww [expr {$rtl8710_flasher_buffer + 0x08}] 0x00000000 - mww [expr {$rtl8710_flasher_buffer + 0x10}] $offset - mww [expr {$rtl8710_flasher_buffer + 0x14}] $len - mww [expr {$rtl8710_flasher_buffer + 0x00}] 0x00000001 - rtl8710_flasher_wait - set status [rtl8710_flasher_mrw [expr {$rtl8710_flasher_buffer + 0x08}]] - if {[expr {$status > 0}]} { - set status [rtl8710_flasher_mrw [expr {$rtl8710_flasher_buffer + 0x0C}]] - set status [expr {$status + $offset}] - error "verify error, offset $status" - } -} - -proc rtl8710_flash_read_id {} { - global rtl8710_flasher_buffer - global rtl8710_flasher_capacity - global rtl8710_flasher_command_read_id - rtl8710_flasher_init - mww [expr {$rtl8710_flasher_buffer + 0x04}] $rtl8710_flasher_command_read_id - mww [expr {$rtl8710_flasher_buffer + 0x08}] 0x00000000 - mww [expr {$rtl8710_flasher_buffer + 0x00}] 0x00000001 - rtl8710_flasher_wait - set id [rtl8710_flasher_mrw [expr {$rtl8710_flasher_buffer + 0x0C}]] - set manufacturer_id [format "0x%02X" [expr {$id & 0xFF}]] - set memory_type [format "0x%02X" [expr {($id >> 8) & 0xFF}]] - set memory_capacity [expr {2 ** [expr {($id >> 16) & 0xFF}]}] - echo "manufacturer ID: $manufacturer_id, memory type: $memory_type, memory capacity: $memory_capacity bytes" -} - -proc rtl8710_flash_mass_erase {} { - global rtl8710_flasher_buffer - global rtl8710_flasher_command_mass_erase - rtl8710_flasher_init - mww [expr {$rtl8710_flasher_buffer + 0x04}] $rtl8710_flasher_command_mass_erase - mww [expr {$rtl8710_flasher_buffer + 0x08}] 0x00000000 - mww [expr {$rtl8710_flasher_buffer + 0x00}] 0x00000001 - rtl8710_flasher_wait -} - -proc rtl8710_flash_sector_erase {offset} { - global rtl8710_flasher_buffer - global rtl8710_flasher_command_sector_erase - rtl8710_flasher_init - mww [expr {$rtl8710_flasher_buffer + 0x04}] $rtl8710_flasher_command_sector_erase - mww [expr {$rtl8710_flasher_buffer + 0x08}] 0x00000000 - mww [expr {$rtl8710_flasher_buffer + 0x10}] $offset - mww [expr {$rtl8710_flasher_buffer + 0x00}] 0x00000001 - rtl8710_flasher_wait -} - -proc rtl8710_flash_read {local_filename loc size} { - global rtl8710_flasher_buffer - global rtl8710_flasher_buffer_size - rtl8710_flasher_init - for {set offset 0} {$offset < $size} {set offset [expr {$offset + $rtl8710_flasher_buffer_size}]} { - set len [expr {$size - $offset}] - if {[expr {$len > $rtl8710_flasher_buffer_size}]} { - set len $rtl8710_flasher_buffer_size - } - set flash_offset [expr {$loc + $offset}] - echo "read offset $flash_offset" - rtl8710_flasher_read_block $flash_offset $len - dump_image _rtl8710_flasher.bin [expr {$rtl8710_flasher_buffer + 0x20}] $len - exec dd conv=notrunc if=_rtl8710_flasher.bin "of=$local_filename" bs=1 "seek=$offset" - echo "read $len bytes" - } -} - -proc rtl8710_flash_write {local_filename loc} { - global rtl8710_flasher_buffer_size - global rtl8710_flasher_sector_size - global rtl8710_flasher_auto_erase - global rtl8710_flasher_auto_verify - global rtl8710_flasher_auto_erase_sector - rtl8710_flasher_init - set sector 0 - set size [file size $local_filename] - for {set offset 0} {$offset < $size} {set offset [expr {$offset + $rtl8710_flasher_buffer_size}]} { - set len [expr {$size - $offset}] - if {[expr {$len > $rtl8710_flasher_buffer_size}]} { - set len $rtl8710_flasher_buffer_size - } - set flash_offset [expr {$loc + $offset}] - echo "write offset $flash_offset" - rtl8710_flasher_load_block $local_filename $offset $len - if {[expr {$rtl8710_flasher_auto_erase != 0}]} { - for {set i $flash_offset} {$i < [expr {$flash_offset + $len}]} {incr i} { - set sector [expr {$i / $rtl8710_flasher_sector_size}] - if {[expr {$rtl8710_flasher_auto_erase_sector != $sector}]} { - echo "erase sector $sector" - rtl8710_flash_sector_erase [expr {$sector * $rtl8710_flasher_sector_size}] - set rtl8710_flasher_auto_erase_sector $sector - } - } - } - rtl8710_flasher_write_block $flash_offset $len - echo "wrote $len bytes" - if {[expr {$rtl8710_flasher_auto_verify != 0}]} { - echo "verify offset $flash_offset" - rtl8710_flasher_verify_block $flash_offset $len - } - } -} - -proc rtl8710_flash_verify {local_filename loc} { - global rtl8710_flasher_buffer_size - rtl8710_flasher_init - set size [file size $local_filename] - for {set offset 0} {$offset < $size} {set offset [expr {$offset + $rtl8710_flasher_buffer_size}]} { - set len [expr {$size - $offset}] - if {[expr {$len > $rtl8710_flasher_buffer_size}]} { - set len $rtl8710_flasher_buffer_size - } - set flash_offset [expr {$loc + $offset}] - echo "read offset $flash_offset" - rtl8710_flasher_load_block $local_filename $offset $len - echo "verify offset $flash_offset" - rtl8710_flasher_verify_block $flash_offset $len - } -} - -proc rtl8710_flash_auto_erase {on} { - global rtl8710_flasher_auto_erase - if {[expr {$on != 0}]} { - set rtl8710_flasher_auto_erase 1 - echo "auto erase on" - } else { - set rtl8710_flasher_auto_erase 0 - echo "auto erase off" - } -} - -proc rtl8710_flash_auto_verify {on} { - global rtl8710_flasher_auto_verify - if {[expr {$on != 0}]} { - set rtl8710_flasher_auto_verify 1 - echo "auto verify on" - } else { - set rtl8710_flasher_auto_verify 0 - echo "auto verify off" - } -} - -proc rtl8710_reboot {} { - echo "# Set processor clock to default before system reset" - mww 0x40000014 0x00000021 - sleep 10 - echo "# Reboot (system reset)" - mww 0xE000ED0C 0x05FA0007 -} - -proc boot_load_srdam {local_filename loc} { - echo "# Set flag WISDRAM" - mww 0x1FFF0000 0x12345678 - mww 0x40000210 0x20011113 - resume - echo "# Wait Init SDRAM..." -# sleep 1000 - while {[rtl8710_flasher_mrw 0x1FFF0000] == 0x12345678 } { sleep 10 } - halt - echo "# Load SDRAM image..." - load_image $local_filename $loc - resume -# echo "# Go" - mww 0x1FFF0000 1 -} - diff --git a/flasher/rtl8710_flasher.bin b/flasher/rtl8710_flasher.bin deleted file mode 100644 index 6c7e36d..0000000 Binary files a/flasher/rtl8710_flasher.bin and /dev/null differ diff --git a/paths.bat b/paths.bat index 724383c..ae6d531 100644 --- a/paths.bat +++ b/paths.bat @@ -1 +1 @@ -PATH=D:\MCU\GNU_Tools_ARM_Embedded\6.2017-q1-update\bin;D:\MCU\SEGGER\JLink_V612i;D:\MCU\OpenOCD\bin;%PATH% \ No newline at end of file +PATH=D:\MCU\GNU_Tools_ARM_Embedded\7.2017-q4-major\bin;D:\MCU\SEGGER\JLink_V630g;D:\MCU\OpenOCD\bin;C:\MinGW\msys\1.0\bin;%PATH% \ No newline at end of file diff --git a/project.mk b/project.mk index 2c35bda..1e4838b 100644 --- a/project.mk +++ b/project.mk @@ -2,7 +2,8 @@ # SDK CONFIG #============================================= USE_SDRAM = 1 -#WEB_INA219_DRV = 1 +#SWO_DEBUG_OUT_ENA = 1 +WEB_INA219_DRV = 1 #WEB_MLX90614_DRV = 1 WEB_ADC_DRV = 1 #USE_SDCARD = 1 @@ -98,3 +99,7 @@ else ADD_SRC_C += project/src/web/_sci_web.c ADD_SRC_C += project/src/web/_sci_web_user.c endif + +ifdef SWO_DEBUG_OUT_ENA +CFLAGS += -DSWO_DEBUG_OUT_ENA=1 +endif diff --git a/project/src/console/wifi_console.c b/project/src/console/wifi_console.c index 9ae9b14..fa8b5ca 100644 --- a/project/src/console/wifi_console.c +++ b/project/src/console/wifi_console.c @@ -31,35 +31,19 @@ LOCAL void fATPN(int argc, char *argv[]){ show_wifi_st_cfg(); } else { - strncpy(wifi_st_cfg.ssid, argv[1], NDIS_802_11_LENGTH_SSID); - int pswlen; + strncpy(wifi_st_cfg.ssid, argv[1], sizeof(wifi_st_cfg.ssid)); + wifi_st_cfg.security = IDX_SECURITY_OPEN; + int pswlen = strlen(strncpy(wifi_st_cfg.password, argv[2], sizeof(wifi_st_cfg.password))); if(argc > 2) { - pswlen = strlen(wifi_st_cfg.password); - strncpy(wifi_st_cfg.password, argv[2], NDIS_802_11_LENGTH_SSID); if(pswlen > 7) { wifi_st_cfg.security = IDX_SECURITY_WPA2_AES_PSK; - } - else if(!pswlen) { - wifi_st_cfg.security = IDX_SECURITY_OPEN; - } - else { + } + else if(pswlen != 0) { printf("password len < 8!\n"); - wifi_st_cfg.security = IDX_SECURITY_OPEN; } } - else { - // default - wifi_st_cfg.password[0] = 0; - wifi_st_cfg.security = IDX_SECURITY_OPEN; - } if(argc > 3) { - if(pswlen > 7) { - wifi_st_cfg.security = atoi(argv[3]); - } - else { - printf("password len < 8!\n"); - wifi_st_cfg.security = IDX_SECURITY_OPEN; - } + wifi_st_cfg.security = atoi(argv[3]); } if(argc > 4) { wifi_st_cfg.autoreconnect = atoi(argv[4]); @@ -85,25 +69,17 @@ LOCAL void fATPA(int argc, char *argv[]){ show_wifi_ap_cfg(); } else { - strncpy(wifi_ap_cfg.ssid, argv[1], NDIS_802_11_LENGTH_SSID); + strncpy(wifi_ap_cfg.ssid, argv[1], sizeof(wifi_ap_cfg.ssid)); + wifi_ap_cfg.security = 0; // IDX_SECURITY_OPEN; + int pswlen = strlen(strncpy(wifi_ap_cfg.password, argv[2], sizeof(wifi_ap_cfg.password))); if(argc > 2) { - strncpy(wifi_ap_cfg.password, argv[2], NDIS_802_11_LENGTH_SSID); - int i = strlen(wifi_ap_cfg.password); - if(i > 7) { + if(pswlen > 7) { wifi_ap_cfg.security = 1; // IDX_SECURITY_WPA2_AES_PSK; } - else if(i == 0) { - wifi_ap_cfg.security = 0; // IDX_SECURITY_OPEN; - } - else { + else if(pswlen != 0) { printf("password len < 8!\n"); - wifi_ap_cfg.security = 0; // IDX_SECURITY_OPEN; } } - else { - wifi_ap_cfg.password[0] = 0; - wifi_ap_cfg.security = 0; // IDX_SECURITY_OPEN; - } if(argc > 3) { wifi_ap_cfg.security = (argv[3][0] == '0')? 0 : 1; //RTW_SECURITY_OPEN : RTW_SECURITY_WPA2_AES_PSK; } diff --git a/project/src/web/web_int_callbacks.c b/project/src/web/web_int_callbacks.c index 890345d..0694eac 100644 --- a/project/src/web/web_int_callbacks.c +++ b/project/src/web/web_int_callbacks.c @@ -384,6 +384,36 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr) #endif ifcmp("start") tcp_puts("0x%08x", web_conn->udata_start); else ifcmp("stop") tcp_puts("0x%08x", web_conn->udata_stop); +#ifdef WEB_INA219_DRV + else ifcmp("ina219") { + if(CheckSCB(SCB_WEBSOC)) { +extern int ina219_ws(TCP_SERV_CONN *ts_conn, char cmd); + int x = ina219_ws(ts_conn, cstr[6]); + if(x < 0) SetSCB(SCB_FCLOSE|SCB_DISCONNECT); + else tcp_puts("%d", x); + } + } +#endif +#ifdef WEB_MLX90614_DRV + else ifcmp("mlx90614") { + if(CheckSCB(SCB_WEBSOC)) { +extern int mlx90614_ws(TCP_SERV_CONN *ts_conn, char cmd); + int x = mlx90614_ws(ts_conn, cstr[8]); + if(x < 0) SetSCB(SCB_FCLOSE|SCB_DISCONNECT); + else tcp_puts("%d", x); + } + } +#endif +#ifdef WEB_ADC_DRV + else ifcmp("adc") { + if(CheckSCB(SCB_WEBSOC)) { +extern int adc_ws(TCP_SERV_CONN *ts_conn, char cmd); + int x = adc_ws(ts_conn, cstr[3]); + if(x < 0) SetSCB(SCB_FCLOSE|SCB_DISCONNECT); + else tcp_puts("%d", x); + } + } +#endif #if USE_WEB_AUTH_LEVEL else ifcmp("realm") tcp_puts("%u", web_conn->auth_realm); else ifcmp("auth") tcp_puts("%u", web_conn->auth_level); @@ -441,7 +471,7 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr) else ifcmp("rdec") tcp_puts("%d", *((uint32 *)(ahextoul(cstr+4)&(~3)))); #endif // #if WEB_DEBUG_FUNCTIONS else ifcmp("ip") { - uint32 cur_ip; + uint32 cur_ip = 0; if(netif_default != NULL) cur_ip = netif_default->ip_addr.addr; tcp_puts(IPSTR, IP2STR(&cur_ip)); } @@ -452,36 +482,6 @@ void ICACHE_FLASH_ATTR web_int_callback(TCP_SERV_CONN *ts_conn, uint8 *cstr) #endif else tcp_put('?'); } -#ifdef WEB_INA219_DRV - else ifcmp("ina219") { - if(CheckSCB(SCB_WEBSOC)) { -extern int ina219_ws(TCP_SERV_CONN *ts_conn, char cmd); - int x = ina219_ws(ts_conn, cstr[6]); - if(x < 0) SetSCB(SCB_FCLOSE|SCB_DISCONNECT); - else tcp_puts("%d", x); - } - } -#endif -#ifdef WEB_MLX90614_DRV - else ifcmp("mlx90614") { - if(CheckSCB(SCB_WEBSOC)) { -extern int mlx90614_ws(TCP_SERV_CONN *ts_conn, char cmd); - int x = mlx90614_ws(ts_conn, cstr[8]); - if(x < 0) SetSCB(SCB_FCLOSE|SCB_DISCONNECT); - else tcp_puts("%d", x); - } - } -#endif -#ifdef WEB_ADC_DRV - else ifcmp("adc") { - if(CheckSCB(SCB_WEBSOC)) { -extern int adc_ws(TCP_SERV_CONN *ts_conn, char cmd); - int x = adc_ws(ts_conn, cstr[3]); - if(x < 0) SetSCB(SCB_FCLOSE|SCB_DISCONNECT); - else tcp_puts("%d", x); - } - } -#endif else ifcmp("cfg_") { cstr += 4; ifcmp("web_") { diff --git a/project/src/web/websock.c b/project/src/web/websock.c index 4c7c789..7226244 100644 --- a/project/src/web/websock.c +++ b/project/src/web/websock.c @@ -214,7 +214,7 @@ WebsocketTxFrame(TCP_SERV_CONN *ts_conn, uint32 opcode, uint8 *raw_data, uint32 head_len = 2; }; if(opcode & (WS_MASK_FLG << 8)) { - mask.ud ^= rand(); + mask.ud = rand(); head.uc[1] |= WS_MASK_FLG; head.uc[head_len] = mask.uc[0]; head.uc[head_len+1] = mask.uc[1]; diff --git a/userset.mk b/userset.mk index 9fdc648..8e8bd46 100644 --- a/userset.mk +++ b/userset.mk @@ -1,14 +1,24 @@ #============================================= # User defined #============================================= -#SDK_PATH = ../RTL00MP3/RTL00_SDKV35a/ SDK_PATH = USDK/ #GCC_PATH = d:/MCU/GNU_Tools_ARM_Embedded/6.2017-q1-update/bin/# + or set in PATH -#OPENOCD_PATH = D:/MCU/OpenOCD/bin/# + or set in PATH -TOOLS_PATH ?= $(SDK_PATH)component/soc/realtek/8195a/misc/iar_utility/common/tools/ +#---------------------------------- +# Set JTAG/SWD +#---------------------------------- #FLASHER_TYPE = Jlink +#FLASHER_TYPE = stlink-v2 FLASHER_TYPE = cmsis-dap FLASHER_SPEED = 3500 -FLASHER_PATH = flasher/ -JLINK_PATH ?= D:/MCU/SEGGER/JLink_V612i/ -JLINK_GDBSRV ?= JLinkGDBServer.exe +#---------------------------------- +# Tools Path +#---------------------------------- +ifneq ($(shell uname), Linux) +PYTHON ?= C:/Python27/python +OPENOCD ?= d:/MCU/OpenOCD/bin/openocd.exe +JLINK_PATH ?= D:/MCU/SEGGER/JLink_V630g/ +else +PYTHON ?= python +OPENOCD ?= /mnt/d/MCU/OpenOCD/bin/openocd.exe +JLINK_PATH ?= /mnt/d/MCU/SEGGER/JLink_V630g/ +endif