File tree Expand file tree Collapse file tree 8 files changed +553
-5
lines changed Expand file tree Collapse file tree 8 files changed +553
-5
lines changed Original file line number Diff line number Diff line change @@ -182,4 +182,4 @@ jobs:
182182 - run : cd esp-config && cargo test --features build
183183
184184 # Run tests in esp-bootloader-esp-idf
185- - run : cd esp-bootloader-esp-idf && cargo test
185+ - run : cd esp-bootloader-esp-idf && cargo test --features=std
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
1414- Support reading partition tables and conveniently read/write partition content (#3316 )
1515
16+ - OTA-DATA partition support (#3354 )
17+
1618### Changed
1719
1820### Fixed
Original file line number Diff line number Diff line change @@ -19,9 +19,11 @@ document-features = "0.2.11"
1919esp-config = { version = " 0.3.0" , path = " ../esp-config" }
2020embedded-storage = " 0.3.1"
2121log = { version = " 0.4.26" , optional = true }
22- md-5 = { version = " 0.10.6" , default-features = false , optional = true }
2322strum = { version = " 0.27.1" , default-features = false , features = [" derive" ] }
2423
24+ crc = { version = " 3.0.0" , optional = true }
25+ md-5 = { version = " 0.10.6" , default-features = false , optional = true }
26+
2527[build-dependencies ]
2628chrono = { version = " 0.4.20" , default-features = false , features = [" clock" ] }
2729esp-config = { version = " 0.3.0" , path = " ../esp-config" , features = [" build" ] }
@@ -37,3 +39,6 @@ log = ["dep:log"]
3739
3840# # Enable support for `defmt`
3941defmt = [" dep:defmt" ]
42+
43+ # Replace ROM functions with pure Rust implementations, needed for tests.
44+ std = [" dep:crc" ]
Original file line number Diff line number Diff line change 2626// MUST be the first module
2727mod fmt;
2828
29+ #[ cfg( not( feature = "std" ) ) ]
30+ mod rom;
31+ #[ cfg( not( feature = "std" ) ) ]
32+ pub ( crate ) use rom as crypto;
33+
34+ #[ cfg( feature = "std" ) ]
35+ mod non_rom;
36+ #[ cfg( feature = "std" ) ]
37+ pub ( crate ) use non_rom as crypto;
38+
2939pub mod partitions;
3040
41+ pub mod ota;
42+
43+ // We run tests on the host which happens to be MacOS machines and mach-o
44+ // doesn't like `link-sections` this way
45+ #[ cfg( not( target_os = "macos" ) ) ]
46+ #[ link_section = ".espressif.metadata" ]
47+ #[ used]
48+ #[ export_name = "bootloader.NAME" ]
49+ static OTA_FEATURE : [ u8 ; 7 ] = * b"ESP-IDF" ;
50+
3151/// ESP-IDF compatible application descriptor
3252///
3353/// This gets populated by the [esp_app_desc] macro.
Original file line number Diff line number Diff line change 1+ use crc:: { Algorithm , Crc } ;
2+
3+ static ALGO_CRC32_NORMAL : Algorithm < u32 > = Algorithm {
4+ width : 32 ,
5+ poly : 0x04c11db7 ,
6+ init : 0 ,
7+ refin : true ,
8+ refout : true ,
9+ xorout : 0xffffffff ,
10+ check : 0 ,
11+ residue : 0 ,
12+ } ;
13+
14+ pub struct Crc32 {
15+ algo : Crc < u32 > ,
16+ }
17+
18+ impl Crc32 {
19+ pub fn new ( ) -> Self {
20+ Self {
21+ algo : Crc :: < u32 > :: new ( & ALGO_CRC32_NORMAL ) ,
22+ }
23+ }
24+
25+ pub fn crc ( & self , data : & [ u8 ] ) -> u32 {
26+ let mut digest = self . algo . digest ( ) ;
27+ digest. update ( & data) ;
28+ digest. finalize ( )
29+ }
30+ }
You can’t perform that action at this time.
0 commit comments