1# Running mynewt apps with MCUboot
2
3Due to small differences between Mynewt's bundled bootloader and MCUboot,
4when building an app that will be run with MCUboot as the bootloader and
5which at the same time requires to use `newtmgr` to manage images, MCUboot
6must be added as a new dependency for this app.
7
8First you need to add the repo to your `project.yml`:
9
10```
11    project.repositories:
12        - mcuboot
13
14    repository.mcuboot:
15        type: github
16        vers: 0-dev
17        user: mcu-tools
18        repo: mcuboot
19```
20
21Then update your app's `pkg.yml` adding the extra dependency:
22
23```
24    pkg.deps:
25        - "@mcuboot/boot/bootutil"
26```
27
28Also remove any dependency on `boot/bootutil` (mynewt's bundled bootloader)
29which might exist.
30
31To configure MCUboot check all the options available in
32`boot/mynewt/mcuboot_config/syscfg.yml`.
33
34Also, MCUboot uses a different image header struct as well as slightly
35different TLV structure, so images created by `newt` have to be generated
36in this new format. That is done by passing the extra parameter `-2` as in:
37
38`newt create-image <target> <version> <pubkey> -2`
39
40# Boot serial functionality with Mynewt
41
42Building with `BOOT_SERIAL: 1` enables some basic management functionality
43like listing images and uploading a new image to `slot0`. The serial bootloader
44requires that `mtu` is set to a value that is less than or equal to `256`.
45This can be done either by editing `~/.newtmgr.cp.json` and setting the `mtu`
46for the connection profile, or specifying you connection string manually as in:
47
48```
49newtmgr --conntype serial --connstring "dev=/dev/ttyUSB0,mtu=256" image upload -e blinky.img
50```
51
52where `/dev/ttyUSB0` is your serial port.
53