Signing image and CONFIG_ROM_START_OFFSET parameter.

Im working with nrf52840DK and nrf Connect SDK 2.2.0. 

My goal is running this sample. (SMP server sample). Let's check the described steps:

1º) I have installed the MCUMGR CLI

2º) I have built and flashed the MCUBoot

3º) I have built the sample application with the next command:

west build -b nrf52840dk_nrf52840 zephyr/samples/subsys/mgmt/mcumgr/smp_svr -- -DOVERLAY_CONFIG='overlay-serial.conf;overlay-fs.conf;overlay-shell-mgmt.conf'

4º) This step is where I got stucked... Trying to signing the image. When I run the next command:

west sign -t imgtool -- --key bootloader/mcuboot/root-rsa-2048.pem

I get the next prompt:

D:\ncs\v2.2.0>west sign -t imgtool -- --key bootloader/mcuboot/root-rsa-2048.pem
=== image configuration:
partition offset: 49152 (0xc000)
partition size: 421888 (0x67000)
rom start offset: 0 (0x0)
=== signing binaries
unsigned bin: D:\ncs\v2.2.0\build\zephyr\zephyr.bin
signed bin:   D:\ncs\v2.2.0\build\zephyr\zephyr.signed.bin
Usage: python -m imgtool sign [OPTIONS] INFILE OUTFILE
Try 'python -m imgtool sign -h' for help.

Error: Invalid value for '-H' / '--header-size': Minimum value for -H/--header-size is 32
FATAL ERROR: command exited with status 2: 'C:\Users\juan.martinez\AppData\Local\Programs\Python\Python38\Scripts\imgtool.EXE' sign --version 0.0.0+0 --align 4 --header-size 0 --slot-size 421888 --key bootloader/mcuboot/root-rsa-2048.pem 'D:\ncs\v2.2.0\build\zephyr\zephyr.bin' 'D:\ncs\v2.2.0\build\zephyr\zephyr.signed.bin'

I noticed the --header-size is 0 and it should be (the prompt says it) minimun 32... What is the exactly minimun value for it? How can I change it?

