Witam
Tak wiec powyzsze problemy zostaly rozwiazanie poprzez juz teraz w miare swiadoma instalacje "srodowiska". Problemem byla zle skonsturowana sciezka PATH, ktora albo nie podpowiadala gdzie znajduja sie programy, albo podpowiadala nie te co trzeba. Na dzien dzisiejszy moj zestaw wyglada tak:
- Eclipse (jeszcze debugger nie polaczony z insightem)
- yagarto
- yagarto tools
- openocd 0.1.0
- czasem flasher pana wlostowskiego
- Kabel ZL18ARM czyli chyba ST'owski flaslink
Kompiluje bez problemu, flashuje raz z problemami raz bez, ale idzie. Ale teraz chcialbym zdebugowac 'dzialajacy program'.W zwiazku z tym poszedlem za 'rymitywnym' przykladem z yagarto - czyli wprowadzenie elfa do insight.
1. Programuje program gpio.bin
2. Odpalam openocd
openocd -f flashlink.cfg -f str912.cfg
C:\openocd>openocd -f flashlink.cfg -f str912.cfg
Open On-Chip Debugger 0.1.0 (2009-01-21-21:15) Release
$URL: https://kc8apf@svn.berlios.de/svnroot/repos/openocd/tags/openocd-0.1.0/src/openocd.c $
jtag_speed: 0
RCLK - adaptive
Error: Translation from khz to jtag_speed not implemented
Warn : No parport port specified, using default '0x378' (LPT1)
Info : JTAG tap: str912.flash tap/device found: 0x04570041 (Manufacturer: 0x020, Part: 0x4570, Version: 0x0)
Info : JTAG Tap/device matched
Info : JTAG tap: str912.cpu tap/device found: 0x25966041 (Manufacturer: 0x020, Part: 0x5966, Version: 0x2)
Info : JTAG Tap/device matched
Info : JTAG tap: str912.bs tap/device found: 0x2457f041 (Manufacturer: 0x020, Part: 0x457f, Version: 0x2)
Error: JTAG tap: str912.bs got: 0x2457f041 (mfg: 0x020, part: 0x457f, ver: 0x2)
Error: JTAG tap: str912.bs expected 1 of 1: 0x1457f041 (mfg: 0x020, part: 0x457f, ver: 0x1)
Error: trying to validate configured JTAG chain anyway...
Warn : no telnet port specified, using default port 4444
Warn : no gdb port specified, using default port 3333
Warn : no tcl port specified, using default port 6666
3. Odpalam insight komenda
arm-elf-insight -x .gdbinit gpio.elf
Zawartosc .gdbinit:
target remote localhost:3333
monitor reset
monitor sleep 500
monitor poll
monitor soft_reset_halt
monitor arm7_9 force_hw_bkpts enable
monitor soft_reset_halt
Efekty na konsoli openocd:
Info : accepting 'gdb' connection from 0
target state: halted
target halted in ARM state due to debug-request, current mode: System
cpsr: 0x200000df pc: 0x000002e0
Warn : acknowledgment received, but no packet pending
Error: Translation from khz to jtag_speed not implemented
Error: Translation from khz to jtag_speed not implemented
Runtime error, file "embedded:startup.tcl", line 143:
Info : JTAG tap: str912.flash tap/device found: 0x04570041 (Manufacturer: 0x
020, Part: 0x4570, Version: 0x0)
Info : JTAG Tap/device matched
Info : JTAG tap: str912.cpu tap/device found: 0x25966041 (Manufacturer: 0x020, P
art: 0x5966, Version: 0x2)
Info : JTAG Tap/device matched
Info : JTAG tap: str912.bs tap/device found: 0x2457f041 (Manufacturer: 0x020, Pa
rt: 0x457f, Version: 0x2)
Error: JTAG tap: str912.bs got: 0x2457f041 (mfg: 0x020, part: 0x457f
, ver: 0x2)
Error: JTAG tap: str912.bs expected 1 of 1: 0x1457f041 (mfg: 0x020, part: 0x457f
, ver: 0x1)
Error: trying to validate configured JTAG chain anyway...
target state: running
requesting target halt and executing a soft reset
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x200000d3 pc: 0x00000000
invalid command name "arm7_9_force_hw_bkpts"
requesting target halt and executing a soft reset
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x200000d3 pc: 0x00000000
Informacja z konsoli gdb (uruchomionej przez program insight:
Translation from khz to jtag_speed not implemented
Translation from khz to jtag_speed not implemented
Runtime error, file "embedded:startup.tcl", line 143:
in procedure 'jtag_rclk' called at file "str912.cfg", line 0
called at file "embedded:startup.tcl", line 142
JTAG tap: str912.flash tap/device found: 0x04570041 (Manufacturer: 0x020, Part: 0x4570, Version: 0x0)
JTAG Tap/device matched
JTAG tap: str912.cpu tap/device found: 0x25966041 (Manufacturer: 0x020, Part: 0x5966, Version: 0x2)
JTAG Tap/device matched
JTAG tap: str912.bs tap/device found: 0x2457f041 (Manufacturer: 0x020, Part: 0x457f, Version: 0x2)
JTAG tap: str912.bs got: 0x2457f041 (mfg: 0x020, part: 0x457f, ver: 0x2)
JTAG tap: str912.bs expected 1 of 1: 0x1457f041 (mfg: 0x020, part: 0x457f, ver: 0x1)
trying to validate configured JTAG chain anyway...
target state: running
requesting target halt and executing a soft reset
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x200000d3 pc: 0x00000000
invalid command name "arm7_9_force_hw_bkpts"
called at file "command.c", line 456
called at file "embedded:startup.tcl", line 89
called at file "embedded:startup.tcl", line 93
requesting target halt and executing a soft reset
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x200000d3 pc: 0x00000000
(gdb)
Problem tkwi w 2 rzeczach:
1) blacha - nie moge zaprogramować urządzenia poprzez debugger - jest ono programowane osobno
2) chocbym nie wiem ile klikał: Step, Next, Finish Nie mogę wejsc do main tylko jestem w pętli delay. Jedynie continue puszcza program dalej - ale nie o to chodzi
gpio.c
#include "91x_map.h"
#include "91x_scu.h"
#include "91x_fmi.h"
/*----------------------------------------------------------------------*/
// delay for n cycles
static void delay(int n)
{
while(n--)
asm volatile ("nop");
}
/*----------------------------------------------------------------------*/
/* Ustawienie parametrow zegarowych */
//Czestotliwosc 96MHz
#define PLL_N 192
#define PLL_M 25
#define PLL_P 2
#define SCU_PLLEN 0x80000
static void setup_pll(void)
{
//Jezeli petla jest zsynchronizowana tzn ze jest ok
if(SCU->SYSSTATUS & SCU_FLAG_LOCK) return;
//Konfiguracja uruchomienie i synchronizacja PLL
SCU->PLLCONF = (PLL_P<<16) | (PLL_N<<8) | PLL_M;
SCU->PLLCONF |= SCU_PLLEN;
while(~SCU->SYSSTATUS & SCU_FLAG_LOCK);
//Ustawiamy pamiec flash na dwa cykle oczekiwania (dla 96MHz)
FMI->CR |= FMI_WRITE_WAIT_STATE_1;
*(vu16*)FMI_BANK_1 = 0x60;
*(vu16*)(FMI_BANK_1|FMI_READ_WAIT_STATE_2|FMI_LVD_ENABLE|FMI_PWD_ENABLE|FMI_FREQ_HIGH) = 0x03;
//Ustawiamy F clk na koncu bedzie z PLL-a
SCU->CLKCNTR = SCU_EMIBCLK_Div2 | SCU_USBCLK_MCLK2 | SCU_PCLK_Div2;
}
/*----------------------------------------------------------------------*/
/* Ustawienie portow IO */
static void setup_gpio(void)
{
// Wylacz sygnal zerowania dla portu 7 i 3
SCU->PRR1 |= __GPIO7 | __GPIO3 ;
//Wlacz sygnal zegarowy dla portu 7 i 3
SCU->PCGR1 |= __GPIO7 | __GPIO3;
//Wszystkie wyjscia portu 7 jako push pull
SCU->GPIOTYPE[7] = 0x0000;
//Wszystkie wyjscia portu 7 w trybie GPIO
SCU->GPIOOUT[7] = 0x5555;
//Caly port 7 jako wyjsciowy
GPIO7->DDR = 0xff;
//Caly port 3 jako wejscie
SCU->GPIOIN[3] = 0x00;
//Port 3 jako wejsciowy
GPIO3->DDR = 0;
}
/*----------------------------------------------------------------------*/
//Funkcja glowna main
int main(void)
{
//Poczatkowe opoznienie (JTAG CACHE)
delay(1000000);
//Ustawienie portow gpio
setup_pll();
//Ustawienie petli PLL (czestotliwosc 96MHz)
setup_gpio();
// petla nieskocznona
while(1)
{
int i;
for(i=0;i<4;i++)
{
// Zalacz wylacz ledy
GPIO7->DR[0x0f<<2]=(1<<i);
//Przepisz dane klawiszy na ledy
GPIO7->DR[0xf0<<2] = ~GPIO3->DR[0xf0<<2];
// wait a while
delay(1000000);
}
}
return 0;
}