Commit f7ac49ef authored by Gerson Fernando Budke's avatar Gerson Fernando Budke Committed by Johan Hedberg
Browse files

lib: updatehub: Fix buffer sizes

The MAX_PAYLOAD_SIZE must reflect the size of COAP_BLOCK_x. This is
necessary becase BLOCK size represents max payload size. The current
value create inconsistencies for coap lib. The same way,
MAX_DOWNLOAD_DATA must allocate sufficient space for MAX_PAYLOAD_SIZE
plus all space for coap header etc.

Signed-off-by: default avatarGerson Fernando Budke <gerson.budke@ossystems.com.br>
Signed-off-by: default avatarOtavio Salvador <otavio@ossystems.com.br>
(cherry picked from commit 5f5919a9)
parent fce4c9e3
Loading
Loading
Loading
Loading
+7 −2
Changes for lib/updatehub/updatehub.c: 7 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -35,8 +35,13 @@ LOG_MODULE_REGISTER(updatehub);
#define NETWORK_TIMEOUT K_SECONDS(2)
#define UPDATEHUB_POLL_INTERVAL K_MINUTES(CONFIG_UPDATEHUB_POLL_INTERVAL)
#define MAX_PATH_SIZE 255
#define MAX_PAYLOAD_SIZE 500
#define MAX_DOWNLOAD_DATA 1100
/* MAX_PAYLOAD_SIZE must reflect size COAP_BLOCK_x option */
#define MAX_PAYLOAD_SIZE 1024
/* MAX_DOWNLOAD_DATA must be equal or bigger than:
 * MAX_PAYLOAD_SIZE + (len + header + options)
 * otherwise download size will be less than real size.
 */
#define MAX_DOWNLOAD_DATA (MAX_PAYLOAD_SIZE + 32)
#define COAP_MAX_RETRY 3
#define MAX_IP_SIZE 30

+1 −1
Changes for samples/net/updatehub/prj.conf: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@
CONFIG_UPDATEHUB=y

#Minimal Heap mem pool size for the updatehub working
CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_HEAP_MEM_POOL_SIZE=8192
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048

CONFIG_NET_IPV4=y