programming LPC4088 with Jlink.exe and hex file

  • programming LPC4088 with Jlink.exe and hex file

    I am trying to make a remote lab so that students can program my lpc4088 from a website that I created. Students work in the µvision software.

    In the laboratory this software uses the J-link device to download the program in the microcontroller but the file the microvision software sends to the downloader has the extention “.axf” and because the “loadfile” function doesn’t support this extension I don’t really get how this works.

    On this site(segger.com/jlink-flash-download.html ) I found the following information:


    J-Link Commander is a free command line utility for simple analysis of the target system with J-Link. J-Link Commander also allows downloads into flash memory of target systems.

    How to perform downloading into flash via J-Link Commander:

    • Connect J-Link to the PC.
    • Connect target system to J-Link
    • Start J-Link Commander.
    • Type the following commands:
      J-Link> device // For a list of known
      devices, please refer to here
      J-Link> speed
      J-Link> r
      J-Link> h
      J-Link> loadbin ,
    • J-Link Commander executes the flash download and prints out the
      time statistics on success.




    In the manual of the J-link device I also found the loadfile function instead of the loadbin.

    µvision can create a hex file on build which can be used by the “loadfile” function. The plan is that this file will be uploaded and downloaded into my server where it will be automatically downloaded into the microcontroller with the j-link device.

    In a first step I tried to program the microcontroller directly from the j-link command window. I entered all the command as specified above and get a success message but the microcontroller is not working as it should. Is it possible that hex files are not compatible?


    Any advice on how to fix this problem?

    This are the in and outputs from my command line Jlink.exe:

    C:\Users\Admin\Documents\Robin\JLink_V498d>jlink.exe


    SEGGER J-Link Commander V4.98d ('?'for help)
    Compiled Apr 28 2015 13:58:44
    DLL version V4.98d, compiled Apr 28 201513:58:23
    Firmware: J-Link ARM V8 compiled Nov 28 2014 13:44:46
    Hardware: V8.00
    S/N: 268006192
    OEM: SEGGER-EDU
    Feature(s): FlashBP, GDB
    VTarget = 3.300V
    Info: TotalIRLen = 4, IRPrint = 0x01
    Info: Found Cortex-M4 r0p1, Little endian.
    Info: FPUnit: 6 code (BP) slots and 2 literal slots
    Info: CoreSight components:
    Info: ROMTbl 0 @ E00FF000
    Info: ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
    Info: ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
    Info: ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
    Info: ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
    Info: ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
    Info: ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
    Found 1 JTAG device, Total IRLen = 4:
    #0 Id: 0x4BA00477, IRLen: 04, IRPrint: 0x1,CoreSight JTAG-DP (ARM)
    Cortex-M4 identified.
    Target interface speed: 100 kHz
    J-Link>device lpc4088
    Info: Device "LPC4088" selected.
    Reconnecting to target...
    Info: TotalIRLen = 4, IRPrint = 0x01
    Info: Found Cortex-M4 r0p1, Little endian.
    Info: FPUnit: 6 code (BP) slots and 2 literal slots
    Info: CoreSight components:
    Info: ROMTbl 0 @ E00FF000
    Info: ROMTbl 0 [0]: FFF0F000, CID: B105E00D, PID: 000BB00C SCS
    Info: ROMTbl 0 [1]: FFF02000, CID: B105E00D, PID: 003BB002 DWT
    Info: ROMTbl 0 [2]: FFF03000, CID: B105E00D, PID: 002BB003 FPB
    Info: ROMTbl 0 [3]: FFF01000, CID: B105E00D, PID: 003BB001 ITM
    Info: ROMTbl 0 [4]: FFF41000, CID: B105900D, PID: 000BB9A1 TPIU
    Info: ROMTbl 0 [5]: FFF42000, CID: B105900D, PID: 000BB925 ETM
    J-Link>speed 2000
    Target interface speed: 2000 kHz
    J-Link>r
    Reset delay: 0 ms
    Reset type NORMAL: Resets core & peripherals via SYSRESETREQ & VECTRESET bit.
    J-Link>h
    PC = 000002AC, CycleCnt = 00000000
    R0 = 00000000, R1 = 000002AD, R2 = 00000000, R3 = 00000000
    R4 = 3456ABCD, R5 = 3456ABCD, R6 = 12345678, R7 = 00000000
    R8 = 00000000, R9 = 00000000, R10= 00000000, R11= 00000000
    R12= 00000000
    SP(R13)= 100010F0, MSP= 100010F0, PSP= 10000830, R14(LR) = 1FFF0483
    XPSR = 61000000: APSR = nZCvq, EPSR = 01000000, IPSR = 000 (NoException)
    CFBP = 00000000, CONTROL = 00, FAULTMASK = 00, BASEPRI = 00, PRIMASK = 00
    FPU regs: FPU not enabled / not implemented on connected CPU.
    J-Link>loadfile C:\Users\Admin\Documents\Robin\pruebaC\Objects\pruebaC.hex
    Downloading file [C:\Users\Admin\Documents\Robin\pruebaC\Objects\pruebaC.hex]...
    Info: J-Link: Flash download: Flash programming performed for 1 range (4096 bytes)
    Info: J-Link: Flash download: Total time needed: 0.254s (Prepare: 0.073s, Compar
    e: 0.022s, Erase: 0.111s, Program: 0.037s, Verify: 0.000s, Restore: 0.007s)
    O.K.
    J-Link>

    The post was edited 3 times, last by robbbin ().

  • Hello Robin,


    Loadbin is the predecessor of the loadfile command. Every feature of loadbin is present in loadfile. Hex files are compatible with loadfile.

    Maybe there is a problem within the application.
    Could you please try to download the programm using µVison's native J-Link implementation? (segger.com/IDE_Integration_Keil.html)

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • thanks for your help!

    i changed the settings in my µvision project and if i build and run the project using the µvision software the build is still succesfull and works. But if i use the newly created hexfile in the loadfile function after repeating the other commands in the command line of the Jlink.exe nothing happens. I also gave the command "g" to make shure the lpc4088 is running.
  • dear,

    i just found out that if i put following commands it works. it is just everything 2 times. any idea why?

    device lpc4088
    speed 2000
    r
    h
    loadfile c:\users\admin\document\robin\botones\objects\botones.hex
    g
    device lpc4088
    speed 2000
    r
    h
    loadfile c:\users\admin\document\robin\botones\objects\botones.hex
    g
  • EDIT: Could please try the following sequence?:

    device lpc4088
    speed 2000
    r
    h
    loadfile c:\users\admin\document\robin\botones\objects\botones.hex
    r
    g

    Resetting the target after download is mandatory in order to set the PC to the entry point of the new application.


    Hi Robin,

    To sum it up, you did the following:

    1) Build the application with µVision.
    2) Download the application using µVsion
    3) If you hit run / continue in µVison, the target did the expected task (e.g. leds blinked)

    But if you downloaded the .hex file created in 1) using J-Link Commander, the expected task was not executed on the target?

    Do you download the application to the internal flash (starting @ 0x0) or somewhere else?
    Would it be possible for you to send us the µVision project and the Hex-File?

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • I have an other question and i am goin to ask it here so you know the context.
    the lpc4088 is located on a development board. this development board has a joystick that i want to simulate with buttons on my screen. I know the location of the register in the microcontroller so i am trying to use the "w4" command to change the bits value. For now this is nog working. Do you thing this can have anything to do with the order of the steps? The hex file is already in the microcontroller but i program it again just to be shure all settings are as initial.


    device lpc4088
    speed 2000
    r
    h
    loadfile c:\users\admin\document\robin\botones\objects\botones.hex

    mem8 0x20098050//mask register
    mem8 0x20098054//register
    w4 0x20098050, 0xFBFFFFFF
    w4 0x20098050, 0x00000000
    mem8 0x20098050//mask registermem8 0x20098054//registerr
    g
  • Hi Robin,

    could you please post the in- and outputs of J-Link Commander, like you did in #1 ?
    loadfile c:\users\admin\document\robin\botones\objects\botones.hex
    As i said in my last post, resetting the target after download is mandatory in order to set the PC to the entry point of the (new) application.
    w4 0x20098050, 0xFBFFFFFF
    w4 0x20098050, 0x00000000
    Did you mean 0x20098054 in the 2nd line?

    Best regards,
    Niklas
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.