@@ -1771,7 +1771,11 @@ void thread_bootstrap_attached_finish(protocol_interface_info_entry_t *cur)
1771
1771
if (cur -> thread_info -> releaseRouterId ) {
1772
1772
thread_router_bootstrap_router_id_release (cur );
1773
1773
}
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 ));
1775
1779
thread_bootstrap_ready (cur );
1776
1780
1777
1781
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
2221
2225
uint16_t my_short_address ;
2222
2226
uint8_t parent_mac64 [8 ];
2223
2227
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 );
2225
2231
return false;
2226
2232
}
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
+ }
2228
2237
if (thread_is_router_addr (my_short_address )) {
2229
2238
thread_info (cur )-> routerShortAddress = my_short_address ;
2230
2239
thread_dynamic_storage_build_mle_table (cur -> id );
2231
2240
thread_router_bootstrap_link_synch_start (cur );
2232
2241
return true;
2233
2242
}
2234
2243
if (!thread_parent_data_allocate (cur -> thread_info )) {
2244
+ tr_info ("parent alloc failed" );
2235
2245
return false;
2236
2246
}
2237
2247
@@ -2294,16 +2304,6 @@ void thread_bootstrap_state_machine(protocol_interface_info_entry_t *cur)
2294
2304
tr_debug ("Thread SM:Active Scan" );
2295
2305
2296
2306
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
-
2307
2307
linkConfiguration = thread_joiner_application_get_config (cur -> id );
2308
2308
if (!linkConfiguration ) {
2309
2309
thread_bootstrap_start_network_discovery (cur );
@@ -3023,10 +3023,10 @@ void thread_bootstrap_dynamic_configuration_save(protocol_interface_info_entry_t
3023
3023
// in error situation this returns 0 !!!!
3024
3024
uint32_t mle_frame_counter = mle_service_security_get_frame_counter (cur -> id );
3025
3025
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 );
3027
3027
}
3028
3028
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 );
3030
3030
}
3031
3031
}
3032
3032
0 commit comments