From 5a51474104028ce12b61de8c8bce6eeeaaad0b2b Mon Sep 17 00:00:00 2001 From: pvvx Date: Mon, 26 Sep 2016 04:41:22 +0300 Subject: [PATCH] add --- JLink-Reset.bat | 2 +- flasher/RTL8710AF.jflash | 148 +++++++++++++++++++++++++++++++++++ flasher/RTLreset.JLinkScript | 5 -- flasher/gdb_init.jlink | 14 +++- flasher/gdb_run_ram.jlink | 20 +++-- 5 files changed, 174 insertions(+), 15 deletions(-) create mode 100644 flasher/RTL8710AF.jflash delete mode 100644 flasher/RTLreset.JLinkScript diff --git a/JLink-Reset.bat b/JLink-Reset.bat index de20dc6..81c18f2 100644 --- a/JLink-Reset.bat +++ b/JLink-Reset.bat @@ -1,3 +1,3 @@ @echo off PATH=D:\MCU\SEGGER\JLink_V610a;%PATH% -JLink.exe -Device CORTEX-M3 -If SWD -Speed 1000 flasher\RTLreset.JLinkScript +JLink.exe -Device CORTEX-M3 -If SWD -Speed 1000 flasher\RTL_Reset.JLinkScript diff --git a/flasher/RTL8710AF.jflash b/flasher/RTL8710AF.jflash new file mode 100644 index 0000000..5b75c61 --- /dev/null +++ b/flasher/RTL8710AF.jflash @@ -0,0 +1,148 @@ + AppVersion = 61001 + FileVersion = 2 +[GENERAL] + ConnectMode = 0 + CurrentFile = "" + DataFileSAddr = 0x00000000 + GUIMode = 0 + HostName = "" + TargetIF = 1 + USBPort = 0 + USBSerialNo = 0x00000000 +[JTAG] + IRLen = 0 + MultipleTargets = 0 + NumDevices = 0 + Speed0 = 6000 + Speed1 = 6000 + TAP_Number = 0 + UseAdaptive0 = 0 + UseAdaptive1 = 0 + UseMaxSpeed0 = 0 + UseMaxSpeed1 = 0 +[CPU] + NumInitSteps = 18 + InitStep0_Action = "Reset" + InitStep0_Value0 = 0x00000000 + InitStep0_Value1 = 0x00000000 + InitStep0_Comment = "Reset and halt target" + InitStep1_Action = "Read 32bit" + InitStep1_Value0 = 0x40000230 + InitStep1_Value1 = 0x00000000 + InitStep1_Comment = "enable spi flash peripheral clock" + InitStep2_Action = "Var OR" + InitStep2_Value0 = 0x00000000 + InitStep2_Value1 = 0x00000300 + InitStep2_Comment = "" + InitStep3_Action = "Var Write 32bit" + InitStep3_Value0 = 0x40000230 + InitStep3_Value1 = 0x00000000 + InitStep3_Comment = "" + InitStep4_Action = "Read 32bit" + InitStep4_Value0 = 0x40000210 + InitStep4_Value1 = 0x00000000 + InitStep4_Comment = "enable spi flash peripheral" + InitStep5_Action = "Var OR" + InitStep5_Value0 = 0x00000000 + InitStep5_Value1 = 0x00000010 + InitStep5_Comment = "" + InitStep6_Action = "Var Write 32bit" + InitStep6_Value0 = 0x40000210 + InitStep6_Value1 = 0x00000000 + InitStep6_Comment = "" + InitStep7_Action = "Read 32bit" + InitStep7_Value0 = 0x400002C0 + InitStep7_Value1 = 0x00000000 + InitStep7_Comment = "select spi flash pinout (0 - internal), enable spi flash pins" + InitStep8_Action = "Var AND" + InitStep8_Value0 = 0x00000000 + InitStep8_Value1 = 0xFFFFFFF8 + InitStep8_Comment = "" + InitStep9_Action = "Var OR" + InitStep9_Value0 = 0x00000000 + InitStep9_Value1 = 0x00000001 + InitStep9_Comment = "" + InitStep10_Action = "Var Write 32bit" + InitStep10_Value0 = 0x400002C0 + InitStep10_Value1 = 0x00000000 + InitStep10_Comment = "" + InitStep11_Action = "Write 32bit" + InitStep11_Value0 = 0x40006008 + InitStep11_Value1 = 0x00000000 + InitStep11_Comment = "disable SPI FLASH operation" + InitStep12_Action = "Write 32bit" + InitStep12_Value0 = 0x4000602C + InitStep12_Value1 = 0x00000000 + InitStep12_Comment = "disable all interrupts" + InitStep13_Action = "Write 32bit" + InitStep13_Value0 = 0x40006010 + InitStep13_Value1 = 0x00000001 + InitStep13_Comment = "use first 'slave select' pin" + InitStep14_Action = "Write 32bit" + InitStep14_Value0 = 0x40006014 + InitStep14_Value1 = 0x00000002 + InitStep14_Comment = "baud rate, default value" + InitStep15_Action = "Write 32bit" + InitStep15_Value0 = 0x40006018 + InitStep15_Value1 = 0x00000000 + InitStep15_Comment = "tx fifo threshold" + InitStep16_Action = "Write 32bit" + InitStep16_Value0 = 0x4000601C + InitStep16_Value1 = 0x00000000 + InitStep16_Comment = "rx fifo threshold" + InitStep17_Action = "Write 32bit" + InitStep17_Value0 = 0x4000604C + InitStep17_Value1 = 0x00000000 + InitStep17_Comment = "disable DMA" + NumExitSteps = 1 + ExitStep0_Action = "Write 32bit" + ExitStep0_Value0 = 0x40000210 + ExitStep0_Value1 = 0x00211157 + ExitStep0_Comment = "Boot from Flash" + UseScriptFile = 0 + ScriptFile = "" + UseRAM = 1 + RAMAddr = 0x10000000 + RAMSize = 0x00060000 + CheckCoreID = 1 + CoreID = 0x2BA01477 + CoreIDMask = 0xFFFFFFFF + UseAutoSpeed = 0x00000001 + ClockSpeed = 0x00000000 + EndianMode = 0 + ChipName = "Cortex-M3" +[FLASH] + BaseAddr = 0x98000000 + CustomRAMCode = "D:\MCU\SEGGER\JLink_V610a\Samples\JFlash\ProjectFiles\Atmel\AT91SAM9261_DataFlash_SPI0\RAMCodeV2_AT91SAM9261_DataFlash_SPI0_LE.mot" + NumBanks = 1 + UseCustomRAMCode = 1 +[PRODUCTION] + AutoBlankCheck = 1 + AutoDisconnect = 0 + AutoMode = 0 + AutoPerformsErase = 0 + AutoPerformsProgram = 0 + AutoPerformsSecure = 0 + AutoPerformsStartApp = 0 + AutoPerformsUnsecure = 0 + AutoPerformsVerify = 1 + EnableTargetPower = 0 + EraseType = 2 + MonitorVTref = 0 + MonitorVTrefMax = 0x0000157C + MonitorVTrefMin = 0x000003E8 + OverrideTimeouts = 0 + ProgramSN = 0 + SerialFile = "" + SkipBlankOnRead = 0 + SNAddr = 0x00000000 + SNInc = 0x00000001 + SNLen = 0x00000008 + SNListFile = "" + SNValue = 0x00000001 + StartAppType = 0 + TargetPowerDelay = 0x00000014 + TimeoutErase = 0x00003A98 + TimeoutProgram = 0x00002710 + TimeoutVerify = 0x00002710 + VerifyType = 1 diff --git a/flasher/RTLreset.JLinkScript b/flasher/RTLreset.JLinkScript deleted file mode 100644 index 303f367..0000000 --- a/flasher/RTLreset.JLinkScript +++ /dev/null @@ -1,5 +0,0 @@ -h -r -w4 0x40000210,0x00211157 -g -q \ No newline at end of file diff --git a/flasher/gdb_init.jlink b/flasher/gdb_init.jlink index b58d2a0..0ffc247 100644 --- a/flasher/gdb_init.jlink +++ b/flasher/gdb_init.jlink @@ -12,10 +12,18 @@ 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 RAM -#monitor long 0x40000210 = 0x8011157 # Boot Flash -#monitor long 0x40000210 = 0x211157 +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? diff --git a/flasher/gdb_run_ram.jlink b/flasher/gdb_run_ram.jlink index 115460c..9991fa8 100644 --- a/flasher/gdb_run_ram.jlink +++ b/flasher/gdb_run_ram.jlink @@ -8,22 +8,30 @@ monitor endian little monitor reset # Set max speed monitor speed 4000 -set mem inaccessible-by-default off +#set mem inaccessible-by-default on # Setup GDB FOR FASTER DOWNLOADS set remote memory-write-packet-size 8192 -#set remote memory-write-packet-size fixed +set remote memory-write-packet-size fixed # Boot Flash #monitor long 0x40000210 = 0x211157 -# Boot RAM -monitor long 0x40000210 = 0x8011157 +# 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 +#monitor long 0x40000014 = 0x00000011 # CPU CLK 83 MHz? #monitor long 0x40000014 = 0x00000021 # Load the program executable called "image.elf" load build/obj/build.axf -#continue monitor reset +#continue monitor go quit