Skip to content

Commit

Permalink
change addresses used by nonvolatile component
Browse files Browse the repository at this point in the history
Used sstorage and estorage for the kernel address and length,
as suggested. Changed the userspace address and length to
0x08038000 and 0x2000 in src/main.rs and chip_layout.ld to
avoid overwriting the code segment
  • Loading branch information
krady21 committed Aug 26, 2020
1 parent a996d10 commit 0d018ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
5 changes: 3 additions & 2 deletions boards/stm32f3discovery/chip_layout.ld
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
/* Memory layout for the STM32F303VCT6
* rom = 256KB (LENGTH = 0x00040000)
* kernel = 128KB
* user = 128KB
* user = 96KB
* user storage space = 32KB (defined in src/main.rs)
* ram = 48KB */

MEMORY
{
rom (rx) : ORIGIN = 0x08000000, LENGTH = 0x00020000
prog (rx) : ORIGIN = 0x08020000, LENGTH = 0x00020000
prog (rx) : ORIGIN = 0x08020000, LENGTH = 0x00018000
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 48K
}

Expand Down
16 changes: 12 additions & 4 deletions boards/stm32f3discovery/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -608,14 +608,22 @@ pub unsafe fn reset_handler() {
)
);
stm32f303xc::adc::ADC1.set_client(adc);

// Kernel storage region, allocated with the storage_volume!
// macro in common/utils.rs
extern "C" {
/// Beginning on the ROM region containing app images.
static _sstorage: u8;
static _estorage: u8;
}

let nonvolatile_storage = components::nonvolatile_storage::NonvolatileStorageComponent::new(
board_kernel,
&stm32f303xc::flash::FLASH,
0x08020000,
0x20000,
0x08000000,
0x20000,
0x08038000,
0x2000,
&_sstorage as *const u8 as usize,
&_estorage as *const u8 as usize - &_sstorage as *const u8 as usize,
)
.finalize(components::nv_storage_component_helper!(
stm32f303xc::flash::Flash
Expand Down

0 comments on commit 0d018ba

Please sign in to comment.