[ANSWERED]Downloading with eclipse the same way as J-Flash does?

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ANSWERED]Downloading with eclipse the same way as J-Flash does?

    Hi!

    I use eclipse(with CDT plugin) with yagarto. Until now I can only download my binary using J-Flash. I tried with eclipse to download the binary but so far I failed!
    I got

    Source Code

    1. Downloading 6600 bytes @ address 0x00000000 - Verify failed
    2. Downloading 24 bytes @ address 0x000019C8 - Verify failed
    3. Downloading 24 bytes @ address 0x000019E0 - Verify failed
    4. Downloading 708 bytes @ address 0x000019F8 - Verify failed
    5. Downloading 16320 bytes @ address 0x00004000 - Verify failed
    6. Downloading 68 bytes @ address 0x00007FC0 - Verify failed
    7. Downloading 4 bytes @ address 0x00008004 - Verify failed
    8. Downloading 4 bytes @ address 0x00008008 - Verify failed
    9. Downloading 4 bytes @ address 0x0000800C - Verify failed

    in the J-Link GBD server log output

    The best I can do for now is to download the bin file in J_Flash and then debug in eclipse using the elf file

    Is there a way to using gbd command and J-Link commander to get the same result as j-Flash?
    If so I should be able to do the same thing in eclipse...
  • Hi,

    it would really help if you would be as exact as in the J-Flash related thread,
    since with the information above we can not help you that much...

    You are trying to download into external CFI compliant flash memory, correct? (This is an important information)
    You are using an ARM7 based device (Cirrus Logic EP7312). (This is also an important information)

    Did you take a look at UM08001 (chapter "flash download", you can use the same addresses as in J-Flash for the setup) in order to know how to setup your debugger for download into external CFI flash memory?
    segger.com/cms/admin/uploads/p…Docs/UM08001_JLinkARM.pdf


    Best regards
    Alex
    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.
  • Hi!

    There's more informations on my system :
    CFI compliant flash memory (I guess) : Intel - 28F320C3T
    ARM7 device : EP7312 from Cirrus Logic.

    The EP7312 is not listed on the page segger.com/jlink_supported_devices.html so I presume that the command :
    exec device = <DeviceName> cannot be used in my case?

    I'm not sure if I should use theses two commands for J-Link GDBServer:
    monitor WorkRAM = <SAddr>-<EAddr>
    monitor flash CFI = <SAddr>-<EAddr>

    or adapt the example (see below) for J-Link commander for my own hardware:

    Source Code

    1. r
    2. speed 1000
    3. exec setcfiflash 0x64000000 - 0x64FFFFFF
    4. exec setworkram 0x20000000 - 0x2000FFFF
    5. w4 0x40021014, 0x00000114 // RCC_AHBENR, FSMC clock enable
    6. w4 0x40021018, 0x000001FD // GPIOD~G clock enable
    7. w4 0x40011400, 0xB4BB44BB // GPIOD low config, NOE, NWE => Output, NWAIT => Input
    8. w4 0x40011404, 0xBBBBBBBB // GPIOD high config, A16-A18
    9. w4 0x40011800, 0xBBBBBBBB // GPIOE low config, A19-A23
    10. w4 0x40011804, 0xBBBBBBBB // GPIOE high config, D5-D12
    11. w4 0x40011C00, 0x44BBBBBB // GPIOF low config, A0-A5
    12. w4 0x40011C04, 0xBBBB4444 // GPIOF high config, A6-A9
    13. w4 0x40012000, 0x44BBBBBB // GPIOG low config, A10-A15
    14. w4 0x40012004, 0x444B4BB4 // GPIOG high config, NE2 => output
    15. w4 0xA0000008, 0x00001059 // CS control reg 2, 16-bit, write enable, Type: NOR flash
    16. w4 0xA000000C, 0x10000505 // CS2 timing reg (read access)
    17. w4 0xA000010C, 0x10000505 // CS2 timing reg (write access)
    18. speed 4000
    19. mem 0x64000000,100
    20. loadbin C:\STMB672_STM32F103ZE_TestBlinky.bin,0x64000000
    21. mem 0x64000000,100
    Display All

    Or maybe a mix of the two solutions?
  • I tried with
    monitor WorkRAM = <SAddr>-<EAddr>
    monitor flash CFI = <SAddr>-<EAddr>

    and it seems to work with eclipse. Here's the settings that I used :

    Source Code

    1. target remote localhost:2331
    2. monitor endian little
    3. monitor speed 500
    4. monitor flash device = 28F320C3T
    5. monitor WorkRAM = 0x60000000-0x60008000
    6. monitor flash CFI = 0-0x3FFFFF
    7. monitor flash download = 1
    8. monitor flash breakpoints = 1
    9. #monitor reset 8
    10. monitor sleep 10


    I'm not sure for the flash device "28F320C3T" if I use this command correctly. If my flash is CFI compliant, do I need to specify the flash device?

    Another thing that bother me, when I debug my code in step mode, is that I see some J-Flash small windows that appear. This may be normal, but I just want to be sure that theses windows are not a clue that something is wrong with my config.

    When I start my debugging session, I put a break points at 0x0. When I execute the next assembly line with a step command, I see a window that appear briefly (see picture screenshot J-Link flash download.JPG in attachment). Its like the program is not copied to flash before the first assembly line is executed? It is a normal behaviour?

    The other window (screenshot J-Link reprogramming flash.JPG picture in attachment) appear when I execute a branch. Why is there any need to reprogram the flash in debug session? My pc is at address 0x6c and jump to 0x9f8. Here's the line :
    0x0000006c <ResetHandler+48>: bl 0x9f8 <CInit_Init>
    And the register value before executing the line 0x6c :

    Source Code

    1. r0 0x0
    2. r1 0x0
    3. r2 0x0
    4. r3 0x1
    5. r4 0x0
    6. r5 0x0
    7. r6 0x0
    8. r7 0x0
    9. r8 0x0
    10. r9 0x0
    11. r10 0x0
    12. r11 0x0
    13. r12 0x80001280
    14. sp 0x60008000
    15. lr 0x54
    16. pc 0x0000006c
    17. f0 0x0
    18. f1 0x0
    19. f2 0x0
    20. f3 0x0
    21. f4 0x0
    22. f5 0x0
    23. f6 0x0
    24. f7 0x0
    25. fps 0x0
    26. cpsr 0xd3
    Display All


    I also see the same windows later in my debug session...

    Is every things seems normal to you?

    Thanks in advance!
    Images
    • screenshot J-Link flash download.JPG

      14.77 kB, 382×135, viewed 1,142 times
    • screenshot J-Link reprogramming flash.JPG

      8.86 kB, 381×100, viewed 1,097 times
  • Other quick question:
    does the address specified in "monitor WorkRAM = <SAddr>-<EAddr>" must be reserved after the code is downloaded in the processor? Can I put my stack pointer somewhere between SAddr and EAddr or it could be corrupted during a debug session?
  • Hi,

    To answer your questions:
    Reprogramming is necessary because in external flash, all breakpoints are implemented as flash breakpoints
    (which means the application instructions are replaced by breakpoint instructions) and when stepping the original instruction needs to be in the flash again.
    J-Link tries to avoid reprogramming by simulating some instructions, but not all instructions are and can be simulated.

    WorkRAM: J-Link restores the original RAM contents everytime it finished all flashing, so do not care about this area in your application. You can also use it in your application.
    The only restriction is: The defined area should not be used by any DMA transfers.


    Best regards
    Alex
    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.