bdi
GDB
for GNU Debugger, BDI2000 (ARM11 / Cortex)
User Manual
36
© Copyright 1997-2014 by ABATRON AG Switzerland
V 1.21
AT91SAM3U/S Internal Flash:
The BDI supports programming of the Atmel AT91SAM3U/S internal flash. Before using any flash
function it is important that the EEFC_FMR is programmed with the correct value for FWS. This can
be done via the initialization list. Have a look at the at91sam3u.cfg configuration example.
[INIT]
WGPR 13 0x20007ffc ;set SP to top of internal SRAM0
WM32 0x400E1208 0xa5000401 ;User reset enable (allows BDI to hard reset the system)
;
; Setup Internal Flash Wait States
WM32 0x400E0800 0x00000200 ;EEFC0_FMR: Flash mode (FWS=2)
WM32 0x400E0A00 0x00000200 ;EEFC1_FMR: Flash mode (FWS=2)
;
; setup clocks
WM32 0x400E0420 0x00373f09 ;CKGR_MOR: enable Main Oscillator
DELAY 100
WM32 0x400E0420 0x01373f09 ;CKGR_MOR: select Main Oscillator
DELAY 100
WM32 0x400E0428 0x20073f01 ;CKGR_PLLAR: Set PLLA to 96 MHz
DELAY 100
WM32 0x400E0430 0x00000011 ;PMC_MCKR: set PRES = 1 (clk/2)
DELAY 100
WM32 0x400E0430 0x00000012 ;PMC_MCKR: set CSS = 2 (select PLLA)
DELAY 100
;
[TARGET]
CPUTYPE CORTEX-M3
CLOCK 1 4 ;BDI2000: start with 1MHz then use 16MHz
POWERUP 3000 ;start delay after power-up detected in ms
RESET
HARD 100 ;assert reset for 100 ms
WAKEUP 100 ;wait after reset released
STARTUP HALT ;halt immediatelly at the reset vector
MEMACCESS AHB 1 ;memory access via AHB (8 TCK's access delay)
[FLASH]
CHIPTYPE SAM3U ;Don't forget to set EEFC_FMR[FWS]
CHIPSIZE 0x20000 ;size of one block
BUSWIDTH 32
FILE E:/temp/dump16k.bin
FORMAT BIN 0x00094000
ERASE 0x00094000 0x100 64 ;erase 64 pages (16kB)
An explicit erase is not necessary because a page is automatically erased during programming. But
the BDI supports also erasing a page or a complete flash memory block. The ERASE command sup-
ports a second parameter, PAGE (default) or BLOCK can be used. A page is erased by programming
it with all 0xFF. Following an example how to erase the complete flash via Telnet:
For SAM3U4:
BDI> erase 0x00080000 block
BDI> erase 0x00100000 block
For SAM3S4:
BDI> erase 0x00400000 block