Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions application_processor/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
all:
export RUSTFLAGS='--cfg debug=true'
echo "${POST_BOOT_CODE}"
cargo make -e BUILD_TYPE=release -e CARGO_TARGET_DIR=${CURDIR}/target ap --verbose

Expand Down
10 changes: 6 additions & 4 deletions application_processor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,13 @@ fn main() -> ! {

#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
led_on(Led::Red);
led_off(Led::Green);
led_off(Led::Blue);
if cfg!(debug) {
led_on(Led::Red);
led_off(Led::Green);
led_off(Led::Blue);

uprintln_error!("Panic: {info}");
uprintln_error!("Panic: {info}");
}

loop {}
}
Expand Down
1 change: 1 addition & 0 deletions component/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
all:
export RUSTFLAGS='--cfg debug=true'
echo "${POST_BOOT_CODE}"
cargo make -e BUILD_TYPE=release -e CARGO_TARGET_DIR=${CURDIR}/target component --verbose

Expand Down
12 changes: 3 additions & 9 deletions component/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,21 @@ fn main() {

let max_spacing = 0x1000;


let stack_start = ram_origin + (ram_length/4) + gen_addr(0, max_spacing, &mut rng);

let sentry = gen_addr(0, max_spacing, &mut rng);

let textoffset = gen_addr(0, max_spacing, &mut rng);
let rodataoffset = gen_addr(0, max_spacing, &mut rng);
let dataoffset = gen_addr(0, max_spacing, &mut rng);
let bssoffset = gen_addr(0, max_spacing, &mut rng);


let memory_x = format!("
MEMORY {{
/* ROM (rx) : ORIGIN = 0x00000000, LENGTH = 0x00010000 */
FLASH (rx) : ORIGIN = {flash_origin:#x}, LENGTH = {flash_length:#x} /* 448KB Flash */
RAM (rwx) : ORIGIN = {ram_origin:#x}, LENGTH = {ram_length:#x} /* 128kB SRAM */
}}

/* Bootloader jumps to this address to start the ap */
_sentry = {sentry:#x};

Expand All @@ -181,17 +178,14 @@ fn main() {
bssoffset = {bssoffset:#x};
textoffset = {textoffset:#x};
");



File::create(out.join("memory.x"))
.unwrap()
.write_all(memory_x.as_bytes())
.unwrap();

println!("cargo:rustc-link-search={}", out.display());

println!("cargo:rustc-link-search={}", out.display());
println!("cargo:rerun-if-changed=memory.x");

println!("cargo:rustc-link-arg=--nmagic");

// Set the linker script to the one provided by cortex-m-rt.
Expand Down
10 changes: 6 additions & 4 deletions component/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,13 @@ fn main() -> ! {

#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
led_on(Led::Red);
led_off(Led::Blue);
led_off(Led::Green);
if cfg!(debug) {
led_on(Led::Red);
led_off(Led::Blue);
led_off(Led::Green);

uprintln_error!("{info}");
uprintln_error!("{info}");
}

loop {}
}
Expand Down
12 changes: 6 additions & 6 deletions deployment/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl SecretDb {
);

match result {
Err(rusqlite::Error::SqliteFailure(error, _))
Err(Error::SqliteFailure(error, _))
if error.code == ErrorCode::ConstraintViolation => {
// this means the build id was generated was not unique, so try again
continue;
Expand Down Expand Up @@ -204,7 +204,7 @@ impl SecretDb {
WHERE component_build_ids.component_id = ?1",
)?;

let componeny_keypair = statement.query_map([component_id], |row| {
let component_keypair = statement.query_map([component_id], |row| {
Ok(ComponentKeyPair {
build_id: row.get(0)?,
keypair: KeyPair {
Expand All @@ -214,12 +214,12 @@ impl SecretDb {
})
})?.next();

// this components keypair is already defined
if let Some(keypair) = componeny_keypair {
// this component's keypair is already defined
if let Some(keypair) = component_keypair {
return Ok(keypair?);
}

// this components keypair is not defined, make it defined
// this component's keypair is not defined, make it defined
let mut statement = self.db.prepare(
"UPDATE component_keypairs
SET in_use = TRUE
Expand Down Expand Up @@ -262,4 +262,4 @@ pub fn parse_component_id(n: &str) -> u32 {
n.parse::<u32>()
.expect("could not parse component id")
}
}
}