@@ -67,17 +67,16 @@ struct slot_usage_t {
67
67
/* Index of the slot chosen to be loaded */
68
68
uint32_t active_slot ;
69
69
bool slot_available [BOOT_NUM_SLOTS ];
70
- #ifdef MCUBOOT_RAM_LOAD
70
+ #if defined( MCUBOOT_RAM_LOAD )
71
71
/* Image destination and size for the active slot */
72
72
uint32_t img_dst ;
73
73
uint32_t img_sz ;
74
- #endif /* MCUBOOT_RAM_LOAD */
75
- #ifdef MCUBOOT_DIRECT_XIP_REVERT
74
+ #elif defined(MCUBOOT_DIRECT_XIP_REVERT )
76
75
/* Swap status for the active slot */
77
76
struct boot_swap_state swap_state ;
78
- #endif /* MCUBOOT_DIRECT_XIP_REVERT */
79
- };
80
77
#endif
78
+ };
79
+ #endif /* MCUBOOT_DIRECT_XIP || MCUBOOT_RAM_LOAD */
81
80
82
81
/*
83
82
* This macro allows some control on the allocation of local variables.
@@ -2247,7 +2246,7 @@ print_loaded_images(struct boot_loader_state *state,
2247
2246
}
2248
2247
#endif
2249
2248
2250
- #ifdef MCUBOOT_DIRECT_XIP_REVERT
2249
+ #if defined( MCUBOOT_DIRECT_XIP ) && defined( MCUBOOT_DIRECT_XIP_REVERT )
2251
2250
/**
2252
2251
* Checks whether the active slot of the current image was previously selected
2253
2252
* to run. Erases the image if it was selected but its execution failed,
@@ -2320,7 +2319,7 @@ boot_select_or_erase(struct boot_loader_state *state,
2320
2319
2321
2320
return rc ;
2322
2321
}
2323
- #endif /* MCUBOOT_DIRECT_XIP_REVERT */
2322
+ #endif /* MCUBOOT_DIRECT_XIP && MCUBOOT_DIRECT_XIP_REVERT */
2324
2323
2325
2324
#ifdef MCUBOOT_RAM_LOAD
2326
2325
@@ -2812,7 +2811,6 @@ boot_load_and_validate_images(struct boot_loader_state *state,
2812
2811
slot_usage [BOOT_CURR_IMG (state )].active_slot = NO_ACTIVE_SLOT ;
2813
2812
continue ;
2814
2813
}
2815
- #endif /* MCUBOOT_DIRECT_XIP */
2816
2814
2817
2815
#ifdef MCUBOOT_DIRECT_XIP_REVERT
2818
2816
rc = boot_select_or_erase (state , slot_usage );
@@ -2823,6 +2821,7 @@ boot_load_and_validate_images(struct boot_loader_state *state,
2823
2821
continue ;
2824
2822
}
2825
2823
#endif /* MCUBOOT_DIRECT_XIP_REVERT */
2824
+ #endif /* MCUBOOT_DIRECT_XIP */
2826
2825
2827
2826
#ifdef MCUBOOT_RAM_LOAD
2828
2827
/* Image is first loaded to RAM and authenticated there in order to
@@ -2877,7 +2876,7 @@ boot_update_hw_rollback_protection(struct boot_loader_state *state,
2877
2876
/* Update the stored security counter with the newer (active) image's
2878
2877
* security counter value.
2879
2878
*/
2880
- #ifdef MCUBOOT_DIRECT_XIP_REVERT
2879
+ #if defined( MCUBOOT_DIRECT_XIP ) && defined( MCUBOOT_DIRECT_XIP_REVERT )
2881
2880
/* When the 'revert' mechanism is enabled in direct-xip mode, the
2882
2881
* security counter can be increased only after reboot, if the image
2883
2882
* has been confirmed at runtime (the image_ok flag has been set).
@@ -2892,7 +2891,7 @@ boot_update_hw_rollback_protection(struct boot_loader_state *state,
2892
2891
"validation." );
2893
2892
return rc ;
2894
2893
}
2895
- #ifdef MCUBOOT_DIRECT_XIP_REVERT
2894
+ #if defined( MCUBOOT_DIRECT_XIP ) && defined( MCUBOOT_DIRECT_XIP_REVERT )
2896
2895
}
2897
2896
#endif
2898
2897
0 commit comments