File tree Expand file tree Collapse file tree 3 files changed +61
-11
lines changed Expand file tree Collapse file tree 3 files changed +61
-11
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,14 @@ const DROM_MAP_END: u32 = 0x3F800000;
24
24
25
25
const BOOT_ADDR : u32 = 0x1000 ;
26
26
const PARTION_ADDR : u32 = 0x8000 ;
27
+ const NVS_ADDR : u32 = 0x9000 ;
28
+ const PHY_INIT_DATA_ADDR : u32 = 0xf000 ;
27
29
const APP_ADDR : u32 = 0x10000 ;
28
30
31
+ const NVS_SIZE : u32 = 0x6000 ;
32
+ const PHY_INIT_DATA_SIZE : u32 = 0x1000 ;
33
+ const APP_SIZE : u32 = 0x3f0000 ;
34
+
29
35
impl ChipType for Esp32 {
30
36
const CHIP_DETECT_MAGIC_VALUE : u32 = 0x00f01d83 ;
31
37
@@ -49,7 +55,14 @@ impl ChipType for Esp32 {
49
55
) -> Box < dyn Iterator < Item = Result < RomSegment < ' a > , Error > > + ' a > {
50
56
let bootloader = include_bytes ! ( "../../bootloader/esp32-bootloader.bin" ) ;
51
57
52
- let partition_table = PartitionTable :: basic ( 0x10000 , 0x3f0000 ) . to_bytes ( ) ;
58
+ let partition_table = PartitionTable :: basic (
59
+ NVS_ADDR ,
60
+ NVS_SIZE ,
61
+ PHY_INIT_DATA_ADDR ,
62
+ PHY_INIT_DATA_SIZE ,
63
+ APP_ADDR ,
64
+ APP_SIZE ,
65
+ ) ;
53
66
54
67
fn get_data < ' a > ( image : & ' a FirmwareImage ) -> Result < RomSegment < ' a > , Error > {
55
68
let mut data = Vec :: new ( ) ;
Original file line number Diff line number Diff line change @@ -24,8 +24,14 @@ const DROM_MAP_END: u32 = 0x3c800000;
24
24
25
25
const BOOT_ADDR : u32 = 0x0 ;
26
26
const PARTITION_ADDR : u32 = 0x8000 ;
27
+ const NVS_ADDR : u32 = 0x9000 ;
28
+ const PHY_INIT_DATA_ADDR : u32 = 0xf000 ;
27
29
const APP_ADDR : u32 = 0x10000 ;
28
30
31
+ const NVS_SIZE : u32 = 0x6000 ;
32
+ const PHY_INIT_DATA_SIZE : u32 = 0x1000 ;
33
+ const APP_SIZE : u32 = 0x3f0000 ;
34
+
29
35
impl ChipType for Esp32c3 {
30
36
const CHIP_DETECT_MAGIC_VALUE : u32 = 0x6921506f ;
31
37
const CHIP_DETECT_MAGIC_VALUE2 : u32 = 0x1b31506f ;
@@ -50,7 +56,15 @@ impl ChipType for Esp32c3 {
50
56
) -> Box < dyn Iterator < Item = Result < RomSegment < ' a > , Error > > + ' a > {
51
57
let bootloader = include_bytes ! ( "../../bootloader/esp32c3-bootloader.bin" ) ;
52
58
53
- let partition_table = PartitionTable :: basic ( 0x10000 , 0x3f0000 ) . to_bytes ( ) ;
59
+ let partition_table = PartitionTable :: basic (
60
+ NVS_ADDR ,
61
+ NVS_SIZE ,
62
+ PHY_INIT_DATA_ADDR ,
63
+ PHY_INIT_DATA_SIZE ,
64
+ APP_ADDR ,
65
+ APP_SIZE ,
66
+ )
67
+ . to_bytes ( ) ;
54
68
55
69
fn get_data < ' a > ( image : & ' a FirmwareImage ) -> Result < RomSegment < ' a > , Error > {
56
70
let mut data = Vec :: new ( ) ;
Original file line number Diff line number Diff line change @@ -72,16 +72,39 @@ pub struct PartitionTable {
72
72
}
73
73
74
74
impl PartitionTable {
75
- /// Create a basic partition table with a single app entry
76
- pub fn basic ( app_offset : u32 , app_size : u32 ) -> Self {
75
+ /// Create a basic partition table with NVS, PHY init data, and the app partition
76
+ pub fn basic (
77
+ nvs_offset : u32 ,
78
+ nvs_size : u32 ,
79
+ phy_init_data_offset : u32 ,
80
+ phy_init_data_size : u32 ,
81
+ app_offset : u32 ,
82
+ app_size : u32 ,
83
+ ) -> Self {
77
84
PartitionTable {
78
- partitions : vec ! [ Partition :: new(
79
- String :: from( "factory" ) ,
80
- SubType :: App ( AppType :: Factory ) ,
81
- app_offset,
82
- app_size,
83
- 0 ,
84
- ) ] ,
85
+ partitions : vec ! [
86
+ Partition :: new(
87
+ String :: from( "nvs" ) ,
88
+ SubType :: Data ( DataType :: Nvs ) ,
89
+ nvs_offset,
90
+ nvs_size,
91
+ 0 ,
92
+ ) ,
93
+ Partition :: new(
94
+ String :: from( "phy_init" ) ,
95
+ SubType :: Data ( DataType :: Phy ) ,
96
+ phy_init_data_offset,
97
+ phy_init_data_size,
98
+ 0 ,
99
+ ) ,
100
+ Partition :: new(
101
+ String :: from( "factory" ) ,
102
+ SubType :: App ( AppType :: Factory ) ,
103
+ app_offset,
104
+ app_size,
105
+ 0 ,
106
+ ) ,
107
+ ] ,
85
108
}
86
109
}
87
110
You can’t perform that action at this time.
0 commit comments