Commit Graph

3901 Commits

Author SHA1 Message Date
Rasmus Melchior Jacobsen
95b31cf2db Remove Drop on Flash and FlashLayout and propage lifetime to region types
This allows the user to "split" the FlashRegions struct into each region
2023-04-05 10:27:13 +02:00
Rasmus Melchior Jacobsen
e2e15e436a Merge remote-tracking branch 'upstream/master' into flash-regions 2023-04-04 23:16:58 +02:00
Rasmus Melchior Jacobsen
3deb65bc87 Merge branch 'master' into flash-regions 2023-04-04 23:16:01 +02:00
bors[bot]
064ec9581e
Merge #1329
1329: Reduce bootloader memory usage r=rmja a=rmja

By not requiring that the provided buffer must be able to contain one "erase-size" bytes.

This PR is the successor of #1314 and replaces it entirely.

Co-authored-by: Rasmus Melchior Jacobsen <rmja@laesoe.org>
2023-04-04 21:00:11 +00:00
Rasmus Melchior Jacobsen
84bfe9b8c9 Align examples with bootloader changes 2023-04-04 22:44:21 +02:00
Rasmus Melchior Jacobsen
a77ce1088d Align chip specific boot projects with new prepare_boot() signature 2023-04-04 22:22:25 +02:00
Rasmus Melchior Jacobsen
e962fe794c Add assertions about the aligned_buf % write sizes 2023-04-04 21:57:28 +02:00
Rasmus Melchior Jacobsen
78e6b4d261 Remove comment about equal erase size requirement 2023-04-04 21:43:18 +02:00
Rasmus Melchior Jacobsen
53efb02900 Allow different erase sizes for active and dfu 2023-04-04 21:30:49 +02:00
Rasmus Melchior Jacobsen
6c93309df4 Remove the Flash trait 2023-04-04 21:18:41 +02:00
Rasmus Melchior Jacobsen
25577e0eaf Assert active and dfu have same erase size and copy in smaller chunks
The copy from active to dfu (and vice versa) is now done in smaller portions depending on aligned_buf, which now does not need to be erase_size big.
2023-04-04 21:09:30 +02:00
Rasmus Melchior Jacobsen
9242ad89d4 Remove magic buffer argument from prepare_boot
and use the aligned page buffer instead
2023-04-04 20:25:55 +02:00
bors[bot]
5923e143e3
Merge #1321
1321: executor: add Pender, rework Cargo features. r=Dirbaio a=Dirbaio

This introduces a `Pender` struct with enum cases for thread-mode, interrupt-mode and
custom callback executors. This avoids calls through function pointers when using only
the thread or interrupt executors. Faster, and friendlier to `cargo-call-stack`.

`embassy-executor` now has `arch-xxx` Cargo features to select the arch and to enable
the builtin executors (thread and interrupt).

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-04-04 15:50:12 +00:00
bors[bot]
143105eeb6
Merge #1313
1313: (embassy-stm32): rework bufferedUart to get rid of PeripheralMutex r=Dirbaio a=MathiasKoch

New implementation is very similar to the implementation of embassy-nrf & embassy-rp. 

Also adds embedded-hal traits to bufferedUart.

**NB**: Still needs testing on actual hardware

Co-authored-by: Mathias <mk@blackbird.online>
2023-04-04 15:14:07 +00:00
bors[bot]
3ede5667d4
Merge #1324 #1327
1324: Add MCO support for L4 and F4 families r=Dirbaio a=m-dupont

Add MCO support for L4 and F4 as already done in F7. 

When the 'HSI' source is selected as MCO source, 'HSI' is activated (`set_hsion(true)`) . This is done to operate the MCO in case 'MSI' is chosen as the clock source for the CPU. The same applies to PLL, etc.

1327: Avoid write before erase r=Dirbaio a=rmja

This introduces an additional marker to the state partition right after the magic which indicates whether the current progress is valid or not. Validation in tests that we never write without an erase is added.

There is currently a FIXME in the FirmwareUpdater. Let me know if we should take the erase value as a parameter. I opened a feature request in embedded-storage to get this value in the trait. Before this, the assumption about ERASE_VALUE=0xFF was the same.

I have made some thoughts about whether this is a breaking change between the app and firmware, i.e. whether adding the "Progress valid" field is breaking. My conclusion is that it is not a breaking change. For the case where an app uses this new FirmwareUpdater together with an old bootloader, what it now does, is that it:

1. Writes the progress valid field to all zeros. This field is not known in the old bootloader, so it actually writes a "current progress" index.
2. The entire state partition is erased - effectively removing any trace of 1.
3. Set magic

This should be compatible.


Co-authored-by: Mathieu Dupont <mdupont@cppm.in2p3.fr>
Co-authored-by: Rasmus Melchior Jacobsen <rmja@laesoe.org>
2023-04-04 14:59:10 +00:00
bors[bot]
7140e97202
Merge #1328
1328: Expose read/write/erase on partition r=Dirbaio a=rmja

This is needed now where FirmwareWriter is removed.

Co-authored-by: Rasmus Melchior Jacobsen <rmja@laesoe.org>
2023-04-04 14:47:09 +00:00
Rasmus Melchior Jacobsen
803c09c300 Expose read/write/erase on partition 2023-04-04 12:50:53 +02:00
Rasmus Melchior Jacobsen
5e19fb6fb9 Fix compile error when verification is enabled 2023-04-04 12:36:50 +02:00
Rasmus Melchior Jacobsen
c38eb9660b Merge remote-tracking branch 'upstream/master' into avoid-write-before-erase 2023-04-04 12:29:24 +02:00
Rasmus Melchior Jacobsen
df3a1e1b9d Avoid write to not-erased magic
This introduces an additional marker to the state partition right after the magic which indicates whether the current progress is valid or not. Validation in tests that we never write without an erase is added.

There is currently a FIXME in the FirmwareUpdater. Let me know if we should take the erase value as a parameter. I opened a feature request in embedded-storage to get this value in the trait. Before this, the assumption about ERASE_VALUE=0xFF was the same.
2023-04-04 07:18:29 +02:00
bors[bot]
36ad82a52b
Merge #1322
1322: Remove FirmwareWriter r=Dirbaio a=rmja

FirmwareWriter currently has a "max-write-size" parameter, but this is a limitation that should be handled by chunking inside the NorFlash driver, and not "up here" in user code. In case that the driver (e.g. qspi driver) is unaware of any max-write limitations, one could simply add an intermediate NorFlash adapter providing the chunk'ing capability.

Co-authored-by: Rasmus Melchior Jacobsen <rmja@laesoe.org>
2023-04-04 00:33:23 +00:00
bors[bot]
117fca84ea
Merge #1315 #1325
1315: Add HIL test for timer on nrf r=Dirbaio a=lulf



1325: Update Rust nightly. r=Dirbaio a=Dirbaio

bors r+

Co-authored-by: Ulf Lilleengen <lulf@redhat.com>
Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2023-04-03 22:59:33 +00:00
Dario Nieuwenhuis
ef361d2e88 Update Rust nightly. 2023-04-03 23:15:19 +02:00
Ulf Lilleengen
ae26a08026 Add HIL test for timer on nrf 2023-04-03 22:55:21 +02:00
Mathieu Dupont
1349dabe1a add compilation time exclusion for stm32f410 2023-04-03 17:55:05 +02:00
Mathieu Dupont
932b80ca8a run fmt 2023-04-03 16:52:57 +02:00
Mathieu Dupont
4ce1c5f27d Add MCO support for L4 and F4 families 2023-04-03 16:41:25 +02:00
Rasmus Melchior Jacobsen
7c11d85e1e Move MemFlash to separate module and add verify_erased_before_write verification 2023-04-03 15:33:20 +02:00
Rasmus Melchior Jacobsen
b1e2195b49 Remove FirmwareWriter
FirmwareWriter currently has a "max-write-size" parameter, but this is a limitation that should be handled by chunking inside the NorFlash driver, and not "up here" in user code. In case that the driver (e.g. qspi driver) is unaware of any max-write limitations, one could simply add an intermediate NorFlash adapter providing the chunk'ing capability.
2023-04-03 14:50:41 +02:00
bors[bot]
0909a6cd3f
Merge #1312
1312: Let bootloader partition have read/write/erase operations r=Dirbaio a=rmja

This change should not have any breaking changes.

Co-authored-by: Rasmus Melchior Jacobsen <rmja@laesoe.org>
2023-04-03 11:49:44 +00:00
Rasmus Melchior Jacobsen
bfebf7a436 Fix formatting of sector erase log 2023-04-03 08:02:43 +02:00
Rasmus Melchior Jacobsen
5504fc54fe
Merge branch 'embassy-rs:master' into flash-regions 2023-04-03 07:57:39 +02:00
Dario Nieuwenhuis
d3c4e4a20a executor: add Pender, rework Cargo features.
This introduces a `Pender` struct with enum cases for thread-mode, interrupt-mode and
custom callback executors. This avoids calls through function pointers when using only
the thread or interrupt executors. Faster, and friendlier to `cargo-call-stack`.

`embassy-executor` now has `arch-xxx` Cargo features to select the arch and to enable
the builtin executors (thread and interrupt).
2023-04-03 03:09:11 +02:00
Dario Nieuwenhuis
94890e544e Update stm32-metapac. 2023-04-03 02:01:06 +02:00
Dario Nieuwenhuis
b41ee47115 executor: unify export mod. 2023-04-03 01:11:42 +02:00
bors[bot]
08f911d25e
Merge #1318
1318: rp: Allow zero len reads for buffered uart r=Dirbaio a=timokroeger

Prevents the read methods from getting stuck forever.

cc `@MathiasKoch` can you test if this fixes the problem you described in the chat?

Co-authored-by: Timo Kröger <timokroeger93@gmail.com>
2023-04-02 18:33:36 +00:00
Timo Kröger
7ef6a3cfb2 rp: Allow zero len writes for buffered uart
Prevents the write methods from getting stuck forever.
2023-04-02 14:36:32 +02:00
bors[bot]
cd2ed065dc
Merge #1317
1317: Fix set_baudrate on RP-PICO r=Dirbaio a=TFleury

See [comment](https://github.com/embassy-rs/embassy/pull/1243#issuecomment-1492894626)

Co-authored-by: Thierry Fleury <thierry@codinlab.fr>
2023-04-02 10:03:20 +00:00
Rasmus Melchior Jacobsen
dd88775871 Ensure that flash locking is defered to after write 2023-04-01 18:10:20 +02:00
Rasmus Melchior Jacobsen
e11eebfa57 Ensure that ranges are validated with the region size 2023-04-01 17:26:32 +02:00
Rasmus Melchior Jacobsen
268e29b153 Let the FlashRegion for region types be public 2023-04-01 16:59:21 +02:00
Timo Kröger
f78aa4f936 rp: Allow zero len reads for buffered uart
Prevents the read methods from getting stuck forever.
2023-04-01 14:31:24 +02:00
Thierry Fleury
0e13fe9925 Fix set_baudrate on RP-PICO 2023-04-01 11:44:49 +02:00
Mathias
472dc6b7d1 Fix interrupt handling so it is similar to before the rework, and fix examples 2023-03-31 15:57:35 +02:00
Rasmus Melchior Jacobsen
50b0fb1a37 Let get_flash_regions be public 2023-03-31 15:47:45 +02:00
Mathias
cfbe93c280 Rework bufferedUart to get rid of PeripheralMutex in a similar fashion as nrf & rp. Also adds embedded-hal traits to bufferedUart 2023-03-31 10:43:30 +02:00
Rasmus Melchior Jacobsen
d9d6fd6d70 Add erase and wipe tests 2023-03-31 10:28:47 +02:00
Rasmus Melchior Jacobsen
42931b51f2 Let bootloader partition have read/write/erase operations
This change should not have any breaking changes.
2023-03-31 10:18:19 +02:00
bors[bot]
e3efda2249
Merge #1311
1311: Split bootloader implementation into multiple files r=lulf a=rmja

No other change has been made. I think that I have all the types re-exported in lib.rs as before.

Co-authored-by: Rasmus Melchior Jacobsen <rmja@laesoe.org>
2023-03-31 06:56:26 +00:00
Rasmus Melchior Jacobsen
373760a56b Split bootloader implementation into multiple files 2023-03-31 08:05:37 +02:00