Commit Graph

22 Commits

Author SHA1 Message Date
Marko Kiiskila e5aeee4ad1 boot_serial; check CRC for RX only if all data has arrived.
Signed-off-by: Marko Kiiskila <marko@apache.org>
2018-12-24 08:47:25 -02:00
Andrzej Puzdrowski c2e30cf2c3 serial recovery: always erase image status
It is possible that while flash was erased progressively
the flash image status page was not erased.
This patch check this case and performs additional eras
if it was required.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-08-04 09:13:23 -03:00
Emanuele Di Santo 205c8c6980 zephyr: erase flash pages progressively
This commit adds the option to erase flash pages while receiving
the firmware, opposed to bulk-erasing the whole image area at
the beginning of the DFU process. This is required on some
hardware that has long erase times, to prevent a long wait
and possibly a timeout during DFU.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-08-04 09:13:23 -03:00
Szymon Janc c48e7f917e boot_serial: Fix build on Zephyr with ECDSA enabled
Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2018-07-03 17:46:33 +02:00
Andrzej Puzdrowski ec1e4d1bef boot_serial: preserve against buffer overflow for zephyr
For zephyr it was possible to make buffer overflow while decoding
incoming base64 sting. This patch correct the available
buffer size transferred to base64 decoding function, which mitigate the
issue.

Clean up boot_serial_start function from unwanted
execution constant pointers.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-06-20 16:08:58 +02:00
Marko Kiiskila 8b1ce3a6ce boot_serial; re-enable mynewt boot_serial unittests.
Signed-off-by: Marko Kiiskila <marko@runtime.io>
2018-06-18 13:13:41 -07:00
Marko Kiiskila c427af2e7e zephyr/serial_adapter; no need to inject \r on \n anymore.
boot_serial; syscfg tabs to spaces.

Signed-off-by: Marko Kiiskila <marko@runtime.io>
2018-06-14 23:19:06 +03:00
Marko Kiiskila 149b457a22 boot_serial; improve platform abstraction.
Pass function pointers to do reads/writes from uart.

Signed-off-by: Marko Kiiskila <marko@runtime.io>
2018-06-14 23:19:06 +03:00
Marko Kiiskila c0011585be boot_serial; fix mynewt unit test.
Signed-off-by: Marko Kiiskila <marko@runtime.io>
2018-06-14 23:19:06 +03:00
Marko Kiiskila ce50ab0648 boot_serial; text size reduction.
- Remove dependency to sprintf()
 - Remove dependency to cborattr
 - mynewt: replace console with more direct interface to uart
 - mynewt: settings to reduce included os code

Signed-off-by: Marko Kiiskila <marko@runtime.io>
2018-06-14 23:19:06 +03:00
Marko Kiiskila 316d361fb3 mynewt app; support additional options to enter serial dfu.
Signed-off-by: Marko Kiiskila <marko@runtime.io>
2018-06-14 23:19:06 +03:00
Fabio Utzig 48841f28ce Remove per file log level configs
This removes settings of log level on a per file basis. The log level
should be set by the global config, while per file log configuration can
still be set, don't enforce them.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-06-04 06:54:39 -03:00
Andrzej Puzdrowski b788c71c08 Replace mcuboot flash_map by zephyr flash_map
The patch introduce usage of zephyr flas_map module instead
of mcuboot zephyr-only implementation. Unused flash_area_to_sectors
API of former flash_map was removed as well.
Size of sector-status-update-map entry is now defined thanks to the
minimum write size supported by the flash driver.

For avoid ambiguity former zephyr-only files flash_map.c
were renamed to flash_map_extended.c (its code now implements
only addition to this what zephyr flash_map implements).

flash_map.h header include is now warped by flash_map_backedn.h headre
because implementations and include pathes are diferent in Zephyr and Mynewt.

Usage of hal_flash_align() were replaced by usage flash_area_align().
This provide consistency between MyNewt and Zephyr implementation as
this API is available in both RTOSes.

flash_map.h was moved to the simulator c-support files as now missing in
the boot/zephyr subdirectories.

f. boot_scratch_fa_device_id was removed as unused.
f. boot_img_fa_device_id was and expanded the only use of it
(on loader.c).

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-05-16 16:05:17 -03:00
Christopher Collins 2844faaccc Mynewt unit tests - Add repo prefix to dep lists.
The unit tests depend on a few Mynewt packages (`test/testutil` and
`sys/console/stub`).  If there is no repo prefix in the dependency
specifier, newt assumes the package is in the local repo (mcuboot)`.
This commit adds the `@apache-mynewt-core/` prefix to these
dependencies.

Signed-off-by: Christopher Collins <ccollins@apache.org>
2018-05-01 15:05:57 -03:00
Andrzej Puzdrowski 268cdd0e09 fix warnings while building along with serial recovery
Following warnings were fixed within this patch:

 'isspace' macro should take an int value

 function 'bs_reset' should return void

 redefinition of 'MBEDTLS_CONFIG_FILE' macro while
 it is already defined by the zephyr build system.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-04-10 08:16:35 -03:00
Andrzej Puzdrowski 386b592109 use zephyr tincybor instead of mcuboot build-in tinycbor
Zephyr has build-in tinycbor code of version which doesn't
require newlib-c by default. Also the cborattr module is now
taken form the zephyr code.

This patch decrease flash consumption by 10 KB for serial recovery build.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2018-04-10 10:36:20 +02:00
Fabio Utzig 30f6b2a908 Fix boot_serial to follow flash write alignment
This fixes an issue found on stm32f3 where newtmgr after writing an odd
sized packet, would hardfault on the next write due to trying to write an
odd address which is not valid on stm32f3 flash.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-04-03 11:42:58 -03:00
Carles Cufi 0165be8ba8 boot_serial: zephyr: Use new base64 library
Instead of relying on mbedTLS' base64 codec, use the new Zephyr base64
library.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-03-27 10:12:11 -03:00
Fabio Utzig 1a2e41ae44 Fix serial boot functionality for Mynewt
Signed-off-by: Fabio Utzig <utzig@apache.org>
2018-02-22 15:51:39 -07:00
Andrzej Puzdrowski 8e96b8352f enable serial recovery functionality on the zephyr mcuboot
This patch introduced serial bootloader functionality ported
from mynewt targets tree.

For achieving this following changes were applied:
- Modified boot_serial module for using, zephyr-os modules
  (crc driver, mbedtls-base64 library) and the zephyr serial adapter module
  introduced recently.
- Added service of boot serial recovery mode to main.
- Adapted the input parser to using static buffers.

Default serial-boot-pin configuration was added for nrf52_pca10040
and nrf52840_pca10056 boards.

Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>
2017-12-06 16:11:10 -07:00
Fabio Utzig d0116731a9 Remove incubator references from mynewt dev email
Also use a single email for all packages.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-21 12:06:44 -06:00
Christopher Collins 39a5fa95c3 Move packages into "boot" top-level directory. 2016-12-12 17:51:23 -08:00