[ABANDONED] Debugger code upload clear flash ?

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

  • [ABANDONED] Debugger code upload clear flash ?

    I have code that I am debugging now and it is around 8kbyte large and it sits in sector 0 (start location at 0x0000). According to the user manual each sector is 32kB.
    I have pushed some custom data to Flash at position 0x8000 (sector 1), but after toggling the power of microcontroller and re-connecting the debugger, data is gone. It is replaced with 0xff.
    Is this due to debugger clearing all sectors before downloading the code to host ? I was expecting only to clear the sector that is used by the code..
    Can I prevent this in configuration ?

    Thanks
  • Hello,

    Thank you for your inquiry.
    Such an issue is not known to us.
    J-Link will usually only delete used sectors and leave everything else untouched.
    Did you verify that the application that has been downloaded at all?
    What target devices are you debugging?
    Is it on custom hardware or an eval board?
    Could you provide an example project for reproduction on an eval board?

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    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 contact us per e-mail.
    Alternatively our support system can be used as well: segger.com/ticket/
  • I made a little test application, and I was able to reproduce the behaviour. After better observation, problem seems to be in Memory viewer rather than debugger clearing the code.

    What I did is following:

    Source Code

    1. Read memory location from flash by dereferencing the address 0x8000
    2. Write 256 bytes in location 0x8000, where first 4 bytes are "0xBEEFC0DE"
    3. Read memory location again

    This works like a charm. Restart the micro, read address again, all there.

    Then I did the following:

    Source Code

    1. Read memory location from flash
    2. Change first byte in Memory1 viewer, so my string is now "0x00EFC0DE"
    3. Write 256 bytes in location 0x8000, where first 4 bytes are "0xBEEFC0DE"
    4. Read memory location again -> "0xBEEFC0DE"
    5. Refresh Memory1 view window -> "0x00FFFFFF"
    After that I cant get any of the Memory viewers to get anything from that memory address. It gets stuck on "0x00FFFFFF". Sometimes restarting the debug session recovers, but sometimes I need to kill the application ..

    I was running this thing for couple of iterations and basically, Memory Viewer is buggy ! It is either over-writing the whole lot when changing one byte, or showing wrong values.. buffer doesnt reflect the actual memory. Refresh is not working at all.

    I am using version 4.12 64-bit on Windows.
    mcu is LPC54102 on custom board
    Program is as simple as explained in above steps.
    For writing the flash I am using sequence:(iap_prepare_sector, iap_erase_page, iap_prepare_sector, iap_write_page).
    I dont think source code is needed, as it is really nothing in the code that could cause this behaviour ..

    Hope this helps to trace the issue 8)