Commit Graph

604 Commits (8489736eac7be570a3fa09793a368aaf232ef74e)

Author SHA1 Message Date
David Garske 8489736eac Fixed and improved erase of remainder of partition logic and logging. Added support for nRF5340 core synchronization (`NRF_SYNC_CORES`). Added test for `WOLFBOOT_FLASH_MULTI_SECTOR_ERASE`. 2024-10-11 10:29:59 +02:00
David Garske 832ac479c3 Example for using custom UART port/pin. Additional debug output on erase of unused flash sectors. 2024-10-11 10:29:59 +02:00
David Garske eb175cdfec Switch network core to use external flash HAL, but map to shared memory. Allows using update_flash logic including encrypted and delta updates. 2024-10-11 10:29:59 +02:00
David Garske 2cf70f0dbd Fix for the `set_trailer_at` with external flash to use 32-bit write using cached value (Many QSPI hardware peripherals do not support a single byte write). Fix delta build error with DISABLE_BACKUP. Added tests for updating both cores in build_flash.sh. 2024-10-11 10:29:59 +02:00
David Garske 322aa325b6 Consolidate duplicate TEST_FLASH code. 2024-10-11 10:29:59 +02:00
David Garske e3b98f1d7d Fixes for properly functioning network core updates. 2024-10-11 10:29:59 +02:00
David Garske 8a9fbe5674 Improve network core firmware update. 2024-10-11 10:29:59 +02:00
David Garske 6db7de6a75 Support for the Nordic nRF5340 (application and network cores):
* Added nRF5340 driver support for Clock, Internal Flash (NVMC), GPIO, SPU, OTP, UART, SPI, QSPI and IPC.
* Added support for updating the network core (Sign using "--id 2")
* Cleanup the nRF52 port
* Improved external QSPI and internal Flash tests and logging.
* Improved internal printf support for formatter length.
2024-10-11 10:29:59 +02:00
Daniele Lacamera 4cbfdf8cf1 [SAMA5D3] Port for 32bit Cortex-A 2024-09-30 14:05:50 +02:00
Hideki Miyazaki 44d3201cc9 fix ccrx use case for rx72n 2024-09-20 20:20:55 +02:00
David Garske 080dae0125 Fixes to properly support TPM policy with more than one PCR. 2024-09-10 20:53:10 +02:00
Daniele Lacamera a1a7601314 Unit tests: cleanup warnings 2024-09-06 11:36:16 +02:00
Daniele Lacamera 6737d7e7ad Refactoring of PKCS11 store module + unit tests 2024-09-05 18:53:03 +02:00
David Garske 9e17315d49 Fixes for building wolfBoot with XMSS/LMS. 2024-08-14 18:06:12 +02:00
David Garske be169145e2 Fixes for Zynqmp QSPI sizes on ZCU102. Fix for XMSS/LMS on Windows mingw with fopen binary mode. 2024-08-14 18:06:12 +02:00
David Garske 8a7f5e5baa Refactor to eliminate PLATFORM_ -> TARGET_. Fix CI errors. 2024-08-14 18:06:12 +02:00
David Garske cf936dffa2 Fixes for Xilinx zynqmp. 2024-08-14 18:06:12 +02:00
David Garske 3687851f75 Xilinx zynqmp documentation cleanups. Fixes for building with Eclipse wildcard .c include pains. 2024-08-14 18:06:12 +02:00
Daniele Lacamera d2811b2538
Unit test for update_ram.c (#488)
* Initial draft with two test cases

* Added more unit tests. Found OOB access.

* Fix potential OOB access with too-large update img

* NO_FORK disabled by default

* Cover more corner cases

* Added unit tests for update_ram.c

Fixed fallback in partition election
2024-08-13 09:36:33 -07:00
Daniele Lacamera 3ff7059dc5
Unit tests for update_flash.c (#487)
* Initial draft with two test cases

* Added more unit tests. Found OOB access.

* Fix potential OOB access with too-large update img

* NO_FORK disabled by default

* Cover more corner cases
2024-08-13 06:25:49 -07:00
Daniele Lacamera 30a1f67e43
Added 32bit simulator via TARGET=sim FORCE_32BIT=1 (#485)
* Added 32bit simulator via TARGET=sim FORCE_32BIT=1

Tests can now run on 32bit simulator (e.g. to match XMALLOC fixed
sizes with sp_math and WOLFBOOT_SMALL_STACK).

* Added draft for new workflow: test simulator with different memory config

* Fix 64bit, SMALL_STACK xmalloc sizes

* Test defaults to SPMATH

* Fixed test: defaults to spmath. Added RSA tests (failing)

* Fixed RSA allocation sizes for 64bit build

* Added 64bit fastmath test (failing)

* Fixed ecc_point size for 64bit builds (FASTMATH)

* simulator config: use SPMATH by default

* Attempt to fix i386 libc dep in workflow

* Added HUGE_STACK to silence warning in FASTMATH+RSA4096 tests
2024-08-09 06:46:15 -07:00
Brett Nicholas 2d6308ec2c - Infineon TC3xx support
- fix (existing) unused variable compiler warnings
- documentation updates
- add multi-sector erase option
2024-07-31 09:22:31 +02:00
David Garske d747afb780 Move interrupt disable to do_boot. 2024-07-23 18:37:06 +02:00
David Garske f7fed89f27 Fix to make sure wolfBoot leaves IRQ's disabled. The TSIP driver will leave IRQ's on which could cause customer issues. Added new `spi_flash_chip_erase` API for the SPI flash driver. 2024-07-23 18:37:06 +02:00
Daniele Lacamera 64f3a395fb
Merge branch 'master' into swap_tail_type 2024-07-19 12:37:47 +02:00
David Garske b3f3b5356c Fix for image_open wolfBoot_get_blob_version print. Added NULL protection on `wolfBoot_get_blob_version`. 2024-07-19 09:08:48 +02:00
David Garske a49f4405a5 Add logging for wolfBoot_update() and partition version information. Enabled with `DEBUG_UART` or other PRINTF_ENABLED logging.
Example Log:
```
wolfBoot HAL Init
SPI Probe: Manuf 0xC2, Product 0x20
Boot at 0xFFE00000 (size 115856, version 0x2)
Update at 0x200000 (size 115856, version 0x0)
Staring Update (fallback allowed 0)
Update at 0x200000 (size 115856, version 0x0)
Boot at 0xFFE00000 (size 115856, version 0x2)
Versions: Current 0x2, Update 0x3
Copy sector 0 (part 1->2)
Copy sector 0 (part 0->1)
Copy sector 0 (part 2->0)
Boot at 0xFFE00000 (size 115856, version 0x3)
Update at 0x200000 (size 115856, version 0x0)
Copy sector 1 (part 1->2)
Copy sector 1 (part 0->1)
Copy sector 1 (part 2->0)
Copy sector 2 (part 1->2)
Copy sector 2 (part 0->1)
Copy sector 2 (part 2->0)
Copy sector 3 (part 1->2)
Copy sector 3 (part 0->1)
Copy sector 3 (part 2->0)
Boot at 0xFFE00000 (size 115856, version 0x3)
Update at 0x200000 (size 115856, version 0x0)
Copy sector 58 (part 0->2)
Boot at 0xFFE00000 (size 115856, version 0x3)
Booting version: 0x3
```
2024-07-19 09:08:48 +02:00
David Garske 82094c92e1 Cleanup "tail" to "trailer" 2024-07-18 14:18:51 -07:00
David Garske 8b954d4a6c Fix for update_flash.c `error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]`. Cleanup the swap logic for `EXT_ENCRYPTED`. Switch to using a `uint32_t` directly for checking tail magic. 2024-07-18 13:55:04 -07:00
Daniele Lacamera d390873096 Fix padding in test 2024-07-18 10:15:50 +02:00
Daniele Lacamera 55396ed969 Restore erase in update_trigger.
Caveat: in case of powerfail during wolfBoot_update_trigger, the key
previously set may be lost. This is OK assuming that the update process
can resume from the previous step in the application (setting the key
before triggering the update).
2024-07-18 09:33:58 +02:00
Daniele Lacamera d31380675e Fix key persistence with FLAGS_HOME + EXT_ENCTYPT 2024-07-18 08:42:39 +02:00
Daniele Lacamera d3795c81cd Implicitly add trailer when setting enc key 2024-07-17 18:33:37 +02:00
Daniele Lacamera 8b73250324 Set trailer on BOOT partition when storing the enc key 2024-07-17 17:00:11 +02:00
Daniele Lacamera e586087422 Added unit test NVM + ENCRYPTION, fix offset 2024-07-17 13:42:28 +02:00
Daniele Lacamera 9250abbb8e Fixed erase address in case of NVM + FLAGS_HOME 2024-07-17 12:09:13 +02:00
Daniele Lacamera 04111a67b4 Added unit tests for FLAGS_HOME + fix NVM election
Taking into account the additional offset for PART_UPDATE_FLAGS at the
end of each flags sector when comparing two redundant flag sectors in
NVM_FLASH_WRITEONCE + FLAGS_HOME
2024-07-17 11:28:40 +02:00
Daniele Lacamera 2ec2bcdf79 Fixed flag comparison selecting most recent flags 2024-07-17 08:55:14 +02:00
David Garske 3444c47fdb * Added support for RX65N and RX72N with native Makefile and RX ELF GCC compiler.
* Added initialization of the clocks and UART driver.
   - wolfBoot uses on chip high speed oscillator (HOCO) at (120MHz RX65N and 240Mhz for RX72N).
* Added RX RSPI and QSPI driver support with external SPI flash
* Improve documentation and fix spelling errors.
* Added .srec (s-record) format support
* Added RX TSIP support for ECDSA (requires https://github.com/wolfSSL/wolfssl/pull/7685).
* Allow custom implementation of `get_trailer_at`, `set_trailer_at` and `set_partition_magic` using `CUSTOM_PARTITION_TRAILER`
2024-07-17 06:08:31 +02:00
Daniele Lacamera a7668842c7 Remove silencer for -Warray-bounds 2024-07-16 17:18:41 +02:00
Daniele Lacamera 230174e2f7 nvm_select_fresh_sector: fix flag offset
The offset for the sector flags position to compare the two
redundant blocks with NVM_FLASH_WRITEONCE mode was wrong, resulting
in a negative offset, which in turn caused an out-of-bound access
outside of the UPDATE partition space.
2024-07-16 16:16:46 +02:00
John Bland 6c3940fafc refactor final step of powerfail safe update and add
emergency fallback test
2024-07-10 16:58:23 -04:00
Daniele Lacamera aff2072694 Demo app: added test, benchmark, other gadgets 2024-07-09 10:22:42 -07:00
Daniele Lacamera 32d6592e50 Fixed regression on powerfail resume 2024-07-04 18:19:02 +02:00
Daniele Lacamera 68f3bfad58 Take into account resumed delta updates due to powerfail events 2024-07-04 17:31:17 +02:00
Daniele Lacamera 929f9d3343 Fix base_version mismatch 2024-07-04 17:27:04 +02:00
David Garske a92c1b9ad9 STM32U5 cache support. Including cache invalidate on `nvm_select_fresh_sector`. ZD 18210 2024-06-25 18:12:47 +02:00
Marco Oliverio a413cc11ef mptable: abide GCC diagnostic false positive 2024-06-19 09:47:13 +02:00
Marco Oliverio dbdb08b3eb x86: misc fixes
fix various issues found by clangd-static-analyzer
2024-06-19 09:47:06 +02:00
Marco Oliverio 829f7b1705 fix: add image alignment costraints 2024-06-19 09:47:06 +02:00