⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flash.dat

📁 AT91M5800a例子
💻 DAT
字号:
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 *
Com *1.0 18/Feb/03   JPP     : Creation
Com *1.1 09/Apr/03   NCy     : Change top_of_memory value to 0x02040000
Com *--------------------------------------------------------------------------------------

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.

Com let $top_of_memory 0x02200000
let $top_of_memory 0x02040000

Com Disable all vector catch to not have AXD to warn you that a vector exception has been caught.
spp vector_catch 0x0

Com =======================================================
Com From 32 kHz Clock Frequency to 32MHz PLL output        -
Com =======================================================
Com Set the APMC in default State without to know the initial value:
Com The APMC_CGMR modification must be performed according to the
Com data writen already.
Com This script set the APMC_CGMR in the default state (known state)
Com ,i.e. 0x0., and step up the Clock Frequency.  

Com Switch from the PLL to the Main Oscillator
setmem 0xffff4020 0x032f4102

Com Shut down the PLL
setmem 0xffff4020 0x032f4002

Com Switch from the Main Oscillator to the Low Frequency Oscillator
setmem 0xffff4020 0x032f0002

Com Initial state after the reset, i.e. APMC_CGMR = 0
setmem  0xffff4020 0x0

Com -------------------------
Com Main Oscillator Starting
Com -------------------------
Com This script is to speed up the System Frequency to run at 32MHz
Com Enable the main oscillator (16Mhz) / MOSCEN = 1, OSCOUNT = 47  (1.4ms/30祍)
setmem 0xffff4020 0x002F0002

Com Wait for Main oscillator stabilization. Wait for APMC_MOSCS Bit in APMC_SR equals 1.
mem 0xffff4030,0xffff4030,32
Com moscs_checking=m 0xffff4030
Com while (moscs_checking != 1)
Com print The Main Oscillator is not ready !
Com moscs_checking=m 0xffff4030
Com endwhile
Com echo OK, the Main Oscillator is ready now
mem 0xffff4030,0xffff4030,32

Com Switch from the Slow Clock source to the Main Oscillator (32K to 16Mhz)
setmem 0xffff4020 0x002F4002

Com -------------
Com PLL Starting
Com -------------
Com Setup the PLL / MUL = 1, PLLCOUNT = 3, CSS = 1
setmem 0xffff4020 0x032F4102 32

Com Wait for the PLL is stabilized. Wait for APMC_PLL_LOCK Bit in APMC_SR equals 1
mem 0xffff4030,0xffff4030,32
Com lock_checking=m 0xffff4030
Com while (lock_checking != 3)
Com print PLL is not ready
Com lock_checking=m 0xffff4030
Com endwhile
Com print OK, the PLL is ready now
mem 0xffff4030,0xffff4030,32


Com Switch from the Main Oscillator (16Mhz) to PLL output (32MHz) / CSS = 2, MUL = 1
setmem 0xffff4020 0x032F8102 32

Com =======================================================
Com Now the AT91M55800A is working at 32 MHz.
Com EBI Setting
Com =======================================================
Com EBI_CSR0 connected to the flash memory.
Com Settings : EBI_BA=0x01000000 / EBI_CSEN / EBI_BAT_BYTE_WRITE / EBI_TDF_2 / EBI_PAGES_16M / EBI_NWS_3 / EBI_DBW_16
setmem 0xffe00000 0x01002529 32

Com EBI_CSR1 connected to the External SRAM memory.
Com Settings : EBI_BA=0x02000000 / EBI_CSEN / EBI_BAT_BYTE_WRITE / EBI_TDF_0 / EBI_PAGES_16M / EBI_NWS_1 / EBI_DBW_16
setmem 0xffe00004 0x02002121 32

Com AT91 REMAP Done
setmem 0xffe00020 0x00000001 32

Com 2M bytes per Chip Select
setmem 0xffe00024 0x00000006 32

Com Get the Chip ID
mem 0xfff00000,0xfff00000,32 


Com Flash download address 
setmem 0x00040 0x01100000 32
Com get the file name
lb ../../name.txt,0x44

Com Load application
ld flash_16x4.axf

Com Start app

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -