Skip to content

Commit

Permalink
devtools/td-layout-config: move payload image to physical memory
Browse files Browse the repository at this point in the history
Maximum size of ROM space is 16MiB which limits the size of payload
image that can be contained by image.

Signed-off-by: Jiaqi Gao <[email protected]>
  • Loading branch information
gaojiaqi7 committed Mar 31, 2024
1 parent ba13296 commit 733c133
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
5 changes: 5 additions & 0 deletions devtools/td-layout-config/config_memory_exec.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
"size": "0x20000",
"type": "Memory"
},
{
"name": "ShimPayload",
"size": "0xC2D000",
"type": "Memory"
},
{
"name": "EventLog",
"size": "0x100000",
Expand Down
8 changes: 3 additions & 5 deletions devtools/td-layout-config/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use serde::Deserialize;

use super::{layout::LayoutConfig, render};

const FIRMWARE_ROM_BASE: usize = 0xFF00_0000;
const FIRMWARE_ROM_TOP: usize = 0xFFFF_FFFF;
const FIRMWARE_ROM_SIZE: usize = 0x100_0000;

#[derive(Deserialize, Debug, PartialEq)]
Expand Down Expand Up @@ -75,16 +75,14 @@ pub fn parse_image(data: String) -> String {

// Build ROM layout at memory space: 0xFF00_0000 - 0xFFFF_FFFF
// Payload image is not loaded into ROM space.
let rom_size = image_size - payload_size;
let mut rom_layout =
LayoutConfig::new(FIRMWARE_ROM_BASE, FIRMWARE_ROM_BASE + FIRMWARE_ROM_SIZE);
LayoutConfig::new(FIRMWARE_ROM_TOP - rom_size, FIRMWARE_ROM_TOP);

if image_size > FIRMWARE_ROM_SIZE {
panic!("Image size exceeds the maximum ROM space");
}

if payload_size != 0 {
image_layout.reserve_low("Payload", payload_size, "Rom")
}
rom_layout.reserve_low("Config", config_size, "Rom");
rom_layout.reserve_low("Mailbox", mailbox_size, "Rom");
rom_layout.reserve_low("TempStack", temp_stack_size, "Rom");
Expand Down

0 comments on commit 733c133

Please sign in to comment.