--- /dev/null
+#include<stdio.h>
+#include<stdlib.h>
+#include<string.h>
+#include"ses_core.h"
+
+int main(int argc, char* argv[])
+{
+ ScfEcomponent* B;
+ ScfEcomponent* D0;
+ ScfEcomponent* D1;
+ ScfEcomponent* D2;
+ ScfEcomponent* R0;
+ ScfEcomponent* R1;
+ ScfEfunction* f;
+ ScfEboard* b;
+
+ b = scf_eboard__alloc();
+ f = scf_efunction__alloc("test");
+
+ EDA_INST_ADD_COMPONENT(f, B, SCF_EDA_Battery);
+
+ B->pins[SCF_EDA_Battery_NEG]->flags = SCF_EDA_PIN_NEG;
+ B->pins[SCF_EDA_Battery_POS]->flags = SCF_EDA_PIN_POS;
+
+ EDA_INST_ADD_COMPONENT(f, D0, SCF_EDA_Diode);
+ EDA_INST_ADD_COMPONENT(f, D1, SCF_EDA_Diode);
+ EDA_INST_ADD_COMPONENT(f, D2, SCF_EDA_Diode);
+
+ EDA_INST_ADD_COMPONENT(f, R0, SCF_EDA_Resistor);
+ EDA_INST_ADD_COMPONENT(f, R1, SCF_EDA_Resistor);
+
+ EDA_PIN_ADD_PIN(D0, SCF_EDA_Diode_POS, B, SCF_EDA_Battery_POS);
+ EDA_PIN_ADD_PIN(D0, SCF_EDA_Diode_NEG, D1, SCF_EDA_Battery_POS);
+ EDA_PIN_ADD_PIN(D1, SCF_EDA_Diode_NEG, R1, 1);
+ EDA_PIN_ADD_PIN(R1, 0, B, SCF_EDA_Battery_NEG);
+
+ EDA_PIN_ADD_PIN(R0, 1, B, SCF_EDA_Battery_POS);
+ EDA_PIN_ADD_PIN(R0, 0, D2, SCF_EDA_Diode_POS);
+ EDA_PIN_ADD_PIN(D2, SCF_EDA_Diode_NEG, D1, SCF_EDA_Diode_NEG);
+
+ scf_eboard__add_function(b, f);
+
+ size_t len = scf_eboard__get_packed_size(b);
+
+ scf_loge("len: %ld\n", len);
+
+ uint8_t* buf = malloc(len);
+ if (!buf) {
+ scf_eboard__free(b);
+ return -ENOMEM;
+ }
+
+ scf_eboard__pack(b, buf);
+ scf_eboard__free(b);
+ b = NULL;
+
+ FILE* fp = fopen("./test.pb", "wb");
+ if (!fp)
+ return -EINVAL;
+
+ fwrite(buf, len, 1, fp);
+ fclose(fp);
+
+ return 0;
+}