bdi
GDB
for GNU Debugger, BDI2000 (ARM)
User Manual
36
© Copyright 1997-2005 by ABATRON AG Switzerland
V 1.17
AT91SAM7S Internal Flash:
The BDI2000 supports programming of the Atmel AT91SAM7S internal flash. Before using any flash
function it is important that the MC_FMR is programmed with the correct values for FMCN and FWS.
This can be done via the initialization list. Following a configuration example:
[INIT]
WM32 0xFFFFFD44 0x00008000 ;Disable watchdog
WM32 0xFFFFFD08 0xA5000001 ;Enable user reset
;
; Setup PLL
WM32 0xFFFFFC20 0x00000601 ;CKGR_MOR : Enabling the Main Oscillator
DELAY 20
WM32 0xFFFFFC2C 0x10480a0e ;CKGR_PLLR: 96.1MHz (DIV=14,MUL=72+1)
DELAY 20
WM32 0xFFFFFC30 0x00000007 ;PMC_MCKR : MCK = PLL / 2 = 48MHz
DELAY 20
;
; Setup Internal Flash for 48MHz Master Clock
WM32 0xFFFFFF60 0x00300100 ;MC_FMR: Flash mode (FWS=1,FMCN=48)
;
[TARGET]
CPUTYPE ARM7TDMI
CLOCK 1 10 ;JTAG clock, start with a slow clock
RESET HARD 300 ;Assert reset line for 300 ms
BREAKMODE HARD ;SOFT or HARD
STEPMODE HWBP
[FLASH]
CHIPTYPE AT91SAM7S ;Don't forget to set MC_FMR[FMCN] and MC_FMR[FWS]
CHIPSIZE 0x10000 ;The AT91SAM7S64 has 64kB internal flash
BUSWIDTH 32 ;Use 32-bit for AT91SAM7S
FILE at91\sam7s.bin
FORMAT BIN 0x00100000
An explicit erase is not necessary because a page is automatically erased during programming. But
the BDI2000 supports also erasing a page or the complete flash memory. The ERASE command
supports a second parameter, PAGE (default) or CHIP can be used. A page is erased by program-
ming it with all 0xFF. Following an example how to erase the complete flash via Telnet:
BDI> erase 0x00100000 chip