Need help about OpenOCD and S3C2440

I DIY a USB2JTAG board using a FT2232L, and I can halt, resume, and reset the Vivi on NOR flash in the S3C2440 Devboard using the USB2JTAG, so I think the hardware is OK.

Now I want to use it to debug some program to learn about ARM. I have tow questions, please give me some help.

The first is about the configuration file for OpenOCD, here is my config file

#daemon configuration
telnet_port 4444
gdb_port 3333
#debug_level 3
jtag_speed 1

#interface
interface ft2232
ft2232_device_desc "Dual RS232 A"
ft2232_layout "usbjtag"
ft2232_vid_pid 0x0403 0xcff8 #not used under Windows
jtag_speed 0
#use combined on interfaces or targets that can't set TRST/SRST separately
reset_config trst_and_srst combined
#jtag_nsrst_delay 500
#jtag_ntrst_delay 500

#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
#jtag_device 4 0x1 0xf  0x0032409d
jtag_device 4 0x1 0xf 0xe

#target configuration
daemon_startup reset_and_halt
#target <type> <endianess> <reset mode>
target arm9tdmi little reset_halt 0 arm920t
working_area 0 0x30000000 0x4000000 nobackup
run_and_halt_time 0 10

#flash configuration
#flash bank <driver> <base> <size> <chip_width> <bus_width> [driver_options ...]
flash bank cfi 0x00000000 0x200000 1 2 0

The S3C2440 has 64MB SDRAM (0x3000000-0x340000000, selected by nGCS6),

and 2M NOR Flash (0x00000000-0x00200000, selected by nGCS0),

it also have 64MB NAND flash

Does the above OpenOCD configuration right ?

The second is about the ldscript.

I modify the ldscript for AT91SAM7 come with the winarm toolchain, the only thing I changed is the MEMORY section

MEMORY
{
  CODE (rx) : ORIGIN = 0x30000000, LENGTH = 0x00003000
  DATA (rw) : ORIGIN = 0x30003000, LENGTH = 0x00001000
  STACK (rw) : ORIGIN = 0x30004000,LENGTH = 0x00000000
}


/* Section Definitions */

SECTIONS
{
  /* first section is .text which is used for code */
  . = 0x0000000;
  .text : { *cstartup.o (.text) }>CODE =0
  .text :
  {
    *(.text)                   /* remaining code */

    *(.glue_7t) *(.glue_7)

  } >CODE =0

  . = ALIGN(4);

  /* .rodata section which is used for read-only data (constants) */

  .rodata :
  {
    *(.rodata)
  } >CODE

  . = ALIGN(4);

  _etext = . ;
  PROVIDE (etext = .);

  /* .data section which is used for initialized data */

  .data : AT (_etext)
  {
    _data = . ;
    *(.data)
    SORT(CONSTRUCTORS)
  } >DATA
  . = ALIGN(4);

  _edata = . ;
   PROVIDE (edata = .);

  /* .bss section which is used for uninitialized data */

  .bss :
  {
    __bss_start = . ;
    __bss_start__ = . ;
    *(.bss)
    *(COMMON)
  } 
  . = ALIGN(4);
  __bss_end__ = . ;
  __bss_end__ = . ;
  _end = .;
    . = ALIGN(4);
   .int_data :  
   { 
   *(.internal_ram_top) 
   }> STACK 

  PROVIDE (end = .);

  /* Stabs debugging sections.  */
  .stab          0 : { *(.stab) }
  .stabstr       0 : { *(.stabstr) }
  .stab.excl     0 : { *(.stab.excl) }
  .stab.exclstr  0 : { *(.stab.exclstr) }
  .stab.index    0 : { *(.stab.index) }
  .stab.indexstr 0 : { *(.stab.indexstr) }
  .comment       0 : { *(.comment) }
  /* DWARF debug sections.
     Symbols in the DWARF debugging sections are relative to the beginning
     of the section so we begin them at 0.  */
  /* DWARF 1 */
  .debug          0 : { *(.debug) }
  .line           0 : { *(.line) }
  /* GNU DWARF 1 extensions */
  .debug_srcinfo  0 : { *(.debug_srcinfo) }
  .debug_sfnames  0 : { *(.debug_sfnames) }
  /* DWARF 1.1 and DWARF 2 */
  .debug_aranges  0 : { *(.debug_aranges) }
  .debug_pubnames 0 : { *(.debug_pubnames) }
  /* DWARF 2 */
  .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }
  .debug_abbrev   0 : { *(.debug_abbrev) }
  .debug_line     0 : { *(.debug_line) }
  .debug_frame    0 : { *(.debug_frame) }
  .debug_str      0 : { *(.debug_str) }
  .debug_loc      0 : { *(.debug_loc) }
  .debug_macinfo  0 : { *(.debug_macinfo) }
  /* SGI/MIPS DWARF 2 extensions */
  .debug_weaknames 0 : { *(.debug_weaknames) }
  .debug_funcnames 0 : { *(.debug_funcnames) }
  .debug_typenames 0 : { *(.debug_typenames) }
  .debug_varnames  0 : { *(.debug_varnames) }
}

Everytime I download the code from arm-elf-insight to Openocd, it says “download failed”.

I have searched the forum, didn’t find some similiar use case. Is there some sample source code for S3C2440 using gnutool chian and can be debugged with OpenOCD ?

Any help is appreciated :slight_smile: