Comments (4)
This is the job of the MCUboot header size, it needs to be an offset that is such that the partition start address plus the header size is a size that is compatible with the vector table address register, which for minimal cortex m3/m4/m7 implementations is 0x80, the zephyr default for these is 0x200 which gives additional spacing which can be argued is too much, but can be changed. The MCUboot header is always going to be larger than the data that is placed there, but that's going to be the case with any sector-based system, e.g. on a 4KiB sector device, if MCUboot occupies 28.5KiB, the partition size needs to be 32KiB (and depending upon security features in the MCU, some hardware-backed features might have more coarse sizes, e.g. a sector security locking system might have a 64KiB granularity, in which case MCUboot would need to be 64KiB so that it could be safely read protected, thus wasting 35.5KiB).
A flip side to having a larger header than is needed is that the header can be altered in the future, e.g. adding new TLVs or information to the image header
from mcuboot.
This is the job of the MCUboot header size, it needs to be an offset that is such that the partition start address plus the header size is a size that is compatible with the vector table address register, which for minimal cortex m3/m4/m7 implementations is 0x80, the zephyr default for these is 0x200 which gives additional spacing which can be argued is too much, but can be changed. The MCUboot header is always going to be larger than the data that is placed there, but that's going to be the case with any sector-based system, e.g. on a 4KiB sector device, if MCUboot occupies 28.5KiB, the partition size needs to be 32KiB (and depending upon security features in the MCU, some hardware-backed features might have more coarse sizes, e.g. a sector security locking system might have a 64KiB granularity, in which case MCUboot would need to be 64KiB so that it could be safely read protected, thus wasting 35.5KiB).
The problem with this is that we loose a lot of space between what is really in header and vector table. That is probably issue with Zephyr linker scripts that just shift the vtor table to proper offset, leaving the space in front of it with no data.
A flip side to having a larger header than is needed is that the header can be altered in the future, e.g. adding new TLVs or information to the image header
You can change header size between applications, the code would allow that in current state. If we would properly do the ld script in Zephyr we could take the reserved space into account.
from mcuboot.
The problem with this is that we loose a lot of space between what is really in header and vector table. That is probably issue with Zephyr linker scripts that just shift the vtor table to proper offset, leaving the space in front of it with no data.
Vector table should always come first, if you assume MCUboot itself in a device with flash address 0x0, then the vector table should reside there because that's the start of the image, that is where the CPU will begin executing from, and if it was chain loaded by a bootloader, it does not need (nor should it have) intimate knowledge of the image to be able to boot it
from mcuboot.
The problem with this is that we loose a lot of space between what is really in header and vector table. That is probably issue with Zephyr linker scripts that just shift the vtor table to proper offset, leaving the space in front of it with no data.
Vector table should always come first, if you assume MCUboot itself in a device with flash address 0x0, then the vector table should reside there because that's the start of the image, that is where the CPU will begin executing from, and if it was chain loaded by a bootloader, it does not need (nor should it have) intimate knowledge of the image to be able to boot it
That is actually not true by the arm definition itself. You can put vector table at specific addresses, they do not have to be 0, if your app does not boot from the beginning of flash. When MCUboot is used, application images do not begin with vtor, they begin with header and vtor is placed at proper offset after the header.
Closing it here, because possibility to fill in unused space should rather be addressed in Zephyr linker scripts.
from mcuboot.
Related Issues (20)
- Imgtool trailer size check incorrect for swap-using-move HOT 4
- imgtool custom TLV disregards endian and always uses big endian
- WARNING: Using default MCUBoot key, it should not be used for production. HOT 8
- Zephyr v3.4.0: MCUBoot doesn't clear the pending flag when configured to operate in RAM_LOAD mode (non-XIP). HOT 4
- Compiler Warning in bootutil_max_image_size due to Incorrect Argument Type HOT 2
- Unconditional erase of trailer sector in serial recovery HOT 5
- serial recovery: image list not working with encrypted images and single slot HOT 2
- ESP32C3: boot_request_upgrade() does not work when flash encryption is enabled HOT 4
- Zephyr: Compilation errors for any board when building mcuboot HOT 1
- it_tlv_tot is uint16_t and also it_len HOT 2
- boot_nv_security_counter_init() not called through boot_go()
- zephyr does not build with `CONFIG_BOOT_SWAP_USING_SCRATCH` for esp32s3_devkitm HOT 3
- Standardize image_version string representation HOT 8
- MCUBOOT_BOOTSTRAP meaning with/without MCUBOOT_VALIDATE_PRIMARY_SLOT
- `MBEDTLS_PRIVATE` is going away, need to construct and use keys properly. HOT 1
- Unsigned data copied as part of image upgrade HOT 1
- Enhancement: option to reduce TLV re-reads
- Security issues related to replaying an update
- Enhancement: cache TLVs instead of re-reading them from flash
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mcuboot.