This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

About the bug of download_test demo。

I added FOTA_DOWNLOAD and MCU_BOOT to my project.Then I want to use http to download a file, and an EBADMSG error occurs at this time.

I reproduced this problem in the download_test demo.

The code has not been changed, just modified prj.conf. Here is my prj.conf

CONFIG_NRF_MODEM_LIB=y
CONFIG_NRF_MODEM_LIB_SYS_INIT=n

CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_NATIVE=n

CONFIG_HEAP_MEM_POOL_SIZE=4096

CONFIG_MODEM_KEY_MGMT=y
CONFIG_LTE_LINK_CONTROL=y

CONFIG_DOWNLOAD_CLIENT=y

CONFIG_SAMPLE_FILE_CUSTOM=y
CONFIG_SAMPLE_FILE_URL="http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100"

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
CONFIG_LTE_NETWORK_MODE_NBIOT=y
CONFIG_LTE_LEGACY_PCO_MODE=y

# FOTA library
CONFIG_FOTA_DOWNLOAD=y

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y
CONFIG_BOOTLOADER_MCUBOOT=y

# DFU Target
CONFIG_DFU_TARGET=y

Application log:

[22:25:50.810]收←◆I: Bootloader chainload address offset: 0x10000
I: Jumping to the first image slot
[22:26:01.080]收←◆*** Booting Zephyr OS build v2.4.99-ncs1  ***
Flash regions		Domain		Permissions
00 02 0x00000 0x18000 	Secure		rwxl
03 31 0x18000 0x100000 	Non-Secure	rwxl

Non-secure callable region 0 placed in flash region 2 with size 32.


[22:26:01.291]收←◆SRAM region		Domain		Permissions
00 07 0x00000 0x10000 	Secure		rwxl
08 31 0x10000 0x40000 	Non-Secure	rwxl

Peripheral		Domain		Status
00 NRF_P0               Non-Secure	OK
01 NRF_CLOCK            Non-Secure	OK
02 NRF_RTC0             Non-Secure	OK
03 NRF_RTC1             Non-Secure	OK
04 NRF_NVMC             Non-Secure	OK
05 NRF_UARTE1           Non-Secure	OK
06 NRF_UARTE2           Secure		SKIP
07 NRF_TWIM2            Non-Secure	OK
08 NRF_SPIM3            Non-Secure	OK
09 NRF_TIMER0           Non-Secure	OK
10 NRF_TIMER1           Non-Secure	OK
11 NRF_TIMER2           Non-Secure	OK
12 NRF_SAADC            Non-Secure	OK
13 NRF_PWM0             Non-Secure	OK
14 NRF_PWM1             Non-Secure	OK
15 NRF_PWM2             Non-Secure	OK
16 NRF_PWM3             Non-Secure	OK
17 NRF_WDT              Non-Secure	OK
18 NRF_IPC              Non-Secure	OK
19 NRF_VMC              Non-Secure	OK
20 NRF_FPU              Non-Secure	OK
21 NRF_EGU1             Non-Secure	OK
22 NRF_EGU2             Non-Secure	OK
23 NRF_DPPIC            Non-Secure	OK
24 NRF_REGULATORS       Non-Secure	OK
25 NRF_GPIOTE1          Non-Secure	OK

SPM: NS image at 0x1c200
SPM: NS MSP at 0x200183d0
SPM: NS reset vector at 0x1f10d
SPM: prepare to jump to Non-Secure image.
*** Booting Zephyr OS build v2.4.99-ncs1  ***
Download client sample started

[22:26:01.610]收←◆Waiting for network.. 
[22:26:07.682]收←◆OK

[22:26:08.294]收←◆Downloading http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100

[22:26:08.893]收←◆Error -77 during download

I did some tests. When I commented out CONFIG_DFU_TARGET=y, everything became normal. But FOTA is gone, this is not the result I want.

CONFIG_NRF_MODEM_LIB=y
CONFIG_NRF_MODEM_LIB_SYS_INIT=n

CONFIG_NETWORKING=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_NATIVE=n

CONFIG_HEAP_MEM_POOL_SIZE=4096

CONFIG_MODEM_KEY_MGMT=y
CONFIG_LTE_LINK_CONTROL=y

CONFIG_DOWNLOAD_CLIENT=y

CONFIG_SAMPLE_FILE_CUSTOM=y
CONFIG_SAMPLE_FILE_URL="http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100"

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
CONFIG_LTE_NETWORK_MODE_NBIOT=y
CONFIG_LTE_LEGACY_PCO_MODE=y

# FOTA library
CONFIG_FOTA_DOWNLOAD=y

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y
CONFIG_BOOTLOADER_MCUBOOT=y

# DFU Target
#CONFIG_DFU_TARGET=y

Application log:

[22:50:40.129]收←◆I: Bootloader chainload address offset: 0x10000
I: Jumping to the first image slot
[22:50:41.848]收←◆*** Booting Zephyr OS build v2.4.99-ncs1  ***
Flash regions		Domain		Permissions
00 02 0x00000 0x18000 	Secure		rwxl
03 31 0x18000 0x100000 	Non-Secure	rwxl

Non-secure callable region 0 placed in flash region 2 with size 32.


[22:50:42.058]收←◆SRAM region		Domain		Permissions
00 07 0x00000 0x10000 	Secure		rwxl
08 31 0x10000 0x40000 	Non-Secure	rwxl

Peripheral		Domain		Status
00 NRF_P0               Non-Secure	OK
01 NRF_CLOCK            Non-Secure	OK
02 NRF_RTC0             Non-Secure	OK
03 NRF_RTC1             Non-Secure	OK
04 NRF_NVMC             Non-Secure	OK
05 NRF_UARTE1           Non-Secure	OK
06 NRF_UARTE2           Secure		SKIP
07 NRF_TWIM2            Non-Secure	OK
08 NRF_SPIM3            Non-Secure	OK
09 NRF_TIMER0           Non-Secure	OK
10 NRF_TIMER1           Non-Secure	OK
11 NRF_TIMER2           Non-Secure	OK
12 NRF_SAADC            Non-Secure	OK
13 NRF_PWM0             Non-Secure	OK
14 NRF_PWM1             Non-Secure	OK
15 NRF_PWM2             Non-Secure	OK
16 NRF_PWM3             Non-Secure	OK
17 NRF_WDT              Non-Secure	OK
18 NRF_IPC              Non-Secure	OK
19 NRF_VMC              Non-Secure	OK
20 NRF_FPU              Non-Secure	OK
21 NRF_EGU1             Non-Secure	OK
22 NRF_EGU2             Non-Secure	OK
23 NRF_DPPIC            Non-Secure	OK
24 NRF_REGULATORS       Non-Secure	OK
25 NRF_GPIOTE1          Non-Secure	OK

SPM: NS image at 0x1c200
SPM: NS MSP at 0x200182f0
SPM: NS reset vector at 0x1f10d
SPM: prepare to jump to Non-Secure image.
*** Booting Zephyr OS build v2.4.99-ncs1  ***
Download client sample started

[22:50:42.377]收←◆Waiting for network.. 
[22:50:47.374]收←◆OK

