Commit Graph

28 Commits

Author SHA1 Message Date
Marti Bolivar 310445b8bc zephyr: cleanup flash driver name
The flash driver name was changed upstream during the v1.11
development cycle. Remove a shim which kept the old name around in the
Zephyr port now that v1.11 is out.

Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
2018-04-10 14:03:35 -03:00
Carles Cufi 90eda80838 doc: Fix MCUboot capitalization
The correct spelling is "MCUboot", so replace the instances that differ
from this.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2018-01-29 15:49:04 -02:00
Marti Bolivar dc4c42bf62 boot: zephyr: fix flash page layout hacks
Zephyr now has proper page layout APIs in its flash driver. Use these
to implement flash_area_get_sectors() and flash_area_to_sectors() when
they are available. Leave the existing implementation behind as a
"legacy" version, for flash drivers which lack page layout support.

This lets us obtain all the target support we need for nRF and STM32
targets entirely from the operating system.

There are two cases where OS-level support is still not enough:

- NXP K6x targets still need an SoC family header, because their flash
  driver does not yet support CONFIG_FLASH_PAGE_LAYOUT.

- The arduino_101 target needs partition and flash alignment
  definitions in its DTS, and a flash driver with page layout support
  as well, so its board-specific header must remain for now.

Fixing these is left to future work. Once that is done,
boot/zephyr/targets/ can be removed completely.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-10 13:57:02 -06:00
Marti Bolivar 3d9e3eb974 boot: zephyr: obtain FLASH_DRIVER_NAME, FLASH_ALIGN from OS
Zephyr now provides defines for FLASH_DRIVER_NAME and
FLASH_WRITE_BLOCK_SIZE (which is what we call FLASH_ALIGN) in
the SoC headers for most targets supported by mcuboot. Use that
information when it's available, falling back on MCUBOOT_TARGET_CONFIG
otherwise.

The soc_family_foo.h files remain for FLASH_AREA_IMAGE_SECTOR_SIZE.  A
subsequent patch can remove these files when the relevant SoC flash
driver provides a page layout.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-10 13:57:02 -06:00
Marti Bolivar 07cd2d053d zephyr: move Kinetis target config to soc_family_kinetis.h
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-04 20:36:34 -04:00
Marti Bolivar 382f64a882 zephyr: move STM32 target config to soc_family_stm32.h
This cleanup commit requires a bit more target-specific knowledge
that's a bit harder to read than board-specific headers, but it's
still an improvement over what we have now.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-04 20:36:34 -04:00
Marti Bolivar 61038df37f zephyr: move nRF5 target config into soc_family_nrf5.h
All of the information we need is in DTS or is the same across all
boards in the SoC family. There's no need for board-specific headers
for these targets.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-10-04 20:36:34 -04:00
Carles Cufi ef35f0adad zephyr: nrf5x: add nRF51 and nRF52832 dev kits as targets
Add the 2 official Nordic Development Kit targets that are missing from
the list in mcuboot, but supported in Zephyr.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2017-09-08 11:33:47 -06:00
Tyler Baker 6cff59a616 zephyr: add nrf52_blenano2 target
Adds a new zephyr target for the nrf52_blenano2. This is the BLE
Nano 2 board created by Red Bear which contains a NRF52832 MCU.

Signed-off-by: Tyler Baker <tyler.baker@linaro.org>
2017-08-24 13:19:11 -06:00
David Brown fd1f76648e zephyr: Add Hexiwear k64 support
The hexiwear k64 is very similar to the frdm_k64, as far as mcuboot is
concerned.  The partitions are now defined in DTS in Zephyr, and this
target file just needs the device name, sector size, and alignment.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-08-24 07:07:56 -06:00
Marti Bolivar 9203b1b9ed zephyr: nucleo_f401re: use flash defines from DTS
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-20 11:31:50 -06:00
Marti Bolivar 99b5b2cb56 zephyr: nrf52840_pca10056: use flash defines from DTS
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-20 11:31:50 -06:00
Marti Bolivar 63fa9cfd88 zephyr: 96b_nitrogen: use flash defines from DTS
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-20 11:31:50 -06:00
Marti Bolivar c868990ec6 zephyr: 96b_carbon: use flash defines from DTS
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-20 11:31:50 -06:00
David Brown 98da04f0fd zephyr: frdm_k64f: Remove partition defines
Now that the partition table has been added to the device tree for the
frdm_k64f in upstream Zephyr, these symbols become redundant defines.
Remove them to fully use the partitions defined in Zephyr.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-06-29 08:56:23 -06:00
Michel Jaouen f710d21ca3 zephyr: targets: add support for disco_l475_iot1
Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
2017-06-23 10:31:31 +02:00
David Brown b8e9dde77c frdm_k64f: Use entire flash.
Expand the data slots to 384K each, leaving the boot and scratch areas
as 128K.  This allows more room for code, but will wear the scratch
partition about 3x faster because of the more extensive use of the
partition.
2017-04-27 16:35:27 -06:00
Marti Bolivar 7f6ea1599d zephyr: add nrf52840_pca10056 target
This board, called the NRF52840-PDK in marketing materials, is a
preview development board for the nRF52840 SoC.

