eculocate

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 115f3a49fba41524d76e07ef6afc55c1e2a1bb18
parent 5fcf9acbe6ab4b3cc7f12f96a3b1bc431af1a4f2
Author: filipton <filipton12@gmail.com>
Date:   Fri,  5 Jul 2024 11:40:15 +0200

fix: seq to part index

Diffstat:
Mexamples/partitions.csv | 2++
Msimple-ota-server/firmware.bin | 0
Msrc/helpers.rs | 2+-
Msrc/lib.rs | 3++-
4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/examples/partitions.csv b/examples/partitions.csv @@ -4,3 +4,5 @@ otadata, data, ota, 0xd000, 0x2000, phy_init, data, phy, 0xf000, 0x1000, ota_0, app, ota_0, 0x10000, 0x100000, ota_1, app, ota_1, 0x110000, 0x100000, +ota_2, app, ota_2, 0x210000, 0x100000, +#ota_3, app, ota_3, 0x310000, 0x10000, diff --git a/simple-ota-server/firmware.bin b/simple-ota-server/firmware.bin Binary files differ. diff --git a/src/helpers.rs b/src/helpers.rs @@ -4,7 +4,7 @@ use crate::{crc32, PARTITIONS_COUNT}; /// Helper funcion! /// Change seq to partition number pub const fn seq_to_part(seq: u32) -> usize { - (PARTITIONS_COUNT - 1) - (seq as usize % PARTITIONS_COUNT) + (seq as usize - 1) % PARTITIONS_COUNT } #[inline(always)] diff --git a/src/lib.rs b/src/lib.rs @@ -8,10 +8,11 @@ pub mod paddr; // TODO: make macros for generating this from partitions.csv, delete them from lib // Maybe just add it as args to Ota object? -pub const PARTITIONS_COUNT: usize = 2; +pub const PARTITIONS_COUNT: usize = 3; pub const PARTITIONS: [core::ops::Range<u32>; PARTITIONS_COUNT] = [ (0x10000..0x10000 + 0x100000), (0x110000..0x110000 + 0x100000), + (0x210000..0x210000 + 0x100000), ]; pub const OTADATA_OFFSET: u32 = 0xd000;