Имеется плата at91sam9263-ek и отладчик sam-ice.
Среда - eclipse + zylin, segger gdb server версия 4.14f.
Моя программа запускается из SDRAM, предварительно будучи загружена туда загрузчиком.
Загрузчик в SRAM отлаживается нормально. Сама программа в SDRAM запускается,
но как только нажимаю Suspend чтоб идти по шагам, соединение разрывается.
Выглядит примерно так:
SEGGER J-Link GDB Server V4.14f
JLinkARM.dll V4.14f (DLL compiled Jul 5 2010 14:21:00)
Listening on TCP/IP port 2331
J-Link connected
Firmware: J-Link ARM V8 compiled Dec 1 2009 11:42:48
Hardware: V8.00
S/N: 28000165
OEM: SAM-ICE
Feature(s): RDI
J-Link found 1 JTAG device, Total IRLen = 4
JTAG ID: 0x0792603F (ARM9)
SAM-ICE found !
Connected to 127.0.0.1
SAM-ICE found !
Reading all registers
Read 4 bytes @ address 0x00000000 (Data = 0xEA000006)
Target endianess set to "little endian"
JTAG speed set to 30 kHz
Resetting target (halt with breakpoint @ address 0)
Sleep 10ms
Read 4 bytes @ address 0x00000000 (Data = 0xEA000006)
Downloading 4 bytes @ address 0xFFFFFC20
Read 4 bytes @ address 0x00000000 (Data = 0xEA000006)
...
Здесь конфигурится SDRAM контроллер
...
Read 4 bytes @ address 0x00000000 (Data = 0xEA000006)
Downloading 4 bytes @ address 0xFFFFE204
Read 4 bytes @ address 0x00000000 (Data = 0xEA000006)
JTAG speed set to 12000 kHz
Downloading 4048 bytes @ address 0x20000000
Downloading 4064 bytes @ address 0x2001DB50
...
Загружается приложение
...
Downloading 1516 bytes @ address 0x2001EB30
Downloading 172 bytes @ address 0x2001F11C
Writing register (PC = 0x20000000)
Read 4 bytes @ address 0x00000000 (Data = 0xEA000006)
Starting target CPU...
Debugger requested to halt target... <--- нажимаю кнопу Suspend
Reading all registers
ERROR: Can not read register 0 (R0) while CPU is running
Connection to debugger closed !
Для загрузчика у меня в поле Initialize commands прописано:
target remote localhost:2331
monitor speed 30
monitor reset 1
monitor sleep 10
monitor speed 12000
load
Для приложения, поскольку надо инициализировать SDRAM, я взял атмеловский
файл из примеров и указал его в GDB command file.
Код
# connect to the J-Link gdb server
target remote localhost:2331
# Set JTAG speed to 30 kHz
monitor endian little
monitor speed 30
# Reset the target
monitor reset 1
monitor sleep 10
# SDRAM initialization script for the AT91SAM9263
#------------------------------------------------
# Configure master clock
echo Configuring the master clock...\n
# Enable main oscillator
set *0xFFFFFC20 = 0x00004001
while ((*0xFFFFFC68 & 0x1) == 0)
end
# Set PLLA to 200MHz
set *0xFFFFFC28 = 0x206DBF09
while ((*0xFFFFFC68 & 0x2) == 0)
end
# Set PLLB for USB usage
set *0xFFFFFC2C = 0x20AF3F0F
while ((*0xFFFFFC68 & 0x4) == 0)
end
# Select prescaler
#set *0xFFFFFC30 = 0x00000100
while ((*0xFFFFFC68 & 0x8) == 0)
end
# Select master clock
set *0xFFFFFC30 = 0x00000102
while ((*0xFFFFFC68 & 0x8) == 0)
end
echo Master clock ok.\n
echo Configuring the SDRAM controller...\n
# Configure PIOD as peripheral (D16/D31)
# __writeMemory32(0xFFFF0000,0xFFFFF870,"Memory");
set *0xFFFFF870 = 0xFFFF0000
# __writeMemory32(0x00000000,0xFFFFF874,"Memory");
set *0xFFFFF874 = 0x00000000
# __writeMemory32(0xFFFF0000,0xFFFFF804,"Memory");
set *0xFFFFF804 = 0xFFFF0000
# Enable EBI chip select for the SDRAM
set *0xFFFFED20 = 0x2
# SDRAM configuration
set *0xFFFFE208 = 0x85227259
set *0xFFFFE200 = 0x1
set *0x20000000 = 0
set *0xFFFFE200 = 0x2
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x3
set *0x20000000 = 0
set *0xFFFFE200 = 0x0
set *0x20000000 = 0
set *0xFFFFE204 = 0x2B7
echo SDRAM configuration ok.\n
# Setup GDB for faster downloads
set remote memory-write-packet-size 4096
set remote memory-write-packet-size fixed
monitor speed 12000
#break main
load
#continue
#stepi
target remote localhost:2331
# Set JTAG speed to 30 kHz
monitor endian little
monitor speed 30
# Reset the target
monitor reset 1
monitor sleep 10
# SDRAM initialization script for the AT91SAM9263
#------------------------------------------------
# Configure master clock
echo Configuring the master clock...\n
# Enable main oscillator
set *0xFFFFFC20 = 0x00004001
while ((*0xFFFFFC68 & 0x1) == 0)
end
# Set PLLA to 200MHz
set *0xFFFFFC28 = 0x206DBF09
while ((*0xFFFFFC68 & 0x2) == 0)
end
# Set PLLB for USB usage
set *0xFFFFFC2C = 0x20AF3F0F
while ((*0xFFFFFC68 & 0x4) == 0)
end
# Select prescaler
#set *0xFFFFFC30 = 0x00000100
while ((*0xFFFFFC68 & 0x8) == 0)
end
# Select master clock
set *0xFFFFFC30 = 0x00000102
while ((*0xFFFFFC68 & 0x8) == 0)
end
echo Master clock ok.\n
echo Configuring the SDRAM controller...\n
# Configure PIOD as peripheral (D16/D31)
# __writeMemory32(0xFFFF0000,0xFFFFF870,"Memory");
set *0xFFFFF870 = 0xFFFF0000
# __writeMemory32(0x00000000,0xFFFFF874,"Memory");
set *0xFFFFF874 = 0x00000000
# __writeMemory32(0xFFFF0000,0xFFFFF804,"Memory");
set *0xFFFFF804 = 0xFFFF0000
# Enable EBI chip select for the SDRAM
set *0xFFFFED20 = 0x2
# SDRAM configuration
set *0xFFFFE208 = 0x85227259
set *0xFFFFE200 = 0x1
set *0x20000000 = 0
set *0xFFFFE200 = 0x2
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x4
set *0x20000000 = 0
set *0xFFFFE200 = 0x3
set *0x20000000 = 0
set *0xFFFFE200 = 0x0
set *0x20000000 = 0
set *0xFFFFE204 = 0x2B7
echo SDRAM configuration ok.\n
# Setup GDB for faster downloads
set remote memory-write-packet-size 4096
set remote memory-write-packet-size fixed
monitor speed 12000
#break main
load
#continue
#stepi
Попутно вопрос: gdb command file исполняется до или после секции Initialize в настройках? И когда исполняется секция Run?
.....