Flash layout (4 KiB sectors):

        User    Start   End     Size (KiB) Size (B)
        ------- ------- ------- ---------- --------
        mcuboot 0x00000 0x07FFF         32  0x08000
        Image 0 0x08000 0x73FFF        432  0x6C000
        Image 1 0x74000 0xDFFFF        432  0x6C000
        Scratch 0xE0000 0xFCFFF        116  0x1D000

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-21 15:48:17 -04:00
Marti Bolivar 29d3a77d3b zephyr: fix flash_area_to_sectors()
This fixes MCUB-39.

On Zephyr targets, flash_area_to_sectors() assumes that the flash
device's sector size is equal to the size of the scratch area.

That breaks swap and rollback when scratch size doesn't divide image
size, since the image flash areas will not be correctly configured.
This is a valid configuration supported by the rest of mcuboot.

The best way to fix this would be to get the flash layout from Zephyr,
but that's not possible yet.

Instead, provide a new FLASH_AREA_IMAGE_SECTOR_SIZE define from
target.h. This must be the sector size for these areas:

       - FLASH_AREA_IMAGE_0
       - FLASH_AREA_IMAGE_1
       - FLASH_AREA_IMAGE_SCRATCH

Other areas on the device may have sizes different than
FLASH_AREA_IMAGE_SECTOR_SIZE.

This won't work on platforms where those areas have nonuniform sector
sizes, but we'll cross that bridge when we come to it. (At that point,
an upstream Zephyr change to the flash API really seems needed.)

Revert to the old/buggy behavior when FLASH_AREA_IMAGE_SECTOR_SIZE
isn't provided, but emit a warning. Additionally, touch up the logging
and error handling while we're here.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-21 15:48:15 -04:00
Marti Bolivar 94f3f91ca7 zephyr: 96b_nitrogen: increase scratch space
The current configuration only allows ~170 updates before we can
expect wear on the flash device (per product spec that the flash
device supports 10,000 erase cycles). Increase the scratch size to
make this better by removing some application space, to allow for
~2500 application updates or rollbacks.

The new configuration is 52 KiB (13 sectors) for scratch, and 208
KiB (52 sectors) for each application image.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-21 15:39:53 -04:00
Marti Bolivar 77683adc20 Move arduino_101.conf to boot/zephyr/.
It's currently one level down, in boot/zephyr/targets, from the rest
of the .conf files.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-03-16 15:06:20 -04:00
Andrew Boie 91c23f214a zephyr: add arduino_101 demo configuration
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2017-03-15 10:16:17 -07:00
Michael Scott 72559a4681 zephyr: targets: update flash driver names to use Zephyr CONFIGs
Let's stay in-sync automatically with Zephyr master by referring
to CONFIGs for the flash device names.

Signed-off-by: Michael Scott <michael.scott@linaro.org>
2017-02-10 15:33:14 -08:00
Marti Bolivar 5e6a1a6245 boot: zephyr: Fix 96b_nitrogen flash alignment
The Zephyr flash driver transparently handles non-word-aligned writes,
but the NRF52's flash write alignment is 4 bytes. Fix that.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-02-03 16:25:14 -08:00
Ricardo Salveti e156e57012 zephyr: add target header file for nucleo f401re
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-26 22:11:19 -02:00
David Brown 79fdfe5dfc k64f: change flash device name
Recent Zephyr changes the flash device name.  Change to match it.
2017-01-23 16:01:01 -07:00
Ricardo Salveti 88303ff1da zephyr: targets: add support for 96b_nitrogen
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-19 10:50:46 -02:00
Ricardo Salveti 3a2c1242f1 zephyr: restructure the build process to use board config files
Move the board specific configurations into its own header file, which
can now be created per board, once it gets tested and validated by the
bootloader.

Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2017-01-19 10:26:40 -02:00