Parents Reply Children
  • I solved my last problem, I need to have installed nrf command line tools AND JLink software . Now I can use this command to know which port is the correct to comm with the board:

    nrfjprog --com
    1050291266    /dev/ttyACM1    VCOM1
    1050291266    /dev/ttyACM0    VCOM0

    Anyway I cant echo nothing with the board from my RaspberryPI:

    root@gcu1:/opt# mcumgr --conntype serial --connstring "/dev/ttyACM0,baud=115200" echo hello
    Error: NMP timeout
    root@gcu1:/opt# mcumgr --conntype serial --connstring "/dev/ttyACM1,baud=115200" echo hello
    Error: NMP timeout

    I would suggest to test UART example before you move to DFU example. 

    When I flashed the merged.hex from my WINDOWS laptop, I connected via RTT and got the Hello World, so the board is working fine. After it, Im testing the board connecting it to my RaspberryPi, I have installed JLink, nrf command line tools and MCUMGR CLI. I can run correctly nrfjprog and mcumgr:

    nrfjprog:

    root@gcu1:/opt# nrfjprog
    
    Usage:
    -------------------------------------------------------------------------------
    
     -q  --quiet                 Reduces the stdout info. Must be combined with
                                 another command.
    
     -h  --help                  Displays this help.
    
     -v  --version               Displays the nrfjprog and dll versions.
    
         --force                 Bypass all questions to continue.
                                 Recommended to use this flag when scripting.
    
         --log [<path>]          Enable logging.
                                 Default output file is "log.log".
                                 Set the <path> option to modify log file
                                 location and/or name.
                                 If the parent folder of <path> does not
                                 yet exist, nrfjprog will attempt to create it.
                                 Logger output is always appended
                                 to the file.
                                 Must be combined with another command.
    
         --jdll <file>           Uses the Segger's JLinkARM dll specified in the
                                 given file path instead of searching for the
                                 latest version of Segger's JLinkARM dll. Must be
                                 combined with another command.
                                 Limitations:
                                 Unicode paths are not supported
    
         --config <file>         Uses the nrfjprog settings file specified in the
                                 given file path instead of searching for the
                                 default config.toml file in the installation
                                 folder. TOML configuration files may contain
                                 both QSPI and nrfjprog target settings.
                                 Must be combined with another command.
    
         --storeconfig <file>    Stores the nrfjprog settings loaded from
                                 --config / --ini / --qspiini and command line
                                 to <file> in toml formatting.
                                 This option can be used to translate old .ini
                                 files to .toml files for example.
    
         --ini <file>            Deprecated: Use a TOML file with --config instead.
                                 Uses the nrfjprog settings file specified in the
                                 given ini file path instead of searching for the
                                 default config.toml file in the installation
                                 folder. Must be combined with another command.
    
         --qspiini <file>        Deprecated: Use a TOML file with --config instead.
                                 Uses the QSPI settings file specified in the given
                                 file ini path instead of searching for the default
                                 config.toml file in the installation folder.
                                 Must be combined with either --erasepage, --memrd,
                                 --memwr, --program, --verify, --readqspi or
                                 --qspieraseall commands.
                                 Limitations:
                                 For nRF51 devices, the operation is not available.
                                 For nRF52 devices, the operation is not available
                                 for devices without a QSPI peripheral.
                                 For nRF91 devices, the operation is not available
    
         --qspicustominit        Deprecated, this operation does nothing.
    
     -i  --ids                   Displays the serial numbers of all the debuggers
                                 connected to the PC.
    
         --expand                Expands the information printed by --ids. This is.
                                 useful for seeing addition information on
                                 network connected debug probes.
    
         --com                   Displays a list of the serial port associated
                                 with all connected debuggers. If combined with
                                 --snr, it will display all comports associated
                                 with this debugger
    
         --deviceversion         Displays the type of device connected.
                                 If combined with --snr, it will display the device
                                 associated with this debugger
    
     -f  --family <family>       Selects the device family for the operation. Valid
                                 argument options are NRF51, NRF52, NRF53, NRF91,
                                 and UNKNOWN.
                                 If UNKNOWN family is given, an automatic family
                                 detection of the device is performed. Note that
                                 providing the actual family is faster than
                                 performing the automatic family detection. If
                                 --family option is not given, the default is taken
                                 from nrfjprog.ini. Must be combined with another
                                 command.
    
     -s  --snr <serial_number>   Selects the debugger with the given serial number
                                 among all those connected to the PC for the
                                 operation. Must be combined with another command.
    
         --ip [<hostname>|<ip>|<tunnel>]        Provide a network connection string
                                 for target debugger. This string can be an IPv4
                                 address or a hostname. The port to connect to can
                                 be specified with the --port option.
                                 Passing --ip without any arguments is equivalent
                                 to passing --iface ip.
                                 It is possible to connect to a debugger running
                                 in tunneling mode. Shortened tunnel connection
                                 string format is not supported.
                                 An example of a tunnel mode connection string is:
                                 "tunnel:123456789:pwd:jlink-europe.segger.com"
                                 Read more about JLink connection types at
                                 "https://wiki.segger.com/J-Link_Remote_Server".
                                 Must be combined with another command.
    
         --port <port>           Selects which port to use when establishing a
                                 network connection to a debugger. Must be used
                                 together with the --ip option.
                                 Default port is 19020.
    
     -c  --clockspeed <speed>    Sets the debugger SWD clock speed in kHz
                                 resolution for the operation. The valid clockspeed
                                 arguments go from 4 kHz to 50000 kHz. If given
                                 clockspeed is above the maxiumum clockspeed
                                 supported by the emulator, its maximum will be
                                 used instead. If --clockspeed option is not given,
                                 the default is taken from nrfjprog.ini. Must be
                                 combined with another command.
    
         --iface <USB|IP> [USB|IP]            Sets which interfaces to use when
                                 searching for and connecting to debuggers.
                                 Both USB and IP can be listed at the same time.
                                 By default, only USB connected debuggers are
                                 targeted unless the --ip option is present.
                                 This option is mainly intended to be
                                 used together with --snr and --ids.
                                 Must be combined with another command
    
         --recover               Erases all user available non-volatile memory and
                                 disables the read back protection mechanism if
                                 enabled.
    
         --rbp <level>           Enables the readback protection mechanism. Valid
                                 argument options are CR0 and ALL.
                                 Limitations:
                                 For nRF52 devices, the CR0 argument option is
                                 invalid.
                                 Side effects:
                                 After an --rbp operation is performed, the
                                 available operations are reduced.
                                 For nRF51 devices, and if argument option ALL is
                                 used, --pinreset will not work on certain older
                                 devices.
                                 For nRF52 devices, only --pinreset, --debugreset
                                 or --recover operations are available after --rbp.
    
         --pinresetenable        Enables the pin reset by the use of UICR PSELRESET
                                 registers.
                                 Limitations:
                                 For nRF51 devices, the command is not available.
                                 For nRF53 devices, the command is not available.
                                 For nRF91 devices, the command is not available.
    
     -p  --pinreset              Performs a pin reset. Core will run after the
                                 operation.
    
         --hardreset             Performs a hard reset. Core will run after the
                                 operation.
                                 Limitations:
                                 For nRF51 devices, the command is not available.
                                 For nRF53 devices, the command is not available.
                                 For nRF91 devices, the command is not available.
    
     -r  --reset                 Performs a soft reset by setting the SysResetReq
                                 bit of the AIRCR register of the core. The core
                                 will run after the operation. Can be combined with
                                 the --program operation. If combined with the
                                 --program operation, the reset will occur after
                                 the flashing has occurred to start execution.
    
     -d  --debugreset            Performs a soft reset by the use of the CTRL-AP.
                                 The core will run after the operation. Can be
                                 combined with the --program operation. If combined
                                 with the --program operation, the debug reset will
                                 occur after the flashing has occurred to start
                                 execution.
                                 Limitations:
                                 For nRF51 devices, the --debugreset operation is
                                 not available.
                                 For nRF52 devices, the --debugreset operation is
                                 not available for nRF52832_xxAA_ENGA devices.
    
     -e  --eraseall              Erases all user available program flash memory and
                                 the UICR page. Can be combined with the
                                 --qspieraseall operation.
                                 Limitations:
                                 For nRF51 devices, if the device came from Nordic
                                 with a pre-programmed SoftDevice, only the user
                                 available code flash and UICR will be erased.
    
         --qspieraseall          Erases all the flash of the external memory device
                                 with the help of the QSPI peripheral. Note that
                                 depending on the external memory device's erase
                                 speed the operation might take minutes. Can be
                                 combined with the --eraseall operation.
                                 Limitations:
                                 For nRF51 devices, the operation is not available.
                                 For nRF52 devices, the operation is not available
                                 for devices without a QSPI peripheral.
                                 For nRF52 devices, the operation is only available
                                 for devices connected to an external memory
                                 device. To determine if an external memory device
                                 is connected, nrfjprog checks MemSize parameter
                                 from the QspiDefault.ini file or the QSPI
                                 configuration ini file that is given with the
                                 --qspiini option.
                                 For nRF91 devices, the operation is not available
    
         --eraseuicr             Erases the UICR page.
                                 Limitations:
                                 For nRF51 devices, the operation is available only
                                 if the device came from Nordic with a
                                 pre-programmed SoftDevice.
                                 For nRF91 devices, the operation is not available
                                 to erase uicr, please use --eraseall
    
         --erasepage <start[-end]>                      Erases the flash pages
                                 starting at the flash page containing the start
                                 address and ending at the page containing the end
                                 address (not included in the erase). If end
                                 address is not given, only one flash page will be
                                 erased. If your device is equipped with a QSPI
                                 peripheral, the pages to erase belong to the XIP
                                 region of the device, and an external memory
                                 device is present, this command erases 4 kB pages
                                 from the external memory device. The first address
                                 of the region is considered as address 0 of the
                                 external memory device. To determine if an
                                 external memory device is present, nrfjprog checks
                                 the MemSize parameter from the QspiDefault.ini
                                 file or from the QSPI configuration ini file given
                                 with the --qspiini option.
                                 Limitations:
                                 For nRF51 devices, the page will not be erased if
                                 it belongs to region 0.
    
         --program <hex_file> [--sectorerase | --chiperase | --sectoranduicrerase |
                                  --recover] [--qspisectorerase | --qspichiperase]
                                 Programs the specified image_file into the device.
                                 Supported file formats are .hex, .ihex, .elf,
                                 .axf, and .bin. A valid format must be specified
                                 by the filename extension.
                                 If the target area to program is not erased, the
                                 --program operation will fail unless an erase
                                 option is given. Valid erase operations for
                                 the internal flash memory are --recover,
                                  --sectorerase, --sectoranduicrerase and
                                  --chiperase. If --chiperase is given, all the
                                 available user non-volatile memory, including
                                 UICR, will be erased before programming. If
                                 --recover is given, all the available user
                                 non-volatile memory, including UICR, will
                                 be erased before programming, even if the
                                 device is readback protected.
                                 If --sectorerase is given, only the targeted
                                 non-volatile memory pages excluding UICR will
                                 be erased. If --sectoranduicrerase is given,
                                 only the targeted non-volatile memory pages
                                 including UICR will be erased. Note that the
                                 --sectoranduicrerase and --sectorerase
                                 operations normally take significantly longer time
                                 compared to --chiperase operation so use them with
                                 caution. If your device is equipped witha QSPI
                                 peripheral and an external memory device is
                                 present, data targeting the XIP region will be
                                 written to the external memory device.
                                 The first address of the XIP region
                                 is considered as address 0 of the external memory
                                 device. To determine if an external memory device
                                 is present, nrfjprog checks the MemSize paramter
                                 from QspiDefault.ini file or from the QSPI
                                 configuration ini file given with the --qspiini
                                 option. If the target area to program is not
                                 erased, the --program operation will fail unless
                                 an erase option is given. Valid erase operations
                                 for the external memory device are --qspichiperase
                                 and --qspisectorerase. If --qspichiperase is
                                 given, the external memory device will be erased.
                                 If the --qspisectorerase is given, only 4kB pages
                                 pages from the targeted external memory device
                                 will be erased. Note that --qspichiperase
                                 operation may take several minutes. The --program
                                 command can be combined with the --verify
                                 operation. It can also be combined with either the
                                 --reset or the --debugreset operations. the reset
                                 will occur after the flash operation in order to
                                 start the execution.
                                 Limitations:
                                 For nRF51 devices, the --sectoranduicrerase
                                 operation is not available.
                                 For nRF51 devices, if the image_file provided
                                 contains sectors belonging to region 0, the
                                 --program operation will fail.
                                 For nRF51 devices, the --qspisectorerase and
                                 --qspichiperase operations are not available.
                                 For nRF52 devices, the --qspisectorerase and
                                 --qspichiperase operations are not available
                                 unless the device is equipped with a QSPI
                                 peripheral and an external memory is connected. To
                                 determine if an external memory is present, the
                                 MemSize parameter from QspiDefault.ini file or
                                 from the QSPI configuration ini file given with
                                 the --qspiini option is evaluated.
                                 For nRF91 devices, the --qspisectorerase and
                                 --qspichiperase operations are not available.
    
         --memwr <addr> --val <val>                     Writes to the provided
                                 address in memory with the help of the NVM
                                 Controller or, if your device is equipped with a
                                 QSPI peripheral and the address to write belongs
                                 to the XIP region, with the help of the QSPI
                                 peripheral to an external memory device. To
                                 determine if an external memory device is present,
                                 nrfjprog checks the MemSize parameter from
                                 QspiDefault.ini file or the QSPI configuration ini
                                 file that is given with the --qspiini option.
                                 The first address of the region is considered as
                                 address 0 of the external memory device. If the
                                 target address is flash (either internal or in the
                                 external memory device) and not erased, the
                                 operation will fail. This command can be combined
                                 with the --verify operation.
    
         --ramwr <addr> --val <val>                     Writes to memory without
                                 the help of the NVM Controller to the provided
                                 address. If the target address is in non-volatile
                                 memory, --ramwr will have no effect unless the
                                 non-volatile memory controller (NVMC) has been
                                 previously configured by the user for a write
                                 operation. Can be combined with the --verify
                                 operation.
    
         --verify [<image_file>] [--fast]                 The provided image_file
                                 contents are compared with the contents in the
                                 device code flash, RAM, UICR and XIP regions for
                                 devices equipped with a QSPI peripheral connected
                                 to an external memory device, and fail if there is
                                 a mismatch.
                                 Supported file formats are .hex, .ihex, .elf,
                                 .axf, and .bin. A valid format must be specified
                                 by the filename extension.
                                 To determine if an external memory
                                 device is present, nrfjprog checks MemSize
                                 parameter from QspiDefault.ini file or from the
                                 QSPI configuration ini file given with the
                                 --qspiini option. If the optional --fast parameter
                                 is given, nrfjprog will calculate a hash of the
                                 flash target area using a sha256 algorithm and
                                 compare it to the expected hash instead of
                                 reading back the actual contents of the device's
                                 flash in order to speed the operation. It can be
                                 combined with the --program, --memwr and --ramwr
                                 operations if provided without the image_file
                                 parameter.
                                 Limitations:
                                 For nRF51 devices, the --fast verifying option
                                 is not available
                                 For nRF91 devices, the --fast verifying option
                                 is not available.
    
         --memrd <addr> [--w <width>] [--n <n>]         Reads n bytes from the
                                 provided address. If width is not given, 32-bit
                                 words will be read if addr is word aligned,
                                 16-bit words if addr is half word aligned, and
                                 8-bit words otherwise. If n is not given, one
                                 word of size width will be read. The address and
                                 n must be aligned to the width parameter. The
                                 maximum number of bytes that can be read is 1 MB.
                                 The width must be 8, 16 or 32. If your device is
                                 equipped with a QSPI peripheral, and the addresses
                                 to read belong to the XIP region, the QSPI
                                 peripheral is used to read from the external
                                 memory device if present. To determine if an
                                 external memory device is present, mrfjprog checks
                                 the MemSize parameter from QspiDefault.ini file or
                                 the QSPI configuration ini file that is given with
                                 the --qspiini option. The first address of the
                                 region is considered as address 0 of the external
                                 memory device.
                                 Limitations:
                                 A single --memrd instruction cannot be used to
                                 read addresses from both the external memory
                                 device and the nRF device.
    
         --halt                  Halts the CPU core.
    
         --run [--pc <pc_addr> --sp <sp_addr>]          Starts the CPU. If --pc and
                                 --sp options are given, the pc_addr and sp_addr
                                 are used as initial PC and stack pointer. For
                                 pc_addr to be valid its last bit must be one. For
                                 sp_addr to be valid it must be word aligned.
    
         --readuicr <file>       Reads the device UICR and stores it in the given
                                 file name. Can be combined with --readram,
                                 --readcode and --readqspi. If combined, only one
                                 instruction can provide a file name.
                                 Supported output formats are .hex, .ihex, .elf,
                                 .axf, and .bin. A valid format must be specified
                                 by the filename extension.
    
         --readcode <file>       Reads the device flash and stores it in the given
                                 file name. Can be combined with --readuicr,
                                 --readram and --readqspi. If combined, only one
                                 instruction can provide a file name.
                                 Supported output formats are .hex, .ihex, .elf,
                                 .axf, and .bin. A valid format must be specified
                                 by the filename extension.
    
         --readram <file>        Reads the device ram and stores it in the given
                                 file name. Can be combined with --readuicr,
                                 --readcode and --readqspi. If combined, only one
                                 instruction can provide a file name.
                                 Supported output formats are .hex, .ihex, .elf,
                                 .axf, and .bin. A valid format must be specified
                                 by the filename extension.
    
         --readqspi <file>       Reads the QSPI-connected external memory and
                                 stores it in the given file name. Can be combined
                                 with --readuicr, --readcode and --readram. If
                                 combined, only one instruction can provide a file
                                 name.
                                 Supported output formats are .hex, .ihex, .elf,
                                 .axf, and .bin. A valid format must be specified
                                 by the filename extension.
    
         --readregs [first_register] [second_register] Reads the cpu registers.
                                 If no optional arguments are specified, all
                                 CPU registers in the selected core are printed.
                                 If optional argument first_register is specified
                                 only that register is printed.
                                 If both first_register and second_register is
                                 specified the registers between and including
                                 first_register and second_register are printed.
    
         --coprocessor <coprocessor>                    Connects the device to the
                                 selected coprocessor. Valid arguments are
                                 CP_APPLICATION and CP_NETWORK.
                                 If --coprocessor option is not used,
                                 CP_APPLICATION will be the target of the other
                                 operation. Must be combined with another command.

    mcumgr:

    root@gcu1:~# mcumgr
    mcumgr helps you manage remote devices
    
    Usage:
      mcumgr [flags]
      mcumgr [command]
    
    Available Commands:
      config      Read or write a config value on a device
      conn        Manage mcumgr connection profiles
      crash       Send a crash command to a device
      datetime    Manage datetime on a device
      echo        Send data to a device and display the echoed back data
      fs          Access files on a device
      help        Help about any command
      image       Manage images on a device
      interactive Run mcumgr interactive mode (used for COAP only)
      log         Manage logs on a device
      mpstat      Read mempool statistics from a device
      res         Access a CoAP resource on a device
      reset       Perform a soft reset of a device
      run         Run test procedures on a device
      shell       Execute shell commands remotely
      stat        Read statistics from a device
      taskstat    Read task statistics from a device
      version     Display the mcumgr version number
    
    Flags:
      -c, --conn string         connection profile to use
          --connextra string    Additional key-value pair to append to the connstring
          --connstring string   Connection key-value pairs to use instead of using the profile's connstring
          --conntype string     Connection type to use instead of using the profile's type
      -i, --hci int             HCI index for the controller on Linux machine
      -h, --help                help for mcumgr
      -l, --loglevel string     log level to use (default "info")
          --name string         name of target BLE device; overrides profile setting
          --ompres string       Use this CoAP resource instead of /omgr (default "/omgr")
      -t, --timeout float       timeout in seconds (partial seconds allowed) (default 10)
      -r, --tries int           total number of tries in case of timeout (default 1)
          --write-rsp           Send BLE acked write requests instead of unacked write commands
    
    Use "mcumgr [command] --help" for more information about a command.
    

  • It doesn't seem UART is working. 
    Could you try the attached hex ? (it's for nRF52840 DK) It worked for me with the VCOM0. 

    I'm using windows, but on Linux you need to disable mass storage: 

    Disable Mass Storage Device
    > JLinkExe
    >> MSDDisable

    3681.merged.hex

  • The result is exactly the same. When I flash your .hex file, i reconnect the USB to my windows laptop and I can connect RTT Viewer to see this:

    But If I connect the board to my RaspberryPI, I cant see nothing:

    root@gcu1:~# mcumgr --conntype serial --connstring "/dev/ttyACM0,baud=115200" echo hello
    Error: NMP timeout
    root@gcu1:~# mcumgr --conntype serial --connstring "/dev/ttyACM1,baud=115200" echo hello
    Error: NMP timeout
    root@gcu1:~# nrfjprog --com
    1050291266    /dev/ttyACM1    VCOM1
    1050291266    /dev/ttyACM0    VCOM0
    

    The MSD is disabled.

    Even I can connect via RTT through my Raspberry:

     

    Linux gcu1 5.15.56-v8+ #1575 SMP PREEMPT Fri Jul 22 20:31:26 BST 2022 aarch64
    
    The programs included with the Debian GNU/Linux system are free software;
    the exact distribution terms for each program are described in the
    individual files in /usr/share/doc/*/copyright.
    
    Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
    permitted by applicable law.
    Last login: Tue Jan 10 15:41:39 2023 from 10.180.180.121
    root@gcu1:~# JLinkRTTClient
    ###RTT Client: ************************************************************
    ###RTT Client: *               SEGGER Microcontroller GmbH                *
    ###RTT Client: *   Solutions for real time microcontroller applications   *
    ###RTT Client: ************************************************************
    ###RTT Client: *                                                          *
    ###RTT Client: *       (c) 2012 - 2016  SEGGER Microcontroller GmbH       *
    ###RTT Client: *                                                          *
    ###RTT Client: *     www.segger.com     Support: [email protected]       *
    ###RTT Client: *                                                          *
    ###RTT Client: ************************************************************
    ###RTT Client: *                                                          *
    ###RTT Client: * SEGGER J-Link RTT Client   Compiled Dec 22 2022 16:23:51 *
    ###RTT Client: *                                                          *
    ###RTT Client: ************************************************************
    
    ###RTT Client: -----------------------------------------------
    ###RTT Client: Connecting to J-Link RTT Server via localhost:19021 ...
    ###RTT Client: Connected.
    
    SEGGER J-Link V7.84a - Real time terminal output
    J-Link OB-nRF5340-NordicSemi compiled Nov  7 2022 16:22:01 V1.0, SN=1050291266
    Process: JLinkExe

  • It works! I have to build it with the next .conf:

    west build -b nrf52840dk_nrf52840 zephyr/samples/subsys/mgmt/mcumgr/smp_svr -- -DOVERLAY_CONFIG='overlay-shell.conf'

    And now it prompts something:

    root@gcu1:~# mcumgr --conntype serial --connstring "/dev/ttyACM0,baud=115200" echo hello
    hello

  • My last problem:

    I can see my image list:

    root@gcu1:~# mcumgr --conntype serial --connstring "/dev/ttyACM0,baud=115200" image list
    Images:
     image=0 slot=0
        version: 0.0.0
        bootable: true
        flags: active confirmed
        hash: 8893d1a1fccdb1719a0d937eb9fffdd98d809c3baa3c6dd2f946fab9ebf4dd84
    Split status: N/A (0)

    After rebuilding the sample, I have signed it and uploaded.

    root@gcu1:~# mcumgr --conntype serial --connstring "/dev/ttyACM0,baud=115200" image upload -e /zephyr.signed_
    zephyr.signed_1.bin           zephyr.signed_2.bin           zephyr.signed_3.bin           zephyr.signed_serial_dfu.bin
    root@gcu1:~# mcumgr --conntype serial --connstring "/dev/ttyACM0,baud=115200" image upload -e /zephyr.signed_serial_dfu.bin
     42.30 KiB / 42.30 KiB [====================================================================================================================================================================] 100.00% 3.43 KiB/s 12s
    Done
    
    
    root@gcu1:~# mcumgr --conntype serial --connstring "/dev/ttyACM0,baud=115200" image list
    Images:
     image=0 slot=0
        version: 0.0.0
        bootable: true
        flags: active confirmed
        hash: 8893d1a1fccdb1719a0d937eb9fffdd98d809c3baa3c6dd2f946fab9ebf4dd84
     image=0 slot=1
        version: 0.0.0
        bootable: true
        flags:
        hash: 6628576c399e33d147b891fa055a82583d1fa112ba71841128d895c2a0df12e7
    Split status: N/A (0)

    I selected the new firmware to swap after reseting:

    root@gcu1:~# mcumgr --conntype serial --connstring "/dev/ttyACM0,baud=115200" image test 6628576c399e33d147b891fa055a82583d1fa112ba71841128d895c2a0df12e7
    Images:
     image=0 slot=0
        version: 0.0.0
        bootable: true
        flags: active confirmed
        hash: 8893d1a1fccdb1719a0d937eb9fffdd98d809c3baa3c6dd2f946fab9ebf4dd84
     image=0 slot=1
        version: 0.0.0
        bootable: true
        flags: pending
        hash: 6628576c399e33d147b891fa055a82583d1fa112ba71841128d895c2a0df12e7
    Split status: N/A (0)

    But it doesn't work:

    root@gcu1:~# mcumgr --conntype serial --connstring "/dev/ttyACM0,baud=115200" reset
    Done
    
    
    
    root@gcu1:~# mcumgr --conntype serial --connstring "/dev/ttyACM0,baud=115200" image list
    Images:
     image=0 slot=0
        version: 0.0.0
        bootable: true
        flags: active confirmed
        hash: 8893d1a1fccdb1719a0d937eb9fffdd98d809c3baa3c6dd2f946fab9ebf4dd84
    Split status: N/A (0)
    

Related