Download into external flash using GDB Server

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

  • Download into external flash using GDB Server

    I am trying out the Codeblocks based tool chain emide.org on my STM32F4.

    It works very well as long as I use internal flash, but I can not seem to be able to figure out how to
    download into the external Flash. For the moment the internal flash should be sufficient,
    but it would be good to be able to use a part (Maybe up to 2MB) of the external NOR Flash for code.
    The rest is used for the Filesystem, which is working well, so I know the flash is accessible and can be written.

    Any clues on how to download into the external Flash?
  • Hi Mike,

    Any clues on how to download into the external Flash?

    Sure.
    This is explained in UM08005 (GDBServer User Guide) chapter "4.2.3 Enabling flash download into CFI-compliant NOR flash".

    What needs to be done is, adding the following lines to your .gdbinit:
    monitor WorkRAM = <SAddr>-<EAddr>
    monitor flash CFI = <SAddr>-<EAddr>

    "monitor flash CFI": Tells the J-Link at what address range to look for the external flash.
    "monitor WorkRAM": Specifies a RAM area that can be temporarily used by J-Link to perform the download into the NOR flash.
    This area can also be used by your application (but should not be used by peripherals as DMAs) since J-Link restores the content when finished with flash programming.

    Example for STM32F4 + 2 MB CFI NOR flash + 16 KB work RAM:

    C Source Code

    1. monitor WorkRAM = 0x20000000-0x20003FFF
    2. monitor flash CFI = 0x60000000-0x601FFFFF


    Note: The initialization for the external memory interface also needs to be added to the .gdbinit.


    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.