mirror of
https://github.com/pvvx/RTL00_AT.git
synced 2024-11-01 01:44:15 +00:00
first commit
This commit is contained in:
commit
11380c5991
75 changed files with 10424 additions and 0 deletions
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
/AutoMake/
|
||||
/build/obj
|
||||
/build/RTL00MP3
|
118
.project
Normal file
118
.project
Normal file
|
@ -0,0 +1,118 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>RTL00_AT</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
<project>RTL00_SDKV35a</project>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||
<triggers>clean,full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>RTL00_SDKV35a</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-1-PROJECT_LOC/RTL00MP3/RTL00_SDKV35a</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>RTL00_SDKV35a</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-*.h</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>RTL00_SDKV35a</name>
|
||||
<type>5</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-*.c</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>RTL00_SDKV35a</name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-AutoMake</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>RTL00_SDKV35a</name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-build</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>RTL00_SDKV35a</name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-flasher</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>RTL00_SDKV35a</name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-LibAutoMake</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>RTL00_SDKV35a</name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-project</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>RTL00_SDKV35a</name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-.git</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>0</id>
|
||||
<name>RTL00_SDKV35a</name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
<id>org.eclipse.ui.ide.multiFilter</id>
|
||||
<arguments>1.0-name-matches-false-false-.settings</arguments>
|
||||
</matcher>
|
||||
</filter>
|
||||
</filteredResources>
|
||||
</projectDescription>
|
36
.settings/language.settings.xml
Normal file
36
.settings/language.settings.xml
Normal file
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<project>
|
||||
<configuration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404" name="Debug">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="327733268004558313" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
<configuration id="cdt.managedbuild.config.gnu.mingw.exe.release.510381534" name="Release">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="-490865881245302940" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
<configuration id="cdt.managedbuild.config.gnu.mingw.exe.debug.1273936404.1853483235" name="AutoMake">
|
||||
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector" console="false" env-hash="278430315188634280" id="ilg.gnuarmeclipse.managedbuild.cross.GCCBuiltinSpecsDetector" keep-relative-paths="false" name="CDT GCC Built-in Compiler Settings Cross ARM" parameter="${COMMAND} ${FLAGS} ${cross_toolchain_flags} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
</extension>
|
||||
</configuration>
|
||||
</project>
|
6
.settings/org.eclipse.cdt.core.prefs
Normal file
6
.settings/org.eclipse.cdt.core.prefs
Normal file
|
@ -0,0 +1,6 @@
|
|||
eclipse.preferences.version=1
|
||||
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/PATH/delimiter=;
|
||||
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/PATH/operation=replace
|
||||
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/PATH/value=D\:\\MCU\\GNU_Tools_ARM_Embedded\\5.4_2016q2\\bin;c\:\\MinGW\\mingw64\\bin;C\:\\MinGW\\bin;C\:\\MinGW\\msys\\1.0\\bin;D\:\\MCU\\SEGGER\\JLink_V612i;C\:\\Python27;C\:\\Python27\\Scripts;C\:\\Eclipse
|
||||
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/append=true
|
||||
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.510381534/appendContributed=true
|
7
DAPLink-RTL00Console.bat
Normal file
7
DAPLink-RTL00Console.bat
Normal file
|
@ -0,0 +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 "load_ram_binary RTL00Console_ROM.bin 0x10000BA8" -c "exit"
|
||||
rem -c "shutdown"
|
||||
|
||||
|
7
DAPLink-RdFullFlash.bat
Normal file
7
DAPLink-RdFullFlash.bat
Normal file
|
@ -0,0 +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"
|
||||
echo flash read fullflash.bin
|
||||
pause
|
||||
|
6
DAPLink-Reset.bat
Normal file
6
DAPLink-Reset.bat
Normal file
|
@ -0,0 +1,6 @@
|
|||
@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 "restart_from_falsh" -c "shutdown"
|
||||
rem
|
||||
|
6
DAPLink_WrFullFlash.bat
Normal file
6
DAPLink_WrFullFlash.bat
Normal file
|
@ -0,0 +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"
|
||||
pause
|
||||
|
BIN
EclipseLinkedSDK.gif
Normal file
BIN
EclipseLinkedSDK.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
3
JLink-RTL00ConsoleROM.bat
Normal file
3
JLink-RTL00ConsoleROM.bat
Normal file
|
@ -0,0 +1,3 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
start JLink.exe -Device CORTEX-M3 -If SWD -Speed 4000 flasher\RTL00ConsoleROM.JLinkScript
|
3
JLink-RdFullFlash.bat
Normal file
3
JLink-RdFullFlash.bat
Normal file
|
@ -0,0 +1,3 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
JLink.exe -Device CORTEX-M3 -If SWD -Speed 10000 flasher/RTL_FFlash.JLinkScript
|
3
JLink-Reset.bat
Normal file
3
JLink-Reset.bat
Normal file
|
@ -0,0 +1,3 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
JLink.exe -Device CORTEX-M3 -If SWD -Speed 1000 flasher\RTL_Reset.JLinkScript
|
3
JLink-RunRAM.bat
Normal file
3
JLink-RunRAM.bat
Normal file
|
@ -0,0 +1,3 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
start JLink.exe -Device CORTEX-M3 -If SWD -Speed 4000 flasher\RTL_RunRAM.JLinkScript
|
6
JLinkGDB-RdFullFlash.bat
Normal file
6
JLinkGDB-RdFullFlash.bat
Normal file
|
@ -0,0 +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_rdflash.jlink
|
||||
taskkill /F /IM JLinkGDBServer.exe
|
||||
|
15
JLinkGDB-RunRAM.bat
Normal file
15
JLinkGDB-RunRAM.bat
Normal file
|
@ -0,0 +1,15 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
@if exist build\obj\build.axf goto run
|
||||
echo File 'build\obj\build.axf' not found!
|
||||
echo Build project...
|
||||
mingw32-make.exe -f Makefile all
|
||||
@if not exist build\obj\build.axf goto err
|
||||
:run
|
||||
start JLinkGDBServer.exe -device Cortex-M3 -if SWD -ir -endian little -speed 1000
|
||||
arm-none-eabi-gdb.exe -x flasher/gdb_run_ram.jlink
|
||||
taskkill /F /IM JLinkGDBServer.exe
|
||||
goto end
|
||||
:err
|
||||
echo Error!
|
||||
:end
|
21
JLinkGDB-WrFlash.bat
Normal file
21
JLinkGDB-WrFlash.bat
Normal file
|
@ -0,0 +1,21 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
@if %1x==x goto xxx
|
||||
set img_file=%1
|
||||
goto run
|
||||
:xxx
|
||||
set img_file=build/bin/ram_all.bin
|
||||
:run
|
||||
echo define call1>flasher/flash_file.jlink
|
||||
echo SetFirwareSize %img_file%>>flasher/flash_file.jlink
|
||||
echo end>>flasher/flash_file.jlink
|
||||
echo define call2>>flasher/flash_file.jlink
|
||||
echo FlasherWrite %img_file% 0 $Image1Size>>flasher/flash_file.jlink
|
||||
echo end>>flasher/flash_file.jlink
|
||||
echo define call3>>flasher/flash_file.jlink
|
||||
echo FlasherWrite %img_file% $Image2Addr $Image2Size>>flasher/flash_file.jlink
|
||||
echo end>>flasher/flash_file.jlink
|
||||
start JLinkGDBServer.exe -device Cortex-M3 -if SWD -ir -endian little -speed 3500
|
||||
arm-none-eabi-gdb.exe -x flasher/gdb_wrflash.jlink
|
||||
taskkill /F /IM JLinkGDBServer.exe
|
||||
|
6
JLinkGDBServer.bat
Normal file
6
JLinkGDBServer.bat
Normal file
|
@ -0,0 +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
|
||||
taskkill /F /IM JLinkGDBServer.exe
|
||||
|
15
JLinkGDB_OTA.bat
Normal file
15
JLinkGDB_OTA.bat
Normal file
|
@ -0,0 +1,15 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
@if exist build\bin\ota.bin goto run
|
||||
echo File 'build\obj\ota.bin' not found!
|
||||
echo Build project...
|
||||
mingw32-make.exe -f Makefile all
|
||||
@if not exist build\bin\ota.bin goto err
|
||||
:run
|
||||
start start JLinkGDBServer.exe -device Cortex-M3 -if SWD -ir -endian little -speed 1000
|
||||
arm-none-eabi-gdb.exe -x flasher/gdb_ota.jlink
|
||||
taskkill /F /IM JLinkGDBServer.exe
|
||||
goto end
|
||||
:err
|
||||
echo Error!
|
||||
:end
|
7
JLinkOCD-RdFullFlash.bat
Normal file
7
JLinkOCD-RdFullFlash.bat
Normal file
|
@ -0,0 +1,7 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
cd flasher
|
||||
openocd -f interface/Jlink.cfg -c "adapter_khz 3500" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "adapter_khz 3900" -c "rtl8710_flash_read ../fullflash.bin 0 1048576" -c "shutdown"
|
||||
echo flash read fullflash.bin
|
||||
pause
|
||||
|
6
JLink_RdFullFlash.bat
Normal file
6
JLink_RdFullFlash.bat
Normal file
|
@ -0,0 +1,6 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
openocd -f interface/Jlink.cfg -c "adapter_khz 1000" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "adapter_khz 3500" -c "rtl8710_flash_read_id" -c "rtl8710_flash_read ../fullflash.bin 0 1048576" -c "shutdown"
|
||||
echo flash read fullflash.bin
|
||||
pause
|
||||
|
4
JlinkOpenOCD.bat
Normal file
4
JlinkOpenOCD.bat
Normal file
|
@ -0,0 +1,4 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
taskkill /F /IM openocd.exe
|
||||
start openocd -f interface\Jlink.cfg -f flasher\ameba1.cfg
|
24
LICENSE
Normal file
24
LICENSE
Normal file
|
@ -0,0 +1,24 @@
|
|||
This is free and unencumbered software released into the public domain.
|
||||
|
||||
Anyone is free to copy, modify, publish, use, compile, sell, or
|
||||
distribute this software, either in source code form or as a compiled
|
||||
binary, for any purpose, commercial or non-commercial, and by any
|
||||
means.
|
||||
|
||||
In jurisdictions that recognize copyright laws, the author or authors
|
||||
of this software dedicate any and all copyright interest in the
|
||||
software to the public domain. We make this dedication for the benefit
|
||||
of the public at large and to the detriment of our heirs and
|
||||
successors. We intend this dedication to be an overt act of
|
||||
relinquishment in perpetuity of all present and future rights to this
|
||||
software under copyright law.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
For more information, please refer to <http://unlicense.org/>
|
59
Makefile
Normal file
59
Makefile
Normal file
|
@ -0,0 +1,59 @@
|
|||
|
||||
all: ram_all
|
||||
mp: ram_all_mp
|
||||
|
||||
.PHONY: ram_all
|
||||
ram_all:
|
||||
@$(MAKE) -f sdkbuild.mk
|
||||
@$(MAKE) -f flasher.mk genbin1 genbin23
|
||||
|
||||
.PHONY: ram_all_mp
|
||||
ram_all_mp:
|
||||
@$(MAKE) -f sdkbuild.mk mp
|
||||
@$(MAKE) -f flasher.mk mp
|
||||
|
||||
.PHONY: clean clean_all
|
||||
clean:
|
||||
@$(MAKE) -f sdkbuild.mk clean
|
||||
|
||||
clean_all:
|
||||
@$(MAKE) -f sdkbuild.mk clean_all
|
||||
|
||||
.PHONY: debug ramdebug
|
||||
debug:
|
||||
@$(MAKE) -f application.mk debug
|
||||
|
||||
ramdebug:
|
||||
@$(MAKE) -f application.mk ramdebug
|
||||
|
||||
.PHONY: flash_OTA flashburn runram reset test readfullflash
|
||||
|
||||
flash_OTA:
|
||||
JLinkGDB_OTA.bat
|
||||
|
||||
flashburn:
|
||||
JLinkGDB-WrFlash.bat
|
||||
#@$(MAKE) -f flasher.mk flashburn
|
||||
|
||||
runram:
|
||||
JLink-RunRAM.bat
|
||||
#@$(MAKE) --f flasher.mk runram
|
||||
|
||||
reset:
|
||||
JLink-Reset.bat
|
||||
#@make -f flasher.mk reset
|
||||
|
||||
test:
|
||||
JLink-RTL00ConsoleROM.bat
|
||||
#@make -f flasher.mk test
|
||||
|
||||
readfullflash:
|
||||
JLink-RdFullFlash.bat
|
||||
#@make -f flasher.mk readfullflash
|
||||
|
||||
.PHONY: prerequirement
|
||||
prerequirement:
|
||||
# @$(file >DEPENDENCY_LIST.txt,$(DEPENDENCY_LIST))
|
||||
|
||||
TARGETTYPE := APP
|
||||
TARGETNAME := build\obj\build.axf
|
7
STLink-RdFullFlash.bat
Normal file
7
STLink-RdFullFlash.bat
Normal file
|
@ -0,0 +1,7 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
cd flasher
|
||||
openocd -f interface/stlink-v2.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"
|
||||
echo flash read fullflash.bin
|
||||
pause
|
||||
|
6
STLink-Reset.bat
Normal file
6
STLink-Reset.bat
Normal file
|
@ -0,0 +1,6 @@
|
|||
@echo off
|
||||
call paths.bat
|
||||
@cd flasher
|
||||
openocd -f interface/stlink-v2.cfg -c "adapter_khz 1000" -f rtl8710.ocd -f cortex.ocd -c "init" -c "reset halt" -c "cortex_reboot" -c "shutdown"
|
||||
rem
|
||||
|
BIN
build/bin/ota.bin
Normal file
BIN
build/bin/ota.bin
Normal file
Binary file not shown.
BIN
build/bin/ram_1.p.bin
Normal file
BIN
build/bin/ram_1.p.bin
Normal file
Binary file not shown.
BIN
build/bin/ram_1.r.bin
Normal file
BIN
build/bin/ram_1.r.bin
Normal file
Binary file not shown.
BIN
build/bin/ram_2.bin
Normal file
BIN
build/bin/ram_2.bin
Normal file
Binary file not shown.
BIN
build/bin/ram_2.ns.bin
Normal file
BIN
build/bin/ram_2.ns.bin
Normal file
Binary file not shown.
BIN
build/bin/ram_2.p.bin
Normal file
BIN
build/bin/ram_2.p.bin
Normal file
Binary file not shown.
BIN
build/bin/ram_all.bin
Normal file
BIN
build/bin/ram_all.bin
Normal file
Binary file not shown.
0
build/bin/sdram.bin
Normal file
0
build/bin/sdram.bin
Normal file
BIN
build/bin/sdram.p.bin
Normal file
BIN
build/bin/sdram.p.bin
Normal file
Binary file not shown.
3603
build/obj/build.nmap
Normal file
3603
build/obj/build.nmap
Normal file
File diff suppressed because it is too large
Load diff
251
flasher.mk
Normal file
251
flasher.mk
Normal file
|
@ -0,0 +1,251 @@
|
|||
# RTL8710 Flasher v0.0.alfa
|
||||
# pvvx 21.09.2016
|
||||
-include paths.mk
|
||||
#---------------------------
|
||||
#FLASHER = stlink-v2-1
|
||||
#FLASHER = stlink-v2
|
||||
FLASHER ?= Jlink
|
||||
JLINK_PATH ?= D:/MCU/SEGGER/JLink_V610a/
|
||||
#---------------------------
|
||||
# Default
|
||||
#---------------------------
|
||||
# TARGET dirs
|
||||
TARGET ?= build
|
||||
OBJ_DIR ?= build/obj
|
||||
BIN_DIR ?= build/bin
|
||||
ELFFILE ?= $(OBJ_DIR)/$(TARGET).axf
|
||||
#---------------------------
|
||||
# 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)
|
||||
|
||||
# openocd tools
|
||||
OPENOCD = $(OPENOCD_PATH)openocd
|
||||
|
||||
JLINK_GDB ?= JLinkGDBServer.exe
|
||||
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 ..500 kHz ?
|
||||
FLASHER_SPEED = 500
|
||||
endif
|
||||
endif
|
||||
|
||||
# COMPILED_BOOT if defined -> extract image1, =1 boot head in elf, =2 boot head ?
|
||||
#COMPILED_BOOT=1
|
||||
# PADDINGSIZE defined -> image2 OTA
|
||||
PADDINGSIZE =44k
|
||||
|
||||
NMAPFILE = $(OBJ_DIR)/$(TARGET).nmap
|
||||
|
||||
#FLASHER_PATH ?= flasher/
|
||||
|
||||
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
|
||||
RAM2NS_IMAGE = $(BIN_DIR)/ram_2.ns.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
|
||||
|
||||
#all: FLASH_IMAGE = $(BIN_DIR)/ram_all.bin
|
||||
#all: OTA_IMAGE = $(BIN_DIR)/ota.bin
|
||||
mp: FLASH_IMAGE = $(BIN_DIR)/ram_all_mp.bin
|
||||
mp: OTA_IMAGE = $(BIN_DIR)/ota_mp.bin
|
||||
|
||||
TST_IMAGE = $(BIN_DIR)/ram_2.bin
|
||||
LD_ADDRESS = 0x1000B000
|
||||
ST_ADDRESS = 0x10006068
|
||||
|
||||
.PHONY: copybin1 genbin1 genbin23 flashburn reset test readfullflash
|
||||
.NOTPARALLEL: all mp copybin1 genbin1 genbin23 flashburn reset test readfullflash _endgenbin
|
||||
|
||||
all: $(ELFFILE) $(OTA_IMAGE) $(FLASH_IMAGE) _endgenbin
|
||||
mp: $(ELFFILE) $(OTA_IMAGE) $(FLASH_IMAGE) _endgenbin
|
||||
|
||||
copybin1:
|
||||
cp $(patsubst sdk/%,$(SDK_PATH)%,$(BOOTS))/ram_1.r.bin $(BIN_DIR)/ram_1.r.bin
|
||||
cp $(patsubst sdk/%,$(SDK_PATH)%,$(BOOTS))/ram_1.p.bin $(BIN_DIR)/ram_1.p.bin
|
||||
# @chmod 777 $(OBJ_DIR)/ram_1.r.bin
|
||||
@$(OBJCOPY) --rename-section .data=.loader.data,contents,alloc,load,readonly,data -I binary -O elf32-littlearm -B arm $(BIN_DIR)/ram_1.r.bin $(OBJ_DIR)/ram_1.r.o
|
||||
|
||||
genbin1: $(ELFFILE) $(RAM1P_IMAGE)
|
||||
|
||||
genbin23: $(ELFFILE) $(OTA_IMAGE) $(FLASH_IMAGE) _endgenbin
|
||||
|
||||
_endgenbin:
|
||||
@echo "-----------------------------------------------------------"
|
||||
@echo "Image ($(OTA_IMAGE)) size $(shell printf '%d\n' $$(( $$(stat --printf="%s" $(OTA_IMAGE)) )) ) bytes"
|
||||
@echo "Image ($(FLASH_IMAGE)) size $(shell printf '%d\n' $$(( $$(stat --printf="%s" $(FLASH_IMAGE)) )) ) bytes"
|
||||
@echo "==========================================================="
|
||||
|
||||
flashburn:
|
||||
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "adapter_khz $(FLASHER_SPEED)" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_flash_auto_erase 1" -c "rtl8710_flash_auto_verify 1" -c "rtl8710_flash_write $(FLASH_IMAGE) 0" -c "rtl8710_reboot" -c "reset run" -c shutdown
|
||||
# @$(JLINK_PATH)$(JLINK_GDB)
|
||||
|
||||
reset:
|
||||
@$(JLINK_PATH)$(JLINK_EXE) -Device CORTEX-M3 -If SWD -Speed $(FLASHER_SPEED) flasher/RTLreset.JLinkScript
|
||||
# @$(OPENOCD) -f interface/$(FLASHER).cfg -c "adapter_khz $(FLASHER_SPEED)" -f $(FLASHER_PATH)rtl8710.ocd -c "init" -c "reset halt" -c "rtl8710_reboot" -c shutdown
|
||||
|
||||
runram:
|
||||
@start $(JLINK_PATH)$(JLINK_GDB) -device Cortex-M3 -if SWD -ir -endian little -speed $(FLASHER_SPEED)
|
||||
@$(GDB) -x flasher/gdb_run_ram.jlink
|
||||
@taskkill.exe -F -IM $(JLINK_GDB)
|
||||
|
||||
test:
|
||||
@$(OPENOCD) -f interface/$(FLASHER).cfg -c "adapter_khz $(FLASHER_SPEED)" -f $(FLASHER_PATH)rtl8710.ocd -f $(FLASHER_PATH)cortex.ocd -c "init" -c "reset halt" -c "load_image $(TST_IMAGE) $(LD_ADDRESS) bin" -c "cortex_bootstrap $(ST_ADDRESS)" -c "shutdown"
|
||||
|
||||
readfullflash:
|
||||
@rm -f $(BIN_DIR)/fullflash.bin
|
||||
@start $(JLINK_PATH)$(JLINK_GDB) -device Cortex-M3 -if SWD -ir -endian little -speed $(FLASHER_SPEED)
|
||||
@$(GDB) -x flasher/gdb_rdflash.jlink
|
||||
@taskkill.exe -F -IM $(JLINK_GDB)
|
||||
# @$(OPENOCD) -f interface/$(FLASHER).cfg -c "adapter_khz $(FLASHER_SPEED)" -f $(FLASHER_PATH)rtl8710.ocd -f $(FLASHER_PATH)cortex.ocd -c "init" -c "reset halt" -c "rtl8710_flash_read_id" -c "rtl8710_flash_read $(BIN_DIR)/fullflash.bin 0 1048576" -c "reset run" -c "shutdown"
|
||||
if [ -s $(BIN_DIR)/fullflash.bin ]; then echo FullFlash = $(BIN_DIR)/fullflash.bin; fi
|
||||
|
||||
$(NMAPFILE): $(ELFFILE)
|
||||
@echo "==========================================================="
|
||||
@echo "Build names map file"
|
||||
@echo $@
|
||||
@$(NM) $< | sort > $@
|
||||
# @echo "==========================================================="
|
||||
|
||||
$(FLASH_IMAGE): $(RAM1P_IMAGE) $(RAM2P_IMAGE) $(RAM3P_IMAGE)
|
||||
@echo "==========================================================="
|
||||
@echo "Make Flash image ($(FLASH_IMAGE))"
|
||||
# @echo "==========================================================="
|
||||
@mkdir -p $(BIN_DIR)
|
||||
@rm -f $(FLASH_IMAGE)
|
||||
@cat $(RAM1P_IMAGE) > $(FLASH_IMAGE)
|
||||
# @chmod 777 $(FLASH_IMAGE)
|
||||
ifdef PADDINGSIZE
|
||||
@$(PADDING) $(PADDINGSIZE) 0xFF $(FLASH_IMAGE)
|
||||
endif
|
||||
@cat $(RAM2P_IMAGE) >> $(FLASH_IMAGE)
|
||||
@cat $(RAM3P_IMAGE) >> $(FLASH_IMAGE)
|
||||
# @echo "Image ($(FLASH_IMAGE)) size $(shell printf '%d\n' $$(( $$(stat --printf="%s" $(FLASH_IMAGE)) )) ) bytes"
|
||||
# @echo "==========================================================="
|
||||
# @rm $(BIN_DIR)/ram_*.p.bin
|
||||
|
||||
$(OTA_IMAGE): $(RAM2NS_IMAGE) $(RAM3_IMAGE)
|
||||
@echo "==========================================================="
|
||||
@echo "Make OTA image ($(OTA_IMAGE))"
|
||||
@rm -f $(OTA_IMAGE)
|
||||
@cat $(RAM2NS_IMAGE) > $(OTA_IMAGE)
|
||||
@cat $(RAM3P_IMAGE) >> $(OTA_IMAGE)
|
||||
# @chmod 777 $(OTA_IMAGE)
|
||||
@$(CHCKSUM) $(OTA_IMAGE) || true
|
||||
# @echo "==========================================================="
|
||||
|
||||
$(RAM1P_IMAGE): $(ELFFILE) $(NMAPFILE)
|
||||
@echo "==========================================================="
|
||||
@echo "Create image1p ($(RAM1P_IMAGE))"
|
||||
# @echo "===========================================================" .bootloader
|
||||
ifdef COMPILED_BOOT
|
||||
@mkdir -p $(BIN_DIR)
|
||||
@rm -f $(RAM1_IMAGE) $(RAM1P_IMAGE)
|
||||
ifeq ($(COMPILED_BOOT),1)
|
||||
@$(eval RAM1_START_ADDR := $(shell grep _binary_build_bin_ram_1_r_bin_start $(NMAPFILE) | awk '{print $$1}'))
|
||||
@$(eval RAM1_END_ADDR := $(shell grep _binary_build_bin_ram_1_r_bin_end $(NMAPFILE) | awk '{print $$1}'))
|
||||
else
|
||||
@$(eval RAM1_START_ADDR := $(shell grep __ram_image1_text_start__ $(NMAPFILE) | awk '{print $$1}'))
|
||||
@$(eval RAM1_END_ADDR := $(shell grep __ram_image1_text_end__ $(NMAPFILE) | awk '{print $$1}'))
|
||||
endif
|
||||
$(if $(RAM1_START_ADDR),,$(error "Not found __ram_image1_text_start__!"))
|
||||
$(if $(RAM1_END_ADDR),,$(error "Not found __ram_image1_text_end__!"))
|
||||
ifeq ($(RAM1_START_ADDR),$(RAM1_END_ADDR))
|
||||
ifneq ($(COMPILED_BOOT),1)
|
||||
$(OBJCOPY) -j .ram.start.table -j .ram_image1.text -Obinary $(ELFFILE) $(RAM1_IMAGE)
|
||||
$(PICK) 0x$(RAM1_START_ADDR) 0x$(RAM1_END_ADDR) $(RAM1_IMAGE) $(RAM1P_IMAGE) body+reset_offset
|
||||
else
|
||||
$(OBJCOPY) --change-section-address .boot.head=0x10000ba8 -j .boot.head -j .bootloader -Obinary $(ELFFILE) $(RAM1P_IMAGE)
|
||||
endif
|
||||
$(warning "Flasher: Use external $(RAM1_IMAGE)?")
|
||||
else
|
||||
$(error "BOOT-image size = 0")
|
||||
# $(error Flasher: COMPILE_BOOT = No)
|
||||
endif
|
||||
else
|
||||
@if [ -s $(RAM1P_IMAGE) ]; then echo "Use external $(RAM1P_IMAGE)!"; fi
|
||||
endif
|
||||
|
||||
$(RAM2P_IMAGE): $(ELFFILE) $(NMAPFILE)
|
||||
@echo "==========================================================="
|
||||
@echo "Create image2p ($(RAM2P_IMAGE))"
|
||||
# @echo "==========================================================="
|
||||
@mkdir -p $(BIN_DIR)
|
||||
@rm -f $(RAM2_IMAGE) $(RAM2P_IMAGE)
|
||||
@$(eval RAM2_START_ADDR = $(shell grep __ram_image2_text $(NMAPFILE) | grep _start__ | awk '{print $$1}'))
|
||||
@$(eval RAM2_END_ADDR = $(shell grep __ram_image2_text $(NMAPFILE) | grep _end__ | awk '{print $$1}'))
|
||||
$(if $(RAM2_START_ADDR),,$(error "Not found __ram_image2_text_start__!"))
|
||||
$(if $(RAM2_END_ADDR),,$(error "Not found __ram_image2_text_end__!"))
|
||||
@$(OBJCOPY) -j .image2.start.table -j .ram_image2.text -j .ram_image2.rodata -j .ram.data -Obinary $(ELFFILE) $(RAM2_IMAGE)
|
||||
@$(PICK) 0x$(RAM2_START_ADDR) 0x$(RAM2_END_ADDR) $(RAM2_IMAGE) $(RAM2P_IMAGE) body+reset_offset+sig
|
||||
|
||||
$(RAM2NS_IMAGE):$(ELFFILE) $(NMAPFILE)
|
||||
@echo "==========================================================="
|
||||
@echo "Create image2ns ($(RAM2NS_IMAGE))"
|
||||
# @echo "==========================================================="
|
||||
mkdir -p $(BIN_DIR)
|
||||
rm -f $(RAM2_IMAGE) $(RAM2NS_IMAGE)
|
||||
$(eval RAM2_START_ADDR = $(shell grep __ram_image2_text $(NMAPFILE) | grep _start__ | awk '{print $$1}'))
|
||||
$(eval RAM2_END_ADDR = $(shell grep __ram_image2_text $(NMAPFILE) | grep _end__ | awk '{print $$1}'))
|
||||
$(if $(RAM2_START_ADDR),,$(error "Not found __ram_image2_text_start__!"))
|
||||
$(if $(RAM2_END_ADDR),,$(error "Not found __ram_image2_text_end__!"))
|
||||
$(OBJCOPY) -j .image2.start.table -j .ram_image2.text -j .ram_image2.rodata -j .ram.data -Obinary $(ELFFILE) $(RAM2_IMAGE)
|
||||
$(PICK) 0x$(RAM2_START_ADDR) 0x$(RAM2_END_ADDR) $(RAM2_IMAGE) $(RAM2NS_IMAGE) body+reset_offset
|
||||
|
||||
$(RAM3_IMAGE): $(ELFFILE) $(NMAPFILE)
|
||||
@echo "==========================================================="
|
||||
@echo "Create image3 (SDRAM, $(RAM3P_IMAGE))"
|
||||
# @echo "==========================================================="
|
||||
@mkdir -p $(BIN_DIR)
|
||||
@rm -f $(RAM3_IMAGE) $(RAM3P_IMAGE)
|
||||
@$(eval RAM3_START_ADDR = $(shell grep __sdram_data_ $(NMAPFILE) | grep _start__ | awk '{print $$1}'))
|
||||
@$(eval RAM3_END_ADDR = $(shell grep __sdram_data_ $(NMAPFILE) | grep _end__ | awk '{print $$1}'))
|
||||
$(if $(RAM3_START_ADDR),,$(error "Not found __sdram_data_start__!"))
|
||||
$(if $(RAM3_END_ADDR),,$(error "Not found __sdram_data_end__!"))
|
||||
#ifneq ($(RAM3_START_ADDR),$(RAM3_END_ADDR))
|
||||
@echo $(RAM3_START_ADDR) $(RAM3_END_ADDR)
|
||||
@$(OBJCOPY) -j .image3 -j .sdr_text -j .sdr_rodata -j .sdr_data -Obinary $(ELFFILE) $(RAM3_IMAGE)
|
||||
$(PICK) 0x$(RAM3_START_ADDR) 0x$(RAM3_END_ADDR) $(RAM3_IMAGE) $(RAM3P_IMAGE) body+reset_offset
|
||||
#else
|
||||
# @rm -f $(RAM3_IMAGE) $(RAM3P_IMAGE)
|
||||
# @echo "SDRAM not used (size = 0)"
|
||||
#endif
|
||||
|
||||
$(ELFFILE):
|
||||
$(error Falsher: file $@ not found)
|
||||
|
||||
clean:
|
||||
@rm -f $(BIN_DIR)/*.bin
|
||||
|
6
flasher/RTL00ConsoleROM.JLinkScript
Normal file
6
flasher/RTL00ConsoleROM.JLinkScript
Normal file
|
@ -0,0 +1,6 @@
|
|||
h
|
||||
loadbin flasher/RTL00Console_ROM.bin 0x10000ba8
|
||||
r
|
||||
w4 0x40000210,0x4011117
|
||||
g
|
||||
q
|
BIN
flasher/RTL00Console_ROM.bin
Normal file
BIN
flasher/RTL00Console_ROM.bin
Normal file
Binary file not shown.
119
flasher/RTL8710.jflash
Normal file
119
flasher/RTL8710.jflash
Normal file
|
@ -0,0 +1,119 @@
|
|||
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
|
130
flasher/RTL8710AF.hex
Normal file
130
flasher/RTL8710AF.hex
Normal file
|
@ -0,0 +1,130 @@
|
|||
: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
|
17
flasher/RTL_FFlash.JLinkScript
Normal file
17
flasher/RTL_FFlash.JLinkScript
Normal file
|
@ -0,0 +1,17 @@
|
|||
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
|
5
flasher/RTL_Reset.JLinkScript
Normal file
5
flasher/RTL_Reset.JLinkScript
Normal file
|
@ -0,0 +1,5 @@
|
|||
h
|
||||
r
|
||||
w4 0x40000210,0x111157
|
||||
g
|
||||
q
|
8
flasher/RTL_RunRAM.JLinkScript
Normal file
8
flasher/RTL_RunRAM.JLinkScript
Normal file
|
@ -0,0 +1,8 @@
|
|||
h
|
||||
r
|
||||
loadbin build/bin/ram_1.r.bin 0x10000bc8
|
||||
loadbin build/bin/ram_2.bin 0x10006000
|
||||
r
|
||||
w4 0x40000210,0x20111157
|
||||
g
|
||||
q
|
124
flasher/ameba1.cfg
Normal file
124
flasher/ameba1.cfg
Normal file
|
@ -0,0 +1,124 @@
|
|||
# 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
|
||||
}
|
99
flasher/cortex.ocd
Normal file
99
flasher/cortex.ocd
Normal file
|
@ -0,0 +1,99 @@
|
|||
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
|
||||
}
|
9
flasher/flash_file.jlink
Normal file
9
flasher/flash_file.jlink
Normal file
|
@ -0,0 +1,9 @@
|
|||
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
|
198
flasher/gdb_flasher.jlink
Normal file
198
flasher/gdb_flasher.jlink
Normal file
|
@ -0,0 +1,198 @@
|
|||
####################################
|
||||
# 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 = 0x211157
|
||||
end
|
||||
# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )
|
||||
define SetBootCall0
|
||||
printf "SetBoot = Call0:\n"
|
||||
monitor long 0x40000210 = 0x80111157
|
||||
end
|
||||
# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 )
|
||||
define SetBootCall1
|
||||
printf "SetBoot = Call1:\n"
|
||||
monitor long 0x40000210 = 0x20111157
|
||||
end
|
||||
# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 )
|
||||
define SetBootCall2
|
||||
printf "SetBoot = Call2:\n"
|
||||
monitor long 0x40000210 = 0x10111157
|
||||
end
|
||||
# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 )
|
||||
define SetBootCall3
|
||||
printf "SetBoot = Call3:\n"
|
||||
monitor long 0x40000210 = 0x8111157
|
||||
end
|
||||
# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 )
|
||||
define SetBootCall4
|
||||
printf "SetBoot = Call4:\n"
|
||||
monitor long 0x40000210 = 0x4111157
|
||||
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 = 0x11117
|
||||
monitor long 0x40000210 = 0x11157
|
||||
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
|
||||
###################
|
||||
# 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
|
||||
printf "FirmwareSize = %d\n", $FirmwareSize
|
||||
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 $Image2Addr = 0
|
||||
set $FirmwareSize = 0
|
||||
printf "Image not format Firmware!\n"
|
||||
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
|
||||
end
|
30
flasher/gdb_init.jlink
Normal file
30
flasher/gdb_init.jlink
Normal file
|
@ -0,0 +1,30 @@
|
|||
#
|
||||
# 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 = 0x211157
|
||||
# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )
|
||||
#monitor long 0x40000210 = 0x80011117
|
||||
# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 )
|
||||
#monitor long 0x40000210 = 0x20011117
|
||||
# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 )
|
||||
#monitor long 0x40000210 = 0x10011117
|
||||
# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 )
|
||||
#monitor long 0x40000210 = 0x8011117
|
||||
# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 )
|
||||
monitor long 0x40000210 = 0x4011117
|
||||
# CPU CLK 166 MHz?
|
||||
# monitor long 0x40000014 = 0x00000011
|
||||
# CPU CLK 83 MHz?
|
||||
#monitor long 0x40000014 = 0x00000021
|
374
flasher/gdb_ota.jlink
Normal file
374
flasher/gdb_ota.jlink
Normal file
|
@ -0,0 +1,374 @@
|
|||
####################################
|
||||
# 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 = 0x211157
|
||||
end
|
||||
# Boot RAM start_addr0() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x80000000 )
|
||||
define SetBootCall0
|
||||
printf "SetBoot = Call0:\n"
|
||||
monitor long 0x40000210 = 0x80011117
|
||||
end
|
||||
# Boot RAM start_addr1() Run if ( v40000210 & 0x20000000 )
|
||||
define SetBootCall1
|
||||
printf "SetBoot = Call1:\n"
|
||||
monitor long 0x40000210 = 0x20011117
|
||||
end
|
||||
# Boot RAM start_addr2() Run if ( v40000210 & 0x10000000 )
|
||||
define SetBootCall2
|
||||
printf "SetBoot = Call2:\n"
|
||||
monitor long 0x40000210 = 0x10011117
|
||||
end
|
||||
# Boot RAM start_addr3() Run if ( v400001F4 & 0x8000000 ) && ( v40000210 & 0x8000000 )
|
||||
define SetBootCall3
|
||||
printf "SetBoot = Call3:\n"
|
||||
monitor long 0x40000210 = 0x8011117
|
||||
end
|
||||
# Boot RAM start_addr4() Init console, Run if ( v40000210 & 0x4000000 )
|
||||
define SetBootCall4
|
||||
printf "SetBoot = Call4:\n"
|
||||
monitor long 0x40000210 = 0x4011117
|
||||
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 = 0x11117
|
||||
monitor long 0x40000210 = 0x11157
|
||||
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
|
17
flasher/gdb_rdflash.jlink
Normal file
17
flasher/gdb_rdflash.jlink
Normal file
|
@ -0,0 +1,17 @@
|
|||
# GDB Jlink read fullflash
|
||||
# Init
|
||||
source -v flasher/gdb_flasher.jlink
|
||||
InitJlink
|
||||
SystemInit
|
||||
SPI_Init
|
||||
monitor speed 12000
|
||||
#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 ../fullflash.bin $dumpstartaddr $dumpendaddr
|
||||
printf "FullFlash saved in ./build/bin/fullflash.bin - OK.\n"
|
||||
quit
|
11
flasher/gdb_run_ram.jlink
Normal file
11
flasher/gdb_run_ram.jlink
Normal file
|
@ -0,0 +1,11 @@
|
|||
#
|
||||
# J-LINK GDB SERVER initialization
|
||||
#
|
||||
source -v flasher/gdb_flasher.jlink
|
||||
InitJlink
|
||||
load build/obj/build.axf
|
||||
SetBootCall4
|
||||
monitor reset
|
||||
monitor go
|
||||
quit
|
||||
|
166
flasher/gdb_wrflash.jlink
Normal file
166
flasher/gdb_wrflash.jlink
Normal file
|
@ -0,0 +1,166 @@
|
|||
###############
|
||||
# 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
|
||||
#262144
|
||||
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)
|
||||
if ($id == 0x1420c2)
|
||||
set $rtl8710_flasher_capacity = 1 << (($id >> 16) & 0x0ff)
|
||||
printf "Flash ID = 0x%08x : MX25L8006E (%d kbytes)\n", $id, $rtl8710_flasher_capacity>>10
|
||||
else
|
||||
set $rtl8710_flasher_capacity = 1024*1024)
|
||||
error "Flash ID = 0x%08x : ?\n", $id
|
||||
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 - $arg1
|
||||
set $parms2 = $offset + $arg1
|
||||
set $parms3 = $offset + $len + $arg1
|
||||
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
|
||||
printf "Write Image2 size %d to Flash addr 0x%08x:\n", $Image2Size, $Image2Addr
|
||||
#FlasherWrite $wr_flile $Image2Addr $Image2Size
|
||||
call3
|
||||
end
|
||||
end
|
||||
FlashImagesInfo
|
||||
monitor reset
|
||||
SetBootFlash
|
||||
monitor go
|
||||
quit
|
340
flasher/rtl8710.ocd
Normal file
340
flasher/rtl8710.ocd
Normal file
|
@ -0,0 +1,340 @@
|
|||
#
|
||||
# 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
|
||||
}
|
||||
|
BIN
flasher/rtl8710_flasher.bin
Normal file
BIN
flasher/rtl8710_flasher.bin
Normal file
Binary file not shown.
1
paths.bat
Normal file
1
paths.bat
Normal file
|
@ -0,0 +1 @@
|
|||
PATH=D:\MCU\GNU_Tools_ARM_Embedded\5.4_2016q2\bin;D:\MCU\SEGGER\JLink_V612i;%PATH%
|
41
paths.mk
Normal file
41
paths.mk
Normal file
|
@ -0,0 +1,41 @@
|
|||
#---------------------------
|
||||
# User defined
|
||||
#---------------------------
|
||||
SDK_PATH = ../RTL00MP3/RTL00_SDKV35a/
|
||||
#GCC_PATH = d:/MCU/GNU_Tools_ARM_Embedded/5.2_2015q4/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/
|
||||
FLASHER_PATH ?= flasher/
|
||||
JLINK_PATH ?= D:/MCU/SEGGER/JLink_V610a/
|
||||
#---------------------------
|
||||
# Default
|
||||
#---------------------------
|
||||
# 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
|
||||
|
||||
# TARGET dirs
|
||||
TARGET ?= build
|
||||
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)
|
||||
|
||||
# openocd tools
|
||||
OPENOCD = $(OPENOCD_PATH)openocd
|
||||
|
1
project/inc/.gitignore
vendored
Normal file
1
project/inc/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
build_info.h
|
211
project/inc/FreeRTOSConfig.h
Normal file
211
project/inc/FreeRTOSConfig.h
Normal file
|
@ -0,0 +1,211 @@
|
|||
/*
|
||||
FreeRTOS V7.3.0 - Copyright (C) 2012 Real Time Engineers Ltd.
|
||||
|
||||
FEATURES AND PORTS ARE ADDED TO FREERTOS ALL THE TIME. PLEASE VISIT
|
||||
http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* FreeRTOS tutorial books are available in pdf and paperback. *
|
||||
* Complete, revised, and edited pdf reference manuals are also *
|
||||
* available. *
|
||||
* *
|
||||
* Purchasing FreeRTOS documentation will not only help you, by *
|
||||
* ensuring you get running as quickly as possible and with an *
|
||||
* in-depth knowledge of how to use FreeRTOS, it will also help *
|
||||
* the FreeRTOS project to continue with its mission of providing *
|
||||
* professional grade, cross platform, de facto standard solutions *
|
||||
* for microcontrollers - completely free of charge! *
|
||||
* *
|
||||
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
|
||||
* *
|
||||
* Thank you for using FreeRTOS, and thank you for your support! *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
This file is part of the FreeRTOS distribution.
|
||||
|
||||
FreeRTOS is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License (version 2) as published by the
|
||||
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
|
||||
>>>NOTE<<< The modification to the GPL is included to allow you to
|
||||
distribute a combined work that includes FreeRTOS without being obliged to
|
||||
provide the source code for proprietary components outside of the FreeRTOS
|
||||
kernel. FreeRTOS is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details. You should have received a copy of the GNU General Public
|
||||
License and the FreeRTOS license exception along with FreeRTOS; if not it
|
||||
can be viewed here: http://www.freertos.org/a00114.html and also obtained
|
||||
by writing to Richard Barry, contact details for whom are available on the
|
||||
FreeRTOS WEB site.
|
||||
|
||||
1 tab == 4 spaces!
|
||||
|
||||
***************************************************************************
|
||||
* *
|
||||
* Having a problem? Start by reading the FAQ "My application does *
|
||||
* not run, what could be wrong?" *
|
||||
* *
|
||||
* http://www.FreeRTOS.org/FAQHelp.html *
|
||||
* *
|
||||
***************************************************************************
|
||||
|
||||
|
||||
http://www.FreeRTOS.org - Documentation, training, latest versions, license
|
||||
and contact details.
|
||||
|
||||
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
|
||||
including FreeRTOS+Trace - an indispensable productivity tool.
|
||||
|
||||
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
|
||||
the code with commercial support, indemnification, and middleware, under
|
||||
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
|
||||
provide a safety engineered and independently SIL3 certified version under
|
||||
the SafeRTOS brand: http://www.SafeRTOS.com.
|
||||
*/
|
||||
|
||||
#ifndef FREERTOS_CONFIG_H
|
||||
#define FREERTOS_CONFIG_H
|
||||
#if defined(__ICCARM__) || defined(__CC_ARM) || defined(__GNUC__)
|
||||
#include <stdint.h>
|
||||
extern uint32_t SystemCoreClock;
|
||||
#endif
|
||||
|
||||
/*-----------------------------------------------------------
|
||||
* Application specific definitions.
|
||||
*
|
||||
* These definitions should be adjusted for your particular hardware and
|
||||
* application requirements.
|
||||
*
|
||||
* THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE
|
||||
* FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE.
|
||||
*
|
||||
* See http://www.freertos.org/a00110.html.
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
#define configUSE_PREEMPTION 1
|
||||
#define configUSE_IDLE_HOOK 1
|
||||
#define configUSE_TICK_HOOK 0
|
||||
#define configCPU_CLOCK_HZ ( SystemCoreClock )
|
||||
#define configTICK_RATE_HZ ( ( uint32_t ) 1000 )
|
||||
#define configMINIMAL_STACK_SIZE ( ( unsigned short ) 70 )
|
||||
#ifdef CONFIG_UVC
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 110 * 1024 ) ) // use HEAP5
|
||||
#else
|
||||
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 40 * 1024 ) ) // use HEAP5
|
||||
#endif
|
||||
#define configMAX_TASK_NAME_LEN ( 10 )
|
||||
#define configUSE_TRACE_FACILITY 0
|
||||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configIDLE_SHOULD_YIELD 0
|
||||
#define configUSE_CO_ROUTINES 1
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configUSE_TIMERS 1
|
||||
|
||||
#define configMAX_PRIORITIES ( 11 )
|
||||
#define PRIORITIE_OFFSET ( 4 )
|
||||
|
||||
#define configMAX_CO_ROUTINE_PRIORITIES ( 2 )
|
||||
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_ALTERNATIVE_API 0
|
||||
#define configCHECK_FOR_STACK_OVERFLOW 2
|
||||
#define configUSE_RECURSIVE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 0
|
||||
#define configGENERATE_RUN_TIME_STATS 1
|
||||
#if configGENERATE_RUN_TIME_STATS
|
||||
#define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS() //( ulHighFrequencyTimerTicks = 0UL )
|
||||
#define portGET_RUN_TIME_COUNTER_VALUE() xTickCount //ulHighFrequencyTimerTicks
|
||||
#undef configUSE_TRACE_FACILITY
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define portCONFIGURE_STATS_PEROID_VALUE 1000 //unit Ticks
|
||||
#endif
|
||||
|
||||
#define configTIMER_TASK_PRIORITY ( 1 )
|
||||
|
||||
#ifdef CONFIG_UVC
|
||||
#define configTIMER_QUEUE_LENGTH ( 20 )
|
||||
#else
|
||||
#define configTIMER_QUEUE_LENGTH ( 10 )
|
||||
#endif
|
||||
|
||||
#define configTIMER_TASK_STACK_DEPTH ( 512 ) //USE_MIN_STACK_SIZE modify from 512 to 256
|
||||
|
||||
#if (__IASMARM__ != 1)
|
||||
|
||||
extern void freertos_pre_sleep_processing(unsigned int *expected_idle_time);
|
||||
extern void freertos_post_sleep_processing(unsigned int *expected_idle_time);
|
||||
extern int freertos_ready_to_sleep();
|
||||
|
||||
/* Enable tickless power saving. */
|
||||
#define configUSE_TICKLESS_IDLE 1
|
||||
|
||||
/* In wlan usage, this value is suggested to use value less than 80 milliseconds */
|
||||
#define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
|
||||
|
||||
/* It's magic trick that let us can use our own sleep function */
|
||||
#define configPRE_SLEEP_PROCESSING( x ) ( freertos_pre_sleep_processing(&x) )
|
||||
|
||||
#define configPOST_SLEEP_PROCESSING( x ) ( freertos_post_sleep_processing(&x) )
|
||||
|
||||
/* It's magic trick that let us can enable/disable tickless dynamically */
|
||||
#define traceLOW_POWER_IDLE_BEGIN(); do { \
|
||||
if (!freertos_ready_to_sleep()) { \
|
||||
mtCOVERAGE_TEST_MARKER(); \
|
||||
break; \
|
||||
}
|
||||
|
||||
// portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime );
|
||||
|
||||
#define traceLOW_POWER_IDLE_END(); } while (0);
|
||||
|
||||
/* It's FreeRTOS related feature but it's not included in FreeRTOS design. */
|
||||
#define configUSE_WAKELOCK_PMU 1
|
||||
|
||||
#endif // #if (__IASMARM__ != 1)
|
||||
|
||||
/* Set the following definitions to 1 to include the API function, or zero
|
||||
to exclude the API function. */
|
||||
#define INCLUDE_vTaskPrioritySet 1
|
||||
#define INCLUDE_uxTaskPriorityGet 1
|
||||
#define INCLUDE_vTaskDelete 1
|
||||
#define INCLUDE_vTaskCleanUpResources 0
|
||||
#define INCLUDE_vTaskSuspend 1
|
||||
#define INCLUDE_vTaskDelayUntil 1
|
||||
#define INCLUDE_vTaskDelay 1
|
||||
#define INCLUDE_pcTaskGetTaskName 1
|
||||
#define INCLUDE_xTimerPendFunctionCall 1
|
||||
|
||||
/* Cortex-M specific definitions. */
|
||||
#ifdef __NVIC_PRIO_BITS
|
||||
/* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */
|
||||
#define configPRIO_BITS __NVIC_PRIO_BITS
|
||||
#else
|
||||
#define configPRIO_BITS 4 /* 15 priority levels */
|
||||
#endif
|
||||
|
||||
|
||||
/* The lowest interrupt priority that can be used in a call to a "set priority"
|
||||
function. */
|
||||
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0x0f
|
||||
|
||||
/* The highest interrupt priority that can be used by any interrupt service
|
||||
routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL
|
||||
INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER
|
||||
PRIORITY THAN THIS! (higher priorities are lower numeric values. */
|
||||
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
|
||||
|
||||
|
||||
/* Interrupt priorities used by the kernel port layer itself. These are generic
|
||||
to all Cortex-M ports, and do not rely on any particular library functions. */
|
||||
#define configKERNEL_INTERRUPT_PRIORITY ( configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
/* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!!
|
||||
See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
|
||||
#define configMAX_SYSCALL_INTERRUPT_PRIORITY ( configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS) )
|
||||
|
||||
//#define RTK_MODE_TIMER
|
||||
|
||||
|
||||
#endif /* FREERTOS_CONFIG_H */
|
29
project/inc/feep_config.h
Normal file
29
project/inc/feep_config.h
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* feep_config.h
|
||||
*
|
||||
* Created on: 06 нояб. 2016 г.
|
||||
* Author: PVV
|
||||
*/
|
||||
|
||||
#ifndef _INC_FEEP_CONFIG_H_
|
||||
#define _INC_FEEP_CONFIG_H_
|
||||
|
||||
#define FEEP_ID_WIFI_CFG 0x5730 // id:'0W', type: struct wlan_fast_reconnect
|
||||
#define FEEP_ID_UART_CFG 0x5530 // id:'0U', type: UART_LOG_CONF
|
||||
#define FEEP_ID_LWIP_CFG 0x4C30 // id:'0L', type: struct atcmd_lwip_conf
|
||||
#define FEEP_ID_DHCP_CFG 0x4430 // id:'0D', type: struct
|
||||
|
||||
typedef struct _sdhcp_cfg {
|
||||
u8 mode; // =0 dhcp off, =1 - dhcp on, =2 Static ip, =3 - auto
|
||||
u32 ip;
|
||||
u32 mask;
|
||||
u32 gw;
|
||||
}dhcp_cfg;
|
||||
|
||||
/*
|
||||
#define FEEP_WRITE_WIFI_CFG(x) flash_write_cfg(x, FEEP_ID_WIFI_CFG, sizeof(struct wlan_fast_reconnect))
|
||||
#define FEEP_READ_WIFI_CFG(x) flash_read_cfg(x, FEEP_ID_WIFI_CFG, sizeof(struct wlan_fast_reconnect))
|
||||
*/
|
||||
|
||||
|
||||
#endif /* _INC_FEEP_CONFIG_H_ */
|
370
project/inc/lwipopts.h
Normal file
370
project/inc/lwipopts.h
Normal file
|
@ -0,0 +1,370 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
* @file lwipopts.h
|
||||
* @author MCD Application Team
|
||||
* @version V1.1.0
|
||||
* @date 07-October-2011
|
||||
* @brief lwIP Options Configuration.
|
||||
* This file is based on Utilities\lwip_v1.3.2\src\include\lwip\opt.h
|
||||
* and contains the lwIP configuration for the STM32F2x7 demonstration.
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
||||
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
|
||||
* TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
|
||||
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
|
||||
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
||||
*
|
||||
* <h2><center>© COPYRIGHT 2011 STMicroelectronics</center></h2>
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __LWIPOPTS_H__
|
||||
#define __LWIPOPTS_H__
|
||||
|
||||
#include <platform/platform_stdlib.h>
|
||||
#include "platform_opts.h"
|
||||
|
||||
/**
|
||||
* LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS==1: randomize the local port for the first
|
||||
* local TCP/UDP pcb (default==0). This can prevent creating predictable port
|
||||
* numbers after booting a device.
|
||||
*/
|
||||
#define LWIP_RANDOMIZE_INITIAL_LOCAL_PORTS 1
|
||||
|
||||
#define WIFI_LOGO_CERTIFICATION_CONFIG 1 //for ping 10k test buffer setting
|
||||
/**
|
||||
* MEM_LIBC_MALLOC==1: Use malloc/free/realloc provided by your C-library
|
||||
* instead of the lwip internal allocator. Can save code size if you
|
||||
* already use it.
|
||||
*/
|
||||
#define MEM_LIBC_MALLOC 1
|
||||
/**
|
||||
* MEMP_MEM_MALLOC==1: Use mem_malloc/mem_free instead of the lwip pool allocator.
|
||||
* Especially useful with MEM_LIBC_MALLOC but handle with care regarding execution
|
||||
* speed and usage from interrupts!
|
||||
*/
|
||||
#define MEMP_MEM_MALLOC 1
|
||||
|
||||
/**
|
||||
* SYS_LIGHTWEIGHT_PROT==1: if you want inter-task protection for certain
|
||||
* critical regions during buffer allocation, deallocation and memory
|
||||
* allocation and deallocation.
|
||||
*/
|
||||
#define SYS_LIGHTWEIGHT_PROT 1
|
||||
|
||||
/* Define LWIP_COMPAT_MUTEX if the port has no mutexes and binary semaphores
|
||||
should be used instead */
|
||||
#define LWIP_COMPAT_MUTEX 1
|
||||
|
||||
#define ETHARP_TRUST_IP_MAC 0
|
||||
#define IP_REASSEMBLY 1
|
||||
#define IP_FRAG 1
|
||||
#define ARP_QUEUEING 0
|
||||
|
||||
/**
|
||||
* NO_SYS==1: Provides VERY minimal functionality. Otherwise,
|
||||
* use lwIP facilities.
|
||||
*/
|
||||
#define NO_SYS 0
|
||||
|
||||
/* ---------- Memory options ---------- */
|
||||
/* MEM_ALIGNMENT: should be set to the alignment of the CPU for which
|
||||
lwIP is compiled. 4 byte alignment -> define MEM_ALIGNMENT to 4, 2
|
||||
byte alignment -> define MEM_ALIGNMENT to 2. */
|
||||
#define MEM_ALIGNMENT 4
|
||||
|
||||
/* MEM_SIZE: the size of the heap memory. If the application will send
|
||||
a lot of data that needs to be copied, this should be set high. */
|
||||
#if WIFI_LOGO_CERTIFICATION_CONFIG
|
||||
#define MEM_SIZE (10*1024) //for ping 10k test
|
||||
#else
|
||||
#define MEM_SIZE (5*1024)
|
||||
#endif
|
||||
|
||||
/* MEMP_NUM_PBUF: the number of memp struct pbufs. If the application
|
||||
sends a lot of data out of ROM (or other static memory), this
|
||||
should be set high. */
|
||||
#define MEMP_NUM_PBUF 100
|
||||
/* MEMP_NUM_UDP_PCB: the number of UDP protocol control blocks. One
|
||||
per active UDP "connection". */
|
||||
#define MEMP_NUM_UDP_PCB 6
|
||||
/* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB 10
|
||||
/* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP
|
||||
connections. */
|
||||
#define MEMP_NUM_TCP_PCB_LISTEN 5
|
||||
/* MEMP_NUM_TCP_SEG: the number of simultaneously queued TCP
|
||||
segments. */
|
||||
#define MEMP_NUM_TCP_SEG 20
|
||||
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
|
||||
timeouts. */
|
||||
#define MEMP_NUM_SYS_TIMEOUT 10
|
||||
|
||||
|
||||
/* ---------- Pbuf options ---------- */
|
||||
/* PBUF_POOL_SIZE: the number of buffers in the pbuf pool. */
|
||||
#if WIFI_LOGO_CERTIFICATION_CONFIG
|
||||
#define PBUF_POOL_SIZE 30 //for ping 10k test
|
||||
#else
|
||||
#define PBUF_POOL_SIZE 20
|
||||
#endif
|
||||
|
||||
/* IP_REASS_MAX_PBUFS: Total maximum amount of pbufs waiting to be reassembled.*/
|
||||
#if WIFI_LOGO_CERTIFICATION_CONFIG
|
||||
#define IP_REASS_MAX_PBUFS 30 //for ping 10k test
|
||||
#else
|
||||
#define IP_REASS_MAX_PBUFS 10
|
||||
#endif
|
||||
|
||||
/* PBUF_POOL_BUFSIZE: the size of each pbuf in the pbuf pool. */
|
||||
#define PBUF_POOL_BUFSIZE 500
|
||||
|
||||
|
||||
/* ---------- TCP options ---------- */
|
||||
#define LWIP_TCP 1
|
||||
#define TCP_TTL 255
|
||||
|
||||
/* Controls if TCP should queue segments that arrive out of
|
||||
order. Define to 0 if your device is low on memory. */
|
||||
#define TCP_QUEUE_OOSEQ 1
|
||||
|
||||
/* TCP Maximum segment size. */
|
||||
#define TCP_MSS (1500 - 40) /* TCP_MSS = (Ethernet MTU - IP header size - TCP header size) */
|
||||
|
||||
/* TCP sender buffer space (bytes). */
|
||||
#define TCP_SND_BUF (5*TCP_MSS)
|
||||
|
||||
/* TCP_SND_QUEUELEN: TCP sender buffer space (pbufs). This must be at least
|
||||
as much as (2 * TCP_SND_BUF/TCP_MSS) for things to work. */
|
||||
|
||||
#define TCP_SND_QUEUELEN (4* TCP_SND_BUF/TCP_MSS)
|
||||
|
||||
/* TCP receive window. */
|
||||
#define TCP_WND (4*TCP_MSS) // (2*TCP_MSS)
|
||||
|
||||
|
||||
/* ---------- ICMP options ---------- */
|
||||
#define LWIP_ICMP 1
|
||||
|
||||
/* ---------- ARP options ----------- */
|
||||
#define LWIP_ARP 1
|
||||
|
||||
/* ---------- DHCP options ---------- */
|
||||
/* Define LWIP_DHCP to 1 if you want DHCP configuration of
|
||||
interfaces. DHCP is not implemented in lwIP 0.5.1, however, so
|
||||
turning this on does currently not work. */
|
||||
#define LWIP_DHCP 1
|
||||
|
||||
/* ---------- UDP options ---------- */
|
||||
#define LWIP_UDP 1
|
||||
#define UDP_TTL 255
|
||||
/* ---------- DNS options ---------- */
|
||||
#define LWIP_DNS 1
|
||||
|
||||
/* ---------- UPNP options --------- */
|
||||
#define LWIP_UPNP 0
|
||||
|
||||
/* Support Multicast */
|
||||
#define LWIP_IGMP 1
|
||||
#define LWIP_RAND() Rand()
|
||||
|
||||
/* Support TCP Keepalive */
|
||||
#define LWIP_TCP_KEEPALIVE 1
|
||||
|
||||
/*LWIP_UART_ADAPTER==1: Enable LWIP_UART_ADAPTER when CONFIG_GAGENT is enabled,
|
||||
because some GAGENT functions denpond on the following macro definitions.*/
|
||||
#if CONFIG_EXAMPLE_UART_ADAPTER
|
||||
#define LWIP_UART_ADAPTER 1
|
||||
#else
|
||||
#define LWIP_UART_ADAPTER 0
|
||||
#endif
|
||||
|
||||
#if LWIP_UART_ADAPTER
|
||||
#undef LWIP_SO_SNDTIMEO
|
||||
#define LWIP_SO_SNDTIMEO 1
|
||||
|
||||
#undef SO_REUSE
|
||||
#define SO_REUSE 1
|
||||
|
||||
#undef MEMP_NUM_NETCONN
|
||||
#define MEMP_NUM_NETCONN 10
|
||||
|
||||
#undef TCP_WND
|
||||
#define TCP_WND (4*TCP_MSS)
|
||||
|
||||
#define TCP_KEEPIDLE_DEFAULT 10000UL
|
||||
#define TCP_KEEPINTVL_DEFAULT 1000UL
|
||||
#define TCP_KEEPCNT_DEFAULT 10U
|
||||
#endif
|
||||
|
||||
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||
#undef LWIP_SO_SNDTIMEO
|
||||
#define LWIP_SO_SNDTIMEO 1
|
||||
|
||||
#undef SO_REUSE
|
||||
#define SO_REUSE 1
|
||||
|
||||
#undef MEMP_NUM_NETCONN
|
||||
#define MEMP_NUM_NETCONN 10
|
||||
|
||||
#undef MEMP_NUM_TCP_PCB
|
||||
#define MEMP_NUM_TCP_PCB (MEMP_NUM_NETCONN)
|
||||
|
||||
#undef MEMP_NUM_UDP_PCB
|
||||
#define MEMP_NUM_UDP_PCB (MEMP_NUM_NETCONN)
|
||||
|
||||
#undef TCP_WND
|
||||
#define TCP_WND (4*TCP_MSS)
|
||||
|
||||
#define TCP_KEEPIDLE_DEFAULT 10000UL
|
||||
#define TCP_KEEPINTVL_DEFAULT 1000UL
|
||||
#define TCP_KEEPCNT_DEFAULT 10U
|
||||
|
||||
#define ERRNO 1
|
||||
#endif
|
||||
|
||||
/* ---------- Statistics options ---------- */
|
||||
#define LWIP_STATS 0
|
||||
#define LWIP_PROVIDE_ERRNO 1
|
||||
|
||||
|
||||
/*
|
||||
--------------------------------------
|
||||
---------- Checksum options ----------
|
||||
--------------------------------------
|
||||
*/
|
||||
|
||||
/*
|
||||
The STM32F2x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums by hardware:
|
||||
- To use this feature let the following define uncommented.
|
||||
- To disable it and process by CPU comment the the checksum.
|
||||
*/
|
||||
//Do checksum by lwip - WLAN nic does not support Checksum offload
|
||||
//#define CHECKSUM_BY_HARDWARE
|
||||
|
||||
|
||||
#ifdef CHECKSUM_BY_HARDWARE
|
||||
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
|
||||
#define CHECKSUM_GEN_IP 0
|
||||
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
|
||||
#define CHECKSUM_GEN_UDP 0
|
||||
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
|
||||
#define CHECKSUM_GEN_TCP 0
|
||||
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
|
||||
#define CHECKSUM_CHECK_IP 0
|
||||
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
|
||||
#define CHECKSUM_CHECK_UDP 0
|
||||
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
|
||||
#define CHECKSUM_CHECK_TCP 0
|
||||
#else
|
||||
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
|
||||
#define CHECKSUM_GEN_IP 1
|
||||
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
|
||||
#define CHECKSUM_GEN_UDP 1
|
||||
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
|
||||
#define CHECKSUM_GEN_TCP 1
|
||||
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
|
||||
#define CHECKSUM_CHECK_IP 1
|
||||
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
|
||||
#define CHECKSUM_CHECK_UDP 1
|
||||
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
|
||||
#define CHECKSUM_CHECK_TCP 1
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
----------------------------------------------
|
||||
---------- Sequential layer options ----------
|
||||
----------------------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_NETCONN==1: Enable Netconn API (require to use api_lib.c)
|
||||
*/
|
||||
#define LWIP_NETCONN 1
|
||||
|
||||
/*
|
||||
------------------------------------
|
||||
---------- Socket options ----------
|
||||
------------------------------------
|
||||
*/
|
||||
/**
|
||||
* LWIP_SOCKET==1: Enable Socket API (require to use sockets.c)
|
||||
*/
|
||||
#define LWIP_SOCKET 1
|
||||
|
||||
/*
|
||||
-----------------------------------
|
||||
---------- DEBUG options ----------
|
||||
-----------------------------------
|
||||
*/
|
||||
|
||||
#define LWIP_DEBUG 0
|
||||
|
||||
/*
|
||||
---------------------------------
|
||||
---------- OS options ----------
|
||||
---------------------------------
|
||||
*/
|
||||
|
||||
/**
|
||||
* TCPIP_THREAD_STACKSIZE: The stack size used by the main tcpip thread.
|
||||
* The stack size value itself is platform-dependent, but is passed to
|
||||
* sys_thread_new() when the thread is created.
|
||||
*/
|
||||
#define TCPIP_THREAD_STACKSIZE 1000
|
||||
/**
|
||||
* TCPIP_MBOX_SIZE: The mailbox size for the tcpip thread messages
|
||||
* The queue size value itself is platform-dependent, but is passed to
|
||||
* sys_mbox_new() when tcpip_init is called.
|
||||
*/
|
||||
#define TCPIP_MBOX_SIZE 6
|
||||
/**
|
||||
* DEFAULT_UDP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
|
||||
* NETCONN_UDP. The queue size value itself is platform-dependent, but is passed
|
||||
* to sys_mbox_new() when the recvmbox is created.
|
||||
*/
|
||||
#define DEFAULT_UDP_RECVMBOX_SIZE 6
|
||||
/**
|
||||
* DEFAULT_TCP_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
|
||||
* NETCONN_TCP. The queue size value itself is platform-dependent, but is passed
|
||||
* to sys_mbox_new() when the recvmbox is created.
|
||||
*/
|
||||
#define DEFAULT_TCP_RECVMBOX_SIZE 6
|
||||
/**
|
||||
* DEFAULT_RAW_RECVMBOX_SIZE: The mailbox size for the incoming packets on a
|
||||
* NETCONN_RAW. The queue size value itself is platform-dependent, but is passed
|
||||
* to sys_mbox_new() when the recvmbox is created.
|
||||
*/
|
||||
#define DEFAULT_RAW_RECVMBOX_SIZE 6
|
||||
/**
|
||||
* DEFAULT_ACCEPTMBOX_SIZE: The mailbox size for the incoming connections.
|
||||
* The queue size value itself is platform-dependent, but is passed to
|
||||
* sys_mbox_new() when the acceptmbox is created.
|
||||
*/
|
||||
#define DEFAULT_ACCEPTMBOX_SIZE 6
|
||||
/**
|
||||
* DEFAULT_THREAD_STACKSIZE: The stack size used by any other lwIP thread.
|
||||
* The stack size value itself is platform-dependent, but is passed to
|
||||
* sys_thread_new() when the thread is created.
|
||||
*/
|
||||
#define DEFAULT_THREAD_STACKSIZE 500
|
||||
/**
|
||||
* TCPIP_THREAD_PRIO: The priority assigned to the main tcpip thread.
|
||||
* The priority value itself is platform-dependent, but is passed to
|
||||
* sys_thread_new() when the thread is created.
|
||||
*/
|
||||
#define TCPIP_THREAD_PRIO (configMAX_PRIORITIES - 2)
|
||||
|
||||
/** LWIP_TIMEVAL_PRIVATE: if you want to use the struct timeval provided
|
||||
* by your system, set this to 0 and include <sys/time.h> in cc.h */
|
||||
#if defined(_SYS__TIMEVAL_H_)
|
||||
#define LWIP_TIMEVAL_PRIVATE 0
|
||||
#endif
|
||||
|
||||
#endif /* __LWIPOPTS_H__ */
|
||||
|
||||
/******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
|
119
project/inc/main.h
Normal file
119
project/inc/main.h
Normal file
|
@ -0,0 +1,119 @@
|
|||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#include <autoconf.h>
|
||||
|
||||
#ifndef CONFIG_WLAN
|
||||
#define CONFIG_WLAN 1
|
||||
#endif
|
||||
|
||||
/* Header file declaration*/
|
||||
void wlan_network();
|
||||
|
||||
/* Interactive Mode */
|
||||
#define SERIAL_DEBUG_RX 1
|
||||
|
||||
/* WLAN and Netork */
|
||||
#define STA_MODE_SSID "ap" /* Set SSID here */
|
||||
#define AP_MODE_SSID "wlan_ap_ssid" /* Set SSID here */
|
||||
#define AP_DEFAULT_CH 6
|
||||
#define WLAN0_NAME "wlan0"
|
||||
#define WLAN1_NAME "wlan1"
|
||||
#define WPA_PASSPHRASE "1234567890" /* Max 32 cahracters */
|
||||
#define WEP40_KEY {0x12, 0x34, 0x56, 0x78, 0x90}
|
||||
|
||||
#define ATVER_1 1 // For First AT command
|
||||
#define ATVER_2 2 // For UART Module AT command
|
||||
|
||||
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||
#define ATCMD_VER ATVER_2
|
||||
#else
|
||||
#define ATCMD_VER ATVER_1
|
||||
#endif
|
||||
|
||||
#if ATCMD_VER == ATVER_2
|
||||
|
||||
extern unsigned char sta_ip[4], sta_netmask[4], sta_gw[4];
|
||||
extern unsigned char ap_ip[4], ap_netmask[4], ap_gw[4];
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#define IP_ADDR0 sta_ip[0]
|
||||
#define IP_ADDR1 sta_ip[1]
|
||||
#define IP_ADDR2 sta_ip[2]
|
||||
#define IP_ADDR3 sta_ip[3]
|
||||
|
||||
/*NETMASK*/
|
||||
#define NETMASK_ADDR0 sta_netmask[0]
|
||||
#define NETMASK_ADDR1 sta_netmask[1]
|
||||
#define NETMASK_ADDR2 sta_netmask[2]
|
||||
#define NETMASK_ADDR3 sta_netmask[3]
|
||||
|
||||
/*Gateway Address*/
|
||||
#define GW_ADDR0 sta_gw[0]
|
||||
#define GW_ADDR1 sta_gw[1]
|
||||
#define GW_ADDR2 sta_gw[2]
|
||||
#define GW_ADDR3 sta_gw[3]
|
||||
|
||||
/*******************************************/
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#define AP_IP_ADDR0 ap_ip[0]
|
||||
#define AP_IP_ADDR1 ap_ip[1]
|
||||
#define AP_IP_ADDR2 ap_ip[2]
|
||||
#define AP_IP_ADDR3 ap_ip[3]
|
||||
|
||||
/*NETMASK*/
|
||||
#define AP_NETMASK_ADDR0 ap_netmask[0]
|
||||
#define AP_NETMASK_ADDR1 ap_netmask[1]
|
||||
#define AP_NETMASK_ADDR2 ap_netmask[2]
|
||||
#define AP_NETMASK_ADDR3 ap_netmask[3]
|
||||
|
||||
/*Gateway Address*/
|
||||
#define AP_GW_ADDR0 ap_gw[0]
|
||||
#define AP_GW_ADDR1 ap_gw[1]
|
||||
#define AP_GW_ADDR2 ap_gw[2]
|
||||
#define AP_GW_ADDR3 ap_gw[3]
|
||||
|
||||
#else
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#define IP_ADDR0 192
|
||||
#define IP_ADDR1 168
|
||||
#define IP_ADDR2 3
|
||||
#define IP_ADDR3 80
|
||||
|
||||
/*NETMASK*/
|
||||
#define NETMASK_ADDR0 255
|
||||
#define NETMASK_ADDR1 255
|
||||
#define NETMASK_ADDR2 255
|
||||
#define NETMASK_ADDR3 0
|
||||
|
||||
/*Gateway Address*/
|
||||
#define GW_ADDR0 192
|
||||
#define GW_ADDR1 168
|
||||
#define GW_ADDR2 3
|
||||
#define GW_ADDR3 1
|
||||
|
||||
/*******************************************/
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#define AP_IP_ADDR0 192
|
||||
#define AP_IP_ADDR1 168
|
||||
#define AP_IP_ADDR2 43
|
||||
#define AP_IP_ADDR3 1
|
||||
|
||||
/*NETMASK*/
|
||||
#define AP_NETMASK_ADDR0 255
|
||||
#define AP_NETMASK_ADDR1 255
|
||||
#define AP_NETMASK_ADDR2 255
|
||||
#define AP_NETMASK_ADDR3 0
|
||||
|
||||
/*Gateway Address*/
|
||||
#define AP_GW_ADDR0 192
|
||||
#define AP_GW_ADDR1 168
|
||||
#define AP_GW_ADDR2 43
|
||||
#define AP_GW_ADDR3 1
|
||||
|
||||
#endif //#if ATCMD_VER == ATVER_2
|
||||
|
||||
#endif
|
253
project/inc/platform_autoconf.h
Normal file
253
project/inc/platform_autoconf.h
Normal file
|
@ -0,0 +1,253 @@
|
|||
/*
|
||||
* Automatically generated by make menuconfig: don't edit
|
||||
*/
|
||||
#define AUTOCONF_INCLUDED
|
||||
|
||||
#define RTL8710AF
|
||||
//#define RTL8711AM
|
||||
/*
|
||||
* Target Platform Selection
|
||||
*/
|
||||
#define CONFIG_WITHOUT_MONITOR 1
|
||||
|
||||
#undef CONFIG_RTL8195A
|
||||
#define CONFIG_RTL8195A 1
|
||||
#undef CONFIG_FPGA
|
||||
#undef CONFIG_RTL_SIM
|
||||
#undef CONFIG_POST_SIM
|
||||
/*
|
||||
* < Mass Production Option
|
||||
*/
|
||||
#undef CONFIG_MP
|
||||
#undef CONFIG_CP
|
||||
#undef CONFIG_FT
|
||||
#define RTL8195A 1
|
||||
#define CONFIG_CPU_CLK 1
|
||||
#define CONFIG_CPU_166_6MHZ 1 // RUN/IDLE/SLP ~63/21/6.4 mA
|
||||
//#define CONFIG_CPU_83_3MHZ 1 // RUN/IDLE/SLP ~55/15/6.4 mA
|
||||
//#define CONFIG_CPU_41_6MHZ 1 // RUN/IDLE ~51/11 mA
|
||||
//#define CONFIG_CPU_20_8MHZ 1 // RUN/IDLE ~49/9.5 mA
|
||||
//#define CONFIG_CPU_10_4MHZ 1
|
||||
//#define CONFIG_CPU_4MHZ 1 // IDLE ~8 mA
|
||||
#undef CONFIG_FPGA_CLK
|
||||
#define CONFIG_SDR_CLK 1
|
||||
#define CONFIG_SDR_100MHZ 1
|
||||
#undef CONFIG_SDR_50MHZ
|
||||
#undef CONFIG_SDR_25MHZ
|
||||
#undef CONFIG_SDR_12_5MHZ
|
||||
#define SDR_CLOCK_SEL_VALUE (0)
|
||||
#define CONFIG_BOOT_PROCEDURE 1
|
||||
#define CONFIG_IMAGE_PAGE_LOAD 1
|
||||
#undef CONFIG_IMAGE_AUTO_LOAD
|
||||
#undef CONFIG_IMAGE_PAGE_LOAD
|
||||
//#define CONFIG_IMAGE_AUTO_LOAD 1
|
||||
//#define CONFIG_BOOT_TO_UPGRADE_IMG2 1
|
||||
#undef CONFIG_PERI_UPDATE_IMG
|
||||
#define CONFIG_BOOT_FROM_JTAG 1
|
||||
#undef CONFIG_ALIGNMENT_EXCEPTION_ENABLE
|
||||
#define CONFIG_KERNEL 1
|
||||
#define PLATFORM_FREERTOS 1
|
||||
#undef PLATFORM_UCOSII
|
||||
#undef PLATFORM_ECOS
|
||||
#undef CONFIG_TASK_SCHEDUL_DIS
|
||||
#define TASK_SCHEDULER_DISABLED (0)
|
||||
#define CONFIG_NORMALL_MODE 1
|
||||
#undef CONFIG_MEMORY_VERIFY_MODE
|
||||
#define CONFIG_TIMER_EN 1
|
||||
#define CONFIG_TIMER_NORMAL 1
|
||||
#undef CONFIG_TIMER_TEST
|
||||
#define CONFIG_TIMER_MODULE 1
|
||||
#define CONFIG_WDG 1
|
||||
#undef CONFIG_WDG_NON
|
||||
#define CONFIG_WDG_NORMAL 1
|
||||
#define CONFIG_GDMA_EN 1
|
||||
#define CONFIG_GDMA_NORMAL 1
|
||||
#undef CONFIG_GDMA_TEST
|
||||
#define CONFIG_GDMA_MODULE 1
|
||||
#define CONFIG_WIFI_EN 1
|
||||
#define CONFIG_WIFI_NORMAL 1
|
||||
#undef CONFIG_WIFI_TEST
|
||||
#define CONFIG_WIFI_MODULE 1
|
||||
#define CONFIG_GPIO_EN 1
|
||||
#define CONFIG_GPIO_NORMAL 1
|
||||
#undef CONFIG_GPIO_TEST
|
||||
#define CONFIG_GPIO_MODULE 1
|
||||
#if defined(CONFIG_INIC) || (CONFIG_SDIOD)
|
||||
#define CONFIG_SDIO_DEVICE_EN 1
|
||||
#define CONFIG_SDIO_DEVICE_NORMAL 1
|
||||
#undef CONFIG_SDIO_DEVICE_TEST
|
||||
#define CONFIG_SDIO_DEVICE_MODULE 1
|
||||
#else
|
||||
#undef CONFIG_SDIO_DEVICE_EN
|
||||
#endif
|
||||
#define CONFIG_SDIO_HOST_EN 1
|
||||
//#define CONFIG_USB_EN 1
|
||||
#undef CONFIG_USB_NORMAL
|
||||
#define CONFIG_USB_TEST 1
|
||||
#define CONFIG_USB_MODULE 1
|
||||
#define CONFIG_USB_VERIFY 1
|
||||
#undef CONFIG_USB_ROM_LIB
|
||||
//#define CONFIG_USB_DBGINFO_EN 1
|
||||
#if defined(CONFIG_INIC) || (CONFIG_USBD)
|
||||
#define DWC_DEVICE_ONLY 1
|
||||
#else
|
||||
#define DWC_HOST_ONLY 1
|
||||
#define CONFIG_USB_HOST_ONLY 1
|
||||
#endif
|
||||
#define CONFIG_SPI_COM_EN 1
|
||||
#define CONFIG_SPI_COM_NORMAL 1
|
||||
#undef CONFIG_SPI_COM_TEST
|
||||
#define CONFIG_SPI_COM_MODULE 1
|
||||
#define CONFIG_UART_EN 1
|
||||
#define CONFIG_UART_NORMAL 1
|
||||
#undef CONFIG_UART_TEST
|
||||
#define CONFIG_UART_MODULE 1
|
||||
#define CONFIG_I2C_EN 1
|
||||
#define CONFIG_I2C_NORMAL 1
|
||||
#undef CONFIG_I2C_TEST
|
||||
#define CONFIG_I2C_MODULE 1
|
||||
#undef CONFIG_DEBUG_LOG_I2C_HAL
|
||||
#undef CONFIG_PCM_EN
|
||||
#define CONFIG_I2S_EN 1
|
||||
#define CONFIG_I2S_NORMAL 1
|
||||
#undef CONFIG_I2S_TEST
|
||||
#define CONFIG_I2S_MODULE 1
|
||||
#undef CONFIG_DEBUG_LOG_I2S_HAL
|
||||
#define CONFIG_NFC_EN 1
|
||||
#define CONFIG_NFC_NORMAL 1
|
||||
#undef CONFIG_NFC_TEST
|
||||
#define CONFIG_NFC_MODULE 1
|
||||
#define CONFIG_SOC_PS_EN 1
|
||||
#define CONFIG_SOC_PS_NORMAL 1
|
||||
#undef CONFIG_SOC_PS_TEST
|
||||
#define CONFIG_SOC_PS_MODULE 1 // hal_soc_ps_monitor.c
|
||||
//#define CONFIG_SOC_PS_VERIFY 1 // hal_soc_ps_monitor.c
|
||||
#define CONFIG_CRYPTO_EN 1
|
||||
#define CONFIG_CRYPTO_NORMAL 1
|
||||
#undef CONFIG_CRYPTO_TEST
|
||||
#define CONFIG_CRYPTO_MODULE 1
|
||||
#define CONFIG_MII_EN 1
|
||||
#define CONFIG_PWM_EN 1
|
||||
#define CONFIG_PWM_NORMAL 1
|
||||
#undef CONFIG_PWM_TEST
|
||||
#define CONFIG_PWM_MODULE 1
|
||||
#define CONFIG_EFUSE_EN 1 // common/mbed/targets/hal/rtl8195a/efuse_api.c
|
||||
#define CONFIG_EFUSE_NORMAL 1
|
||||
#undef CONFIG_EFUSE_TEST
|
||||
#define CONFIG_EFUSE_MODULE 1
|
||||
#ifdef RTL8711AM
|
||||
#define CONFIG_SDR_EN 1
|
||||
#endif
|
||||
#define CONFIG_SDR_NORMAL 1
|
||||
#undef CONFIG_SDR_TEST
|
||||
#define CONFIG_SDR_MODULE 1
|
||||
#define CONFIG_SPIC_EN 1
|
||||
#define CONFIG_SPIC_NORMAL 1
|
||||
#undef CONFIG_SPIC_TEST
|
||||
#define CONFIG_SPIC_MODULE 1
|
||||
#define CONFIG_ADC_EN 1
|
||||
//#define CONFIG_DAC_EN 1
|
||||
#define CONFIG_NOR_FLASH 1
|
||||
#undef CONFIG_SPI_FLASH
|
||||
#undef CONFIG_NAND_FLASH
|
||||
#undef CONFIG_NONE_FLASH
|
||||
#undef CONFIG_BTBX_EN
|
||||
|
||||
// add pvvx
|
||||
#define CONFIG_LOG_UART_EN 1
|
||||
|
||||
/*
|
||||
* < Engineer Mode Config
|
||||
*/
|
||||
#undef CONFIG_JTAG
|
||||
#undef CONFIG_COMPILE_FLASH_DOWNLOAD_CODE
|
||||
#undef CONIFG_COMPILE_EXTERNAL_SRAM_CALIBRATE
|
||||
#undef CONFIG_CMSIS_MATH_LIB_EN
|
||||
|
||||
/*
|
||||
* < Application Config
|
||||
*/
|
||||
#define CONFIG_NETWORK 1
|
||||
#define CONFIG_RTLIB_EN 1
|
||||
#define CONFIG_RTLIB_NORMAL 1
|
||||
#undef CONFIG_RTLIB_TEST
|
||||
#define CONFIG_RTLIB_MODULE 1
|
||||
|
||||
/*
|
||||
* < System Debug Message Config
|
||||
*/
|
||||
#define CONFIG_UART_LOG_HISTORY 1
|
||||
#undef CONFIG_CONSOLE_NORMALL_MODE
|
||||
#define CONFIG_CONSOLE_VERIFY_MODE 1
|
||||
|
||||
/* CONFIG_DEBUG_LOG:
|
||||
=0 Off all diag/debug msg,
|
||||
=1 Only errors,
|
||||
=2 errors + warning, (default)
|
||||
=3 errors + warning + info,
|
||||
=4 errors + warning + info + debug,
|
||||
=5 full */
|
||||
#define CONFIG_DEBUG_LOG 5
|
||||
#if CONFIG_DEBUG_LOG > 0
|
||||
//#define CONFIG_DEBUG_ERR_MSG 1
|
||||
#define CONFIG_DEBUG_LOG_ADC_HAL 1
|
||||
#define CONFIG_DEBUG_LOG_I2S_HAL 1
|
||||
//#undef CONFIG_DEBUG_WARN_MSG
|
||||
//#undef CONFIG_DEBUG_INFO_MSG
|
||||
#endif // CONFIG_DEBUG_LOG
|
||||
/*
|
||||
* < SDK Option Config
|
||||
*/
|
||||
#undef CONFIG_MBED_ENABLED
|
||||
#undef CONFIG_APP_DEMO
|
||||
|
||||
/*
|
||||
* < Select Chip Version
|
||||
*/
|
||||
#undef CONFIG_CHIP_A_CUT
|
||||
#define CONFIG_CHIP_B_CUT 1
|
||||
#undef CONFIG_CHIP_C_CUT
|
||||
#undef CONFIG_CHIP_E_CUT
|
||||
|
||||
/*
|
||||
* < Select toolchain
|
||||
*/
|
||||
#undef CONFIG_TOOLCHAIN_ASDK
|
||||
#undef CONFIG_TOOLCHAIN_ARM_GCC
|
||||
|
||||
/*
|
||||
* < Build Option
|
||||
*/
|
||||
#define CONFIG_LINK_ROM_LIB 1
|
||||
#undef CONFIG_LINK_ROM_SYMB
|
||||
#undef CONFIG_NORMAL_BUILD
|
||||
#undef CONFIG_RELEASE_BUILD
|
||||
#undef CONFIG_RELEASE_BUILD_LIBRARIES
|
||||
#undef CONFIG_LIB_BUILD_RAM
|
||||
#define CONFIG_RELEASE_BUILD_RAM_ALL 1
|
||||
#undef CONFIG_IMAGE_ALL
|
||||
#define CONFIG_IMAGE_SEPARATE 1
|
||||
|
||||
#if defined(CONFIG_CPU_166_6MHZ)
|
||||
#define CPU_CLOCK_SEL_VALUE 0
|
||||
#define PLATFORM_CLOCK (166666666) // (((200000000*5)/3)>>(CPU_CLOCK_SEL_VALUE + 1))
|
||||
#elif defined(CONFIG_CPU_83_3MHZ)
|
||||
#define CPU_CLOCK_SEL_VALUE 1
|
||||
#define PLATFORM_CLOCK (((200000000*5)/3)>>(CPU_CLOCK_SEL_VALUE + 1))
|
||||
#elif defined(CONFIG_CPU_41_6MHZ)
|
||||
#define CPU_CLOCK_SEL_VALUE 2
|
||||
#define PLATFORM_CLOCK (((200000000*5)/3)>>(CPU_CLOCK_SEL_VALUE + 1))
|
||||
#elif defined(CONFIG_CPU_20_8MHZ)
|
||||
#define CPU_CLOCK_SEL_VALUE 3
|
||||
#define PLATFORM_CLOCK (((200000000*5)/3)>>(CPU_CLOCK_SEL_VALUE + 1))
|
||||
#elif defined(CONFIG_CPU_10_4MHZ)
|
||||
#define CPU_CLOCK_SEL_VALUE 4
|
||||
#define PLATFORM_CLOCK (((200000000*5)/3)>>(CPU_CLOCK_SEL_VALUE + 1))
|
||||
#elif defined(CONFIG_CPU_4MHZ)
|
||||
#define CPU_CLOCK_SEL_VALUE 5
|
||||
#define PLATFORM_CLOCK (4000000)
|
||||
#else
|
||||
#define CONFIG_CPU_166_6MHZ 1
|
||||
#define CPU_CLOCK_SEL_VALUE (0)
|
||||
#define PLATFORM_CLOCK (((200000000*5)/3)>>(CPU_CLOCK_SEL_VALUE + 1))
|
||||
#endif
|
172
project/inc/platform_opts.h
Normal file
172
project/inc/platform_opts.h
Normal file
|
@ -0,0 +1,172 @@
|
|||
/**
|
||||
******************************************************************************
|
||||
*This file contains general configurations for ameba platform
|
||||
******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef __PLATFORM_OPTS_H__
|
||||
#define __PLATFORM_OPTS_H__
|
||||
|
||||
/*For MP mode setting*/
|
||||
#define SUPPORT_MP_MODE 1
|
||||
|
||||
/**
|
||||
* For AT cmd Log service configurations
|
||||
*/
|
||||
#define SUPPORT_LOG_SERVICE 1
|
||||
#if SUPPORT_LOG_SERVICE
|
||||
#define LOG_SERVICE_BUFLEN 100 //can't larger than UART_LOG_CMD_BUFLEN(127)
|
||||
#define CONFIG_LOG_HISTORY 0
|
||||
#if CONFIG_LOG_HISTORY
|
||||
#define LOG_HISTORY_LEN 5
|
||||
#endif
|
||||
#define SUPPORT_INTERACTIVE_MODE 0 //on/off wifi_interactive_mode
|
||||
#define CONFIG_LOG_SERVICE_LOCK 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* For interactive mode configurations, depends on log service
|
||||
*/
|
||||
#if SUPPORT_INTERACTIVE_MODE
|
||||
#define CONFIG_INTERACTIVE_MODE 1
|
||||
#define CONFIG_INTERACTIVE_EXT 0
|
||||
#else
|
||||
#define CONFIG_INTERACTIVE_MODE 0
|
||||
#define CONFIG_INTERACTIVE_EXT 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
* For FreeRTOS tickless configurations
|
||||
*/
|
||||
#define FREERTOS_PMU_TICKLESS_PLL_RESERVED 0 // In sleep mode, 0: close PLL clock, 1: reserve PLL clock
|
||||
#define FREERTOS_PMU_TICKLESS_SUSPEND_SDRAM 1 // In sleep mode, 1: suspend SDRAM, 0: no act
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/**
|
||||
* For common flash usage
|
||||
*/
|
||||
#define AP_SETTING_SECTOR 0x000FE000
|
||||
#define UART_SETTING_SECTOR 0x000FC000
|
||||
#define FAST_RECONNECT_DATA (0x80000 - 0x1000)
|
||||
|
||||
/**
|
||||
* For Wlan configurations
|
||||
*/
|
||||
#define CONFIG_WLAN 1
|
||||
#if CONFIG_WLAN
|
||||
#define CONFIG_LWIP_LAYER 1
|
||||
//#define CONFIG_AT_USR 1 // add pvxx
|
||||
#define CONFIG_AT_LWIP 1 // add pvxx
|
||||
#define CONFIG_AT_SYS 1 // add pvxx
|
||||
#define CONFIG_AT_WIFI 1 // add pvxx
|
||||
#define CONFIG_INIT_NET 1 // init lwip layer when start up
|
||||
#define CONFIG_WIFI_IND_USE_THREAD 0// wifi indicate worker thread
|
||||
|
||||
//on/off relative commands in log service
|
||||
#define CONFIG_SSL_CLIENT 0
|
||||
#define CONFIG_WEBSERVER 1
|
||||
#define CONFIG_OTA_UPDATE 1
|
||||
#define CONFIG_BSD_TCP 1 //NOTE : Enable CONFIG_BSD_TCP will increase about 11KB code size
|
||||
#define CONFIG_AIRKISS 0 //on or off tencent airkiss
|
||||
#define CONFIG_UART_SOCKET 1 // Set: CONFIG_UART_EN, CONFIG_UART_SOCKET
|
||||
#define CONFIG_UART_XMODEM 1 //support uart xmodem upgrade or not (sdram!)
|
||||
#define CONFIG_TRANSPORT 1 //on or off the at command for transport socket
|
||||
|
||||
/* For WPS and P2P */
|
||||
#define CONFIG_ENABLE_WPS 0 //0
|
||||
#define CONFIG_ENABLE_P2P 0 //0
|
||||
#if CONFIG_ENABLE_P2P
|
||||
#define CONFIG_ENABLE_WPS_AP 1
|
||||
#undef CONFIG_WIFI_IND_USE_THREAD
|
||||
#define CONFIG_WIFI_IND_USE_THREAD 1
|
||||
#endif
|
||||
#if (CONFIG_ENABLE_P2P && ((CONFIG_ENABLE_WPS_AP == 0) || (CONFIG_ENABLE_WPS == 0)))
|
||||
#error "If CONFIG_ENABLE_P2P, need to define CONFIG_ENABLE_WPS_AP 1"
|
||||
#endif
|
||||
|
||||
/* For Simple Link */
|
||||
#define CONFIG_INCLUDE_SIMPLE_CONFIG 1
|
||||
|
||||
/*For wowlan service settings*/
|
||||
#define CONFIG_WOWLAN_SERVICE 0
|
||||
|
||||
#endif //end of #if CONFIG_WLAN
|
||||
/*******************************************************************************/
|
||||
|
||||
/**
|
||||
* For Ethernet configurations
|
||||
*/
|
||||
#define CONFIG_ETHERNET 0
|
||||
#if CONFIG_ETHERNET
|
||||
|
||||
#define CONFIG_LWIP_LAYER 1
|
||||
#define CONFIG_INIT_NET 1 //init lwip layer when start up
|
||||
|
||||
//on/off relative commands in log service
|
||||
#define CONFIG_SSL_CLIENT 0
|
||||
#define CONFIG_BSD_TCP 0 //NOTE : Enable CONFIG_BSD_TCP will increase about 11KB code size
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* For iNIC configurations
|
||||
*/
|
||||
#ifdef CONFIG_INIC //this flag is defined in IAR project
|
||||
#define CONFIG_INIC_EN 1 //enable iNIC mode
|
||||
#undef CONFIG_ENABLE_WPS
|
||||
#define CONFIG_ENABLE_WPS 1
|
||||
#undef CONFIG_INCLUDE_SIMPLE_CONFIG
|
||||
#define CONFIG_INCLUDE_SIMPLE_CONFIG 1
|
||||
#undef CONFIG_WOWLAN_SERVICE
|
||||
#define CONFIG_WOWLAN_SERVICE 1
|
||||
#undef LOG_SERVICE_BUFLEN
|
||||
#define LOG_SERVICE_BUFLEN 256
|
||||
#undef CONFIG_LWIP_LAYER
|
||||
#define CONFIG_LWIP_LAYER 0
|
||||
#undef CONFIG_OTA_UPDATE
|
||||
#define CONFIG_OTA_UPDATE 0
|
||||
#undef CONFIG_EXAMPLE_WLAN_FAST_CONNECT
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 0
|
||||
#define CONFIG_INIC_SDIO_HCI 1 //for SDIO or USB iNIC
|
||||
#define CONFIG_INIC_USB_HCI 0
|
||||
#define CONFIG_INIC_CMD_RSP 1 //need to return msg to host
|
||||
#endif
|
||||
/******************End of iNIC configurations*******************/
|
||||
|
||||
/* For UART Module AT command example */
|
||||
#define CONFIG_EXAMPLE_UART_ATCMD 1
|
||||
#if CONFIG_EXAMPLE_UART_ATCMD
|
||||
#undef FREERTOS_PMU_TICKLESS_PLL_RESERVED
|
||||
#define FREERTOS_PMU_TICKLESS_PLL_RESERVED 1
|
||||
#undef CONFIG_OTA_UPDATE
|
||||
#define CONFIG_OTA_UPDATE 1
|
||||
#undef CONFIG_TRANSPORT
|
||||
#define CONFIG_TRANSPORT 1
|
||||
#undef LOG_SERVICE_BUFLEN
|
||||
#define LOG_SERVICE_BUFLEN 1600
|
||||
#undef CONFIG_LOG_SERVICE_LOCK
|
||||
#define CONFIG_LOG_SERVICE_LOCK 1
|
||||
#else
|
||||
#define CONFIG_EXAMPLE_WLAN_FAST_CONNECT 1
|
||||
#endif
|
||||
|
||||
//#define CONFIG_EXAMPLE_UART_ADAPTER 1
|
||||
//#define CONFIG_EXAMPLE_MDNS
|
||||
#define USE_FLASH_EEP 1
|
||||
#define CONFIG_WLAN_CONNECT_CB 1
|
||||
|
||||
//#define CONFIG_FATFS_EN 1 // включить FatFs
|
||||
#ifdef CONFIG_FATFS_EN
|
||||
// fatfs version
|
||||
#define FATFS_R_10C
|
||||
// fatfs disk interface
|
||||
#define FATFS_DISK_USB 0
|
||||
#define FATFS_DISK_SD 1
|
||||
#undef CONFIG_SDIO_HOST_EN
|
||||
#define CONFIG_SDIO_HOST_EN 1
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
96
project/inc/rtl8195a/c_types.h
Normal file
96
project/inc/rtl8195a/c_types.h
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* Copyright (c) 2010 - 2011 Espressif System
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _C_TYPES_H_
|
||||
#define _C_TYPES_H_
|
||||
|
||||
typedef unsigned char uint8_t;
|
||||
typedef signed char sint8_t;
|
||||
typedef signed char int8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
typedef signed short sint16_t;
|
||||
typedef signed short int16_t;
|
||||
typedef unsigned long uint32_t;
|
||||
typedef signed long sint32_t;
|
||||
typedef signed long int32_t;
|
||||
typedef signed long long sint64_t;
|
||||
typedef unsigned long long uint64_t;
|
||||
typedef unsigned long long u_int64_t;
|
||||
typedef float real32_t;
|
||||
typedef double real64_t;
|
||||
|
||||
typedef unsigned char uint8;
|
||||
typedef unsigned char u8;
|
||||
typedef signed char sint8;
|
||||
typedef signed char int8;
|
||||
typedef signed char s8;
|
||||
typedef unsigned short uint16;
|
||||
typedef unsigned short u16;
|
||||
typedef signed short sint16;
|
||||
typedef signed short s16;
|
||||
typedef unsigned int uint32;
|
||||
typedef unsigned int u_int;
|
||||
typedef unsigned int u32;
|
||||
typedef signed int sint32;
|
||||
typedef signed int s32;
|
||||
typedef int int32;
|
||||
typedef signed long long sint64;
|
||||
typedef unsigned long long uint64;
|
||||
typedef unsigned long long u64;
|
||||
typedef float real32;
|
||||
typedef double real64;
|
||||
|
||||
#define __le16 u16
|
||||
|
||||
typedef unsigned int size_t;
|
||||
typedef int ssize_t;
|
||||
|
||||
#ifndef _SYS_CDEFS_H_
|
||||
#define __packed __attribute__((packed))
|
||||
#endif
|
||||
|
||||
#define LOCAL static
|
||||
|
||||
#ifndef NULL
|
||||
#define NULL (void *)0
|
||||
#endif /* NULL */
|
||||
|
||||
/* probably should not put STATUS here */
|
||||
typedef enum {
|
||||
OK = 0,
|
||||
FAIL,
|
||||
PENDING,
|
||||
BUSY,
|
||||
CANCEL,
|
||||
} STATUS;
|
||||
|
||||
#define BIT(nr) (1UL << (nr))
|
||||
|
||||
#define REG_SET_BIT(_r, _b) (*(volatile uint32_t*)(_r) |= (_b))
|
||||
#define REG_CLR_BIT(_r, _b) (*(volatile uint32_t*)(_r) &= ~(_b))
|
||||
|
||||
#define DMEM_ATTR
|
||||
#define SHMEM_ATTR
|
||||
|
||||
#ifdef ICACHE_FLASH
|
||||
#define ICACHE_FLASH_ATTR
|
||||
#define ICACHE_RODATA_ATTR
|
||||
#else
|
||||
#define ICACHE_FLASH_ATTR
|
||||
#define ICACHE_RODATA_ATTR
|
||||
#endif /* ICACHE_FLASH */
|
||||
|
||||
#ifndef __cplusplus
|
||||
typedef unsigned char bool;
|
||||
//#define BOOL bool
|
||||
#define true (1)
|
||||
#define false (0)
|
||||
#define TRUE true
|
||||
#define FALSE false
|
||||
|
||||
|
||||
#endif /* !__cplusplus */
|
||||
|
||||
#endif /* _C_TYPES_H_ */
|
593
project/inc/rtl8195a/os.h
Normal file
593
project/inc/rtl8195a/os.h
Normal file
|
@ -0,0 +1,593 @@
|
|||
/*
|
||||
* OS specific functions
|
||||
* Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef OS_H
|
||||
#define OS_H
|
||||
|
||||
//#include "basic_types.h"
|
||||
#include <autoconf.h>
|
||||
#include "osdep_service.h"
|
||||
#include "freertos/wrapper.h"
|
||||
#include "utils/rom/rom_wps_os.h"
|
||||
|
||||
typedef void* xqueue_handle_t;
|
||||
|
||||
typedef long os_time_t;
|
||||
|
||||
typedef _timer os_timer;
|
||||
|
||||
/**
|
||||
* os_sleep - Sleep (sec, usec)
|
||||
* @sec: Number of seconds to sleep
|
||||
* @usec: Number of microseconds to sleep
|
||||
*/
|
||||
void os_sleep(os_time_t sec, os_time_t usec);
|
||||
|
||||
struct os_time {
|
||||
os_time_t sec;
|
||||
os_time_t usec;
|
||||
};
|
||||
|
||||
struct os_reltime {
|
||||
os_time_t sec;
|
||||
os_time_t usec;
|
||||
};
|
||||
|
||||
/**
|
||||
* os_get_time - Get current time (sec, usec)
|
||||
* @t: Pointer to buffer for the time
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*/
|
||||
int os_get_time(struct os_time *t);
|
||||
|
||||
int os_get_reltime(struct os_reltime *t);
|
||||
/* Helper macros for handling struct os_time */
|
||||
/* (&timeout->time, &tmp->time) */
|
||||
#define os_time_before(a, b) \
|
||||
((a)->sec < (b)->sec || \
|
||||
((a)->sec == (b)->sec && (a)->usec < (b)->usec))
|
||||
|
||||
#define os_time_sub(a, b, res) do { \
|
||||
(res)->sec = (a)->sec - (b)->sec; \
|
||||
(res)->usec = (a)->usec - (b)->usec; \
|
||||
if ((res)->usec < 0) { \
|
||||
(res)->sec--; \
|
||||
(res)->usec += 1000000; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* os_mktime - Convert broken-down time into seconds since 1970-01-01
|
||||
* @year: Four digit year
|
||||
* @month: Month (1 .. 12)
|
||||
* @day: Day of month (1 .. 31)
|
||||
* @hour: Hour (0 .. 23)
|
||||
* @min: Minute (0 .. 59)
|
||||
* @sec: Second (0 .. 60)
|
||||
* @t: Buffer for returning calendar time representation (seconds since
|
||||
* 1970-01-01 00:00:00)
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* Note: The result is in seconds from Epoch, i.e., in UTC, not in local time
|
||||
* which is used by POSIX mktime().
|
||||
*/
|
||||
int os_mktime(int year, int month, int day, int hour, int min, int sec,
|
||||
os_time_t *t);
|
||||
|
||||
struct os_tm {
|
||||
int sec; /* 0..59 or 60 for leap seconds */
|
||||
int min; /* 0..59 */
|
||||
int hour; /* 0..23 */
|
||||
int day; /* 1..31 */
|
||||
int month; /* 1..12 */
|
||||
int year; /* Four digit year */
|
||||
};
|
||||
|
||||
int os_gmtime(os_time_t t, struct os_tm *tm);
|
||||
|
||||
/* Helpers for handling struct os_time */
|
||||
|
||||
/* Helpers for handling struct os_reltime */
|
||||
|
||||
static inline int os_reltime_before(struct os_reltime *a,
|
||||
struct os_reltime *b)
|
||||
{
|
||||
return os_time_before(a,b);
|
||||
}
|
||||
|
||||
|
||||
static inline void os_reltime_sub(struct os_reltime *a, struct os_reltime *b,
|
||||
struct os_reltime *res)
|
||||
{
|
||||
os_time_sub(a,b,res);
|
||||
}
|
||||
|
||||
|
||||
static inline void os_reltime_age(struct os_reltime *start,
|
||||
struct os_reltime *age)
|
||||
{
|
||||
struct os_reltime now;
|
||||
|
||||
os_get_time((struct os_time *)&now);
|
||||
os_reltime_sub(&now, start, age);
|
||||
}
|
||||
|
||||
|
||||
static inline int os_reltime_expired(struct os_reltime *now,
|
||||
struct os_reltime *ts,
|
||||
os_time_t timeout_secs)
|
||||
{
|
||||
struct os_reltime age;
|
||||
|
||||
os_reltime_sub(now, ts, &age);
|
||||
return (age.sec > timeout_secs) ||
|
||||
(age.sec == timeout_secs && age.usec > 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* os_daemonize - Run in the background (detach from the controlling terminal)
|
||||
* @pid_file: File name to write the process ID to or %NULL to skip this
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*/
|
||||
int os_daemonize(const char *pid_file);
|
||||
|
||||
/**
|
||||
* os_daemonize_terminate - Stop running in the background (remove pid file)
|
||||
* @pid_file: File name to write the process ID to or %NULL to skip this
|
||||
*/
|
||||
void os_daemonize_terminate(const char *pid_file);
|
||||
|
||||
/**
|
||||
* os_get_random - Get cryptographically strong pseudo random data
|
||||
* @buf: Buffer for pseudo random data
|
||||
* @len: Length of the buffer
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*/
|
||||
int os_get_random(unsigned char *buf, size_t len);
|
||||
|
||||
/**
|
||||
* os_random - Get pseudo random value (not necessarily very strong)
|
||||
* Returns: Pseudo random value
|
||||
*/
|
||||
unsigned long os_random(void);
|
||||
|
||||
/**
|
||||
* os_rel2abs_path - Get an absolute path for a file
|
||||
* @rel_path: Relative path to a file
|
||||
* Returns: Absolute path for the file or %NULL on failure
|
||||
*
|
||||
* This function tries to convert a relative path of a file to an absolute path
|
||||
* in order for the file to be found even if current working directory has
|
||||
* changed. The returned value is allocated and caller is responsible for
|
||||
* freeing it. It is acceptable to just return the same path in an allocated
|
||||
* buffer, e.g., return strdup(rel_path). This function is only used to find
|
||||
* configuration files when os_daemonize() may have changed the current working
|
||||
* directory and relative path would be pointing to a different location.
|
||||
*/
|
||||
char * os_rel2abs_path(const char *rel_path);
|
||||
|
||||
/**
|
||||
* os_program_init - Program initialization (called at start)
|
||||
* Returns: 0 on success, -1 on failure
|
||||
*
|
||||
* This function is called when a programs starts. If there are any OS specific
|
||||
* processing that is needed, it can be placed here. It is also acceptable to
|
||||
* just return 0 if not special processing is needed.
|
||||
*/
|
||||
int os_program_init(void);
|
||||
|
||||
/**
|
||||
* os_program_deinit - Program deinitialization (called just before exit)
|
||||
*
|
||||
* This function is called just before a program exists. If there are any OS
|
||||
* specific processing, e.g., freeing resourced allocated in os_program_init(),
|
||||
* it should be done here. It is also acceptable for this function to do
|
||||
* nothing.
|
||||
*/
|
||||
void os_program_deinit(void);
|
||||
|
||||
/**
|
||||
* os_setenv - Set environment variable
|
||||
* @name: Name of the variable
|
||||
* @value: Value to set to the variable
|
||||
* @overwrite: Whether existing variable should be overwritten
|
||||
* Returns: 0 on success, -1 on error
|
||||
*
|
||||
* This function is only used for wpa_cli action scripts. OS wrapper does not
|
||||
* need to implement this if such functionality is not needed.
|
||||
*/
|
||||
int os_setenv(const char *name, const char *value, int overwrite);
|
||||
|
||||
/**
|
||||
* os_unsetenv - Delete environent variable
|
||||
* @name: Name of the variable
|
||||
* Returns: 0 on success, -1 on error
|
||||
*
|
||||
* This function is only used for wpa_cli action scripts. OS wrapper does not
|
||||
* need to implement this if such functionality is not needed.
|
||||
*/
|
||||
int os_unsetenv(const char *name);
|
||||
|
||||
/**
|
||||
* os_readfile - Read a file to an allocated memory buffer
|
||||
* @name: Name of the file to read
|
||||
* @len: For returning the length of the allocated buffer
|
||||
* Returns: Pointer to the allocated buffer or %NULL on failure
|
||||
*
|
||||
* This function allocates memory and reads the given file to this buffer. Both
|
||||
* binary and text files can be read with this function. The caller is
|
||||
* responsible for freeing the returned buffer with os_free().
|
||||
*/
|
||||
char * os_readfile(const char *name, size_t *len);
|
||||
|
||||
//#if 0
|
||||
/**
|
||||
* os_zalloc - Allocate and zero memory
|
||||
* @size: Number of bytes to allocate
|
||||
* Returns: Pointer to allocated and zeroed memory or %NULL on failure
|
||||
*
|
||||
* Caller is responsible for freeing the returned buffer with os_free().
|
||||
*/
|
||||
void * os_zalloc(size_t size);
|
||||
|
||||
/**
|
||||
* os_calloc - Allocate and zero memory for an array
|
||||
* @nmemb: Number of members in the array
|
||||
* @size: Number of bytes in each member
|
||||
* Returns: Pointer to allocated and zeroed memory or %NULL on failure
|
||||
*
|
||||
* This function can be used as a wrapper for os_zalloc(nmemb * size) when an
|
||||
* allocation is used for an array. The main benefit over os_zalloc() is in
|
||||
* having an extra check to catch integer overflows in multiplication.
|
||||
*
|
||||
* Caller is responsible for freeing the returned buffer with os_free().
|
||||
*/
|
||||
static inline void * os_calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
if (size && nmemb > (~(size_t) 0) / size)
|
||||
return NULL;
|
||||
return os_zalloc(nmemb * size);
|
||||
}
|
||||
//#endif
|
||||
|
||||
|
||||
static inline int os_memcmp_const(const void *a, const void *b, size_t len)
|
||||
{
|
||||
const u8 *aa = a;
|
||||
const u8 *bb = b;
|
||||
size_t i;
|
||||
u8 res;
|
||||
|
||||
for (res = 0, i = 0; i < len; i++)
|
||||
res |= aa[i] ^ bb[i];
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* The following functions are wrapper for standard ANSI C or POSIX functions.
|
||||
* By default, they are just defined to use the standard function name and no
|
||||
* os_*.c implementation is needed for them. This avoids extra function calls
|
||||
* by allowing the C pre-processor take care of the function name mapping.
|
||||
*
|
||||
* If the target system uses a C library that does not provide these functions,
|
||||
* build_config.h can be used to define the wrappers to use a different
|
||||
* function name. This can be done on function-by-function basis since the
|
||||
* defines here are only used if build_config.h does not define the os_* name.
|
||||
* If needed, os_*.c file can be used to implement the functions that are not
|
||||
* included in the C library on the target system. Alternatively,
|
||||
* OS_NO_C_LIB_DEFINES can be defined to skip all defines here in which case
|
||||
* these functions need to be implemented in os_*.c file for the target system.
|
||||
*/
|
||||
|
||||
#ifdef OS_NO_C_LIB_DEFINES
|
||||
|
||||
/**
|
||||
* os_malloc - Allocate dynamic memory
|
||||
* @size: Size of the buffer to allocate
|
||||
* Returns: Allocated buffer or %NULL on failure
|
||||
*
|
||||
* Caller is responsible for freeing the returned buffer with os_free().
|
||||
*/
|
||||
void * os_malloc(size_t size);
|
||||
|
||||
/**
|
||||
* os_realloc - Re-allocate dynamic memory
|
||||
* @ptr: Old buffer from os_malloc() or os_realloc()
|
||||
* @size: Size of the new buffer
|
||||
* Returns: Allocated buffer or %NULL on failure
|
||||
*
|
||||
* Caller is responsible for freeing the returned buffer with os_free().
|
||||
* If re-allocation fails, %NULL is returned and the original buffer (ptr) is
|
||||
* not freed and caller is still responsible for freeing it.
|
||||
*/
|
||||
void * os_realloc(void *ptr, size_t size);
|
||||
|
||||
/**
|
||||
* os_free - Free dynamic memory
|
||||
* @ptr: Old buffer from os_malloc() or os_realloc(); can be %NULL
|
||||
*/
|
||||
void os_free(void *ptr);
|
||||
|
||||
/**
|
||||
* os_memcpy - Copy memory area
|
||||
* @dest: Destination
|
||||
* @src: Source
|
||||
* @n: Number of bytes to copy
|
||||
* Returns: dest
|
||||
*
|
||||
* The memory areas src and dst must not overlap. os_memmove() can be used with
|
||||
* overlapping memory.
|
||||
*/
|
||||
void * os_memcpy(void *dest, const void *src, size_t n);
|
||||
|
||||
/**
|
||||
* os_memmove - Copy memory area
|
||||
* @dest: Destination
|
||||
* @src: Source
|
||||
* @n: Number of bytes to copy
|
||||
* Returns: dest
|
||||
*
|
||||
* The memory areas src and dst may overlap.
|
||||
*/
|
||||
void *os_memmove(void *dest, const void *src, size_t n);
|
||||
|
||||
/**
|
||||
* os_memset - Fill memory with a constant byte
|
||||
* @s: Memory area to be filled
|
||||
* @c: Constant byte
|
||||
* @n: Number of bytes started from s to fill with c
|
||||
* Returns: s
|
||||
*/
|
||||
void *os_memset(void *s, int c, size_t n);
|
||||
|
||||
/**
|
||||
* os_memcmp - Compare memory areas
|
||||
* @s1: First buffer
|
||||
* @s2: Second buffer
|
||||
* @n: Maximum numbers of octets to compare
|
||||
* Returns: An integer less than, equal to, or greater than zero if s1 is
|
||||
* found to be less than, to match, or be greater than s2. Only first n
|
||||
* characters will be compared.
|
||||
*/
|
||||
int os_memcmp(const void *s1, const void *s2, size_t n);
|
||||
|
||||
/**
|
||||
* os_strdup - Duplicate a string
|
||||
* @s: Source string
|
||||
* Returns: Allocated buffer with the string copied into it or %NULL on failure
|
||||
*
|
||||
* Caller is responsible for freeing the returned buffer with os_free().
|
||||
*/
|
||||
char *os_strdup(const char *s);
|
||||
|
||||
/**
|
||||
* os_strlen - Calculate the length of a string
|
||||
* @s: '\0' terminated string
|
||||
* Returns: Number of characters in s (not counting the '\0' terminator)
|
||||
*/
|
||||
size_t os_strlen(const char *s);
|
||||
|
||||
/**
|
||||
* os_strcasecmp - Compare two strings ignoring case
|
||||
* @s1: First string
|
||||
* @s2: Second string
|
||||
* Returns: An integer less than, equal to, or greater than zero if s1 is
|
||||
* found to be less than, to match, or be greatred than s2
|
||||
*/
|
||||
int os_strcasecmp(const char *s1, const char *s2);
|
||||
|
||||
/**
|
||||
* os_strncasecmp - Compare two strings ignoring case
|
||||
* @s1: First string
|
||||
* @s2: Second string
|
||||
* @n: Maximum numbers of characters to compare
|
||||
* Returns: An integer less than, equal to, or greater than zero if s1 is
|
||||
* found to be less than, to match, or be greater than s2. Only first n
|
||||
* characters will be compared.
|
||||
*/
|
||||
int os_strncasecmp(const char *s1, const char *s2, size_t n);
|
||||
|
||||
/**
|
||||
* os_strchr - Locate the first occurrence of a character in string
|
||||
* @s: String
|
||||
* @c: Character to search for
|
||||
* Returns: Pointer to the matched character or %NULL if not found
|
||||
*/
|
||||
char *os_strchr(const char *s, int c);
|
||||
|
||||
/**
|
||||
* os_strrchr - Locate the last occurrence of a character in string
|
||||
* @s: String
|
||||
* @c: Character to search for
|
||||
* Returns: Pointer to the matched character or %NULL if not found
|
||||
*/
|
||||
char *os_strrchr(const char *s, int c);
|
||||
|
||||
/**
|
||||
* os_strcmp - Compare two strings
|
||||
* @s1: First string
|
||||
* @s2: Second string
|
||||
* Returns: An integer less than, equal to, or greater than zero if s1 is
|
||||
* found to be less than, to match, or be greatred than s2
|
||||
*/
|
||||
int os_strcmp(const char *s1, const char *s2);
|
||||
|
||||
/**
|
||||
* os_strncmp - Compare two strings
|
||||
* @s1: First string
|
||||
* @s2: Second string
|
||||
* @n: Maximum numbers of characters to compare
|
||||
* Returns: An integer less than, equal to, or greater than zero if s1 is
|
||||
* found to be less than, to match, or be greater than s2. Only first n
|
||||
* characters will be compared.
|
||||
*/
|
||||
int os_strncmp(const char *s1, const char *s2, size_t n);
|
||||
|
||||
/**
|
||||
* os_strncpy - Copy a string
|
||||
* @dest: Destination
|
||||
* @src: Source
|
||||
* @n: Maximum number of characters to copy
|
||||
* Returns: dest
|
||||
*/
|
||||
char *os_strncpy(char *dest, const char *src, size_t n);
|
||||
|
||||
/**
|
||||
* os_strstr - Locate a substring
|
||||
* @haystack: String (haystack) to search from
|
||||
* @needle: Needle to search from haystack
|
||||
* Returns: Pointer to the beginning of the substring or %NULL if not found
|
||||
*/
|
||||
char *os_strstr(const char *haystack, const char *needle);
|
||||
|
||||
/**
|
||||
* os_snprintf - Print to a memory buffer
|
||||
* @str: Memory buffer to print into
|
||||
* @size: Maximum length of the str buffer
|
||||
* @format: printf format
|
||||
* Returns: Number of characters printed (not including trailing '\0').
|
||||
*
|
||||
* If the output buffer is truncated, number of characters which would have
|
||||
* been written is returned. Since some C libraries return -1 in such a case,
|
||||
* the caller must be prepared on that value, too, to indicate truncation.
|
||||
*
|
||||
* Note: Some C library implementations of snprintf() may not guarantee null
|
||||
* termination in case the output is truncated. The OS wrapper function of
|
||||
* os_snprintf() should provide this guarantee, i.e., to null terminate the
|
||||
* output buffer if a C library version of the function is used and if that
|
||||
* function does not guarantee null termination.
|
||||
*
|
||||
* If the target system does not include snprintf(), see, e.g.,
|
||||
* http://www.ijs.si/software/snprintf/ for an example of a portable
|
||||
* implementation of snprintf.
|
||||
*/
|
||||
int os_snprintf(char *str, size_t size, const char *format, ...);
|
||||
|
||||
#else /* OS_NO_C_LIB_DEFINES */
|
||||
|
||||
#if !defined(CONFIG_PLATFORM_8195A) && !defined(CONFIG_PLATFORM_8711B)
|
||||
#ifdef CONFIG_MEM_MONITOR
|
||||
u8* os_malloc(u32 sz);
|
||||
void os_mfree(u8 *pbuf, u32 sz);
|
||||
#ifndef os_free
|
||||
#define os_free(p, sz) os_mfree(((u8*)(p)), (sz))
|
||||
#endif
|
||||
#else
|
||||
#ifndef os_malloc
|
||||
#define os_malloc(sz) _rtw_malloc(sz)
|
||||
#endif
|
||||
#ifndef os_free
|
||||
#define os_free(p, sz) _rtw_mfree(((u8*)(p)), (sz))
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
extern void *os_zalloc(size_t size);
|
||||
extern char *os_strdup(const char *string_copy_from);
|
||||
|
||||
#ifndef os_sleep
|
||||
#define os_sleep(s, us) rtw_mdelay_os((s)*1000 + (us)/1000)
|
||||
#endif
|
||||
#ifndef os_memcpy
|
||||
#define os_memcpy(d, s, n) rtw_memcpy((void*)(d), ((void*)(s)), (n))
|
||||
#endif
|
||||
#ifndef os_memmove
|
||||
#define os_memmove(d, s, n) memmove((d), (s), (n))
|
||||
#endif
|
||||
#ifndef os_memset
|
||||
#define os_memset(pbuf, c, sz) rtw_memset(pbuf, c, sz)
|
||||
#endif
|
||||
#ifndef os_memcmp
|
||||
#define os_memcmp(s1, s2, n) rtw_memcmp(((void*)(s1)), ((void*)(s2)), (n))
|
||||
#endif
|
||||
#ifndef os_memcmp_p2p
|
||||
#define os_memcmp_p2p(s1, s2, n) memcmp((s1), (s2), (n))
|
||||
#endif
|
||||
#ifndef os_get_random_bytes
|
||||
#define os_get_random_bytes(d,sz) rtw_get_random_bytes(((void*)(d)), (sz))
|
||||
#endif
|
||||
#ifndef os_strlen
|
||||
#define os_strlen(s) strlen(s)
|
||||
#endif
|
||||
#ifndef os_strcasecmp
|
||||
#ifdef _MSC_VER
|
||||
#define os_strcasecmp(s1, s2) _stricmp((s1), (s2))
|
||||
#else
|
||||
#define os_strcasecmp(s1, s2) strcasecmp((s1), (s2))
|
||||
#endif
|
||||
#endif
|
||||
#ifndef os_strncasecmp
|
||||
#ifdef _MSC_VER
|
||||
#define os_strncasecmp(s1, s2, n) _strnicmp((s1), (s2), (n))
|
||||
#else
|
||||
#define os_strncasecmp(s1, s2, n) strncasecmp((s1), (s2), (n))
|
||||
#endif
|
||||
#endif
|
||||
#ifndef os_init_timer
|
||||
#define os_init_timer(t, p, f, x, n) rtw_init_timer((t), (p), (f), (x), (n))
|
||||
#endif
|
||||
#ifndef os_set_timer
|
||||
#define os_set_timer(t, d) rtw_set_timer((t), (d))
|
||||
#endif
|
||||
#ifndef os_cancel_timer
|
||||
#define os_cancel_timer(t) rtw_cancel_timer(t)
|
||||
#endif
|
||||
#ifndef os_del_timer
|
||||
#define os_del_timer(t) rtw_del_timer(t)
|
||||
#endif
|
||||
#ifndef os_atoi
|
||||
#define os_atoi(s) rtw_atoi(s)
|
||||
#endif
|
||||
|
||||
#ifndef os_strchr
|
||||
#define os_strchr(s, c) strchr((s), (c))
|
||||
#endif
|
||||
#ifndef os_strcmp
|
||||
#define os_strcmp(s1, s2) strcmp((s1), (s2))
|
||||
#endif
|
||||
#ifndef os_strncmp
|
||||
#define os_strncmp(s1, s2, n) strncmp((s1), (s2), (n))
|
||||
#endif
|
||||
#ifndef os_strncpy
|
||||
#define os_strncpy(d, s, n) strncpy((d), (s), (n))
|
||||
#endif
|
||||
#ifndef os_strrchr
|
||||
#define os_strrchr(s, c) strrchr((s), (c))
|
||||
#endif
|
||||
#ifndef os_strstr
|
||||
#define os_strstr(h, n) strstr((h), (n))
|
||||
#endif
|
||||
|
||||
#ifndef os_snprintf
|
||||
#ifdef _MSC_VER
|
||||
#define os_snprintf _snprintf
|
||||
#else
|
||||
#define os_snprintf snprintf
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* OS_NO_C_LIB_DEFINES */
|
||||
|
||||
|
||||
static inline void * os_realloc_array(void *ptr, size_t nmemb, size_t size)
|
||||
{
|
||||
if (size && nmemb > (~(size_t) 0) / size)
|
||||
return NULL;
|
||||
return os_realloc(ptr, nmemb * size, nmemb * size);
|
||||
}
|
||||
|
||||
void *os_xqueue_create(unsigned long uxQueueLength, unsigned long uxItemSize) ;
|
||||
|
||||
int os_xqueue_receive(xqueue_handle_t xQueue, void * const pvBuffer, unsigned long xSecsToWait);
|
||||
|
||||
void os_xqueue_delete(xqueue_handle_t xQueue );
|
||||
|
||||
int os_xqueue_send(xqueue_handle_t xQueue, const void * const pvItemToQueue, unsigned long xSecsToWait);
|
||||
|
||||
|
||||
#endif /* OS_H */
|
24
project/inc/rtl8195a/rom_wps_os.h
Normal file
24
project/inc/rtl8195a/rom_wps_os.h
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* OS specific functions
|
||||
* Copyright (c) 2005-2009, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef ROM_WPS_OS_H
|
||||
#define ROM_WPS_OS_H
|
||||
|
||||
#if defined(CONFIG_PLATFORM_8195A) || defined(CONFIG_PLATFORM_8711B)
|
||||
|
||||
#include <rom_wlan_ram_map.h>
|
||||
extern struct _rom_wlan_ram_map rom_wlan_ram_map;
|
||||
#define os_malloc(sz) rom_wlan_ram_map.rtw_malloc(sz)
|
||||
#define os_free(p, sz) rom_wlan_ram_map.rtw_mfree(((u8*)(p)), (sz))
|
||||
|
||||
#endif
|
||||
|
||||
extern u8 *WPS_realloc(u8 *old_buf, u32 old_sz, u32 new_sz);
|
||||
#define os_realloc(p, os, ns) WPS_realloc(((u8*)(p)),(os),(ns))
|
||||
|
||||
#endif /* ROM_WPS_OS_H */
|
18
project/inc/rtl8195a/rtl_common.h
Normal file
18
project/inc/rtl8195a/rtl_common.h
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __RTL_COMMON_H__
|
||||
#define __RTL_COMMON_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "c_types.h"
|
||||
|
||||
#include "os.h"
|
||||
//#include "rom_wps_os.h"
|
||||
|
||||
#endif
|
233
project/inc/rtl_bios_data.h
Normal file
233
project/inc/rtl_bios_data.h
Normal file
|
@ -0,0 +1,233 @@
|
|||
/*
|
||||
* rtl_bios_data.h
|
||||
*
|
||||
* Created on: 12/02/2017
|
||||
* Author: pvvx
|
||||
*
|
||||
* This variables declared in ROM code!
|
||||
* Variables use fixed addresses!
|
||||
* (see *.ld script)
|
||||
*/
|
||||
|
||||
#ifndef _RTL_BIOS_DATA_H_
|
||||
#define _RTL_BIOS_DATA_H_
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/reent.h>
|
||||
// component/soc/realtek/common/bsp/
|
||||
#include "basic_types.h"
|
||||
// component/soc/realtek/8195a/fwlib/
|
||||
#include "rtl8195a/rtl8195a.h"
|
||||
#include "hal_gpio.h"
|
||||
#include "hal_irqn.h"
|
||||
#include "hal_timer.h"
|
||||
#include "hal_sdr_controller.h"
|
||||
// component/soc/realtek/8195a/fwlib/
|
||||
#include "ram_lib/wlan/realtek/wlan_ram_map/rom/rom_wlan_ram_map.h"
|
||||
// component/soc/realtek/8195a/misc/driver/
|
||||
#include "rtl_consol.h"
|
||||
// component/soc/realtek/8195a/misc/rtl_std_lib/
|
||||
#include "include/rtl_lib.h"
|
||||
#include "include/rt_lib_rom.h"
|
||||
#include "libc/rom/string/rom_libc_string.h"
|
||||
#include "libgloss/rtl8195a/rom/rom_libgloss_retarget.h"
|
||||
|
||||
//#include "rom/rom_libgloss_retarget.h"
|
||||
|
||||
typedef void (*START_FUNC)(void);
|
||||
|
||||
/* ROM + startup.c */
|
||||
extern IRQ_FUN NewVectorTable[64]; // 10000000
|
||||
extern IRQ_FUN UserIrqFunTable[64]; // 10000100
|
||||
extern u32 UserIrqDataTable[64]; // 10000200
|
||||
|
||||
/* ROM + diag.h */
|
||||
extern u32 CfgSysDebugWarn; // 10000300
|
||||
extern u32 CfgSysDebugInfo; // 10000304
|
||||
extern u32 CfgSysDebugErr; // 10000308
|
||||
extern u32 ConfigDebugWarn; // 1000030c
|
||||
extern u32 ConfigDebugInfo; // 10000310
|
||||
extern u32 ConfigDebugErr; // 10000314
|
||||
|
||||
|
||||
/* ROM + hal_timer.h & .. */
|
||||
extern HAL_TIMER_OP HalTimerOp; // 10000318
|
||||
extern u16 GPIOState[11]; // 10000334 // побитно 16 бит для каждого порта (A..K), бит=номер задействованного пина в порту на периферию.
|
||||
extern u32 gTimerRecord; // 1000034C
|
||||
/* ROM + hal_ssi.h */
|
||||
extern u32 SSI_DBG_CONFIG; // 10000350
|
||||
extern PHAL_GPIO_ADAPTER _pHAL_Gpio_Adapter; // 10000354
|
||||
|
||||
/* ROM + rtl8195a_timer.c */
|
||||
extern IRQ_FUN Timer2To7VectorTable[MAX_TIMER_VECTOR_TABLE_NUM]; // 10000358
|
||||
|
||||
/* ROM + Rand() */
|
||||
extern u32 _rand_z4, _rand_z3, _rand_z2, _rand_z1, _rand_first; // 10000370..
|
||||
|
||||
/* ROM + rtl_consol.c */
|
||||
extern volatile UART_LOG_CTL *pUartLogCtl; // 10000384
|
||||
extern UART_LOG_BUF UartLogBuf; // 10000388
|
||||
extern volatile UART_LOG_CTL UartLogCtl; // 10000408
|
||||
extern u8 UartLogHistoryBuf[UART_LOG_HISTORY_LEN][UART_LOG_CMD_BUFLEN]; // 10000430 UartLogHistoryBuf[5][127] !
|
||||
extern u8 *ArgvArray[MAX_ARGV]; // 100006AC *ArgvArray[10] !
|
||||
|
||||
/* ROM + ?? */
|
||||
extern struct _rom_wlan_ram_map rom_wlan_ram_map; // 100006D4
|
||||
typedef struct _FALSE_ALARM_STATISTICS {
|
||||
u32 Cnt_Parity_Fail;
|
||||
u32 Cnt_Rate_Illegal;
|
||||
u32 Cnt_Crc8_fail;
|
||||
u32 Cnt_Mcs_fail;
|
||||
u32 Cnt_Ofdm_fail;
|
||||
u32 Cnt_Ofdm_fail_pre;
|
||||
u32 Cnt_Cck_fail;
|
||||
u32 Cnt_all;
|
||||
u32 Cnt_Fast_Fsync;
|
||||
u32 Cnt_SB_Search_fail;
|
||||
u32 Cnt_OFDM_CCA;
|
||||
u32 Cnt_CCK_CCA;
|
||||
u32 Cnt_CCA_all;
|
||||
u32 Cnt_BW_USC;
|
||||
u32 Cnt_BW_LSC;
|
||||
} FALSE_ALARM_STATISTICS;
|
||||
extern FALSE_ALARM_STATISTICS FalseAlmCnt; // 100006E0
|
||||
|
||||
typedef struct _rom_info {
|
||||
u8 EEPROMVersion;
|
||||
u8 CrystalCap;
|
||||
u64 DebugComponents;
|
||||
u32 DebugLevel;
|
||||
} ROM_INFO;
|
||||
extern ROM_INFO ROMInfo; // 10000720
|
||||
|
||||
typedef struct _CFO_TRACKING_ {
|
||||
BOOL bATCStatus;
|
||||
BOOL largeCFOHit;
|
||||
BOOL bAdjust;
|
||||
u8 CrystalCap;
|
||||
u8 DefXCap;
|
||||
u32 CFO_tail[2];
|
||||
u32 CFO_ave_pre;
|
||||
u32 packetCount;
|
||||
u32 packetCount_pre;
|
||||
BOOL bForceXtalCap;
|
||||
BOOL bReset;
|
||||
u8 CFO_TH_XTAL_HIGH;
|
||||
u8 CFO_TH_XTAL_LOW;
|
||||
u8 CFO_TH_ATC;
|
||||
}CFO_TRACKING;
|
||||
extern CFO_TRACKING DM_CfoTrack; // 10000738
|
||||
|
||||
/* in rom_libgloss_retarget.h
|
||||
struct _rom_libgloss_ram_map {
|
||||
int (*libgloss_close)(int fildes);
|
||||
int (*libgloss_fstat)(int fildes , struct stat *st);
|
||||
int (*libgloss_isatty)(int file);
|
||||
int (*libgloss_lseek)(int file , int ptr , int dir);
|
||||
int (*libgloss_open)(char *file , int flags , int mode);
|
||||
int (*libgloss_read)(int file , char *ptr , int len);
|
||||
int (*libgloss_write)(int file , const char *ptr , int len);
|
||||
void* (*libgloss_sbrk)(int incr);
|
||||
};
|
||||
*/
|
||||
extern struct _rom_libgloss_ram_map rom_libgloss_ram_map; // 10000760
|
||||
struct malloc_chunk
|
||||
{
|
||||
size_t prev_size;
|
||||
size_t size;
|
||||
struct malloc_chunk *fd;
|
||||
struct malloc_chunk *bk;
|
||||
};
|
||||
extern struct malloc_chunk * __rtl_malloc_av_[258]; // 10000780 __rom_mallocr_init_v1_00(), _rtl_free_r_v1_00()..
|
||||
extern u32 __rtl_malloc_trim_threshold; // 10000b88 __rom_mallocr_init_v1_00()
|
||||
extern u32 __rtl_malloc_top_pad; // 10000b8c __rom_mallocr_init_v1_00()
|
||||
extern u8 * __rtl_malloc_sbrk_base; // 10000b90 __rom_mallocr_init_v1_00()
|
||||
extern u32 __rtl_malloc_max_sbrked_mem; // 10000b94 __rom_mallocr_init_v1_00()
|
||||
extern u32 __rtl_malloc_max_total_mem; // 10000b98 __rom_mallocr_init_v1_00()
|
||||
struct mallinfo
|
||||
{
|
||||
int arena;
|
||||
int ordblks;
|
||||
int smblks;
|
||||
int hblks;
|
||||
int hblkhd;
|
||||
int usmblks;
|
||||
int fsmblks;
|
||||
int uordblks;
|
||||
int fordblks;
|
||||
int keepcost;
|
||||
};
|
||||
extern struct mallinfo __rtl_malloc_current_mallinfo; // 10000b9c __rom_mallocr_init_v1_00()
|
||||
|
||||
/* IMAGE1 HEAD: ROM + startup.c (bootloader) */
|
||||
extern RAM_START_FUNCTION gRamStartFun; // 10000bc8 = { PreProcessForVendor + 1 };
|
||||
extern RAM_START_FUNCTION gRamPatchWAKE; // 10000bcc = { RtlBootToSram + 1 };
|
||||
extern RAM_START_FUNCTION gRamPatchFun0; // 10000bd0 = { RtlBootToSram + 1 };
|
||||
extern RAM_START_FUNCTION gRamPatchFun1; // 10000bd4 = { RtlBootToSram + 1 };
|
||||
extern RAM_START_FUNCTION gRamPatchFun2; // 10000bd8 = { RtlBootToSram + 1 };
|
||||
extern uint8 RAM_IMG1_VALID_PATTEN[8]; // 10000bdc = { 0x23, 0x79, 0x16, 0x88, 0xff, 0xff, 0xff, 0xff };
|
||||
|
||||
/* ROM + hal_sdr_controller.c */
|
||||
extern u32 rand_x; // 10000be4: ChangeRandSeed_rom(), Sdr_Rand2_rom()
|
||||
#define REC_NUM 512
|
||||
extern u32 AvaWds[2][REC_NUM]; // 10000be8
|
||||
extern DRAM_DEVICE_INFO SdrDramInfo; // 10001be8
|
||||
#define DRAM_DEVICE_INFO_INIT() { \
|
||||
&SdrDramDev, \
|
||||
&SdrDramModeReg, \
|
||||
&SdrDramTiming, \
|
||||
DRAM_TIMING_TCK, \
|
||||
DFI_RATIO_1 }
|
||||
extern DRAM_TIMING_INFO SdrDramTiming; // 10001bfc
|
||||
#define DRAM_TIMING_INFO_INIT() { \
|
||||
DRAM_TIMING_TRFC, /* TrfcPs; */ \
|
||||
DRAM_TIMING_TREFI, /* TrefiPs; */ \
|
||||
DRAM_TIMING_TWRMAXTCK, /* WrMaxTck; */\
|
||||
DRAM_TIMING_TRCD, /* TrcdPs; */ \
|
||||
DRAM_TIMING_TRP, /* TrpPs; */ \
|
||||
DRAM_TIMING_TRAS, /* TrasPs; */ \
|
||||
DRAM_TIMING_TRRD, /* TrrdTck; */ \
|
||||
DRAM_TIMING_TWR, /* TwrPs; */ \
|
||||
DRAM_TIMING_TWTR, /* TwtrTck; */ \
|
||||
/* 13090, */ /* TrtpPs; */ \
|
||||
DRAM_TIMING_TMRD, /* TmrdTck; */ \
|
||||
DRAM_TIMING_TRTP, /* TrtpTck; */ \
|
||||
DRAM_TIMING_TCCD, /* TccdTck; */ \
|
||||
DRAM_TIMING_TRC } /* TrcPs; */
|
||||
extern DRAM_MODE_REG_INFO SdrDramModeReg; // 10001c30
|
||||
#define DRAM_MODE_REG_INFO_INIT() { \
|
||||
BST_LEN_4, \
|
||||
SENQUENTIAL, \
|
||||
0x3, /* Mode0Cas: 3 */ \
|
||||
0x0, /* Mode0Wr */ \
|
||||
0, /* Mode1DllEnN */ \
|
||||
0, /* Mode1AllLat */ \
|
||||
0 } /* Mode2Cwl */
|
||||
extern DRAM_INFO SdrDramDev; // 10001c4c
|
||||
#define DRAM_INFO_INIT() { DRAM_INFO_TYPE, DRAM_INFO_COL_ADDR_WTH,DRAM_INFO_BANK_SZ, DRAM_INFO_DQ_WTH }
|
||||
//extern SPIC_INIT_PARA SpicInitParaAllClk[SpicMaxMode][CPU_CLK_TYPE_NO]; // SpicInitParaAllClk[3][6] !
|
||||
|
||||
/* ROM + "C" standard library */
|
||||
extern struct _reent * _rtl_impure_ptr; // 10001c60 = { &impure_reent };
|
||||
extern struct _reent impure_reent; // 10001c68 = _REENT_INIT(impure_reent);
|
||||
|
||||
/* ROM ? UserData? */
|
||||
extern u32 _rom_unc_data[9]; // 100020e8
|
||||
|
||||
/* ROM + hal_sdr_controller.c: Sdr_Rand2() */
|
||||
extern u32 _sdr_rnd2_c, _sdr_rnd2_z, _sdr_rnd2_y; // 100020BC, 100020B8, 100020B4
|
||||
|
||||
/* *.ld */
|
||||
extern u8 __rom_bss_start__, __rom_bss_end__;
|
||||
extern u8 __image1_bss_start__, __image1_bss_end__;
|
||||
extern START_FUNC __image2_entry_func__;
|
||||
//extern RAM_START_FUNCTION __image2_entry_func__;
|
||||
extern u8 __image2_validate_code__;
|
||||
|
||||
#ifndef STACK_TOP
|
||||
#define STACK_TOP 0x1ffffffc
|
||||
#endif
|
||||
|
||||
#endif /* _RTL_BIOS_DATA_H_ */
|
86
project/inc/user/atcmd_user.h
Normal file
86
project/inc/user/atcmd_user.h
Normal file
|
@ -0,0 +1,86 @@
|
|||
#ifndef __ATCMD_USR_H__
|
||||
#define __ATCMD_USR_H__
|
||||
#include <platform_opts.h>
|
||||
#ifdef CONFIG_AT_USR
|
||||
#include "main.h"
|
||||
#include "lwip_netconf.h"
|
||||
|
||||
#ifndef WLAN0_NAME
|
||||
#define WLAN0_NAME "wlan0"
|
||||
#endif
|
||||
#ifndef WLAN1_NAME
|
||||
#define WLAN1_NAME "wlan1"
|
||||
#endif
|
||||
/* Give default value if not defined */
|
||||
#ifndef NET_IF_NUM
|
||||
#ifdef CONFIG_CONCURRENT_MODE
|
||||
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN) + 1)
|
||||
#else
|
||||
#define NET_IF_NUM ((CONFIG_ETHERNET) + (CONFIG_WLAN))
|
||||
#endif // end of CONFIG_CONCURRENT_MODE
|
||||
#endif // end of NET_IF_NUM
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#ifndef IP_ADDR0
|
||||
#define IP_ADDR0 192
|
||||
#define IP_ADDR1 168
|
||||
#define IP_ADDR2 3
|
||||
#define IP_ADDR3 80
|
||||
#endif
|
||||
|
||||
/*NETMASK*/
|
||||
#ifndef NETMASK_ADDR0
|
||||
#define NETMASK_ADDR0 255
|
||||
#define NETMASK_ADDR1 255
|
||||
#define NETMASK_ADDR2 255
|
||||
#define NETMASK_ADDR3 0
|
||||
#endif
|
||||
|
||||
/*Gateway Address*/
|
||||
#ifndef GW_ADDR0
|
||||
#define GW_ADDR0 192
|
||||
#define GW_ADDR1 168
|
||||
#define GW_ADDR2 3
|
||||
#define GW_ADDR3 1
|
||||
#endif
|
||||
|
||||
/*Static IP ADDRESS*/
|
||||
#ifndef AP_IP_ADDR0
|
||||
#define AP_IP_ADDR0 192
|
||||
#define AP_IP_ADDR1 168
|
||||
#define AP_IP_ADDR2 43
|
||||
#define AP_IP_ADDR3 1
|
||||
#endif
|
||||
|
||||
/*NETMASK*/
|
||||
#ifndef AP_NETMASK_ADDR0
|
||||
#define AP_NETMASK_ADDR0 255
|
||||
#define AP_NETMASK_ADDR1 255
|
||||
#define AP_NETMASK_ADDR2 255
|
||||
#define AP_NETMASK_ADDR3 0
|
||||
#endif
|
||||
|
||||
/*Gateway Address*/
|
||||
#ifndef AP_GW_ADDR0
|
||||
#define AP_GW_ADDR0 192
|
||||
#define AP_GW_ADDR1 168
|
||||
#define AP_GW_ADDR2 43
|
||||
#define AP_GW_ADDR3 1
|
||||
#endif
|
||||
|
||||
|
||||
#define at_printf(fmt, args...) do{printf(fmt, ##args);}while(0)
|
||||
#define at_print_data(data, size) do{__rtl_memDump(data, size, NULL);}while(0)
|
||||
|
||||
typedef struct _USR_server_setings
|
||||
{
|
||||
u16 port;
|
||||
u8 url[128];
|
||||
} ext_server_setings;
|
||||
|
||||
extern ext_server_setings ext_serv;
|
||||
extern void at_USR_init(void);
|
||||
|
||||
#endif // CONFIG_AT_USR
|
||||
|
||||
#endif // __ATCMD_WIFI_H__
|
531
project/src/user/atcmd_user.c
Normal file
531
project/src/user/atcmd_user.c
Normal file
|
@ -0,0 +1,531 @@
|
|||
#include <platform_opts.h>
|
||||
|
||||
#ifdef CONFIG_AT_USR
|
||||
|
||||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "semphr.h"
|
||||
#include "at_cmd/log_service.h"
|
||||
#include "at_cmd/atcmd_wifi.h"
|
||||
#include <lwip_netconf.h>
|
||||
#include "tcpip.h"
|
||||
#include <dhcp/dhcps.h>
|
||||
#include <wifi/wifi_conf.h>
|
||||
#include <wifi/wifi_util.h>
|
||||
#include "tcm_heap.h"
|
||||
#include "user/atcmd_user.h"
|
||||
|
||||
#include "sleep_ex_api.h"
|
||||
|
||||
//#include "lwip/err.h"
|
||||
//#include "arch/cc.h"
|
||||
//#include "lwip/mem.h"
|
||||
//#include "lwip/tcp.h"
|
||||
#include "lwip/tcp_impl.h"
|
||||
//#include "lwip/udp.h"
|
||||
|
||||
rtw_mode_t wifi_mode = RTW_MODE_STA;
|
||||
ext_server_setings ext_serv = {0,{0}}; //{ PLAY_PORT, { PLAY_SERVER }};
|
||||
|
||||
#define DEBUG_AT_USER_LEVEL 1
|
||||
|
||||
/******************************************************************************/
|
||||
/*
|
||||
#define _AT_WLAN_SET_SSID_ "ATW0"
|
||||
#define _AT_WLAN_SET_PASSPHRASE_ "ATW1"
|
||||
#define _AT_WLAN_SET_KEY_ID_ "ATW2"
|
||||
#define _AT_WLAN_JOIN_NET_ "ATWC"
|
||||
#define _AT_WLAN_SET_MP3_URL_ "ATWS"
|
||||
*/
|
||||
//extern struct netif xnetif[NET_IF_NUM];
|
||||
|
||||
/* fastconnect use wifi AT command. Not init_wifi_struct when log service disabled
|
||||
* static initialize all values for using fastconnect when log service disabled
|
||||
*/
|
||||
static rtw_network_info_t wifi = {
|
||||
{0}, // ssid
|
||||
{0}, // bssid
|
||||
0, // security
|
||||
NULL, // password
|
||||
0, // password len
|
||||
-1 // key id
|
||||
};
|
||||
|
||||
static rtw_ap_info_t ap = {0};
|
||||
static unsigned char password[65] = {0};
|
||||
|
||||
int connect_cfg_read(void)
|
||||
{
|
||||
bzero(&ext_serv, sizeof(ext_serv));
|
||||
if(flash_read_cfg(&ext_serv, 0x5000, sizeof(ext_serv)) >= sizeof(ext_serv.port) + 2) {
|
||||
ext_serv.port = 10201;
|
||||
strcpy(ext_serv.url, "sesp8266/test.mp3");
|
||||
}
|
||||
return ext_serv.port;
|
||||
}
|
||||
|
||||
|
||||
_WEAK void connect_start(void)
|
||||
{
|
||||
#ifdef CONFIG_DEBUG_LOG
|
||||
printf("Time at start %d ms.\n", xTaskGetTickCount());
|
||||
#endif
|
||||
}
|
||||
|
||||
_WEAK void connect_close(void)
|
||||
{
|
||||
}
|
||||
|
||||
static void init_wifi_struct(void)
|
||||
{
|
||||
memset(wifi.ssid.val, 0, sizeof(wifi.ssid.val));
|
||||
memset(wifi.bssid.octet, 0, ETH_ALEN);
|
||||
memset(password, 0, sizeof(password));
|
||||
wifi.ssid.len = 0;
|
||||
wifi.password = NULL;
|
||||
wifi.password_len = 0;
|
||||
wifi.key_id = -1;
|
||||
memset(ap.ssid.val, 0, sizeof(ap.ssid.val));
|
||||
ap.ssid.len = 0;
|
||||
ap.password = NULL;
|
||||
ap.password_len = 0;
|
||||
ap.channel = 1;
|
||||
}
|
||||
|
||||
void fATW0(void *arg){
|
||||
if(!arg){
|
||||
printf("ATW0: Usage: ATW0=SSID\n");
|
||||
goto exit;
|
||||
}
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATW0: %s\n", (char*)arg);
|
||||
#endif
|
||||
strcpy((char *)wifi.ssid.val, (char*)arg);
|
||||
wifi.ssid.len = strlen((char*)arg);
|
||||
exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void fATW1(void *arg){
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATW1: %s\n", (char*)arg);
|
||||
#endif
|
||||
strcpy((char *)password, (char*)arg);
|
||||
wifi.password = password;
|
||||
wifi.password_len = strlen((char*)arg);
|
||||
return;
|
||||
}
|
||||
|
||||
void fATW2(void *arg){
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATW2: %s\n", (char*)arg);
|
||||
#endif
|
||||
if((strlen((const char *)arg) != 1 ) || (*(char*)arg <'0' ||*(char*)arg >'3')) {
|
||||
printf("ATW2: Wrong WEP key id. Must be one of 0,1,2, or 3.\n");
|
||||
return;
|
||||
}
|
||||
wifi.key_id = atoi((const char *)(arg));
|
||||
return;
|
||||
}
|
||||
|
||||
// Test
|
||||
void fATST(void *arg){
|
||||
extern u8 __HeapLimit, __StackTop;
|
||||
extern struct Heap g_tcm_heap;
|
||||
//DBG_INFO_MSG_ON(_DBG_TCM_HEAP_); // On Debug TCM MEM
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATST: Mem info:\n");
|
||||
#endif
|
||||
// vPortFree(pvPortMalloc(4)); // Init RAM heap
|
||||
printf("\nCLK CPU\t\t%d Hz\nRAM heap\t%d bytes\nTCM heap\t%d bytes\n",
|
||||
HalGetCpuClk(), xPortGetFreeHeapSize(), tcm_heap_freeSpace());
|
||||
dump_mem_block_list();
|
||||
u32 saved = ConfigDebugInfo;
|
||||
DBG_INFO_MSG_ON(_DBG_TCM_HEAP_); // On Debug TCM MEM
|
||||
tcm_heap_dump();
|
||||
ConfigDebugInfo = saved;
|
||||
printf("\n");
|
||||
#if (configGENERATE_RUN_TIME_STATS == 1)
|
||||
char *cBuffer = pvPortMalloc(512);
|
||||
if(cBuffer != NULL) {
|
||||
vTaskGetRunTimeStats((char *)cBuffer);
|
||||
printf("%s", cBuffer);
|
||||
}
|
||||
vPortFree(cBuffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Set server, Close connect
|
||||
void fATWS(void *arg){
|
||||
int argc = 0;
|
||||
char *argv[MAX_ARGC] = {0};
|
||||
if(arg) {
|
||||
argc = parse_param(arg, argv);
|
||||
if (argc == 2) {
|
||||
if(argv[1][0] == '?') {
|
||||
printf("ATWS: %s,%d\n", ext_serv.url, ext_serv.port);
|
||||
return;
|
||||
}
|
||||
else if(strcmp(argv[1], "open") == 0) {
|
||||
printf("ATWS: open %s:%d\n", ext_serv.url, ext_serv.port);
|
||||
connect_close();
|
||||
return;
|
||||
}
|
||||
else if(strcmp(argv[1], "close") == 0) {
|
||||
printf("ATWS: close\n");
|
||||
connect_close();
|
||||
return;
|
||||
}
|
||||
else if(strcmp(argv[1], "read") == 0) {
|
||||
connect_cfg_read();
|
||||
connect_start();
|
||||
return;
|
||||
}
|
||||
else if(strcmp(argv[1], "save") == 0) {
|
||||
printf("ATWS: %s,%d\n", ext_serv.url, ext_serv.port);
|
||||
if(flash_write_cfg(&ext_serv, 0x5000, strlen(ext_serv.port) + strlen(ext_serv.url)))
|
||||
printf("ATWS: saved\n", ext_serv.url, ext_serv.port);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (argc >= 3 ) {
|
||||
strcpy((char *)ext_serv.url, (char*)argv[1]);
|
||||
ext_serv.port = atoi((char*)argv[2]);
|
||||
printf("ATWS: %s,%d\r\n", ext_serv.url, ext_serv.port);
|
||||
connect_start();
|
||||
return;
|
||||
}
|
||||
}
|
||||
printf("ATWS: Usage: ATWS=URL,PORT or ATWS=close, ATWS=read, ATWS=save\n");
|
||||
}
|
||||
|
||||
|
||||
void fATWC(void *arg){
|
||||
int mode, ret;
|
||||
unsigned long tick1 = xTaskGetTickCount();
|
||||
unsigned long tick2, tick3;
|
||||
char empty_bssid[6] = {0}, assoc_by_bssid = 0;
|
||||
|
||||
connect_close();
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATWC: Connect to AP...\n");
|
||||
#endif
|
||||
if(memcmp (wifi.bssid.octet, empty_bssid, 6))
|
||||
assoc_by_bssid = 1;
|
||||
else if(wifi.ssid.val[0] == 0){
|
||||
printf("ATWC: Error: SSID can't be empty\n");
|
||||
ret = RTW_BADARG;
|
||||
goto EXIT;
|
||||
}
|
||||
if(wifi.password != NULL){
|
||||
if((wifi.key_id >= 0)&&(wifi.key_id <= 3)) {
|
||||
wifi.security_type = RTW_SECURITY_WEP_PSK;
|
||||
}
|
||||
else{
|
||||
wifi.security_type = RTW_SECURITY_WPA2_AES_PSK;
|
||||
}
|
||||
}
|
||||
else{
|
||||
wifi.security_type = RTW_SECURITY_OPEN;
|
||||
}
|
||||
//Check if in AP mode
|
||||
wext_get_mode(WLAN0_NAME, &mode);
|
||||
if(mode == IW_MODE_MASTER) {
|
||||
dhcps_deinit();
|
||||
wifi_off();
|
||||
vTaskDelay(wifi_test_timeout_step_ms/portTICK_RATE_MS);
|
||||
if (wifi_on(RTW_MODE_STA) < 0){
|
||||
printf("ERROR: Wifi on failed!\n");
|
||||
ret = RTW_ERROR;
|
||||
goto EXIT;
|
||||
}
|
||||
}
|
||||
|
||||
///wifi_set_channel(1);
|
||||
|
||||
if(assoc_by_bssid){
|
||||
printf("Joining BSS by BSSID "MAC_FMT" ...\n", MAC_ARG(wifi.bssid.octet));
|
||||
ret = wifi_connect_bssid(wifi.bssid.octet, (char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password,
|
||||
ETH_ALEN, wifi.ssid.len, wifi.password_len, wifi.key_id, NULL);
|
||||
} else {
|
||||
printf("Joining BSS by SSID %s...\n", (char*)wifi.ssid.val);
|
||||
ret = wifi_connect((char*)wifi.ssid.val, wifi.security_type, (char*)wifi.password, wifi.ssid.len,
|
||||
wifi.password_len, wifi.key_id, NULL);
|
||||
}
|
||||
|
||||
if(ret!= RTW_SUCCESS){
|
||||
printf("ERROR: Can't connect to AP\n");
|
||||
goto EXIT;
|
||||
}
|
||||
tick2 = xTaskGetTickCount();
|
||||
printf("Connected after %dms\n", (tick2-tick1));
|
||||
/* Start DHCPClient */
|
||||
LwIP_DHCP(0, DHCP_START);
|
||||
tick3 = xTaskGetTickCount();
|
||||
printf("Got IP after %dms\n", (tick3-tick1));
|
||||
printf("\n\r");
|
||||
//#if CONFIG_WLAN_CONNECT_CB
|
||||
connect_start();
|
||||
EXIT:
|
||||
init_wifi_struct( );
|
||||
}
|
||||
|
||||
void fATWD(void *arg){
|
||||
int timeout = wifi_test_timeout_ms/wifi_test_timeout_step_ms;;
|
||||
char essid[33];
|
||||
int ret = RTW_SUCCESS;
|
||||
|
||||
connect_close();
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATWD: Disconnect...\n");
|
||||
#endif
|
||||
printf("Deassociating AP ...\n");
|
||||
if(wext_get_ssid(WLAN0_NAME, (unsigned char *) essid) < 0) {
|
||||
printf("WIFI disconnected\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if((ret = wifi_disconnect()) < 0) {
|
||||
printf("ERROR: Operation failed!\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
if(wext_get_ssid(WLAN0_NAME, (unsigned char *) essid) < 0) {
|
||||
printf("WIFI disconnected\n");
|
||||
break;
|
||||
}
|
||||
|
||||
if(timeout == 0) {
|
||||
printf("ERROR: Deassoc timeout!\n");
|
||||
ret = RTW_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
|
||||
vTaskDelay(wifi_test_timeout_step_ms/portTICK_RATE_MS);
|
||||
timeout --;
|
||||
}
|
||||
printf("\n\r");
|
||||
exit:
|
||||
init_wifi_struct( );
|
||||
return;
|
||||
}
|
||||
|
||||
// Dump register
|
||||
void fATSD(void *arg)
|
||||
{
|
||||
int argc = 0;
|
||||
char *argv[MAX_ARGC] = {0};
|
||||
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATSD: dump registers\n");
|
||||
#endif
|
||||
if(!arg){
|
||||
printf("ATSD: Usage: ATSD=REGISTER");
|
||||
return;
|
||||
}
|
||||
argc = parse_param(arg, argv);
|
||||
if(argc == 2 || argc == 3)
|
||||
CmdDumpWord(argc-1, (unsigned char**)(argv+1));
|
||||
}
|
||||
|
||||
void fATSW(void *arg)
|
||||
{
|
||||
int argc = 0;
|
||||
char *argv[MAX_ARGC] = {0};
|
||||
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATSW: write register\n");
|
||||
#endif
|
||||
if(!arg){
|
||||
printf("ATSW: Usage: ATSW=REGISTER,DATA");
|
||||
return;
|
||||
}
|
||||
argc = parse_param(arg, argv);
|
||||
if(argc == 2 || argc == 3)
|
||||
CmdWriteWord(argc-1, (unsigned char**)(argv+1));
|
||||
}
|
||||
|
||||
// Close connections
|
||||
void fATOF(void *arg)
|
||||
{
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATOF: Close connections...\n");
|
||||
#endif
|
||||
connect_close();
|
||||
}
|
||||
|
||||
// Open connections
|
||||
void fATON(void *arg)
|
||||
{
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATON: Open connections...\n");
|
||||
#endif
|
||||
connect_start();
|
||||
}
|
||||
|
||||
/* Get one byte from the 4-byte address */
|
||||
#define ip4_addr1(ipaddr) (((u8_t*)(ipaddr))[0])
|
||||
#define ip4_addr2(ipaddr) (((u8_t*)(ipaddr))[1])
|
||||
#define ip4_addr3(ipaddr) (((u8_t*)(ipaddr))[2])
|
||||
#define ip4_addr4(ipaddr) (((u8_t*)(ipaddr))[3])
|
||||
/* These are cast to u16_t, with the intent that they are often arguments
|
||||
* to printf using the U16_F format from cc.h. */
|
||||
#define ip4_addr1_16(ipaddr) ((u16_t)ip4_addr1(ipaddr))
|
||||
#define ip4_addr2_16(ipaddr) ((u16_t)ip4_addr2(ipaddr))
|
||||
#define ip4_addr3_16(ipaddr) ((u16_t)ip4_addr3(ipaddr))
|
||||
#define ip4_addr4_16(ipaddr) ((u16_t)ip4_addr4(ipaddr))
|
||||
|
||||
#define IP2STR(ipaddr) ip4_addr1_16(ipaddr), \
|
||||
ip4_addr2_16(ipaddr), \
|
||||
ip4_addr3_16(ipaddr), \
|
||||
ip4_addr4_16(ipaddr)
|
||||
|
||||
#define IPSTR "%d.%d.%d.%d"
|
||||
|
||||
extern const char * const tcp_state_str[];
|
||||
/*
|
||||
static const char * const tcp_state_str[] = {
|
||||
"CLOSED",
|
||||
"LISTEN",
|
||||
"SYN_SENT",
|
||||
"SYN_RCVD",
|
||||
"ESTABLISHED",
|
||||
"FIN_WAIT_1",
|
||||
"FIN_WAIT_2",
|
||||
"CLOSE_WAIT",
|
||||
"CLOSING",
|
||||
"LAST_ACK",
|
||||
"TIME_WAIT"
|
||||
};
|
||||
*/
|
||||
/******************************************************************************
|
||||
* FunctionName : debug
|
||||
* Parameters :
|
||||
* Returns :
|
||||
*******************************************************************************/
|
||||
void print_udp_pcb(void)
|
||||
{
|
||||
struct udp_pcb *pcb;
|
||||
bool prt_none = true;
|
||||
rtl_printf("UDP pcbs:\n");
|
||||
for(pcb = udp_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||
rtl_printf("flg:%02x\t" IPSTR ":%d\t" IPSTR ":%d\trecv:%p\n", pcb->flags, IP2STR(&pcb->local_ip), pcb->local_port, IP2STR(&pcb->remote_ip), pcb->remote_port, pcb->recv );
|
||||
prt_none = false;
|
||||
}
|
||||
if(prt_none) rtl_printf("none\n");
|
||||
}
|
||||
/******************************************************************************
|
||||
* FunctionName : debug
|
||||
* Parameters :
|
||||
* Returns :
|
||||
*******************************************************************************/
|
||||
void print_tcp_pcb(void)
|
||||
{
|
||||
struct tcp_pcb *pcb;
|
||||
rtl_printf("Active PCB states:\n");
|
||||
bool prt_none = true;
|
||||
for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||
rtl_printf("Port %d|%d\tflg:%02x\ttmr:%p\t%s\n", pcb->local_port, pcb->remote_port, pcb->flags, pcb->tmr, tcp_state_str[pcb->state]);
|
||||
prt_none = false;
|
||||
}
|
||||
if(prt_none) rtl_printf("none\n");
|
||||
rtl_printf("Listen PCB states:\n");
|
||||
prt_none = true;
|
||||
for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next) {
|
||||
rtl_printf("Port %d|%d\tflg:%02x\ttmr:%p\t%s\n", pcb->local_port, pcb->remote_port, pcb->flags, pcb->tmr, tcp_state_str[pcb->state]);
|
||||
prt_none = false;
|
||||
}
|
||||
if(prt_none) rtl_printf("none\n");
|
||||
rtl_printf("TIME-WAIT PCB states:\n");
|
||||
prt_none = true;
|
||||
for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next) {
|
||||
rtl_printf("Port %d|%d\tflg:%02x\ttmr:%p\t%s\n", pcb->local_port, pcb->remote_port, pcb->flags, pcb->tmr, tcp_state_str[pcb->state]);
|
||||
prt_none = false;
|
||||
}
|
||||
if(prt_none) rtl_printf("none\n");
|
||||
}
|
||||
/******************************************************************************
|
||||
* FunctionName : debug
|
||||
* Parameters :
|
||||
* Returns :
|
||||
*******************************************************************************/
|
||||
//------------------------------------------------------------------------------
|
||||
void fATLW(void *arg) // Info Lwip
|
||||
{
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATLW: Lwip pcb Info\n");
|
||||
#endif
|
||||
print_udp_pcb();
|
||||
print_tcp_pcb();
|
||||
}
|
||||
|
||||
void fATDS(void *arg) // Deep sleep
|
||||
{
|
||||
#if DEBUG_AT_USER_LEVEL > 1
|
||||
printf("ATDS: Deep sleep\n");
|
||||
#endif
|
||||
/*
|
||||
// turn off log uart
|
||||
sys_log_uart_off();
|
||||
// initialize wakeup pin at PB_1
|
||||
gpio_t gpio_wake;
|
||||
gpio_init(&gpio_wake, PB_1);
|
||||
gpio_dir(&gpio_wake, PIN_INPUT);
|
||||
gpio_mode(&gpio_wake, PullDown);
|
||||
|
||||
// enter deep sleep
|
||||
deepsleep_ex(DSLEEP_WAKEUP_BY_GPIO | DSLEEP_WAKEUP_BY_TIMER, 10000); */
|
||||
deepsleep_ex(DSLEEP_WAKEUP_BY_TIMER, 10000);
|
||||
|
||||
// standby_wakeup_event_add(STANDBY_WAKEUP_BY_STIMER, 10000, 0);
|
||||
// deepstandby_ex();
|
||||
|
||||
// sleep_ex(SLEEP_WAKEUP_BY_STIMER, 8000); // sleep_ex can't be put in irq handler
|
||||
// release_wakelock(WAKELOCK_OS);
|
||||
}
|
||||
|
||||
|
||||
void print_wlan_help(void *arg){
|
||||
printf("WLAN AT COMMAND SET:\n");
|
||||
printf("==============================\n");
|
||||
printf(" Set MP3 server\n");
|
||||
printf("\t# ATWS=URL,PATH,PORT\n");
|
||||
printf("\tSample:\tATWS=icecast.omroep.nl/3fm-sb-mp3,80\n");
|
||||
printf("\t\tATWS=meuk.spritesserver.nl/Ii.Romanzeandante.mp3,80\n");
|
||||
printf("\t\tATWS=?, ATWS=close, ATWS=save, ATWS=read\n");
|
||||
printf(" Connect to an AES AP\n");
|
||||
printf("\t# ATW0=SSID\n");
|
||||
printf("\t# ATW1=PASSPHRASE\n");
|
||||
printf("\t# ATWC\n");
|
||||
printf(" DisConnect AP\n");
|
||||
printf("\t# ATWD\n");
|
||||
}
|
||||
|
||||
log_item_t at_user_items[ ] = {
|
||||
{"ATW0", fATW0,},
|
||||
{"ATW1", fATW1,},
|
||||
{"ATW2", fATW2,},
|
||||
{"ATWC", fATWC,},
|
||||
{"ATST", fATST,},
|
||||
{"ATDS", fATDS,},
|
||||
{"ATLW", fATLW,}, // Info Lwip
|
||||
{"ATSD", fATSD,}, // Dump register
|
||||
{"ATSW", fATSW,}, // Set register
|
||||
{"ATWD", fATWD,}, //
|
||||
{"ATWS", fATWS,}, // MP3 Set server, Close connect
|
||||
{"ATOF", fATOF,}, // Close connections
|
||||
{"ATON", fATON,}, // Open connections
|
||||
};
|
||||
|
||||
|
||||
void at_user_init(void)
|
||||
{
|
||||
init_wifi_struct();
|
||||
connect_cfg_read();
|
||||
log_service_add_table(at_user_items, sizeof(at_user_items)/sizeof(at_user_items[0]));
|
||||
}
|
||||
|
||||
log_module_init(at_user_init);
|
||||
|
||||
#endif //#ifdef CONFIG_AT_USR
|
115
project/src/user/main.c
Normal file
115
project/src/user/main.c
Normal file
|
@ -0,0 +1,115 @@
|
|||
#include "FreeRTOS.h"
|
||||
#include "task.h"
|
||||
#include "diag.h"
|
||||
#include "main.h"
|
||||
#include <example_entry.h>
|
||||
#include "user/atcmd_user.h"
|
||||
|
||||
#include "rtl8195a.h"
|
||||
|
||||
#ifdef CONFIG_DEBUG_LOG
|
||||
#define DEBUG_MAIN_LEVEL CONFIG_DEBUG_LOG
|
||||
#else
|
||||
#define DEBUG_MAIN_LEVEL 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_WLAN_CONNECT_CB
|
||||
/*_WEAK*/ void connect_start(void)
|
||||
{
|
||||
#if CONFIG_DEBUG_LOG
|
||||
rtl_printf("Time at start %d ms.\n", xTaskGetTickCount());
|
||||
#endif
|
||||
}
|
||||
|
||||
/*_WEAK*/ void connect_close(void)
|
||||
{
|
||||
}
|
||||
#endif // CONFIG_WLAN_CONNECT_CB
|
||||
|
||||
|
||||
/*-------------------------
|
||||
* void Init_Rand(void)
|
||||
* __low_level_init()
|
||||
*------------------------*/
|
||||
void Init_Rand(void)
|
||||
{
|
||||
extern u32 _rand_z1, _rand_z2, _rand_z3, _rand_z4, _rand_first;
|
||||
u32 *p = (u32 *)0x1FFFFF00;
|
||||
while(p < (u32 *)0x20000000) _rand_z1 ^= *p++;
|
||||
_rand_z1 ^= (*((u32 *)0x40002018) << 24) ^ (*((u32 *)0x40002118) << 16) ^ (*((u32 *)0x40002218) << 8) ^ *((u32 *)0x40002318);
|
||||
_rand_z2 = ((_rand_z1 & 0x007F00FF) << 7) ^ ((_rand_z1 & 0x0F80FF00) >> 8);
|
||||
_rand_z3 = ((_rand_z2 & 0x007F00FF) << 7) ^ ((_rand_z2 & 0x0F80FF00) >> 8);
|
||||
_rand_z4 = ((_rand_z3 & 0x007F00FF) << 7) ^ ((_rand_z3 & 0x0F80FF00) >> 8);
|
||||
_rand_first = 1;
|
||||
#if DEBUG_MAIN_LEVEL > 100
|
||||
DBG_8195A("Rand z: %p, %p, %p, %p.\n", _rand_z1, _rand_z2, _rand_z3, _rand_z4);
|
||||
DBG_8195A("Rand() %p, %p, %p, %p.\n", Rand(), Rand(), Rand(), Rand());
|
||||
#endif
|
||||
}
|
||||
/**
|
||||
* @brief Main program.
|
||||
* @param None
|
||||
* @retval None
|
||||
*/
|
||||
void main(void)
|
||||
{
|
||||
#if DEBUG_MAIN_LEVEL > 3
|
||||
ConfigDebugErr = -1;
|
||||
ConfigDebugInfo = -1; //~_DBG_SPI_FLASH_;
|
||||
ConfigDebugWarn = -1;
|
||||
CfgSysDebugErr = -1;
|
||||
CfgSysDebugInfo = -1;
|
||||
CfgSysDebugWarn = -1;
|
||||
#endif
|
||||
/*
|
||||
if ( rtl_cryptoEngine_init() != 0 ) {
|
||||
DBG_8195A("crypto engine init failed\r\n");
|
||||
}
|
||||
*/
|
||||
#if 0 // def CONFIG_CPU_CLK
|
||||
if(HalGetCpuClk() != PLATFORM_CLOCK) {
|
||||
HalCpuClkConfig(CPU_CLOCK_SEL_VALUE); // 0 - 166666666 Hz, 1 - 83333333 Hz, 2 - 41666666 Hz, 3 - 20833333 Hz, 4 - 10416666 Hz, 5 - 4000000 Hz
|
||||
HAL_LOG_UART_ADAPTER pUartAdapter;
|
||||
pUartAdapter.BaudRate = RUART_BAUD_RATE_38400;
|
||||
HalLogUartSetBaudRate(&pUartAdapter);
|
||||
SystemCoreClockUpdate();
|
||||
En32KCalibration();
|
||||
}
|
||||
#else // 200 MHz
|
||||
HalCpuClkConfig(0);
|
||||
*((int *)0x40000074) |= (1<<17); // 6 - 200000000 Hz, 7 - 10000000 Hz, 8 - 50000000 Hz, 9 - 25000000 Hz, 10 - 12500000 Hz, 11 - 4000000 Hz
|
||||
HAL_LOG_UART_ADAPTER pUartAdapter;
|
||||
pUartAdapter.BaudRate = RUART_BAUD_RATE_38400;
|
||||
HalLogUartSetBaudRate(&pUartAdapter);
|
||||
SystemCoreClockUpdate();
|
||||
En32KCalibration();
|
||||
#endif
|
||||
|
||||
#if DEBUG_MAIN_LEVEL > 1
|
||||
vPortFree(pvPortMalloc(4)); // Init RAM heap
|
||||
fATST(NULL); // RAM/TCM/Heaps info
|
||||
#endif
|
||||
|
||||
/* Initialize log uart and at command service */
|
||||
console_init();
|
||||
|
||||
/* pre-processor of application example */
|
||||
pre_example_entry();
|
||||
|
||||
/* wlan intialization */
|
||||
#if defined(CONFIG_WIFI_NORMAL) && defined(CONFIG_NETWORK)
|
||||
wlan_network();
|
||||
#endif
|
||||
|
||||
/* Execute application example */
|
||||
example_entry();
|
||||
|
||||
/*Enable Schedule, Start Kernel*/
|
||||
#if defined(CONFIG_KERNEL) && !TASK_SCHEDULER_DISABLED
|
||||
#ifdef PLATFORM_FREERTOS
|
||||
vTaskStartScheduler();
|
||||
#endif
|
||||
#else
|
||||
RtlConsolTaskRom(NULL);
|
||||
#endif
|
||||
}
|
14
readme.txt
Normal file
14
readme.txt
Normal file
|
@ -0,0 +1,14 @@
|
|||
AT command
|
||||
RTL00 module (RTL8710AF)
|
||||
|
||||
# ATSV
|
||||
DeviceID: FC, Flash Size: 1048576 bytes, FlashID: C22014/1, SpicMode: DIO
|
||||
v2.2.1,v3.5(2017/02/02-09:48:00)
|
||||
|
||||
###########################################################################################
|
||||
Used GCC SDK RTL8710 basic version
|
||||
set paths.mk
|
||||
|
||||
SDK_PATH = ../RTL00MP3/RTL00_SDKV35a/
|
||||
..
|
||||
EclipseLinkedSDK.gif
|
93
sdkbuild.mk
Normal file
93
sdkbuild.mk
Normal file
|
@ -0,0 +1,93 @@
|
|||
|
||||
include sdkset.mk
|
||||
include paths.mk
|
||||
|
||||
INCFLAGS = $(patsubst %,-I%,$(patsubst sdk/%,$(SDK_PATH)%,$(INCLUDES)))
|
||||
|
||||
LIBFLAGS = $(addprefix -L,$(patsubst sdk/%,$(SDK_PATH)%,$(PATHLIBS))) $(addprefix -l,$(LIBS))
|
||||
|
||||
LFLAGS += -Wl,-Map=$(OBJ_DIR)/$(TARGET).map
|
||||
|
||||
CFLAGS += $(INCFLAGS)
|
||||
|
||||
SRC_O = $(patsubst %.c,%.o,$(patsubst sdk/%,$(SDK_PATH)%,$(ADD_SRC_C))) $(patsubst %.c,%.o,$(patsubst sdk/%,$(SDK_PATH)%,$(SRC_C)))
|
||||
DRAM_O = $(patsubst %.c,%.o,$(patsubst sdk/%,$(SDK_PATH)%,$(DRAM_C)))
|
||||
|
||||
SRC_C_LIST = $(patsubst sdk/%,$(SDK_PATH)%,$(ADD_SRC_C)) $(patsubst sdk/%,$(SDK_PATH)%,$(SRC_C)) $(patsubst sdk/%,$(SDK_PATH)%,$(DRAM_C))
|
||||
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
|
||||
|
||||
.PHONY: build_info
|
||||
build_info:
|
||||
@echo \#define UTS_VERSION \"`date +%Y/%m/%d-%T`\" > .ver
|
||||
@echo \#define RTL8195AFW_COMPILE_TIME \"`date +%Y/%m/%d-%T`\" >> .ver
|
||||
@echo \#define RTL8195AFW_COMPILE_DATE \"`date +%Y%m%d`\" >> .ver
|
||||
@echo \#define RTL8195AFW_COMPILE_BY \"`id -u -n`\" >> .ver
|
||||
@echo \#define RTL8195AFW_COMPILE_HOST \"`$(HOSTNAME_APP)`\" >> .ver
|
||||
@if [ -x /bin/dnsdomainname ]; then \
|
||||
echo \#define RTL8195AFW_COMPILE_DOMAIN \"`dnsdomainname`\"; \
|
||||
elif [ -x /bin/domainname ]; then \
|
||||
echo \#define RTL8195AFW_COMPILE_DOMAIN \"`domainname`\"; \
|
||||
else \
|
||||
echo \#define RTL8195AFW_COMPILE_DOMAIN ; \
|
||||
fi >> .ver
|
||||
@echo \#define RTL195AFW_COMPILER \"gcc `$(CC) $(CFLAGS) -dumpversion | tr --delete '\r'`\" >> .ver
|
||||
@mv -f .ver project/inc/$@.h
|
||||
|
||||
.PHONY: application
|
||||
application: build_info $(SRC_O) $(DRAM_O)
|
||||
@echo "==========================================================="
|
||||
@echo "Make BootLoader (ram_1.p.bin, ram_1.r.bin)"
|
||||
# @echo "==========================================================="
|
||||
@mkdir -p $(BIN_DIR) $(OBJ_DIR)
|
||||
@cp $(patsubst sdk/%,$(SDK_PATH)%,$(BOOTS))/ram_1.r.bin $(BIN_DIR)/ram_1.r.bin
|
||||
@cp $(patsubst sdk/%,$(SDK_PATH)%,$(BOOTS))/ram_1.p.bin $(BIN_DIR)/ram_1.p.bin
|
||||
# @chmod 777 $(OBJ_DIR)/ram_1.r.bin
|
||||
$(OBJCOPY) --rename-section .data=.loader.data,contents,alloc,load,readonly,data -I binary -O elf32-littlearm -B arm $(BIN_DIR)/ram_1.r.bin $(OBJ_DIR)/ram_1.r.o
|
||||
@echo "==========================================================="
|
||||
@echo "Link ($(TARGET))"
|
||||
# @echo "==========================================================="
|
||||
@$(LD) $(LFLAGS) -o $(ELFFILE) $(OBJ_LIST) $(OBJ_DIR)/ram_1.r.o $(LIBFLAGS) -T$(LDFILE)
|
||||
@$(OBJDUMP) -d $(ELFFILE) > $(OBJ_DIR)/$(TARGET).asm
|
||||
|
||||
.PHONY: prerequirement
|
||||
#.NOTPARALLEL: prerequirement
|
||||
prerequirement:
|
||||
# @$(file >DEPENDENCY_LIST.txt,$(DEPENDENCY_LIST))
|
||||
@echo "==========================================================="
|
||||
@echo "Compile ($(TARGET))"
|
||||
# @echo "==========================================================="
|
||||
@mkdir -p $(OBJ_DIR)
|
||||
|
||||
$(SRC_O): %.o : %.c
|
||||
@echo $<
|
||||
@mkdir -p $(OBJ_DIR)/$(dir $@)
|
||||
@$(CC) $(CFLAGS) $(INCFLAGS) -c $< -o $(OBJ_DIR)/$@
|
||||
@$(CC) -MM $(CFLAGS) $(INCFLAGS) $< -MT $@ -MF $(OBJ_DIR)/$(patsubst %.o,%.d,$@)
|
||||
|
||||
$(DRAM_O): %.o : %.c
|
||||
@echo $<
|
||||
@mkdir -p $(OBJ_DIR)/$(dir $@)
|
||||
@$(CC) $(CFLAGS) $(INCFLAGS) -c $< -o $(OBJ_DIR)/$@
|
||||
@$(OBJCOPY) --prefix-alloc-sections .sdram $(OBJ_DIR)/$@
|
||||
@$(CC) -MM $(CFLAGS) $(INCFLAGS) $< -MT $@ -MF $(OBJ_DIR)/$(patsubst %.o,%.d,$@)
|
||||
|
||||
-include $(DEPENDENCY_LIST)
|
||||
|
||||
VPATH:=$(OBJ_DIR) $(SDK_PATH)
|
||||
|
||||
#.PHONY: clean
|
||||
clean:
|
||||
rm -rf $(OBJ_DIR) $(BIN_DIR) $(OBJ_DIR)/$(SDK_PATH)
|
||||
# @rm -f $(patsubst %.c,%.d,$(SRC_C_LIST))
|
||||
# @rm -f $(patsubst %.c,%.o,$(SRC_C_LIST))
|
||||
|
||||
|
388
sdkset.mk
Normal file
388
sdkset.mk
Normal file
|
@ -0,0 +1,388 @@
|
|||
# FLAGS
|
||||
# -------------------------------------------------------------------
|
||||
CFLAGS = -DM3 -DCONFIG_PLATFORM_8195A -DGCC_ARMCM3 -DARDUINO_SDK -DF_CPU=166666666L
|
||||
CFLAGS += -mcpu=cortex-m3 -mthumb -g2 -Os -std=gnu99
|
||||
CFLAGS += -fno-common -fmessage-length=0 -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-short-enums -fsigned-char
|
||||
CFLAGS += -w -Wno-pointer-sign
|
||||
LFLAGS = -mcpu=cortex-m3 -mthumb -g -Os --specs=nano.specs -nostartfiles
|
||||
LFLAGS += -Wl,--gc-sections -Wl,--cref -Wl,--entry=Reset_Handler -Wl,--no-enum-size-warning -Wl,--no-wchar-size-warning
|
||||
|
||||
# LIBS
|
||||
# -------------------------------------------------------------------
|
||||
LIBS =
|
||||
all: LIBS +=_platform_new _wlan _p2p _wps _rtlstd _websocket _xmodem _sdcard _mdns m c nosys gcc
|
||||
mp: LIBS +=_platform_new _wlan_mp _p2p _wps _rtlstd _websocket _xmodem _sdcard _mdns m c nosys gcc
|
||||
PATHLIBS = sdk/component/soc/realtek/8195a/misc/bsp/lib/common/gcc
|
||||
# LDFILE = rtl8711am-symbol-v03-img2.ld
|
||||
LDFILE = rlx8195A-symbol-v04-img2.ld
|
||||
BOOTS = sdk/component/soc/realtek/8195a/misc/bsp/image
|
||||
|
||||
# Include folder list
|
||||
# -------------------------------------------------------------------
|
||||
INCLUDES = ../inc
|
||||
INCLUDES += project/inc
|
||||
INCLUDES += sdk/component/soc/realtek/common/bsp
|
||||
INCLUDES += sdk/component/os/freertos
|
||||
INCLUDES += sdk/component/os/freertos/freertos_v8.1.2/Source/include
|
||||
INCLUDES += sdk/component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3
|
||||
INCLUDES += sdk/component/os/os_dep/include sdk/component/soc/realtek/8195a/misc/driver
|
||||
INCLUDES += sdk/component/common/api/network/include
|
||||
INCLUDES += sdk/component/common/api
|
||||
INCLUDES += sdk/component/common/api/platform
|
||||
INCLUDES += sdk/component/common/api/wifi
|
||||
INCLUDES += sdk/component/common/api/wifi/rtw_wpa_supplicant/src
|
||||
INCLUDES += sdk/component/common/application
|
||||
INCLUDES += sdk/component/common/application/iotdemokit
|
||||
INCLUDES += sdk/component/common/application/google
|
||||
INCLUDES += sdk/component/common/media/framework
|
||||
INCLUDES += sdk/component/common/example
|
||||
INCLUDES += sdk/component/common/example/wlan_fast_connect
|
||||
INCLUDES += sdk/component/common/mbed/api
|
||||
INCLUDES += sdk/component/common/mbed/hal
|
||||
INCLUDES += sdk/component/common/mbed/hal_ext
|
||||
INCLUDES += sdk/component/common/mbed/targets/hal/rtl8195a
|
||||
INCLUDES += sdk/component/common/network
|
||||
INCLUDES += sdk/component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos
|
||||
INCLUDES += sdk/component/common/network/lwip/lwip_v1.4.1/src/include
|
||||
INCLUDES += sdk/component/common/network/lwip/lwip_v1.4.1/src/include/lwip
|
||||
INCLUDES += sdk/component/common/network/lwip/lwip_v1.4.1/src/include/ipv4
|
||||
INCLUDES += sdk/component/common/network/lwip/lwip_v1.4.1/port/realtek
|
||||
INCLUDES += sdk/component/common/test
|
||||
INCLUDES += sdk/component/soc/realtek/8195a/cmsis
|
||||
INCLUDES += sdk/component/soc/realtek/8195a/cmsis/device
|
||||
INCLUDES += sdk/component/soc/realtek/8195a/fwlib
|
||||
INCLUDES += sdk/component/soc/realtek/8195a/fwlib/rtl8195a
|
||||
INCLUDES += sdk/component/soc/realtek/8195a/misc/rtl_std_lib
|
||||
INCLUDES += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/include
|
||||
INCLUDES += sdk/component/common/drivers
|
||||
INCLUDES += sdk/component/common/drivers/wlan/realtek/include
|
||||
INCLUDES += sdk/component/common/drivers/wlan/realtek/src/osdep
|
||||
INCLUDES += sdk/component/common/drivers/wlan/realtek/src/hci
|
||||
INCLUDES += sdk/component/common/drivers/wlan/realtek/src/hal
|
||||
INCLUDES += sdk/component/common/drivers/wlan/realtek/src/hal/OUTSRC
|
||||
INCLUDES += sdk/component/soc/realtek/8195a/fwlib/ram_lib/wlan/realtek/wlan_ram_map/rom
|
||||
INCLUDES += sdk/component/common/network/ssl/polarssl-1.3.8/include
|
||||
INCLUDES += sdk/component/common/network/ssl/ssl_ram_map/rom
|
||||
INCLUDES += sdk/component/common/utilities
|
||||
INCLUDES += sdk/component/soc/realtek/8195a/misc/rtl_std_lib/include
|
||||
INCLUDES += sdk/component/common/application/apple/WACServer/External/Curve25519
|
||||
INCLUDES += sdk/component/common/application/apple/WACServer/External/GladmanAES
|
||||
INCLUDES += sdk/component/soc/realtek/8195a/fwlib/ram_lib/usb_otg/include
|
||||
INCLUDES += sdk/component/common/media/codec
|
||||
INCLUDES += sdk/component/common/drivers/usb_class/host/uvc/inc
|
||||
INCLUDES += sdk/component/common/drivers/usb_class/device
|
||||
INCLUDES += sdk/component/common/drivers/usb_class/device/class sdk/component/common/file_system/fatfs
|
||||
INCLUDES += sdk/component/common/file_system/fatfs/r0.10c/include
|
||||
INCLUDES += sdk/component/common/drivers/sdio/realtek/sdio_host/inc
|
||||
INCLUDES += sdk/component/common/audio sdk/component/common/drivers/i2s
|
||||
INCLUDES += sdk/component/common/application/xmodem
|
||||
|
||||
# Source file list
|
||||
# -------------------------------------------------------------------
|
||||
SRC_C =
|
||||
DRAM_C =
|
||||
#cmsis
|
||||
SRC_C += sdk/component/soc/realtek/8195a/cmsis/device/system_8195a.c
|
||||
|
||||
#console
|
||||
DRAM_C += sdk/component/common/api/at_cmd/atcmd_ethernet.c
|
||||
DRAM_C += sdk/component/common/api/at_cmd/atcmd_lwip.c
|
||||
DRAM_C += sdk/component/common/api/at_cmd/atcmd_sys.c
|
||||
DRAM_C += sdk/component/common/api/at_cmd/atcmd_wifi.c
|
||||
SRC_C += sdk/component/common/api/at_cmd/log_service.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/misc/driver/low_level_io.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/misc/driver/rtl_consol.c
|
||||
|
||||
#network - api
|
||||
SRC_C += sdk/component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_eap_config.c
|
||||
SRC_C += sdk/component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_p2p_config.c
|
||||
SRC_C += sdk/component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_wps_config.c
|
||||
SRC_C += sdk/component/common/api/wifi/wifi_conf.c
|
||||
SRC_C += sdk/component/common/api/wifi/wifi_ind.c
|
||||
SRC_C += sdk/component/common/api/wifi/wifi_promisc.c
|
||||
SRC_C += sdk/component/common/api/wifi/wifi_simple_config.c
|
||||
SRC_C += sdk/component/common/api/wifi/wifi_util.c
|
||||
SRC_C += sdk/component/common/api/lwip_netconf.c
|
||||
|
||||
#network - app
|
||||
SRC_C += sdk/component/common/utilities/ssl_client.c
|
||||
SRC_C += sdk/component/common/utilities/ssl_client_ext.c
|
||||
SRC_C += sdk/component/common/utilities/tcptest.c
|
||||
SRC_C += sdk/component/common/utilities/uart_ymodem.c
|
||||
SRC_C += sdk/component/common/utilities/update.c
|
||||
SRC_C += sdk/component/common/application/uart_adapter/uart_adapter.c
|
||||
SRC_C += sdk/component/common/api/network/src/wlan_network.c
|
||||
SRC_C += sdk/component/common/api/wifi_interactive_mode.c
|
||||
SRC_C += sdk/component/common/api/network/src/ping_test.c
|
||||
|
||||
#network - lwip
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/api/api_lib.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/api/api_msg.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/api/err.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/api/netbuf.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/api/netdb.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/api/netifapi.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/api/sockets.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/api/tcpip.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/autoip.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/icmp.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/igmp.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/inet.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/inet_chksum.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/ip.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/ip_addr.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/ipv4/ip_frag.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/def.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/dhcp.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/dns.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/init.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/lwip_timers.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/mem.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/memp.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/netif.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/pbuf.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/raw.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/stats.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/sys.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/tcp.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/tcp_in.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/tcp_out.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/core/udp.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/src/netif/etharp.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos/ethernetif.c
|
||||
SRC_C += sdk/component/common/drivers/wlan/realtek/src/osdep/lwip_intf.c
|
||||
SRC_C += sdk/component/common/network/lwip/lwip_v1.4.1/port/realtek/freertos/sys_arch.c
|
||||
SRC_C += sdk/component/common/network/dhcp/dhcps.c
|
||||
SRC_C += sdk/component/common/network/sntp/sntp.c
|
||||
|
||||
#network - mdns
|
||||
SRC_C += sdk/component/common/network/mDNS/mDNSPlatform.c
|
||||
|
||||
#os - freertos
|
||||
SRC_C += sdk/component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_5.c
|
||||
SRC_C += sdk/component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM3/port.c
|
||||
SRC_C += sdk/component/os/freertos/cmsis_os.c
|
||||
SRC_C += sdk/component/os/freertos/freertos_v8.1.2/Source/croutine.c
|
||||
SRC_C += sdk/component/os/freertos/freertos_v8.1.2/Source/event_groups.c
|
||||
SRC_C += sdk/component/os/freertos/freertos_v8.1.2/Source/list.c
|
||||
SRC_C += sdk/component/os/freertos/freertos_v8.1.2/Source/queue.c
|
||||
SRC_C += sdk/component/os/freertos/freertos_v8.1.2/Source/tasks.c
|
||||
SRC_C += sdk/component/os/freertos/freertos_v8.1.2/Source/timers.c
|
||||
|
||||
#os - osdep
|
||||
SRC_C += sdk/component/os/os_dep/device_lock.c
|
||||
SRC_C += sdk/component/os/freertos/freertos_service.c
|
||||
SRC_C += sdk/component/os/os_dep/mailbox.c
|
||||
SRC_C += sdk/component/os/os_dep/osdep_api.c
|
||||
SRC_C += sdk/component/os/os_dep/osdep_service.c
|
||||
SRC_C += sdk/component/os/os_dep/tcm_heap.c
|
||||
|
||||
#peripheral - api
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/analogin_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/dma_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/efuse_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/ethernet_api.c
|
||||
SRC_C += sdk/component/common/drivers/ethernet_mii/ethernet_mii.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/flash_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/gpio_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/gpio_irq_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/i2c_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/i2s_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/log_uart_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/nfc_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/pinmap.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/pinmap_common.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/port_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/pwmout_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/rtc_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/serial_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/sleep.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/spdio_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/spi_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/sys_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/timer_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/us_ticker.c
|
||||
SRC_C += sdk/component/common/mbed/common/us_ticker_api.c
|
||||
SRC_C += sdk/component/common/mbed/common/wait_api.c
|
||||
SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/wdt_api.c
|
||||
|
||||
#peripheral - hal
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_32k.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_adc.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_gdma.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_gpio.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_i2c.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_i2s.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_mii.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_nfc.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_pcm.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_pwm.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_sdr_controller.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_ssi.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_timer.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_uart.c
|
||||
|
||||
#peripheral - osdep
|
||||
SRC_C += sdk/component/os/freertos/freertos_pmu.c
|
||||
|
||||
#peripheral - rtl8195a
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_adc.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_gdma.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_gpio.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_i2c.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_i2s.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_mii.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_nfc.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_pwm.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_ssi.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_timer.c
|
||||
SRC_C += sdk/component/soc/realtek/8195a/fwlib/rtl8195a/src/rtl8195a_uart.c
|
||||
|
||||
#peripheral - wlan
|
||||
#SRC_C += sdk/component/common/drivers/wlan/realtek/src/core/option/rtw_opt_skbuf.c
|
||||
|
||||
#SDRAM
|
||||
DRAM_C += sdk/component/common/api/platform/stdlib_patch.c
|
||||
#SDRAM - polarssl
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/aes.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/aesni.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/arc4.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/asn1parse.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/asn1write.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/base64.c
|
||||
SRC_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/bignum.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/blowfish.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/camellia.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ccm.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/certs.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/cipher.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/cipher_wrap.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ctr_drbg.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/debug.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/des.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/dhm.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ecp.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ecp_curves.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ecdh.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ecdsa.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/entropy.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/entropy_poll.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/error.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/gcm.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/havege.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/hmac_drbg.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/md.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/md_wrap.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/md2.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/md4.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/md5.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/memory_buffer_alloc.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/net.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/oid.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/padlock.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/pbkdf2.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/pem.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/pkcs5.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/pkcs11.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/pkcs12.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/pk.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/pk_wrap.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/pkparse.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/pkwrite.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/platform.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ripemd160.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/rsa.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/sha1.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/sha256.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/sha512.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ssl_cache.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ssl_ciphersuites.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ssl_cli.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ssl_srv.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/ssl_tls.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/threading.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/timing.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/version.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/version_features.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/x509.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/x509_crt.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/x509_crl.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/x509_csr.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/x509_create.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/x509write_crt.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/x509write_csr.c
|
||||
DRAM_C += sdk/component/common/network/ssl/polarssl-1.3.8/library/xtea.c
|
||||
|
||||
#SDRAM - ssl_ram_map
|
||||
DRAM_C += sdk/component/common/network/ssl/ssl_ram_map/rom/rom_ssl_ram_map.c
|
||||
DRAM_C += sdk/component/common/network/ssl/ssl_ram_map/ssl_ram_map.c
|
||||
|
||||
#SDRAM - wigadget
|
||||
DRAM_C += sdk/component/common/application/wigadget/cloud_link.c
|
||||
DRAM_C += sdk/component/common/application/wigadget/shtc1.c
|
||||
DRAM_C += sdk/component/common/application/wigadget/wigadget.c
|
||||
|
||||
#utilities
|
||||
SRC_C += sdk/component/common/utilities/cJSON.c
|
||||
SRC_C += sdk/component/common/utilities/http_client.c
|
||||
SRC_C += sdk/component/common/utilities/uart_socket.c
|
||||
SRC_C += sdk/component/common/utilities/webserver.c
|
||||
SRC_C += sdk/component/common/utilities/xml.c
|
||||
|
||||
#utilities - FatFS
|
||||
SRC_C += sdk/component/common/file_system/fatfs/fatfs_ext/src/ff_driver.c
|
||||
SRC_C += sdk/component/common/file_system/fatfs/r0.10c/src/diskio.c
|
||||
SRC_C += sdk/component/common/file_system/fatfs/r0.10c/src/ff.c
|
||||
SRC_C += sdk/component/common/file_system/fatfs/r0.10c/src/option/ccsbcs.c
|
||||
SRC_C += sdk/component/common/file_system/fatfs/disk_if/src/sdcard.c
|
||||
|
||||
#utilities - xmodem update
|
||||
SRC_C += sdk/component/common/application/xmodem/uart_fw_update.c
|
||||
#user
|
||||
#SRC_C += project/src/main.c
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# My Source file list
|
||||
# -------------------------------------------------------------------
|
||||
ADD_SRC_C =
|
||||
# REVERSED
|
||||
ADD_SRC_C += sdk/component/soc/realtek/8195a/cmsis/device/app_start.c
|
||||
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_dac.c
|
||||
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_common.c
|
||||
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_soc_ps_monitor.c
|
||||
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_efuse.c
|
||||
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_log_uart.c
|
||||
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_pinmux.c
|
||||
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_misc.c
|
||||
#ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_spi_flash_ram.c
|
||||
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/ram_lib/startup.c
|
||||
# COMPONENTS
|
||||
ADD_SRC_C += sdk/component/common/mbed/targets/hal/rtl8195a/flash_eep.c
|
||||
# -------------------------------------------------------------------
|
||||
# SAMPLES
|
||||
# -------------------------------------------------------------------
|
||||
ADD_SRC_C += sdk/component/common/example/cJSON/cJSON_example.c
|
||||
ADD_SRC_C += sdk/component/common/example/googlenest/example_google.c
|
||||
ADD_SRC_C += sdk/component/common/example/mdns/example_mdns.c
|
||||
ADD_SRC_C += sdk/component/common/example/socket_select/example_socket_select.c
|
||||
ADD_SRC_C += sdk/component/common/example/uart_atcmd/example_uart_atcmd.c
|
||||
ADD_SRC_C += sdk/component/common/example/wlan_fast_connect/example_wlan_fast_connect.c
|
||||
ADD_SRC_C += sdk/component/common/example/xml/example_xml.c
|
||||
ADD_SRC_C += sdk/component/common/example/example_entry.c
|
||||
ADD_SRC_C += sdk/component/common/drivers/sdio/realtek/sdio_host/src/sd.c
|
||||
ADD_SRC_C += sdk/component/common/drivers/sdio/realtek/sdio_host/src/sdio_host.c
|
||||
ADD_SRC_C += sdk/component/soc/realtek/8195a/fwlib/src/hal_sdio_host.c
|
||||
#ADD_SRC_C += sdk/component/common/file_system/fatfs/disk_if/src/sdcard.c
|
||||
#=============================================
|
||||
# PROGECT
|
||||
#=============================================
|
||||
#user main
|
||||
ADD_SRC_C += project/src/user/main.c
|
||||
# components
|
||||
#ADD_SRC_C += project/src/user/atcmd_user.c
|
||||
|
||||
#libs
|
||||
#driver
|
||||
|
||||
#include
|
||||
#=============================================
|
Loading…
Reference in a new issue