load command inside gdb CLI doesn't flash new image into device

I use `west debug` to start `gdb` for debugging nRF5340DK

when I use `west build` to update the image, I use `load` command inside gdb CLI, the new `zephyr.elf` is loaded, then `mon reset` and `continue` but the execution (changed text inside LOG_) still remains, I think the load doesn't flash the device as intended.

(gdb) mon flash download=1
Flash download enabled
(gdb) load
Loading section rom_start, size 0x154 lma 0x8000
Loading section text, size 0x4464c lma 0x8154
Loading section .ARM.exidx, size 0x8 lma 0x4c7a0
Loading section initlevel, size 0xa8 lma 0x4c7a8
Loading section device_area, size 0xa0 lma 0x4c850
Loading section sw_isr_table, size 0x228 lma 0x4c8f0
Loading section app_shmem_regions, size 0x8 lma 0x4cb18
Loading section _static_thread_data_area, size 0x2c lma 0x4cb20
Loading section ctors, size 0xc lma 0x4cb4c
Loading section log_const_area, size 0xc0 lma 0x4cb58
Loading section log_backend_area, size 0x10 lma 0x4cc18
Loading section zephyr_dbg_info, size 0x41 lma 0x4cc28
Loading section shell_area, size 0x30 lma 0x4cc6c
Loading section shell_root_cmds_area, size 0x30 lma 0x4cc9c
Loading section shell_subcmds_area, size 0x14 lma 0x4cccc
Loading section shell_dynamic_subcmds_area, size 0xc lma 0x4cce0
Loading section rodata, size 0xb594 lma 0x4ccf0
Loading section datas, size 0x5c0 lma 0x58a84
Loading section device_states, size 0x10 lma 0x59044
Loading section log_mpsc_pbuf_area, size 0x44 lma 0x59054
Loading section log_msg_ptr_area, size 0x4 lma 0x59098
Loading section log_dynamic_area, size 0x60 lma 0x5909c
Loading section k_mem_slab_area, size 0x20 lma 0x590fc
Loading section k_mutex_area, size 0x14 lma 0x5911c
Loading section k_sem_area, size 0x18 lma 0x59130
Loading section net_buf_pool_area, size 0x34 lma 0x59148
Loading section kobject_data, size 0x5d0 lma 0x5917c
Loading section .last_section, size 0x4 lma 0x5974c
Start address 0x00017f20, load size 331593
Transfer rate: 477 KB/sec, 7055 bytes/write.
(gdb) mon reset
Resetting target
(gdb) c
Continuing.

  • Hi,

    Could you provide all commands that you used in sequential order and relevant commands' output? Where did you run mentioned commands from?

    Which command did you run to get showed loading section? Is the loading section that you showed complete? If not, could you please provide a complete one?

    Best regards,
    Dejan


  • I first use

    west debug

    to start gdb, then it loaded and flash firmware into nRF5340.

    then inside gdb command line,

    I used the commands ( they are all under gdb command line prompt ) as the code I referenced in my first post.

  • Here is response returned from west debug

    $ west debug
    -- west debug: rebuilding
    [0/31] Performing build step for 'tfm'
    ninja: no work to do.
    -- west debug: using runner jlink
    -- runners.jlink: JLink version: 7.94e
    -- runners.jlink: J-Link GDB server running on port 2331; thread info enabled
    SEGGER J-Link GDB Server V7.94e Command Line Version
    
    JLinkARM.dll V7.94e (DLL compiled Jan 15 2024 15:19:33)
    
    -----GDB Server start settings-----
    GDBInit file:                  none
    GDB Server Listening port:     2331
    SWO raw output listening port: 2332
    Terminal I/O port:             2333
    Accept remote connection:      yes
    Generate logfile:              off
    Verify download:               off
    Init regs on start:            off
    Silent mode:                   on
    Single run mode:               on
    Target connection timeout:     0 ms
    ------J-Link related settings------
    J-Link Host interface:         USB
    J-Link script:                 none
    J-Link settings file:          none
    ------Target related settings------
    Target device:                 nrf5340_xxaa_app
    Target device parameters:      none
    Target interface:              SWD
    Target interface speed:        4000kHz
    Target endian:                 little
    
    GNU gdb (Zephyr SDK 0.16.5) 12.1
    Copyright (C) 2022 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=arm-zephyr-eabi".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <https://github.com/zephyrproject-rtos/sdk-ng/issues>.
    Find the GDB manual and other documentation resources online at:
        <http://www.gnu.org/software/gdb/documentation/>.
    
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Scripting in the "Python" language is not supported in this copy of GDB.
    Reading symbols from /home/hongbo/Developer/Embedded/IotPi/lte-tracker/fw/applications/lte_tracker/build/zephyr/zephyr.elf...
    Remote debugging using :2331
    
    Resetting target
    Loading section rom_start, size 0x154 lma 0x8000
    Loading section text, size 0x44808 lma 0x8154
    Loading section .ARM.exidx, size 0x8 lma 0x4c95c
    Loading section initlevel, size 0xa8 lma 0x4c964
    Loading section device_area, size 0xa0 lma 0x4ca0c
    Loading section sw_isr_table, size 0x228 lma 0x4caac
    Loading section app_shmem_regions, size 0x8 lma 0x4ccd4
    Loading section _static_thread_data_area, size 0x2c lma 0x4ccdc
    Loading section ctors, size 0xc lma 0x4cd08
    --Type <RET> for more, q to quit, c to continue without paging--
    Loading section log_const_area, size 0xc0 lma 0x4cd14
    Loading section log_backend_area, size 0x10 lma 0x4cdd4
    Loading section zephyr_dbg_info, size 0x41 lma 0x4cde4
    Loading section shell_area, size 0x30 lma 0x4ce28
    Loading section shell_root_cmds_area, size 0x30 lma 0x4ce58
    Loading section shell_subcmds_area, size 0x14 lma 0x4ce88
    Loading section shell_dynamic_subcmds_area, size 0xc lma 0x4ce9c
    Loading section rodata, size 0xb5e8 lma 0x4ceb0
    Loading section datas, size 0x5c0 lma 0x58c98
    Loading section device_states, size 0x10 lma 0x59258
    Loading section log_mpsc_pbuf_area, size 0x44 lma 0x59268
    Loading section log_msg_ptr_area, size 0x4 lma 0x592ac
    Loading section log_dynamic_area, size 0x60 lma 0x592b0
    Loading section k_mem_slab_area, size 0x20 lma 0x59310
    Loading section k_mutex_area, size 0x14 lma 0x59330
    Loading section k_sem_area, size 0x18 lma 0x59344
    Loading section net_buf_pool_area, size 0x34 lma 0x5935c
    Loading section kobject_data, size 0x5d0 lma 0x59390
    Loading section .last_section, size 0x4 lma 0x59960
    Start address 0x00017f20, load size 332121
    Transfer rate: 25 KB/sec, 7066 bytes/write.

  • Hi,

    Thank you for additional information.

    Which operating system do you use?

    Where do you run "west debug" command from?

    Best regards,
    Dejan

  • Under Debian bookworm

    My workspace likes:

    ROOT / applications / app / src

                                              / CMakeLists.txt

                                              / boards / ... overlay/conf

               / ncs / nrf

                        / zephyr

                        / nrfxlib

                        / bootloader

                        / ...

    I ran "west debug" under my application root directory, which "app" in above directory structure.

Related