Commit 9e5a6679 authored by ntfreak's avatar ntfreak
Browse files

- added svn props

- fixed mixed line endings on flash.c, log.c, gdb_server.c

git-svn-id: svn://svn.berlios.de/openocd/trunk@371 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent 76ebc783
2008-01-21 :
xscale big-endian branch closed and all changes moved to
trunk.
2008-01-21 :
xscale big-endian branch closed and all changes moved to
trunk.
#daemon configuration
telnet_port 4444
gdb_port 3333
#interface
interface ft2232
ft2232_device_desc "Stellaris Evaluation Board A"
ft2232_layout evb_lm3s811
ft2232_vid_pid 0x0403 0xbcd9
jtag_speed 40
#LM3S811 Evaluation Board has only srst
reset_config srst_only separate
#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe
#target configuration
daemon_startup attach
#target <type> <startup mode>
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target cortex_m3 little run_and_halt 0
# 4k working area at base of ram
working_area 0 0x20000800 0x1200 nobackup
#target_script 0 reset ../doc/scripts/evb_lm3s811_test.script
#flash configuration
flash bank stellaris 0 0 0 0 0
#daemon configuration
telnet_port 4444
gdb_port 3333
#interface
interface ft2232
ft2232_device_desc "Stellaris Evaluation Board A"
ft2232_layout evb_lm3s811
ft2232_vid_pid 0x0403 0xbcd9
jtag_speed 40
#LM3S811 Evaluation Board has only srst
reset_config srst_only separate
#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe
#target configuration
daemon_startup attach
#target <type> <startup mode>
#target arm7tdmi <reset mode> <chainpos> <endianness> <variant>
target cortex_m3 little run_and_halt 0
# 4k working area at base of ram
working_area 0 0x20000800 0x1200 nobackup
#target_script 0 reset ../doc/scripts/evb_lm3s811_test.script
#flash configuration
flash bank stellaris 0 0 0 0 0
# Resets and unlocks the MSM of TMS470R1A288 (an others with an MSM).
# Assumes default MSM keys (all 0xFFFFFFFF).
#
resume
jtag_reset 0 1
halt
jtag_reset 0 0
poll # hack-ish, but effective version of 'reset halt'
mdw 0x1fe0 4 # unlock MSM
# Resets and unlocks the MSM of TMS470R1A288 (an others with an MSM).
# Assumes default MSM keys (all 0xFFFFFFFF).
#
resume
jtag_reset 0 1
halt
jtag_reset 0 0
poll # hack-ish, but effective version of 'reset halt'
mdw 0x1fe0 4 # unlock MSM
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
1. GDB startup script for debugging purposes.
# startup script for debugging flash erase
target remote 10.0.0.56:2001
monitor halt
monitor reset
load
# stack
monitor rm 13 0x7000
# pc
monitor rm 15 0x8000
# arg1 to erase()
monitor rm 0 0x1030000
# arg2 to erase()
monitor rm 1 0x10000
stepi
2. Uploading flash driver via tftp
$ tftp 10.0.0.108
tftp> binary
tftp> put at91fr40162.bin 10.0.0.108:/config/flashdriver.bin
Sent 4048 bytes in 0.1 seconds
tftp>
4. Programming flash
eCosBoard_prog 0x1000000 /config/testdata.bin
tftp> put /cygdrive/c/workspace/ecosboard/ecosboard/phi/bootloader/images/bootloader.bin 10.0.0.108:/config/test.bin
Sent 165724 bytes in 3.9 seconds
halt
reg cpsr 0x000000D3
mww 0xFFE00020 0x1
mww 0xFFE00024 0x00000000
mww 0xFFE00000 0x01002539
eCosBoard_profile
eCosBoard_prog /config/test.bin 0x1000000
eCosBoard_profile_done
set remote memory-write-packet-size fixed
set remote memory-write-packet-size 8192
set remote memory-map-packet on
target remote 10.0.0.108:3333
monitor halt
monitor reg cpsr 0x000000D3
monitor mww 0xFFE00020 0x1
monitor mww 0xFFE00024 0x00000000
monitor mww 0xFFE00000 0x01002539
monitor eCosBoard_profile
load
monitor eCosBoard_profile_done
source /tmp/ecosboard/packages/services/profile/gprof/current/host/gprof.gdb
gprof_dump
shell cp gmon.out /tmp/ecosboard/build/src
echo To view: cd /tmp/ecosboard/build/src && gprof openocd
Performance problems:
It seems the problem is that the actual flash programming takes time.
hal_delay_us() is invoked between each time the
CPU is polled for whether flash programming has completed.
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
35.82 37.66 37.66 hal_delay_us
11.90 50.17 12.51 arm7tdmi_clock_out
9.86 60.54 10.37 gdb_get_packet
5.36 66.17 5.63 memcpy
4.34 70.73 4.56 target_buffer_get_u32
3.34 74.25 3.51 embeddedice_read_reg_w_che
ck
1.39 75.71 1.46 arm7_9_write_memory
1.34 77.11 1.40 cyg_tcp_output
1.33 78.51 1.40 __udivsi3
1.11 79.68 1.17 cyg_tcp_input
1.07 80.80 1.13 arm7tdmi_store_word_regs
0.95 81.81 1.00 __udivdi3
0.95 82.80 1.00 __umodsi3
0.93 83.78 0.98 arm7tdmi_write_core_regs
0.86 84.68 0.91 arm7_9_poll
0.85 85.57 0.89 memset
0.77 86.38 0.81 cyg_splx
0.64 87.05 0.67 cyg_in_cksumdata
0.63 87.71 0.66 openeth_deliver
0.57 88.31 0.60 strstr
0.51 88.85 0.53 eth_drv_recv
0.49 89.36 0.52 cyg_splinternal
0.49 89.88 0.52 cyg_splimp
1. GDB startup script for debugging purposes.
# startup script for debugging flash erase
target remote 10.0.0.56:2001
monitor halt
monitor reset
load
# stack
monitor rm 13 0x7000
# pc
monitor rm 15 0x8000
# arg1 to erase()
monitor rm 0 0x1030000
# arg2 to erase()
monitor rm 1 0x10000
stepi
2. Uploading flash driver via tftp
$ tftp 10.0.0.108
tftp> binary
tftp> put at91fr40162.bin 10.0.0.108:/config/flashdriver.bin
Sent 4048 bytes in 0.1 seconds
tftp>
4. Programming flash
eCosBoard_prog 0x1000000 /config/testdata.bin
tftp> put /cygdrive/c/workspace/ecosboard/ecosboard/phi/bootloader/images/bootloader.bin 10.0.0.108:/config/test.bin
Sent 165724 bytes in 3.9 seconds
halt
reg cpsr 0x000000D3
mww 0xFFE00020 0x1
mww 0xFFE00024 0x00000000
mww 0xFFE00000 0x01002539
eCosBoard_profile
eCosBoard_prog /config/test.bin 0x1000000
eCosBoard_profile_done
set remote memory-write-packet-size fixed
set remote memory-write-packet-size 8192
set remote memory-map-packet on
target remote 10.0.0.108:3333
monitor halt
monitor reg cpsr 0x000000D3
monitor mww 0xFFE00020 0x1
monitor mww 0xFFE00024 0x00000000
monitor mww 0xFFE00000 0x01002539
monitor eCosBoard_profile
load
monitor eCosBoard_profile_done
source /tmp/ecosboard/packages/services/profile/gprof/current/host/gprof.gdb
gprof_dump
shell cp gmon.out /tmp/ecosboard/build/src
echo To view: cd /tmp/ecosboard/build/src && gprof openocd
Performance problems:
It seems the problem is that the actual flash programming takes time.
hal_delay_us() is invoked between each time the
CPU is polled for whether flash programming has completed.
Flat profile:
Each sample counts as 0.01 seconds.
% cumulative self self total
time seconds seconds calls Ts/call Ts/call name
35.82 37.66 37.66 hal_delay_us
11.90 50.17 12.51 arm7tdmi_clock_out
9.86 60.54 10.37 gdb_get_packet
5.36 66.17 5.63 memcpy
4.34 70.73 4.56 target_buffer_get_u32
3.34 74.25 3.51 embeddedice_read_reg_w_che
ck
1.39 75.71 1.46 arm7_9_write_memory
1.34 77.11 1.40 cyg_tcp_output
1.33 78.51 1.40 __udivsi3
1.11 79.68 1.17 cyg_tcp_input
1.07 80.80 1.13 arm7tdmi_store_word_regs
0.95 81.81 1.00 __udivdi3
0.95 82.80 1.00 __umodsi3
0.93 83.78 0.98 arm7tdmi_write_core_regs
0.86 84.68 0.91 arm7_9_poll
0.85 85.57 0.89 memset
0.77 86.38 0.81 cyg_splx
0.64 87.05 0.67 cyg_in_cksumdata
0.63 87.71 0.66 openeth_deliver
0.57 88.31 0.60 strstr
0.51 88.85 0.53 eth_drv_recv
0.49 89.36 0.52 cyg_splinternal
0.49 89.88 0.52 cyg_splimp
0.46 90.36 0.48 cyg_ip_input
\ No newline at end of file
This diff is collapsed.
......@@ -64,7 +64,7 @@ extern flash_driver_t stellaris_flash;
extern flash_driver_t str9xpec_flash;
extern flash_driver_t stm32x_flash;
extern flash_driver_t tms470_flash;
extern flash_driver_t ecosflash_flash;
extern flash_driver_t ecosflash_flash;
flash_driver_t *flash_drivers[] =
{
......@@ -77,7 +77,7 @@ flash_driver_t *flash_drivers[] =
&str9xpec_flash,
&stm32x_flash,
&tms470_flash,
&ecosflash_flash,
&ecosflash_flash,
NULL,
};
......@@ -115,7 +115,7 @@ static int flash_driver_erase(struct flash_bank_s *bank, int first, int last)
{
ERROR("invalid flash sector");
retval=ERROR_FLASH_SECTOR_INVALID;
} else
} else
{
retval=bank->driver->erase(bank, first, last);
}
......@@ -137,7 +137,7 @@ int flash_driver_protect(struct flash_bank_s *bank, int set, int first, int last
{
ERROR("invalid flash sector");
retval=ERROR_FLASH_SECTOR_INVALID;
} else
} else
{
retval=bank->driver->protect(bank, set, first, last);
}
......@@ -152,7 +152,7 @@ int flash_driver_protect(struct flash_bank_s *bank, int set, int first, int last
int flash_register_commands(struct command_context_s *cmd_ctx)
{
flash_cmd = register_command(cmd_ctx, NULL, "flash", NULL, COMMAND_ANY, NULL);
register_command(cmd_ctx, flash_cmd, "bank", handle_flash_bank_command, COMMAND_CONFIG, "flash_bank <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...]");
register_command(cmd_ctx, flash_cmd, "auto_erase", handle_flash_auto_erase_command, COMMAND_ANY,
"auto erase flash sectors <on|off>");
......@@ -184,7 +184,7 @@ int flash_init_drivers(struct command_context_s *cmd_ctx)
register_command(cmd_ctx, flash_cmd, "protect", handle_flash_protect_command, COMMAND_EXEC,
"set protection of sectors at <bank> <first> <last> <on|off>");
}
return ERROR_OK;
}
......@@ -208,12 +208,12 @@ flash_bank_t *get_flash_bank_by_num(int num)
{
flash_bank_t *p = get_flash_bank_by_num_noprobe(num);
int retval;
if (p == NULL)
return NULL;
retval = p->driver->auto_probe(p);
if (retval != ERROR_OK)
{
ERROR("auto_probe failed %d\n", retval);
......@@ -227,31 +227,31 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
int i;
int found = 0;
target_t *target;
if (argc < 6)
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((target = get_target_by_num(strtoul(args[5], NULL, 0))) == NULL)
{
ERROR("target %lu not defined", strtoul(args[5], NULL, 0));
return ERROR_OK;
}
for (i = 0; flash_drivers[i]; i++)
{
if (strcmp(args[0], flash_drivers[i]->name) == 0)
{
flash_bank_t *p, *c;
/* register flash specific commands */
if (flash_drivers[i]->register_commands(cmd_ctx) != ERROR_OK)
{
ERROR("couldn't register '%s' commands", args[0]);
exit(-1);
}
c = malloc(sizeof(flash_bank_t));
c->target = target;
c->driver = flash_drivers[i];
......@@ -263,14 +263,14 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
c->num_sectors = 0;
c->sectors = NULL;
c->next = NULL;
if (flash_drivers[i]->flash_bank_command(cmd_ctx, cmd, args, argc, c) != ERROR_OK)
{
ERROR("'%s' driver rejected flash bank at 0x%8.8x", args[0], c->base);
free(c);
return ERROR_OK;
}
/* put flash bank in linked list */
if (flash_banks)
{
......@@ -283,18 +283,18 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
{
flash_banks = c;
}
found = 1;
}
}
/* no matching flash driver found */
if (!found)
{
ERROR("flash driver '%s' not found", args[0]);
exit(-1);
}
return ERROR_OK;
}
......@@ -302,19 +302,19 @@ int handle_flash_banks_command(struct command_context_s *cmd_ctx, char *cmd, cha
{
flash_bank_t *p;
int i = 0;
if (!flash_banks)
{
command_print(cmd_ctx, "no flash banks configured");
return ERROR_OK;
}
for (p = flash_banks; p; p = p->next)
{
command_print(cmd_ctx, "#%i: %s at 0x%8.8x, size 0x%8.8x, buswidth %i, chipwidth %i",
i++, p->driver->name, p->base, p->size, p->bus_width, p->chip_width);
}
return ERROR_OK;
}
......@@ -323,34 +323,34 @@ int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cmd, char
flash_bank_t *p;
int i = 0;
int j = 0;
if (argc != 1)
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
for (p = flash_banks; p; p = p->next, i++)
{
if (i == strtoul(args[0], NULL, 0))
{
char buf[1024];
/* attempt auto probe */
p->driver->auto_probe(p);
command_print(cmd_ctx, "#%i: %s at 0x%8.8x, size 0x%8.8x, buswidth %i, chipwidth %i",
i, p->driver->name, p->base, p->size, p->bus_width, p->chip_width);
for (j = 0; j < p->num_sectors; j++)
{
char *erase_state, *protect_state;
if (p->sectors[j].is_erased == 0)
erase_state = "not erased";
else if (p->sectors[j].is_erased == 1)
erase_state = "erased";
else
erase_state = "erase state unknown";
if (p->sectors[j].is_protected == 0)
protect_state = "not protected";
else if (p->sectors[j].is_protected == 1)
......@@ -362,12 +362,12 @@ int handle_flash_info_command(struct command_context_s *cmd_ctx, char *cmd, char
j, p->sectors[j].offset, p->sectors[j].size, p->sectors[j].size>>10,
erase_state, protect_state);
}
p->driver->info(p, buf, 1024);
command_print(cmd_ctx, "%s", buf);
}
}
return ERROR_OK;
}
......@@ -375,12 +375,12 @@ int handle_flash_probe_command(struct command_context_s *cmd_ctx, char *cmd, cha
{
flash_bank_t *p;
int retval;
if (argc != 1)
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
p = get_flash_bank_by_num_noprobe(strtoul(args[0], NULL, 0));
if (p)
{
......@@ -403,7 +403,7 @@ int handle_flash_probe_command(struct command_context_s *cmd_ctx, char *cmd, cha
{
command_print(cmd_ctx, "flash bank '#%s' is out of bounds", args[0]);
}
return ERROR_OK;
}
......@@ -411,12 +411,12 @@ int handle_flash_erase_check_command(struct command_context_s *cmd_ctx, char *cm
{
flash_bank_t *p;
int retval;
if (argc != 1)
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
p = get_flash_bank_by_num(strtoul(args[0], NULL, 0));
if (p)
{
......@@ -430,7 +430,7 @@ int handle_flash_erase_check_command(struct command_context_s *cmd_ctx, char *cm
args[0], p->base);
}
}
return ERROR_OK;
}
......@@ -442,14 +442,14 @@ int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, char *
int length;
duration_t duration;
char *duration_text;
target_t *target = get_current_target(cmd_ctx);
if (argc != 2)
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
address = strtoul(args[0], NULL, 0);
length = strtoul(args[1], NULL, 0);
if (length <= 0)
......@@ -463,19 +463,19 @@ int handle_flash_erase_address_command(struct command_context_s *cmd_ctx, char *
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
/* We can't know if we did a resume + halt, in which case we no longer know the erased state */
flash_set_dirty();
duration_start_measure(&duration);
if ((retval = flash_erase_address_range(target, address, length)) == ERROR_OK)
{
duration_stop_measure(&duration, &duration_text);
duration_stop_measure(&duration, &duration_text);
command_print(cmd_ctx, "erased address 0x%8.8x length %i in %s", address, length, duration_text);
free(duration_text);
}
return retval;
}
......@@ -483,12 +483,12 @@ int handle_flash_protect_check_command(struct command_context_s *cmd_ctx, char *
{
flash_bank_t *p;
int retval;
if (argc != 1)
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
p = get_flash_bank_by_num(strtoul(args[0], NULL, 0));
if (p)
{
......@@ -509,7 +509,7 @@ int handle_flash_protect_check_command(struct command_context_s *cmd_ctx, char *
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
}
......@@ -523,18 +523,18 @@ int handle_flash_erase_command(struct command_context_s *cmd_ctx, char *cmd, cha
flash_bank_t *p = get_flash_bank_by_num(strtoul(args[0], NULL, 0));