📄 flash.dat
字号:
echo off
Com *--------------------------------------------------------------------------------------
Com * ATMEL Microcontroller Software Support - ROUSSET -
Com *--------------------------------------------------------------------------------------
Com *The software is delivered "AS IS" without warranty or condition of any
Com *kind, either express, implied or statutory. This includes without
Com *limitation any warranty or condition with respect to merchantability or
Com *fitness for any particular purpose, or against the infringements of
Com *intellectual property rights of others.
Com *--------------------------------------------------------------------------------------
Com *File Name : File Flash.dat
Com *Object : Script file for Flash_tools
Com * This application do not remap and load source at 0x00200000
Com *
Com *1.0 29/Nov/03 JPP : Creation
Com *--------------------------------------------------------------------------------------
Com <---- This command is the comment command.
Com Enable the semihosting. If you don't use printf and/or scanf functions, set semihosting_enabled to 0.
spp semihosting_enabled 1
Com Define the top of memory to store the buffer for semihosting calls.
Com Needed when working with an ICE Interface and if you use C printf/scanf functions in your code.
Com The value after $top_of_memory variable is the address of the buffer needed for the semihosting.
Com Generally pointing to the top of Internal or External Memory. Change it according to your board configuration.
Com Hereafter, $top_of_memory variable is defined at the top of the internal SRAM of the AT91R40008.
echo on
let $top_of_memory 0x00203600
echo off
Com Disable all vector catch to not have AXD to warn you that a vector exception has been caught.
spp vector_catch 0x0
Com Watchdog Disable
Com AT91C_BASE_WDTC->WDTC_WDMR= AT91C_SYSC_WDDIS;
setmem 0xFFFFFD44 0x00008000 32
Com Set Flash Waite sate
Com Single Cycle Access at Up to 30 MHz
Com if MCK = 47923200 I have 50 Cycle for 1 useconde ( flied MC_FMR->FMCN)
Com A page erase is performed before programming.
Com AT91C_BASE_MC->MC_FMR = ((AT91C_MC_FMCN)&(50 <<16)) | AT91C_MC_FWS_1FWS ;
setmem 0xFFFFFF60 0x00320100 32
Com Set PLL
Com -1- Enabling the Main Oscillator:
Com *#define AT91C_PMC_MOR ((AT91_REG *) 0xFFFFFC20) (PMC) Main Oscillator Register
Com *#define AT91C_PMC_PLLR ((AT91_REG *) 0xFFFFFC2C) (PMC) PLL Register
Com *#define AT91C_PMC_MCKR ((AT91_REG *) 0xFFFFFC30) (PMC) Master Clock Register
Com *pPMC->PMC_MOR = (( AT91C_CKGR_OSCOUNT & (0x06 <<8) | 0x0000 0600
Com AT91C_CKGR_MOSCEN )); 0x0000 0001
echo on
setmem 0xFFFFFC20 0x00000601 32
echo off
Com -2- Wait
Com -3- Setting PLL and divider:
Com - div by 5 Fin = 3,6864 =(18,432 / 5)
Com - Mul 25+1: Fout = 95,8464 =(3,6864 *26)
Com for 96 MHz the erroe is 0.16%
Com Field out NOT USED = 0
Com PLLCOUNT pll startup time esrtimate at : 0.844 ms
Com PLLCOUNT 28 = 0.000844 /(1/32768)
Com pPMC->PMC_PLLR = ((AT91C_CKGR_DIV & 0x05) | 0x0000 0005
Com (AT91C_CKGR_PLLCOUNT & (28<<8)) 0x0000 1C00
Com (AT91C_CKGR_MUL & (25<<16))); 0x0019 0000
echo on
setmem 0xFFFFFC2C 0x00191C05 32
echo off
Com -2- Wait
Com -5- Selection of Master Clock and Processor Clock
Com select the PLL clock divided by 2
Com pPMC->PMC_MCKR = AT91C_PMC_CSS_PLL_CLK | 0x0000 0003
Com AT91C_PMC_PRES_CLK_2 ; 0x0000 0004
echo on
setmem 0xFFFFFC30 0x00000007 32
Com "------------------------------- PLL Enable "
mem 0x0 +0 32 hex
mem 0x0010000 +0 32 hex
mem 0x0020000 +0 32 hex
echo off
Com Flash download address
setmem 0x200000 0x00100000 32
setmem 0x200004 0x0 32
setmem 0x200008 0x0 32
setmem 0x20000C 0x0 32
setmem 0x200010 0x0 32
setmem 0x200014 0x0 32
setmem 0x200018 0x0 32
setmem 0x20001C 0x0 32
setmem 0x200020 0x0 32
setmem 0x200024 0x0 32
setmem 0x200028 0x0 32
setmem 0x20002C 0x0 32
setmem 0x200030 0x0 32
setmem 0x200034 0x0 32
setmem 0x200038 0x0 32
setmem 0x20003C 0x0 32
setmem 0x200040 0x0 32
setmem 0x200044 0x0 32
setmem 0x200048 0x0 32
setmem 0x20004C 0x0 32
setmem 0x200050 0x0 32
setmem 0x200054 0x0 32
setmem 0x200058 0x0 32
setmem 0x20005C 0x0 32
Com get the file name
lb ../../name.txt,0x200004
Com Load application
ld flash_SAM7.axf
echo on
Com Start app
go
go
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -