@@ -1771,7 +1771,11 @@ void thread_bootstrap_attached_finish(protocol_interface_info_entry_t *cur)
17711771 if (cur -> thread_info -> releaseRouterId ) {
17721772 thread_router_bootstrap_router_id_release (cur );
17731773 }
1774- thread_nvm_store_link_info_file_write (cur );
1774+ uint8_t * parent_mac_addr = NULL ;
1775+ if (cur -> thread_info -> thread_endnode_parent ) {
1776+ parent_mac_addr = cur -> thread_info -> thread_endnode_parent -> mac64 ;
1777+ }
1778+ thread_nvm_store_link_info_write (parent_mac_addr , mac_helper_mac16_address_get (cur ));
17751779 thread_bootstrap_ready (cur );
17761780
17771781 if (thread_is_router_addr (mac_helper_mac16_address_get (cur ))) {
@@ -2221,17 +2225,23 @@ static bool thread_bootstrap_sync_after_reset_start(protocol_interface_info_entr
22212225 uint16_t my_short_address ;
22222226 uint8_t parent_mac64 [8 ];
22232227
2224- if (!thread_nvm_store_link_info_get (parent_mac64 , & my_short_address )) {
2228+ int link_info_err = thread_nvm_store_link_info_get (parent_mac64 , & my_short_address );
2229+ if ( link_info_err != THREAD_NVM_FILE_SUCCESS ) {
2230+ tr_warning ("thread_nvm_store_link_info_get returned %d" , link_info_err );
22252231 return false;
22262232 }
2227- thread_nvm_store_link_info_clear ();
2233+ link_info_err = thread_nvm_store_link_info_clear ();
2234+ if ( link_info_err != THREAD_NVM_FILE_SUCCESS ) {
2235+ tr_warning ("thread_nvm_store_link_info_clear returned %d" , link_info_err );
2236+ }
22282237 if (thread_is_router_addr (my_short_address )) {
22292238 thread_info (cur )-> routerShortAddress = my_short_address ;
22302239 thread_dynamic_storage_build_mle_table (cur -> id );
22312240 thread_router_bootstrap_link_synch_start (cur );
22322241 return true;
22332242 }
22342243 if (!thread_parent_data_allocate (cur -> thread_info )) {
2244+ tr_info ("parent alloc failed" );
22352245 return false;
22362246 }
22372247
@@ -2294,16 +2304,6 @@ void thread_bootstrap_state_machine(protocol_interface_info_entry_t *cur)
22942304 tr_debug ("Thread SM:Active Scan" );
22952305
22962306 thread_joiner_application_nvm_link_configuration_load (cur -> id );
2297-
2298- if (thread_joiner_application_nvm_operation_in_progress (cur -> id )) {
2299- /*
2300- * joiner application has pending NVM operation in progress,
2301- * wait it to complete before continuing startup
2302- */
2303- cur -> bootsrap_state_machine_cnt = 1 ;
2304- return ;
2305- }
2306-
23072307 linkConfiguration = thread_joiner_application_get_config (cur -> id );
23082308 if (!linkConfiguration ) {
23092309 thread_bootstrap_start_network_discovery (cur );
@@ -3023,10 +3023,10 @@ void thread_bootstrap_dynamic_configuration_save(protocol_interface_info_entry_t
30233023 // in error situation this returns 0 !!!!
30243024 uint32_t mle_frame_counter = mle_service_security_get_frame_counter (cur -> id );
30253025 if (linkConfiguration ) {
3026- thread_nvm_store_fast_data_check_and_store (mac_frame_counter , mle_frame_counter , linkConfiguration -> key_sequence );
3026+ thread_nvm_store_fast_data_check_and_write (mac_frame_counter , mle_frame_counter , linkConfiguration -> key_sequence );
30273027 }
30283028 else {
3029- thread_nvm_store_frame_counters_check_and_store (mac_frame_counter , mle_frame_counter );
3029+ thread_nvm_store_frame_counters_check_and_write (mac_frame_counter , mle_frame_counter );
30303030 }
30313031}
30323032
0 commit comments