CC2340R5: CC2340r5: Erase through debugger always erases all flash

Part Number: CC2340R5
Other Parts Discussed in Thread: UNIFLASH

Hi,

In our project, we use the CC2340r5 and we have a custom bootloader which has 60 sectors of flash dedicated to it, the application then uses the other 206 sectors of flash.

We have not been able to find a way to program only the application, while keeping the bootloader intact. When we try flashing the application hex using JFlash, it first erases the whole flash before then programming only the application, instead of only erasing the application sectors. We even tried erasing only 1 sector in JFlash, and allthough it says  - Erasing range 0x4E020000 - 0x4E0207FF (  1 Sector, 2 KB), when reading the chip aftwerward, the chip was actually completely erased.
We have tried using an XDS probe and Uniflash as well, but also do not succeed in updating only parts of the flash.

Does the CC2340r5 not allow this?

We are able to erase single sectors at runtime, the problem specifically lies in erasing with a debug probe.

Thank you in advance,
Roeland Benoot

  • Hi Roeland,

    Here are some similar E2E threads and images that will help you implement the functionality you are asking about.

    Regards,
    Ryan

  • Hi Ryan,

    Thank you for your reponse. I had already look at similar threads, allthough your query is useful.

    I'm afraid that using the eraise/retain field in CCFG is not exactly useful for our use case. We would like the application to be updated, without erasing the bootloader. But we would also want the reverse: We would like the bootloader to be updated, without erasing the application part of the flash. So, if we set in the CCFG to not erase the bootloader section, such that we can solely update the application, we can't solely update the bootloader anymore as it is write/erase protected...

    Kind regards,
    Roeland Benoot

  • Thanks for clarifying.  For the use case you've described, would "Do not erase sectors (program load only)" support your needs?

    Regards,
    Ryan

  • Hi Ryan,

    The problem here is that I do need to erase the application part before I can flash a new version of the application. But in that case the bootloader part should not be erased.

    Kind regards
    Roeland

  • Have you tried the "skip specified sectors during program load" option?  This option is included in both CCS and Uniflash.

    The CC2340R5 supports flash sector erases, so it should be possible even if outside the typical tools.  Or you could choose to read the existing bootloader memory, mass erase, and re-program both the new application and original bootloader sectors.

    Regards,
    Ryan

  • Hi Ryan

    I would indeed expect this to be possible, as our custom bootloader can erase and program the application. However, when I try your suggestion by setting skip sectors 60-128, these sectors are still being erased.

    It seems as if it still mass erases the flash.

    Kind regards
    Roeland

  • Hi Roeland, I've looped in the CCS/Uniflash Tools Team to comment further on what the "Skip specified sectors during program load" accomplishes.

    Regards,
    Ryan