Loading flash with J-Link

Discussion in 'Embedded Systems and Microcontrollers' started by kender, Dec 5, 2009.

  1. kender

    Thread Starter Senior Member

    Jan 17, 2007
    263
    0
    Folks,

    I have an IAR Embedded Workbench 5.11, J-Link debugger and a board with LPC2368 and a JTAG connector. I should be able to load the program into Flash, so that it can start on power-up and run on its own without J-Link, right? What steps should I take?

    I understand that I need to build my project with certain options. But what are they? Then there will be some output file (like .hex) which cane be downloaded into the micro from EWARM IDE or with something JLinkARM.

    Couldn't find a document or a web page describing how to do it. I've been trying to figure them out all day today.

    - Nick
     
  2. kender

    Thread Starter Senior Member

    Jan 17, 2007
    263
    0
    I was able to generate a .hex file. However, when I try to connect to the target from J-Flash ARM, I get a message:
    I can run my code in RAM with a J-Link debugger from IAR Embedded Workbench, so I think the JTAG is wired correctly (it's custom PCB). LPC2368 has got on-board Flash. What could be causing this message?

    Best,
    - Nick
     
  3. ftsolutions

    Active Member

    Nov 21, 2009
    48
    2
    I am presently running IAR EWARM 5.40 so perhaps the settings are different. But, I will try to help if I can:

    First off, are you sure that under Project->Options->General Options->Target is set for the exact device target (LPC2368) that you are using?

    Also, make sure that Project->Options->Debugger is NOT set to Simulator, but is set for J-Link/J-Trace. There are other option settings to check, but at least make sure that these are correct first .. There are also settings under the Options->JLink/Jtrace that can trip you up, but we'll cross that bridge if we need to.

    Lastly, are you using the Yellow Box (IAR licensed J-Link from Segger) or the original black Segger J-Link box? Have you downloaded/installed the J-Link Commander software/driver from Segger for the latest drivers?
     
  4. kender

    Thread Starter Senior Member

    Jan 17, 2007
    263
    0
    Thank you for the tips!

    The target is actually set to LPC2368.

    That setting is set to J-Link/J-Trace.

    I'm using a Yellow Box. I've installed the latest drivers about a month ago.
     
    Last edited: Dec 6, 2009
  5. ftsolutions

    Active Member

    Nov 21, 2009
    48
    2
    IT is possible that the flash is write protected, many times ones needs to run a macro file as part of the JTAG initialization with these parts or one of the other more obscure settings. A couple other things to check:
    Under Project->Options->Debugger->Setup do you have "Use macro file(s)" checked (and if so, what is macro file name)? I've found on the LPC2103 that I often needed to run one to ensure processor was fully reset during multiple download/debug sessions. Also, on same page, what about ""Override device description file"? You can try turning this on and clicking on the the button to view the installed files - there should be one in an NXP folder called "iolpc2368.ddf". Though this is mostly used by the compiler, it may be impacting your code image generation.

    On the next "tab" (Download), if you are using the IAR J-Link box and have loaded the drivers (you should NOT have the "Use Flash loader" box checked.

    Also, on the General Options->Output tab, you should make sure that the output file type is set to Executable

    another thing that can mess up your day is if the linker configuration file (Under Project->Options->Linker, Linker configuration file: Override default) is not correct. I have always had to turn this thing to Override, and specify the specific config file for the device. Search the directory tree for the LPC2368_Flash.icf file and select it (or select the LPC2368_RAM.icf file if making an exec to run in RAM).

    Hopefully one of these things may be amiss and correcting will get you going. I don't have any LPC2368 devices so I cannot make an empty starter project for you, sorry.

    You can also go to the LPC2000 forum on Yahoo.com and the LPC ARM discussion group in the Sparkfun.com forum websites for additional help.
     
Loading...