Skip to content

Commit 5aa1612

Browse files
committed
feat(checkpoint): enable serializer checkpoint in SHARE
Expose serializer entries that can write checkpoint files with an explicit base path in SHARE builds. Keep the checkpoint path separate from the flash checkpoint layout: callers that need flash-backed checkpoints can set the serializer flash-checkpoint state through a C wrapper instead of relying on a non-null path.
1 parent 451dc04 commit 5aa1612

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

include/checkpoint/serializer.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ class Serializer
5757

5858
void serializeRegs(uint8_t* serialize_base_addr);
5959

60+
void setStoreCptInFlash(bool enable);
61+
6062
explicit Serializer();
6163
#ifdef CONFIG_LIBCHECKPOINT_RESTORER
6264
void init(bool store_cpt_in_flash, bool enable_libcheckpoint);

src/checkpoint/serializer.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,10 @@ void Serializer::serialize(uint64_t inst_count, const char *checkpoint_base_path
504504
#endif
505505
}
506506

507+
void Serializer::setStoreCptInFlash(bool enable) {
508+
store_cpt_in_flash = enable;
509+
}
510+
507511
#ifdef CONFIG_LIBCHECKPOINT_RESTORER
508512

509513
#define USING_METADATA_OVERRIDE_DEFAULT_MEMLAYOUT(variable_name) \
@@ -662,4 +666,12 @@ void serialize_reg_to_mem() {
662666
serializer.serializeRegs(get_pmem());
663667
}
664668

669+
void set_store_cpt_in_flash(bool enable) {
670+
serializer.setStoreCptInFlash(enable);
671+
}
672+
673+
void serialize_checkpoint(const char *base_filepath) {
674+
serializer.serialize(0, base_filepath);
675+
}
676+
665677
}

0 commit comments

Comments
 (0)