December 25, 2024, 08:33:06 AM

openocd lpc1788.cfg file

Started by Nihat, October 16, 2012, 04:49:48 PM

Previous topic - Next topic

Nihat

Where can i find lpc1788.cfg for openocd?
Mod-LCD 4.3" used lpc1788 mcu and on pdf manual in section 2.2 says
"
2.2 Requirements
...........
You may use any of Olimex's ARM-JTAG programmer/debugger (For example ARM-USB-TINYH)
for this task.
"

Nihat

I found from http://nemuisan.blog.bai.ne.jp/
# script for LPC1788 nemuisan tokusei
# NXP LPC1788 Cortex-M3 with 512kB Flash and 64kB+32kBAHB Local On-Chip SRAM,

# Reset init script sets it to 120MHz
set CCLK 120000

# set LPC1788 Information
set CHIPNAME lpc1788
set CPUTAPID 0x4ba00477
set CPURAMSIZE 0x10000
set CPUROMSIZE 0x80000

#Include the main configuration file.
source [find target/lpc17xx.cfg];
$_TARGETNAME configure -work-area-phys 0x10000000 -work-area-size $_CPURAMSIZE -rtos auto

# A Scripts

$_TARGETNAME configure -event reset-start {
   # Start *real slow* as we do not know the
    # state the boot rom left the clock in
   adapter_khz 10
}

# Set up 120MHz clock to CPU
$_TARGETNAME configure -event reset-init {
   echo "RIZE UP TO 120MHz"

    # PLL0CON: Disable PLL
   mww 0x400FC080 0x00000000
    # PLLFEED
   mww 0x400FC08C 0x000000AA
    # PLLFEED
   mww 0x400FC08C 0x00000055

    # CLKSEL: internal 12MHz RC oscillator Div 1.
   mww 0x400FC104 0x00000001
    # CLKSRCSEL: Clock source = internal 12MHz RC oscillator
   mww 0x400FC10C 0x00000000

    # PLL0CFG: M=10,P=1 -> PLL=240 MHz
   mww 0x400FC084 0x00000009
    # PLLFEED
   mww 0x400FC08C 0x000000AA
    # PLLFEED
   mww 0x400FC08C 0x00000055

   # PLL0CON: Enable PLL
   mww 0x400FC080 0x00000001
    # PLLFEED
   mww 0x400FC08C 0x000000AA
    # PLLFEED
   mww 0x400FC08C 0x00000055

   sleep 50

    # PLL0CON: Connect PLL
    # CCLKSEL=PLLED(240MHz)/2 (=120 MHz)
   mww 0x400FC104 0x00000102
    # PLLFEED
   mww 0x400FC08C 0x000000AA
    # PLLFEED
   mww 0x400FC08C 0x00000055

   # Dividing CPU clock by 8 should be pretty conservative
   #
   #
   global CCLK
   adapter_khz [expr $CCLK / 8]

   # Do not remap 0x0000-0x0020 to anything but the flash (i.e. select
   # "User Flash Mode" where interrupt vectors are _not_ remapped,
   # and reside in flash instead).
   #
   # See Table 612. Memory Mapping Control register (MEMMAP - 0x400F C040) bit description
   # Bit Symbol Value Description Reset
   # value
   # 0 MAP Memory map control. 0
   # 0 Boot mode. A portion of the Boot ROM is mapped to address 0.
   # 1 User mode. The on-chip Flash memory is mapped to address 0.
   # 31:1 - Reserved. The value read from a reserved bit is not defined. NA
   #
   # http://ics.nxp.com/support/documents/microcontrollers/?scope=LPC1788&type=user

   mww 0x400FC040 0x01
}


proc mt_flash {IMGFILE} {
   flash write_image erase $IMGFILE
   verify_image $IMGFILE
   reset run
   shutdown
}

proc mt_flash_bin {IMGFILE OFFSET} {
   flash write_image erase $IMGFILE $OFFSET bin
   verify_image $IMGFILE $OFFSET
   reset run
   shutdown
}

proc mt_flash_hex {IMGFILE} {
   flash write_image erase $IMGFILE 0 ihex
   verify_image $IMGFILE 0
   reset run
   shutdown
}

proc eraser {} {
# Verbose procedure confirmed erase routine
   flash erase_sector 0 0 last
   flash erase_check 0
   soft_reset_halt
   shutdown
}


#debug_level 3
cortex_m3 reset_config sysresetreq
init
reset init

maria_olimex

Hello,

We have a lpc1788.cfg file up on the website, which uses the standard lpc17xx.cfg file in openocd.

You can find the files here:
https://www.olimex.com/Products/Modules/LCD/MOD-LCD4.3''/resources/LPC1788cfg.zip

Navigate to:
<openocd installation folder>/scripts/target/

and paste the lpc1788.cfg file from there. You'll notice that a file named lpc17xx.cfg is already present and all other specific lpc scripts call it at the end (the specific scripts are used to define things like RAM and ROM size, CPU frequency etc.)

Best Regards,
Maria/OLIMEX
Software developer at Olimex