@@ -7,7 +7,7 @@ use byteorder::{ByteOrder, LittleEndian};
77use crate :: errors:: { AttributeParseError , TockError , TockloaderError } ;
88use crate :: IO ;
99
10- use super :: decode:: { bytes_to_string , decode_attribute} ;
10+ use super :: decode:: decode_attribute;
1111
1212/// This structure contains all relevant information about board that is stored
1313/// in the bootloader ROM.
@@ -64,8 +64,8 @@ impl SystemAttributes {
6464 }
6565 }
6666 /// Read system and kernel attributes.
67- ///``
68- ///
67+ /// System attributes are read only if the board has
68+ /// a bootloader present.
6969 /// # Parameters
7070 /// - `conn` : Either a SerialConnection or a ProbeRSConnection.
7171 /// - `flash_address` : The start of flash memory.
@@ -95,6 +95,7 @@ impl SystemAttributes {
9595 . unwrap_or ( false ) ;
9696
9797 if !has_bootloader {
98+ // TODO: Chain: CLI arguments -> hardcoded start_address -> calculate from kernel app start address
9899 result. appaddr = Some ( start_address) ;
99100 } else {
100101 for current_slot in 0 ..data. len ( ) {
@@ -171,7 +172,9 @@ impl SystemAttributes {
171172 - 100 ;
172173 let kernel_attr_binary = conn. read ( kernel_attr_addr, 100 ) . await ?;
173174
174- let sentinel = bytes_to_string ( & kernel_attr_binary[ 96 ..100 ] ) ;
175+ let sentinel = std:: str:: from_utf8 ( & kernel_attr_binary[ 96 ..100 ] )
176+ . unwrap_or ( "unknown" )
177+ . to_string ( ) ;
175178 let kernel_version = LittleEndian :: read_uint ( & kernel_attr_binary[ 95 ..96 ] , 1 ) ;
176179
177180 let app_memory_len = LittleEndian :: read_u32 ( & kernel_attr_binary[ 84 ..92 ] ) ;
0 commit comments