[22:50:47.823]收←◆Downloading http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100

[22:50:49.448]收←◆[  88% ] |============================================      | (2048/2304 bytes)[ 100% ] |==================================================| (2304/2304 bytes)
Download completed in 1639 ms @ 1405 bytes per sec, total 2304 bytes
Bye

This seems to be related to CONFIG_DFU_TARGET=y, but I can’t see any problems in the code. Can you help me analyze the problem?

Parents
  • Hi,

    Let's start by enabling some more logging so we can try to pinpoint where the error comes from.

    Could you try to add the following configuration options to your prj.conf file and send me the log?

    CONFIG_LOG=y
    CONFIG_LOG_MINIMAL=n
    CONFIG_BACKEND_SHOW_COLOR=n
    CONFIG_DFU_TARGET_LOG_LEVEL_DBG=y

    Best regards,

    Didrik

  • I added the above four macro definitions according to your requirements, and then reported an error:

    warning: attempt to assign the value 'n' to the undefined symbol BACKEND_SHOW_COLOR

    I added according to my idea. The log is consistent with the above.

    CONFIG_LOG=y
    CONFIG_LOG_MINIMAL=n
    #CONFIG_BACKEND_SHOW_COLOR=n
    CONFIG_DFU_TARGET_LOG_LEVEL_DBG=y
    
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_LOG_BACKEND_RTT=y

    CONFIG_DFU_TARGET=y

    *** Booting Zephyr OS build v2.4.99-ncs1  ***
    Download client sample started
    Waiting for network.. [00:00:00.211,090] <inf> lte_lc: Using legacy LTE PCO mode...
    OK
    [00:00:06.879,394] <inf> download_client: Configuring socket timeout (30 s)
    [00:00:06.879,425] <inf> download_client: Connecting to http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100
    [00:00:07.031,311] <inf> download_client: Downloading: http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100 [0]
    Downloading http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device[00:00:07.682,647] <err> download_client: Server did not honor partial content request
    Error -77 during download
    

    CONFIG_DFU_TARGET=n

    *** Booting Zephyr OS build v2.4.99-ncs1  ***
    Download client sample started
    Waiting for network.. [00:00:00.211,090] <inf> lte_lc: Using legacy LTE PCO mode...
    OK
    [00:00:04.927,673] <inf> download_client: Configuring socket timeout (30 s)
    [00:00:04.927,673] <inf> download_client: Connecting to http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100
    [00:00:05.095,581] <inf> download_client: Downloading: http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100 [0]
    Downloading http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device=--- 81 messages dropped ---
    =======================| (2304/2304 bytes)[00:00:06.758,209] <inf> download_client: Download complete
    
    Download completed in 1663 ms @ 1385 bytes per sec, total 2304 bytes
    Bye

  • xinjiang said:

    I added the above four macro definitions according to your requirements, and then reported an error:

    warning: attempt to assign the value 'n' to the undefined symbol BACKEND_SHOW_COLOR

     I don't know why you get that error, it works for me. Regardless, that option is not very important, it just formats the output a bit nicer for terminals that doesn't support colors.

    The problem doesn't seem to be with the DFU target library directly, but with the download_client and/or server.

    Could you add CONFIG_DOWNLOAD_CLIENT_LOG_LEVEL_DBG=y and CONFIG_DOWNLOAD_CLIENT_LOG_HEADERS=y so we can get more information about the communication between the device and the server?

    Also, you said originally that you were using the fota_download library. However, that library depends on dfu_target. How are you using it with dfu_target disabled?

    Can you share the code where you configure and start the download?

  • Also, you said originally that you were using the fota_download library. However, that library depends on dfu_target. How are you using it with dfu_target disabled?

    I just added the corresponding macros of fota_download and disabled dfu_target. But I didn't use the functions in fota_download, so it won't cause errors.

    Can you share the code where you configure and start the download?

    As I said at the beginning, I just added fota-related macros to pri.conf on the basis of download_test, and modified the domain name and downloaded file name. The source code did not change anything. You can reproduce this problem in download_test.

    This is my pri.conf.

    CONFIG_LOG=y
    CONFIG_LOG_MINIMAL=n
    #CONFIG_BACKEND_SHOW_COLOR=n
    CONFIG_DFU_TARGET_LOG_LEVEL_DBG=y
    CONFIG_DOWNLOAD_CLIENT_LOG_LEVEL_DBG=y 
    CONFIG_DOWNLOAD_CLIENT_LOG_HEADERS=y
    
    CONFIG_LOG_DEFAULT_LEVEL=3
    CONFIG_USE_SEGGER_RTT=y
    CONFIG_RTT_CONSOLE=y
    CONFIG_LOG_BACKEND_RTT=y
    
    CONFIG_NRF_MODEM_LIB=y
    CONFIG_NRF_MODEM_LIB_SYS_INIT=n
    
    CONFIG_NETWORKING=y
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_NATIVE=n
    
    CONFIG_HEAP_MEM_POOL_SIZE=4096
    
    CONFIG_MODEM_KEY_MGMT=y
    CONFIG_LTE_LINK_CONTROL=y
    
    CONFIG_DOWNLOAD_CLIENT=y
    
    CONFIG_SAMPLE_FILE_CUSTOM=y
    CONFIG_SAMPLE_FILE_URL="http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100"
    
    # LTE link control
    CONFIG_LTE_LINK_CONTROL=y
    CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
    CONFIG_LTE_NETWORK_MODE_NBIOT=y
    CONFIG_LTE_LEGACY_PCO_MODE=y
    
    # FOTA library
    CONFIG_FOTA_DOWNLOAD=y
    
    # Image manager
    CONFIG_IMG_MANAGER=y
    CONFIG_FLASH=y
    CONFIG_IMG_ERASE_PROGRESSIVELY=y
    CONFIG_BOOTLOADER_MCUBOOT=y
    
    # DFU Target
    CONFIG_DFU_TARGET=y

    This is my project, just download_test:

    download_test.rar

    ------------------------------------------------------------------------------------

    When I added CONFIG_DOWNLOAD_CLIENT_LOG_LEVEL_DBG=y and CONFIG_DOWNLOAD_CLIENT_LOG_HEADERS=y log.

    CONFIG_DFU_TARGET=y:

    *** Booting Zephyr OS build v2.4.99-ncs1  ***
    Download client sample started
    Waiting for network.. [00:00:00.211,090] <inf> lte_lc: Using legacy LTE PCO mode...
    OK
    [00:00:08.851,226] <dbg> download_client.client_connect: Port not specified, using default: 80
    [00:00:08.851,257] <dbg> download_client.client_connect: family: 1, type: 1, proto: 6
    [00:00:08.851,654] <inf> download_client: Configuring socket timeout (30 s)
    [00:00:08.851,684] <inf> download_client: Connecting to http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100
    [00:00:08.851,684] <dbg> download_client.client_connect: fd 1, addrlen 8, fam IPv4, port 80
    [00:00:11.365,234] <dbg> download_client: HTTP request
                                              47 45 54 20 2f 51 47 50  53 5f 31 2e 44 41 54 3f |GET /QGP S_1.DAT?
                                              76 65 6e 64 6f 72 3d 47  4f 54 4f 50 26 70 72 6f |vendor=G OTOP&pro
                                              6a 65 63 74 3d 4b 75 69  69 6b 6c 4e 41 71 6f 72 |ject=Kui iklNAqor
                                              6d 38 53 52 64 61 57 50  51 69 47 62 5a 36 6c 6b |m8SRdaWP QiGbZ6lk
                                              45 6c 4d 36 2d 4b 7a 4e  52 49 61 75 5f 74 6a 45 |ElM6-KzN RIau_tjE
                                              26 64 65 76 69 63 65 5f  69 64 3d 31 30 30 20 48 |&device_ id=100 H
                                              54 54 50 2f 31 2e 31 0d  0a 48 6f 73 74 3a 20 77 |TTP/1.1. .Host: w
                                              70 65 70 6f 64 6f 77 6e  6c 6f 61 64 2e 6d 65 64 |pepodown load.med
                                              69 61 74 65 6b 2e 63 6f  6d 0d 0a 52 61 6e 67 65 |iatek.co m..Range
                                              3a 20 62 79 74 65 73 3d  30 2d 32 30 34 37 0d 0a |: bytes= 0-2047..
                                              43 6f 6e 6e 65 63 74 69  6f 6e 3a 20 6b 65 65 70 |Connecti on: keep
                                              2d 61 6c 69 76 65 0d 0a  0d 0a                   |-alive.. ..      
    [00:00:11.365,509] <inf> download_client: Downloading: http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100 [0]
    Downloading http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device[00:00:19.385,681] <dbg> download_client.download_thread: Read 708 bytes from socket
    [00:00:19.385,772] <dbg> download_client.http_header_parse: GET header size: 426
    [00:00:19.385,803] <dbg> download_client: HTTP response
                                              48 54 54 50 2f 31 2e 31  20 32 30 30 20 4f 4b 0d |HTTP/1.1  200 OK.
                                              0a 43 6f 6e 74 65 6e 74  2d 54 79 70 65 3a 20 61 |.Content -Type: a
                                              70 70 6c 69 63 61 74 69  6f 6e 2f 6f 63 74 65 74 |pplicati on/octet
                                              2d 73 74 72 65 61 6d 0d  0a 43 6f 6e 74 65 6e 74 |-stream. .Content
                                              2d 4c 65 6e 67 74 68 3a  20 32 33 30 34 0d 0a 43 |-Length:  2304..C
                                              6f 6e 6e 65 63 74 69 6f  6e 3a 20 6b 65 65 70 2d |onnectio n: keep-
                                              61 6c 69 76 65 0d 0a 44  61 74 65 3a 20 54 75 65 |alive..D ate: Tue
                                              2c 20 30 31 20 4a 75 6e  20 32 30 32 31 20 31 30 |, 01 Jun  2021 10
                                              3a 33 31 3a 33 36 20 47  4d 54 0d 0a 45 54 61 67 |:31:36 G MT..ETag
                                              3a 20 22 32 32 30 62 64  36 64 32 65 35 66 63 62 |: "220bd 6d2e5fcb
                                              64 31 62 64 61 37 32 39  64 38 37 62 31 66 31 38 |d1bda729 d87b1f18
                                              33 62 32 22 0d 0a 53 65  72 76 65 72 3a 20 6e 67 |3b2"..Se rver: ng
                                              69 6e 78 2f 31 2e 31 30  2e 31 0d 0a 58 2d 50 6f |inx/1.10 .1..X-Po
                                              77 65 72 65 64 2d 42 79  3a 20 45 78 70 72 65 73 |wered-By : Expres
                                              73 0d 0a 58 2d 43 61 63  68 65 3a 20 4d 69 73 73 |s..X-Cac he: Miss
                                              20 66 72 6f 6d 20 63 6c  6f 75 64 66 72 6f 6e 74 | from cl oudfront
                                              0d 0a 56 69 61 3a 20 31  2e 31 20 33 36 39 62 36 |..Via: 1 .1 369b6
                                              66 62 39 36 31 36 37 66  39 64 31 64 64 38 63 66 |fb96167f 9d1dd8cf
                                              65 65 64 64 35 38 63 31  32 63 33 2e 63 6c 6f 75 |eedd58c1 2c3.clou
                                              64 66 72 6f 6e 74 2e 6e  65 74 20 28 43 6c 6f 75 |dfront.n et (Clou
                                              64 46 72 6f 6e 74 29 0d  0a 58 2d 41 6d 7a 2d 43 |dFront). .X-Amz-C
                                              66 2d 50 6f 70 3a 20 48  4b 47 36 32 2d 43 31 0d |f-Pop: H KG62-C1.
                                              0a 58 2d 41 6d 7a 2d 43  66 2d 49 64 3a 20 68 62 |.X-Amz-C f-Id: hb
                                              66 77 70 77 64 6d 41 6a  52 75 51 30 6a 31 34 77 |fwpwdmAj RuQ0j14w
                                              74 46 79 32 6e 57 49 52  54 6a 4b 78 45 39 54 47 |tFy2nWIR TjKxE9TG
                                              64 65 6c 42 45 2d 42 37  6a 63 79 5f 6b 48 6b 6f |delBE-B7 jcy_kHko
                                              37 6a 61 51 3d 3d 0d 0a  0d 0a                   |7jaQ==.. ..      
    [00:00:19.385,986] <err> download_client: Server did not honor partial content request
    Error -77 during download

    CONFIG_DFU_TARGET=n:

    *** Booting Zephyr OS build v2.4.99-ncs1  ***
    Download client sample started
    Waiting for network.. [00:00:00.211,303] <inf> lte_lc: Using legacy LTE PCO mode...
    OK
    [00:00:06.922,027] <dbg> download_client.client_connect: Port not specified, using default: 80
    [00:00:06.922,058] <dbg> download_client.client_connect: family: 1, type: 1, proto: 6
    [00:00:06.922,454] <inf> download_client: Configuring socket timeout (30 s)
    [00:00:06.922,454] <inf> download_client: Connecting to http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100
    [00:00:06.922,485] <dbg> download_client.client_connect: fd 1, addrlen 8, fam IPv4, port 80
    [00:00:09.375,000] <dbg> download_client: HTTP request
                                              47 45 54 20 2f 51 47 50  53 5f 31 2e 44 41 54 3f |GET /QGP S_1.DAT?
                                              76 65 6e 64 6f 72 3d 47  4f 54 4f 50 26 70 72 6f |vendor=G OTOP&pro
                                              6a 65 63 74 3d 4b 75 69  69 6b 6c 4e 41 71 6f 72 |ject=Kui iklNAqor
                                              6d 38 53 52 64 61 57 50  51 69 47 62 5a 36 6c 6b |m8SRdaWP QiGbZ6lk
                                              45 6c 4d 36 2d 4b 7a 4e  52 49 61 75 5f 74 6a 45 |ElM6-KzN RIau_tjE
                                              26 64 65 76 69 63 65 5f  69 64 3d 31 30 30 20 48 |&device_ id=100 H
                                              54 54 50 2f 31 2e 31 0d  0a 48 6f 73 74 3a 20 77 |TTP/1.1. .Host: w
                                              70 65 70 6f 64 6f 77 6e  6c 6f 61 64 2e 6d 65 64 |pepodown load.med
                                              69 61 74 65 6b 2e 63 6f  6d 0d 0a 52 61 6e 67 65 |iatek.co m..Range
                                              3a 20 62 79 74 65 73 3d  30 2d 0d 0a 43 6f 6e 6e |: bytes= 0-..Conn
                                              65 63 74 69 6f 6e 3a 20  6b 65 65 70 2d 61 6c 69 |ection:  keep-ali
                                              76 65 0d 0a 0d 0a                                |ve....           
    [00:00:09.375,305] <inf> download_client: Downloading: http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100 [0]
    Downloading http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device[00:00:09.375,549] <dbg> download_client.download_thread: Receiving up to 2048 bytes at 0x200146fc...
    [00:00:17.466,430] <dbg> download_client.download_thread: Read 708 bytes from socket
    [00:00:17.466,522] <dbg> download_client.http_header_parse: GET header size: 426
    [00:00:17.466,552] <dbg> download_client: HTTP response
                                              48 54 54 50 2f 31 2e 31  20 32 30 30 20 4f 4b 0d |HTTP/1.1  200 OK.
                                              0a 43 6f 6e 74 65 6e 74  2d 54 79 70 65 3a 20 61 |.Content -Type: a
                                              70 70 6c 69 63 61 74 69  6f 6e 2f 6f 63 74 65 74 |pplicati on/octet
                                              2d 73 74 72 65 61 6d 0d  0a 43 6f 6e 74 65 6e 74 |-stream. .Content
                                              2d 4c 65 6e 67 74 68 3a  20 32 33 30 34 0d 0a 43 |-Length:  2304..C
                                              6f 6e 6e 65 63 74 69 6f  6e 3a 20 6b 65 65 70 2d |onnectio n: keep-
                                              61 6c 69 76 65 0d 0a 44  61 74 65 3a 20 54 75 65 |alive..D ate: Tue
                                              2c 20 30 31 20 4a 75 6e  20 32 30 32 31 20 31 30 |, 01 Jun  2021 10
                                              3a 34 32 3a 31 38 20 47  4d 54 0d 0a 45 54 61 67 |:42:18 G MT..ETag
                                              3a 20 22 32 32 30 62 64  36 64 32 65 35 66 63 62 |: "220bd 6d2e5fcb
                                              64 31 62 64 61 37 32 39  64 38 37 62 31 66 31 38 |d1bda729 d87b1f18
                                              33 62 32 22 0d 0a 53 65  72 76 65 72 3a 20 6e 67 |3b2"..Se rver: ng
                                              69 6e 78 2f 31 2e 31 30  2e 31 0d 0a 58 2d 50 6f |inx/1.10 .1..X-Po
                                              77 65 72 65 64 2d 42 79  3a 20 45 78 70 72 65 73 |wered-By : Expres
                                              73 0d 0a 58 2d 43 61 63  68 65 3a 20 4d 69 73 73 |s..X-Cac he: Miss
                                              20 66 72 6f 6d 20 63 6c  6f 75 64 66 72 6f 6e 74 | from cl oudfront
                                              0d 0a 56 69 61 3a 20 31  2e 31 20 36 32 36 36 35 |..Via: 1 .1 62665
                                              63 33 32 31 63 36 64 64  30 37 63 39 65 33 66 31 |c321c6dd 07c9e3f1
                                              64 35 34 35 37 38 35 65  32 66 36 2e 63 6c 6f 75 |d545785e 2f6.clou
                                              64 66 72 6f 6e 74 2e 6e  65 74 20 28 43 6c 6f 75 |dfront.n et (Clou
                                              64 46 72 6f 6e 74 29 0d  0a 58 2d 41 6d 7a 2d 43 |dFront). .X-Amz-C
                                              66 2d 50 6f 70 3a 20 48  4b 47 36 32 2d 43 31 0d |f-Pop: H KG62-C1.
                                              0a 58 2d 41 6d 7a 2d 43  66 2d 49 64 3a 20 4e 64 |.X-Amz-C f-Id: Nd
                                              46 30 5f 47 70 6c 32 51  31 42 73 52 31 5f 51 75 |F0_Gpl2Q 1BsR1_Qu
                                              46 6d 65 36 4e 66 6d 6f  49 42 61 7a 62 34 34 5f |Fme6Nfmo IBazb44_
                                              30 75 62 6f 77 45 4e 6a  4d 58 56 67 2d 71 51 6a |0ubowENj MXVg-qQj
                                              72 51 50 41 3d 3d 0d 0a  0d 0a                   |rQPA==.. ..      
    [00:00:17.466,735] <dbg> download_client.http_header_parse: File size = 2304
    [00:00:17.466,827] <dbg> download_client.http_parse: Copying 282 payload bytes
    [00:00:17.466,857] <dbg> download_client.download_thread: Receiving up to 1766 bytes at 0x20014816...
    =--- 88 messages dropped ---
    =======================| (2304/2304 bytes)[00:00:20.612,396] <inf> download_client: Download complete
    
    Download completed in 11238 ms @ 205 bytes per sec, total 2304 bytes
    Bye
    

  • I haven't had time to study your code yet, so I can't tell you exactly why it is happening, but this is what happens:

    With CONFIG_DFU_TARGET=y, the device asks for only a piece of the file. But, the server doesn't honor this request, and provides the whole file instead (or, at least, it doesn't set the "content-range" header in the response). This is what causes the error, and the application aborts the download.

    With CONFIG_DFU_TARGET=n, the application doesn't request just the first part of the file, but the whole file. It therefore doesn't check if the content-range header is set (which it is not), and is therefore able to download the file without issue.

    As I said, I don't know yet why the application specifies the range with DFU_TARGET enabled, and doesn't when it is disabled.

    One solution would be to enable the content-range header in the server. This is probably the best solution if you plan to download files of more than 2kB in the future (especially if you want to use TLS to download the file).

    The other solution would be to figure out why the application specifies the range when DFU_target is enabled.

  • I've already done a comparative for the content-range header you mentioned. The reason that the content-range header is different is caused by the 76th line of code in http.c. When CONFIG_DFU_TARGET=y, CONFIG_DOWNLOAD_CLIENT_RANGE_REQUESTS will be enabled.

    #define GET_HTTP_TEMPLATE                                                      \
    	"GET /%s HTTP/1.1\r\n"                                                 \
    	"Host: %s\r\n"                                                         \
    	"Range: bytes=%u-\r\n"                                                 \
    	"Connection: keep-alive\r\n"                                           \
    	"\r\n"
    
    #define GET_HTTPS_TEMPLATE                                                     \
    	"GET /%s HTTP/1.1\r\n"                                                 \
    	"Host: %s\r\n"                                                         \
    	"Range: bytes=%u-%u\r\n"                                               \
    	"Connection: keep-alive\r\n"                                           \
    	"\r\n"
    
    
    /* We use range requests only for HTTPS, due to memory limitations.
     * When using HTTP, we request the whole resource to minimize
     * network usage (only one request/response are sent).
     */
    if (client->proto == IPPROTO_TLS_1_2
       || IS_ENABLED(CONFIG_DOWNLOAD_CLIENT_RANGE_REQUESTS)) {
    	len = snprintf(client->buf,
    		CONFIG_DOWNLOAD_CLIENT_BUF_SIZE,
    		GET_HTTPS_TEMPLATE, file, host, client->progress, off);
    } else {
    	len = snprintf(client->buf,
    		CONFIG_DOWNLOAD_CLIENT_BUF_SIZE,
    		GET_HTTP_TEMPLATE, file, host, client->progress);
    }

    But the real reason is not caused by the content-range header. Below is my log comparing different situations.

    CONFIG_DFU_TARGET=y

    Range: bytes=0-

    *** Booting Zephyr OS build v2.4.99-ncs1  ***
    Download client sample started
    Waiting for network.. [00:00:00.209,136] <inf> lte_lc: Using legacy LTE PCO mode...
    OK
    [00:00:05.343,811] <dbg> download_client.client_connect: Port not specified, using default: 80
    [00:00:05.343,841] <dbg> download_client.client_connect: family: 1, type: 1, proto: 6
    [00:00:05.344,238] <inf> download_client: Configuring socket timeout (30 s)
    [00:00:05.344,238] <inf> download_client: Connecting to http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100
    [00:00:05.344,268] <dbg> download_client.client_connect: fd 1, addrlen 8, fam IPv4, port 80
    [00:00:07.872,772] <dbg> download_client: HTTP request
                                              47 45 54 20 2f 51 47 50  53 5f 31 2e 44 41 54 3f |GET /QGP S_1.DAT?
                                              76 65 6e 64 6f 72 3d 47  4f 54 4f 50 26 70 72 6f |vendor=G OTOP&pro
                                              6a 65 63 74 3d 4b 75 69  69 6b 6c 4e 41 71 6f 72 |ject=Kui iklNAqor
                                              6d 38 53 52 64 61 57 50  51 69 47 62 5a 36 6c 6b |m8SRdaWP QiGbZ6lk
                                              45 6c 4d 36 2d 4b 7a 4e  52 49 61 75 5f 74 6a 45 |ElM6-KzN RIau_tjE
                                              26 64 65 76 69 63 65 5f  69 64 3d 31 30 30 20 48 |&device_ id=100 H
                                              54 54 50 2f 31 2e 31 0d  0a 48 6f 73 74 3a 20 77 |TTP/1.1. .Host: w
                                              70 65 70 6f 64 6f 77 6e  6c 6f 61 64 2e 6d 65 64 |pepodown load.med
                                              69 61 74 65 6b 2e 63 6f  6d 0d 0a 52 61 6e 67 65 |iatek.co m..Range
                                              3a 20 62 79 74 65 73 3d  30 2d 0d 0a 43 6f 6e 6e |: bytes= 0-..Conn
                                              65 63 74 69 6f 6e 3a 20  6b 65 65 70 2d 61 6c 69 |ection:  keep-ali
                                              76 65 0d 0a 0d 0a                                |ve....           
    [00:00:07.873,077] <inf> download_client: Downloading: http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100 [0]
    Downloading http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device[00:00:07.873,260] <dbg> download_client.download_thread: Receiving up to 2048 bytes at 0x200146fc...
    [00:00:15.863,220] <dbg> download_client.download_thread: Read 708 bytes from socket
    [00:00:15.863,311] <dbg> download_client.http_header_parse: GET header size: 426
    [00:00:15.863,342] <dbg> download_client: HTTP response
                                              48 54 54 50 2f 31 2e 31  20 32 30 30 20 4f 4b 0d |HTTP/1.1  200 OK.
                                              0a 43 6f 6e 74 65 6e 74  2d 54 79 70 65 3a 20 61 |.Content -Type: a
                                              70 70 6c 69 63 61 74 69  6f 6e 2f 6f 63 74 65 74 |pplicati on/octet
                                              2d 73 74 72 65 61 6d 0d  0a 43 6f 6e 74 65 6e 74 |-stream. .Content
                                              2d 4c 65 6e 67 74 68 3a  20 32 33 30 34 0d 0a 43 |-Length:  2304..C
                                              6f 6e 6e 65 63 74 69 6f  6e 3a 20 6b 65 65 70 2d |onnectio n: keep-
                                              61 6c 69 76 65 0d 0a 44  61 74 65 3a 20 54 68 75 |alive..D ate: Thu
                                              2c 20 30 33 20 4a 75 6e  20 32 30 32 31 20 30 33 |, 03 Jun  2021 03
                                              3a 32 38 3a 35 32 20 47  4d 54 0d 0a 45 54 61 67 |:28:52 G MT..ETag
                                              3a 20 22 33 37 38 34 63  62 62 31 39 30 61 62 34 |: "3784c bb190ab4
                                              61 66 33 30 66 32 39 33  36 39 66 35 30 36 33 34 |af30f293 69f50634
                                              64 37 66 22 0d 0a 53 65  72 76 65 72 3a 20 6e 67 |d7f"..Se rver: ng
                                              69 6e 78 2f 31 2e 31 30  2e 31 0d 0a 58 2d 50 6f |inx/1.10 .1..X-Po
                                              77 65 72 65 64 2d 42 79  3a 20 45 78 70 72 65 73 |wered-By : Expres
                                              73 0d 0a 58 2d 43 61 63  68 65 3a 20 4d 69 73 73 |s..X-Cac he: Miss
                                              20 66 72 6f 6d 20 63 6c  6f 75 64 66 72 6f 6e 74 | from cl oudfront
                                              0d 0a 56 69 61 3a 20 31  2e 31 20 62 64 39 34 36 |..Via: 1 .1 bd946
                                              32 62 63 38 38 36 66 66  37 34 30 35 61 63 30 61 |2bc886ff 7405ac0a
                                              39 35 32 35 35 34 36 32  38 33 34 2e 63 6c 6f 75 |95255462 834.clou
                                              64 66 72 6f 6e 74 2e 6e  65 74 20 28 43 6c 6f 75 |dfront.n et (Clou
                                              64 46 72 6f 6e 74 29 0d  0a 58 2d 41 6d 7a 2d 43 |dFront). .X-Amz-C
                                              66 2d 50 6f 70 3a 20 48  4b 47 36 32 2d 43 31 0d |f-Pop: H KG62-C1.
                                              0a 58 2d 41 6d 7a 2d 43  66 2d 49 64 3a 20 65 42 |.X-Amz-C f-Id: eB
                                              6e 67 34 71 2d 73 4e 48  31 63 69 5a 52 77 6c 67 |ng4q-sNH 1ciZRwlg
                                              74 48 57 38 2d 61 79 47  61 42 45 51 2d 66 64 65 |tHW8-ayG aBEQ-fde
                                              4b 58 44 46 43 31 66 39  45 47 76 76 76 36 52 4a |KXDFC1f9 EGvvv6RJ
                                              63 43 59 41 3d 3d 0d 0a  0d 0a                   |cCYA==.. ..      
    [00:00:15.863,494] <err> download_client: Server did not honor partial content request
    Error -77 during download

    CONFIG_DFU_TARGET=y

    Range: bytes=0-2047

    *** Booting Zephyr OS build v2.4.99-ncs1  ***
    Download client sample started
    Waiting for network.. [00:00:00.209,045] <inf> lte_lc: Using legacy LTE PCO mode...
    OK
    [00:00:07.034,637] <dbg> download_client.client_connect: Port not specified, using default: 80
    [00:00:07.034,637] <dbg> download_client.client_connect: family: 1, type: 1, proto: 6
    [00:00:07.035,064] <inf> download_client: Configuring socket timeout (30 s)
    [00:00:07.035,064] <inf> download_client: Connecting to http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100
    [00:00:07.035,064] <dbg> download_client.client_connect: fd 1, addrlen 8, fam IPv4, port 80
    [00:00:09.483,673] <dbg> download_client: HTTP request
                                              47 45 54 20 2f 51 47 50  53 5f 31 2e 44 41 54 3f |GET /QGP S_1.DAT?
                                              76 65 6e 64 6f 72 3d 47  4f 54 4f 50 26 70 72 6f |vendor=G OTOP&pro
                                              6a 65 63 74 3d 4b 75 69  69 6b 6c 4e 41 71 6f 72 |ject=Kui iklNAqor
                                              6d 38 53 52 64 61 57 50  51 69 47 62 5a 36 6c 6b |m8SRdaWP QiGbZ6lk
                                              45 6c 4d 36 2d 4b 7a 4e  52 49 61 75 5f 74 6a 45 |ElM6-KzN RIau_tjE
                                              26 64 65 76 69 63 65 5f  69 64 3d 31 30 30 20 48 |&device_ id=100 H
                                              54 54 50 2f 31 2e 31 0d  0a 48 6f 73 74 3a 20 77 |TTP/1.1. .Host: w
                                              70 65 70 6f 64 6f 77 6e  6c 6f 61 64 2e 6d 65 64 |pepodown load.med
                                              69 61 74 65 6b 2e 63 6f  6d 0d 0a 52 61 6e 67 65 |iatek.co m..Range
                                              3a 20 62 79 74 65 73 3d  30 2d 32 30 34 37 0d 0a |: bytes= 0-2047..
                                              43 6f 6e 6e 65 63 74 69  6f 6e 3a 20 6b 65 65 70 |Connecti on: keep
                                              2d 61 6c 69 76 65 0d 0a  0d 0a                   |-alive.. ..      
    [00:00:09.483,947] <inf> download_client: Downloading: http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100 [0]
    Downloading http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device[00:00:17.579,040] <dbg> download_client.download_thread: Read 708 bytes from socket
    [00:00:17.579,132] <dbg> download_client.http_header_parse: GET header size: 426
    [00:00:17.579,162] <dbg> download_client: HTTP response
                                              48 54 54 50 2f 31 2e 31  20 32 30 30 20 4f 4b 0d |HTTP/1.1  200 OK.
                                              0a 43 6f 6e 74 65 6e 74  2d 54 79 70 65 3a 20 61 |.Content -Type: a
                                              70 70 6c 69 63 61 74 69  6f 6e 2f 6f 63 74 65 74 |pplicati on/octet
                                              2d 73 74 72 65 61 6d 0d  0a 43 6f 6e 74 65 6e 74 |-stream. .Content
                                              2d 4c 65 6e 67 74 68 3a  20 32 33 30 34 0d 0a 43 |-Length:  2304..C
                                              6f 6e 6e 65 63 74 69 6f  6e 3a 20 6b 65 65 70 2d |onnectio n: keep-
                                              61 6c 69 76 65 0d 0a 44  61 74 65 3a 20 54 68 75 |alive..D ate: Thu
                                              2c 20 30 33 20 4a 75 6e  20 32 30 32 31 20 30 33 |, 03 Jun  2021 03
                                              3a 32 36 3a 34 36 20 47  4d 54 0d 0a 45 54 61 67 |:26:46 G MT..ETag
                                              3a 20 22 33 37 38 34 63  62 62 31 39 30 61 62 34 |: "3784c bb190ab4
                                              61 66 33 30 66 32 39 33  36 39 66 35 30 36 33 34 |af30f293 69f50634
                                              64 37 66 22 0d 0a 53 65  72 76 65 72 3a 20 6e 67 |d7f"..Se rver: ng
                                              69 6e 78 2f 31 2e 31 30  2e 31 0d 0a 58 2d 50 6f |inx/1.10 .1..X-Po
                                              77 65 72 65 64 2d 42 79  3a 20 45 78 70 72 65 73 |wered-By : Expres
                                              73 0d 0a 58 2d 43 61 63  68 65 3a 20 4d 69 73 73 |s..X-Cac he: Miss
                                              20 66 72 6f 6d 20 63 6c  6f 75 64 66 72 6f 6e 74 | from cl oudfront
                                              0d 0a 56 69 61 3a 20 31  2e 31 20 38 34 31 30 34 |..Via: 1 .1 84104
                                              65 31 33 30 65 30 37 63  64 39 38 32 65 34 35 38 |e130e07c d982e458
                                              36 35 63 36 34 37 31 66  38 64 62 2e 63 6c 6f 75 |65c6471f 8db.clou
                                              64 66 72 6f 6e 74 2e 6e  65 74 20 28 43 6c 6f 75 |dfront.n et (Clou
                                              64 46 72 6f 6e 74 29 0d  0a 58 2d 41 6d 7a 2d 43 |dFront). .X-Amz-C
                                              66 2d 50 6f 70 3a 20 48  4b 47 36 32 2d 43 31 0d |f-Pop: H KG62-C1.
                                              0a 58 2d 41 6d 7a 2d 43  66 2d 49 64 3a 20 34 69 |.X-Amz-C f-Id: 4i
                                              39 71 62 61 51 6c 4e 39  51 52 37 5f 44 37 6f 4d |9qbaQlN9 QR7_D7oM
                                              4f 59 45 31 44 4c 4e 57  57 6e 49 73 59 52 42 52 |OYE1DLNW WnIsYRBR
                                              58 44 42 30 69 32 53 46  69 71 56 77 46 54 6f 35 |XDB0i2SF iqVwFTo5
                                              66 59 69 77 3d 3d 0d 0a  0d 0a                   |fYiw==.. ..      
    [00:00:17.579,315] <err> download_client: Server did not honor partial content request
    Error -77 during download

    CONFIG_DFU_TARGET=n

    Range: bytes=0-

    *** Booting Zephyr OS build v2.4.99-ncs1  ***
    Download client sample started
    Waiting for network.. [00:00:00.209,045] <inf> lte_lc: Using legacy LTE PCO mode...
    OK
    [00:00:04.935,455] <dbg> download_client.client_connect: Port not specified, using default: 80
    [00:00:04.935,485] <dbg> download_client.client_connect: family: 1, type: 1, proto: 6
    [00:00:04.935,882] <inf> download_client: Configuring socket timeout (30 s)
    [00:00:04.935,882] <inf> download_client: Connecting to http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100
    [00:00:04.935,913] <dbg> download_client.client_connect: fd 1, addrlen 8, fam IPv4, port 80
    [00:00:07.464,355] <dbg> download_client: HTTP request
                                              47 45 54 20 2f 51 47 50  53 5f 31 2e 44 41 54 3f |GET /QGP S_1.DAT?
                                              76 65 6e 64 6f 72 3d 47  4f 54 4f 50 26 70 72 6f |vendor=G OTOP&pro
                                              6a 65 63 74 3d 4b 75 69  69 6b 6c 4e 41 71 6f 72 |ject=Kui iklNAqor
                                              6d 38 53 52 64 61 57 50  51 69 47 62 5a 36 6c 6b |m8SRdaWP QiGbZ6lk
                                              45 6c 4d 36 2d 4b 7a 4e  52 49 61 75 5f 74 6a 45 |ElM6-KzN RIau_tjE
                                              26 64 65 76 69 63 65 5f  69 64 3d 31 30 30 20 48 |&device_ id=100 H
                                              54 54 50 2f 31 2e 31 0d  0a 48 6f 73 74 3a 20 77 |TTP/1.1. .Host: w
                                              70 65 70 6f 64 6f 77 6e  6c 6f 61 64 2e 6d 65 64 |pepodown load.med
                                              69 61 74 65 6b 2e 63 6f  6d 0d 0a 52 61 6e 67 65 |iatek.co m..Range
                                              3a 20 62 79 74 65 73 3d  30 2d 0d 0a 43 6f 6e 6e |: bytes= 0-..Conn
                                              65 63 74 69 6f 6e 3a 20  6b 65 65 70 2d 61 6c 69 |ection:  keep-ali
                                              76 65 0d 0a 0d 0a                                |ve....           
    [00:00:07.464,660] <inf> download_client: Downloading: http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100 [0]
    Downloading http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device[00:00:07.464,874] <dbg> download_client.download_thread: Receiving up to 2048 bytes at 0x200146fc...
    [00:00:15.472,839] <dbg> download_client.download_thread: Read 708 bytes from socket
    [00:00:15.472,930] <dbg> download_client.http_header_parse: GET header size: 426
    [00:00:15.472,961] <dbg> download_client: HTTP response
                                              48 54 54 50 2f 31 2e 31  20 32 30 30 20 4f 4b 0d |HTTP/1.1  200 OK.
                                              0a 43 6f 6e 74 65 6e 74  2d 54 79 70 65 3a 20 61 |.Content -Type: a
                                              70 70 6c 69 63 61 74 69  6f 6e 2f 6f 63 74 65 74 |pplicati on/octet
                                              2d 73 74 72 65 61 6d 0d  0a 43 6f 6e 74 65 6e 74 |-stream. .Content
                                              2d 4c 65 6e 67 74 68 3a  20 32 33 30 34 0d 0a 43 |-Length:  2304..C
                                              6f 6e 6e 65 63 74 69 6f  6e 3a 20 6b 65 65 70 2d |onnectio n: keep-
                                              61 6c 69 76 65 0d 0a 44  61 74 65 3a 20 54 68 75 |alive..D ate: Thu
                                              2c 20 30 33 20 4a 75 6e  20 32 30 32 31 20 30 33 |, 03 Jun  2021 03
                                              3a 32 32 3a 31 32 20 47  4d 54 0d 0a 45 54 61 67 |:22:12 G MT..ETag
                                              3a 20 22 33 37 38 34 63  62 62 31 39 30 61 62 34 |: "3784c bb190ab4
                                              61 66 33 30 66 32 39 33  36 39 66 35 30 36 33 34 |af30f293 69f50634
                                              64 37 66 22 0d 0a 53 65  72 76 65 72 3a 20 6e 67 |d7f"..Se rver: ng
                                              69 6e 78 2f 31 2e 31 30  2e 31 0d 0a 58 2d 50 6f |inx/1.10 .1..X-Po
                                              77 65 72 65 64 2d 42 79  3a 20 45 78 70 72 65 73 |wered-By : Expres
                                              73 0d 0a 58 2d 43 61 63  68 65 3a 20 4d 69 73 73 |s..X-Cac he: Miss
                                              20 66 72 6f 6d 20 63 6c  6f 75 64 66 72 6f 6e 74 | from cl oudfront
                                              0d 0a 56 69 61 3a 20 31  2e 31 20 64 33 63 34 35 |..Via: 1 .1 d3c45
                                              31 34 61 34 39 34 31 37  37 38 32 63 35 61 65 34 |14a49417 782c5ae4
                                              35 33 38 63 66 30 65 33  65 61 64 2e 63 6c 6f 75 |538cf0e3 ead.clou
                                              64 66 72 6f 6e 74 2e 6e  65 74 20 28 43 6c 6f 75 |dfront.n et (Clou
                                              64 46 72 6f 6e 74 29 0d  0a 58 2d 41 6d 7a 2d 43 |dFront). .X-Amz-C
                                              66 2d 50 6f 70 3a 20 48  4b 47 36 32 2d 43 31 0d |f-Pop: H KG62-C1.
                                              0a 58 2d 41 6d 7a 2d 43  66 2d 49 64 3a 20 65 56 |.X-Amz-C f-Id: eV
                                              31 39 58 50 44 47 5a 5f  73 66 6b 4c 55 70 54 74 |19XPDGZ_ sfkLUpTt
                                              75 66 50 68 6e 57 37 4c  4d 55 38 6f 74 65 6f 65 |ufPhnW7L MU8oteoe
                                              54 70 6b 53 4f 4c 75 42  33 31 6b 76 6a 74 45 4e |TpkSOLuB 31kvjtEN
                                              4d 47 7a 51 3d 3d 0d 0a  0d 0a                   |MGzQ==.. ..      
    [00:00:15.473,144] <dbg> download_client.http_header_parse: File size = 2304
    [00:00:15.473,236] <dbg> download_client.http_parse: Copying 282 payload bytes
    [00:00:15.473,266] <dbg> download_client.download_thread: Receiving up to 1766 bytes at 0x20014816...
    =--- 88 messages dropped ---
    =======================| (2304/2304 bytes)[00:00:18.709,716] <inf> download_client: Download complete
    
    Download completed in 11261 ms @ 204 bytes per sec, total 2304 bytes
    Bye

    CONFIG_DFU_TARGET=n

    Range: bytes=0-2047

    *** Booting Zephyr OS build v2.4.99-ncs1  ***
    Download client sample started
    Waiting for network.. [00:00:00.209,136] <inf> lte_lc: Using legacy LTE PCO mode...
    OK
    [00:00:07.387,786] <dbg> download_client.client_connect: Port not specified, using default: 80
    [00:00:07.387,817] <dbg> download_client.client_connect: family: 1, type: 1, proto: 6
    [00:00:07.388,214] <inf> download_client: Configuring socket timeout (30 s)
    [00:00:07.388,244] <inf> download_client: Connecting to http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100
    [00:00:07.388,244] <dbg> download_client.client_connect: fd 1, addrlen 8, fam IPv4, port 80
    [00:00:09.920,104] <dbg> download_client: HTTP request
                                              47 45 54 20 2f 51 47 50  53 5f 31 2e 44 41 54 3f |GET /QGP S_1.DAT?
                                              76 65 6e 64 6f 72 3d 47  4f 54 4f 50 26 70 72 6f |vendor=G OTOP&pro
                                              6a 65 63 74 3d 4b 75 69  69 6b 6c 4e 41 71 6f 72 |ject=Kui iklNAqor
                                              6d 38 53 52 64 61 57 50  51 69 47 62 5a 36 6c 6b |m8SRdaWP QiGbZ6lk
                                              45 6c 4d 36 2d 4b 7a 4e  52 49 61 75 5f 74 6a 45 |ElM6-KzN RIau_tjE
                                              26 64 65 76 69 63 65 5f  69 64 3d 31 30 30 20 48 |&device_ id=100 H
                                              54 54 50 2f 31 2e 31 0d  0a 48 6f 73 74 3a 20 77 |TTP/1.1. .Host: w
                                              70 65 70 6f 64 6f 77 6e  6c 6f 61 64 2e 6d 65 64 |pepodown load.med
                                              69 61 74 65 6b 2e 63 6f  6d 0d 0a 52 61 6e 67 65 |iatek.co m..Range
                                              3a 20 62 79 74 65 73 3d  30 2d 32 30 34 37 0d 0a |: bytes= 0-2047..
                                              43 6f 6e 6e 65 63 74 69  6f 6e 3a 20 6b 65 65 70 |Connecti on: keep
                                              2d 61 6c 69 76 65 0d 0a  0d 0a                   |-alive.. ..      
    [00:00:09.920,379] <inf> download_client: Downloading: http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device_id=100 [0]
    Downloading http://wpepodownload.mediatek.com/QGPS_1.DAT?vendor=GOTOP&project=KuiiklNAqorm8SRdaWPQiGbZ6lkElM6-KzNRIau_tjE&device[00:00:17.934,204] <dbg> download_client.download_thread: Read 708 bytes from socket
    [00:00:17.934,295] <dbg> download_client.http_header_parse: GET header size: 426
    [00:00:17.934,356] <dbg> download_client: HTTP response
                                              48 54 54 50 2f 31 2e 31  20 32 30 30 20 4f 4b 0d |HTTP/1.1  200 OK.
                                              0a 43 6f 6e 74 65 6e 74  2d 54 79 70 65 3a 20 61 |.Content -Type: a
                                              70 70 6c 69 63 61 74 69  6f 6e 2f 6f 63 74 65 74 |pplicati on/octet
                                              2d 73 74 72 65 61 6d 0d  0a 43 6f 6e 74 65 6e 74 |-stream. .Content
                                              2d 4c 65 6e 67 74 68 3a  20 32 33 30 34 0d 0a 43 |-Length:  2304..C
                                              6f 6e 6e 65 63 74 69 6f  6e 3a 20 6b 65 65 70 2d |onnectio n: keep-
                                              61 6c 69 76 65 0d 0a 44  61 74 65 3a 20 54 68 75 |alive..D ate: Thu
                                              2c 20 30 33 20 4a 75 6e  20 32 30 32 31 20 30 33 |, 03 Jun  2021 03
                                              3a 31 37 3a 34 36 20 47  4d 54 0d 0a 45 54 61 67 |:17:46 G MT..ETag
                                              3a 20 22 33 37 38 34 63  62 62 31 39 30 61 62 34 |: "3784c bb190ab4
                                              61 66 33 30 66 32 39 33  36 39 66 35 30 36 33 34 |af30f293 69f50634
                                              64 37 66 22 0d 0a 53 65  72 76 65 72 3a 20 6e 67 |d7f"..Se rver: ng
                                              69 6e 78 2f 31 2e 31 30  2e 31 0d 0a 58 2d 50 6f |inx/1.10 .1..X-Po
                                              77 65 72 65 64 2d 42 79  3a 20 45 78 70 72 65 73 |wered-By : Expres
                                              73 0d 0a 58 2d 43 61 63  68 65 3a 20 4d 69 73 73 |s..X-Cac he: Miss
                                              20 66 72 6f 6d 20 63 6c  6f 75 64 66 72 6f 6e 74 | from cl oudfront
                                              0d 0a 56 69 61 3a 20 31  2e 31 20 61 33 36 34 30 |..Via: 1 .1 a3640
                                              31 61 65 36 35 65 30 37  66 34 30 37 61 63 32 35 |1ae65e07 f407ac25
                                              35 62 61 32 35 38 66 63  64 31 35 2e 63 6c 6f 75 |5ba258fc d15.clou
                                              64 66 72 6f 6e 74 2e 6e  65 74 20 28 43 6c 6f 75 |dfront.n et (Clou
                                              64 46 72 6f 6e 74 29 0d  0a 58 2d 41 6d 7a 2d 43 |dFront). .X-Amz-C
                                              66 2d 50 6f 70 3a 20 48  4b 47 36 32 2d 43 31 0d |f-Pop: H KG62-C1.
                                              0a 58 2d 41 6d 7a 2d 43  66 2d 49 64 3a 20 4e 39 |.X-Amz-C f-Id: N9
                                              77 66 38 34 42 65 65 67  58 50 56 4c 61 4f 49 6b |wf84Beeg XPVLaOIk
                                              55 30 43 68 65 4d 30 33  37 6a 57 6a 52 4e 4a 63 |U0CheM03 7jWjRNJc
                                              2d 67 54 35 5f 4c 51 6b  73 64 45 38 57 6e 7a 58 |-gT5_LQk sdE8WnzX
                                              32 71 72 67 3d 3d 0d 0a  0d 0a                   |2qrg==.. ..      
    [00:00:17.934,509] <dbg> download_client.http_header_parse: File size = 2304
    [00:00:17.934,600] <dbg> download_client.http_parse: Copying 282 payload bytes
    [00:00:17.934,631] <dbg> download_client.download_thread: Receiving up to 1766 bytes at 0x20014816...
    =--- 88 messages dropped ---
    =======================| (2304/2304 bytes)[00:00:21.162,078] <inf> download_client: Download complete
    
    Download completed in 11259 ms @ 204 bytes per sec, total 2304 bytes
    Bye
    

  • The download_client still checks for the content-range header, regardless of if you send it or not.

    The reason for the check is that CONFIG_DOWNLOAD_CLIENT_RANGE_REQUESTS is set. The reason it is set is because CONFIG_DFU_TARGET_MODEM_DELTA (which is enabled by default) is implying CONFIG_DOWNLOAD_CLIENT_RANGE_REQUESTS. So if you set either of those options to 'n', it should work with CONFIG_DFU_TARGET enabled.

Reply
  • The download_client still checks for the content-range header, regardless of if you send it or not.

    The reason for the check is that CONFIG_DOWNLOAD_CLIENT_RANGE_REQUESTS is set. The reason it is set is because CONFIG_DFU_TARGET_MODEM_DELTA (which is enabled by default) is implying CONFIG_DOWNLOAD_CLIENT_RANGE_REQUESTS. So if you set either of those options to 'n', it should work with CONFIG_DFU_TARGET enabled.

Children
Related