forked from espressif/esp-matter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-include-files.cmake
696 lines (616 loc) · 27.1 KB
/
generate-include-files.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
# Generating FirmwareBuildTime.h
execute_process(
COMMAND date "+%s"
OUTPUT_VARIABLE BUILD_SECONDS
OUTPUT_STRIP_TRAILING_WHITESPACE
)
math(EXPR BUILD_SECONDS "${BUILD_SECONDS} - (946684800)")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/FirmwareBuildTime.h
"#pragma once\n
#define CHIP_DEVICE_CONFIG_FIRMWARE_BUILD_TIME_MATTER_EPOCH_S ${BUILD_SECONDS}
")
# Generating app/AppBuildConfig.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/app/AppBuildConfig.h
"#pragma once\n
#include <sdkconfig.h>\n
#ifdef CONFIG_CHIP_CONFIG_IM_PRETTY_PRINT
#define CHIP_CONFIG_IM_PRETTY_PRINT 1
#else
#define CHIP_CONFIG_IM_PRETTY_PRINT 0
#endif
#define CHIP_CONFIG_IM_FORCE_FABRIC_QUOTA_CHECK 0
#define CHIP_CONFIG_ENABLE_SESSION_RESUMPTION 1
#define CHIP_CONFIG_ACCESS_CONTROL_POLICY_LOGGING_VERBOSITY 0
#ifdef CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM
#define CHIP_CONFIG_PERSIST_SUBSCRIPTIONS 0
#define CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION 0
#else
#define CHIP_CONFIG_PERSIST_SUBSCRIPTIONS 1
#define CHIP_CONFIG_SUBSCRIPTION_TIMEOUT_RESUMPTION 1
#endif
#ifdef CONFIG_ENABLE_MATTER_EVENT_LIST
#define CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE 1
#else
#define CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE 0
#endif
#ifdef CONFIG_DISABLE_READ_CLIENT
#define CHIP_CONFIG_ENABLE_READ_CLIENT 0
#else
#define CHIP_CONFIG_ENABLE_READ_CLIENT 1
#endif
")
# Generating app/icd/server/ICDServerBuildConfig.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/app/icd/server/ICDServerBuildConfig.h
"#pragma once\n
#ifdef CONFIG_ENABLE_ICD_SERVER
#define CHIP_CONFIG_ENABLE_ICD_SERVER 1
#else
#define CHIP_CONFIG_ENABLE_ICD_SERVER 0
#endif
#define CHIP_CONFIG_ENABLE_ICD_LIT 0
#define CHIP_CONFIG_ENABLE_ICD_CIP 0
#define CHIP_CONFIG_ENABLE_ICD_UAT 0
#define ICD_REPORT_ON_ENTER_ACTIVE_MODE 0
#define ICD_MAX_NOTIFICATION_SUBSCRIBERS 1
#define ICD_ENFORCE_SIT_SLOW_POLL_LIMIT 0
")
# Generating asn1/ASN1OID.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/asn1/ASN1OID.h
"#pragma once\n
#include <cstdint>
#include <cstddef>
#include <sdkconfig.h>\n
namespace chip {
namespace ASN1 {
enum OIDCategory
{
kOIDCategory_PubKeyAlgo = 0x0100,
kOIDCategory_SigAlgo = 0x0200,
kOIDCategory_AttributeType = 0x0300,
kOIDCategory_EllipticCurve = 0x0400,
kOIDCategory_Extension = 0x0500,
kOIDCategory_KeyPurpose = 0x0600,
kOIDCategory_NotSpecified = 0,
kOIDCategory_Unknown = 0x0F00,
kOIDCategory_Mask = 0x0F00
};
typedef uint16_t OID;
enum
{
kOID_PubKeyAlgo_ECPublicKey = 0x0101,
kOID_SigAlgo_ECDSAWithSHA256 = 0x0201,
kOID_AttributeType_CommonName = 0x0301,
kOID_AttributeType_Surname = 0x0302,
kOID_AttributeType_SerialNumber = 0x0303,
kOID_AttributeType_CountryName = 0x0304,
kOID_AttributeType_LocalityName = 0x0305,
kOID_AttributeType_StateOrProvinceName = 0x0306,
kOID_AttributeType_OrganizationName = 0x0307,
kOID_AttributeType_OrganizationalUnitName = 0x0308,
kOID_AttributeType_Title = 0x0309,
kOID_AttributeType_Name = 0x030A,
kOID_AttributeType_GivenName = 0x030B,
kOID_AttributeType_Initials = 0x030C,
kOID_AttributeType_GenerationQualifier = 0x030D,
kOID_AttributeType_DNQualifier = 0x030E,
kOID_AttributeType_Pseudonym = 0x030F,
kOID_AttributeType_DomainComponent = 0x0310,
kOID_AttributeType_MatterNodeId = 0x0311,
kOID_AttributeType_MatterFirmwareSigningId = 0x0312,
kOID_AttributeType_MatterICACId = 0x0313,
kOID_AttributeType_MatterRCACId = 0x0314,
kOID_AttributeType_MatterFabricId = 0x0315,
kOID_AttributeType_MatterCASEAuthTag = 0x0316,
kOID_EllipticCurve_prime256v1 = 0x0401,
kOID_Extension_BasicConstraints = 0x0501,
kOID_Extension_KeyUsage = 0x0502,
kOID_Extension_ExtendedKeyUsage = 0x0503,
kOID_Extension_SubjectKeyIdentifier = 0x0504,
kOID_Extension_AuthorityKeyIdentifier = 0x0505,
kOID_Extension_CSRRequest = 0x0506,
kOID_KeyPurpose_ServerAuth = 0x0601,
kOID_KeyPurpose_ClientAuth = 0x0602,
kOID_KeyPurpose_CodeSigning = 0x0603,
kOID_KeyPurpose_EmailProtection = 0x0604,
kOID_KeyPurpose_TimeStamping = 0x0605,
kOID_KeyPurpose_OCSPSigning = 0x0606,
kOID_NotSpecified = 0,
kOID_Unknown = 0xFFFF,
kOID_EnumMask = 0x00FF
};
struct OIDTableEntry
{
OID EnumVal;
const uint8_t *EncodedOID;
uint16_t EncodedOIDLen;
};
struct OIDNameTableEntry
{
OID EnumVal;
const char *Name;
};
extern const OIDTableEntry sOIDTable[];
extern const OIDNameTableEntry sOIDNameTable[];
extern const size_t sOIDTableSize;
#ifdef ASN1_DEFINE_OID_TABLE
static const uint8_t sOID_PubKeyAlgo_ECPublicKey[] = { 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x02, 0x01 };
static const uint8_t sOID_SigAlgo_ECDSAWithSHA256[] = { 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x04, 0x03, 0x02 };
static const uint8_t sOID_AttributeType_CommonName[] = { 0x55, 0x04, 0x03 };
static const uint8_t sOID_AttributeType_Surname[] = { 0x55, 0x04, 0x04 };
static const uint8_t sOID_AttributeType_SerialNumber[] = { 0x55, 0x04, 0x05 };
static const uint8_t sOID_AttributeType_CountryName[] = { 0x55, 0x04, 0x06 };
static const uint8_t sOID_AttributeType_LocalityName[] = { 0x55, 0x04, 0x07 };
static const uint8_t sOID_AttributeType_StateOrProvinceName[] = { 0x55, 0x04, 0x08 };
static const uint8_t sOID_AttributeType_OrganizationName[] = { 0x55, 0x04, 0x0A };
static const uint8_t sOID_AttributeType_OrganizationalUnitName[] = { 0x55, 0x04, 0x0B };
static const uint8_t sOID_AttributeType_Title[] = { 0x55, 0x04, 0x0C };
static const uint8_t sOID_AttributeType_Name[] = { 0x55, 0x04, 0x29 };
static const uint8_t sOID_AttributeType_GivenName[] = { 0x55, 0x04, 0x2A };
static const uint8_t sOID_AttributeType_Initials[] = { 0x55, 0x04, 0x2B };
static const uint8_t sOID_AttributeType_GenerationQualifier[] = { 0x55, 0x04, 0x2C };
static const uint8_t sOID_AttributeType_DNQualifier[] = { 0x55, 0x04, 0x2E };
static const uint8_t sOID_AttributeType_Pseudonym[] = { 0x55, 0x04, 0x41 };
static const uint8_t sOID_AttributeType_DomainComponent[] = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x19 };
static const uint8_t sOID_AttributeType_MatterNodeId[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0xA2, 0x7C, 0x01, 0x01 };
static const uint8_t sOID_AttributeType_MatterFirmwareSigningId[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0xA2, 0x7C, 0x01, 0x02 };
static const uint8_t sOID_AttributeType_MatterICACId[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0xA2, 0x7C, 0x01, 0x03 };
static const uint8_t sOID_AttributeType_MatterRCACId[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0xA2, 0x7C, 0x01, 0x04 };
static const uint8_t sOID_AttributeType_MatterFabricId[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0xA2, 0x7C, 0x01, 0x05 };
static const uint8_t sOID_AttributeType_MatterCASEAuthTag[] = { 0x2B, 0x06, 0x01, 0x04, 0x01, 0x82, 0xA2, 0x7C, 0x01, 0x06 };
static const uint8_t sOID_EllipticCurve_prime256v1[] = { 0x2A, 0x86, 0x48, 0xCE, 0x3D, 0x03, 0x01, 0x07 };
static const uint8_t sOID_Extension_BasicConstraints[] = { 0x55, 0x1D, 0x13 };
static const uint8_t sOID_Extension_KeyUsage[] = { 0x55, 0x1D, 0x0F };
static const uint8_t sOID_Extension_ExtendedKeyUsage[] = { 0x55, 0x1D, 0x25 };
static const uint8_t sOID_Extension_SubjectKeyIdentifier[] = { 0x55, 0x1D, 0x0E };
static const uint8_t sOID_Extension_AuthorityKeyIdentifier[] = { 0x55, 0x1D, 0x23 };
static const uint8_t sOID_Extension_CSRRequest[] = { 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09, 0x0E };
static const uint8_t sOID_KeyPurpose_ServerAuth[] = { 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x01 };
static const uint8_t sOID_KeyPurpose_ClientAuth[] = { 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x02 };
static const uint8_t sOID_KeyPurpose_CodeSigning[] = { 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x03 };
static const uint8_t sOID_KeyPurpose_EmailProtection[] = { 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x04 };
static const uint8_t sOID_KeyPurpose_TimeStamping[] = { 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x08 };
static const uint8_t sOID_KeyPurpose_OCSPSigning[] = { 0x2B, 0x06, 0x01, 0x05, 0x05, 0x07, 0x03, 0x09 };
const OIDTableEntry sOIDTable[] =
{
{ kOID_PubKeyAlgo_ECPublicKey, sOID_PubKeyAlgo_ECPublicKey, sizeof(sOID_PubKeyAlgo_ECPublicKey) },
{ kOID_SigAlgo_ECDSAWithSHA256, sOID_SigAlgo_ECDSAWithSHA256, sizeof(sOID_SigAlgo_ECDSAWithSHA256) },
{ kOID_AttributeType_CommonName, sOID_AttributeType_CommonName, sizeof(sOID_AttributeType_CommonName) },
{ kOID_AttributeType_Surname, sOID_AttributeType_Surname, sizeof(sOID_AttributeType_Surname) },
{ kOID_AttributeType_SerialNumber, sOID_AttributeType_SerialNumber, sizeof(sOID_AttributeType_SerialNumber) },
{ kOID_AttributeType_CountryName, sOID_AttributeType_CountryName, sizeof(sOID_AttributeType_CountryName) },
{ kOID_AttributeType_LocalityName, sOID_AttributeType_LocalityName, sizeof(sOID_AttributeType_LocalityName) },
{ kOID_AttributeType_StateOrProvinceName, sOID_AttributeType_StateOrProvinceName, sizeof(sOID_AttributeType_StateOrProvinceName) },
{ kOID_AttributeType_OrganizationName, sOID_AttributeType_OrganizationName, sizeof(sOID_AttributeType_OrganizationName) },
{ kOID_AttributeType_OrganizationalUnitName, sOID_AttributeType_OrganizationalUnitName, sizeof(sOID_AttributeType_OrganizationalUnitName) },
{ kOID_AttributeType_Title, sOID_AttributeType_Title, sizeof(sOID_AttributeType_Title) },
{ kOID_AttributeType_Name, sOID_AttributeType_Name, sizeof(sOID_AttributeType_Name) },
{ kOID_AttributeType_GivenName, sOID_AttributeType_GivenName, sizeof(sOID_AttributeType_GivenName) },
{ kOID_AttributeType_Initials, sOID_AttributeType_Initials, sizeof(sOID_AttributeType_Initials) },
{ kOID_AttributeType_GenerationQualifier, sOID_AttributeType_GenerationQualifier, sizeof(sOID_AttributeType_GenerationQualifier) },
{ kOID_AttributeType_DNQualifier, sOID_AttributeType_DNQualifier, sizeof(sOID_AttributeType_DNQualifier) },
{ kOID_AttributeType_Pseudonym, sOID_AttributeType_Pseudonym, sizeof(sOID_AttributeType_Pseudonym) },
{ kOID_AttributeType_DomainComponent, sOID_AttributeType_DomainComponent, sizeof(sOID_AttributeType_DomainComponent) },
{ kOID_AttributeType_MatterNodeId, sOID_AttributeType_MatterNodeId, sizeof(sOID_AttributeType_MatterNodeId) },
{ kOID_AttributeType_MatterFirmwareSigningId, sOID_AttributeType_MatterFirmwareSigningId, sizeof(sOID_AttributeType_MatterFirmwareSigningId) },
{ kOID_AttributeType_MatterICACId, sOID_AttributeType_MatterICACId, sizeof(sOID_AttributeType_MatterICACId) },
{ kOID_AttributeType_MatterRCACId, sOID_AttributeType_MatterRCACId, sizeof(sOID_AttributeType_MatterRCACId) },
{ kOID_AttributeType_MatterFabricId, sOID_AttributeType_MatterFabricId, sizeof(sOID_AttributeType_MatterFabricId) },
{ kOID_AttributeType_MatterCASEAuthTag, sOID_AttributeType_MatterCASEAuthTag, sizeof(sOID_AttributeType_MatterCASEAuthTag) },
{ kOID_EllipticCurve_prime256v1, sOID_EllipticCurve_prime256v1, sizeof(sOID_EllipticCurve_prime256v1) },
{ kOID_Extension_BasicConstraints, sOID_Extension_BasicConstraints, sizeof(sOID_Extension_BasicConstraints) },
{ kOID_Extension_KeyUsage, sOID_Extension_KeyUsage, sizeof(sOID_Extension_KeyUsage) },
{ kOID_Extension_ExtendedKeyUsage, sOID_Extension_ExtendedKeyUsage, sizeof(sOID_Extension_ExtendedKeyUsage) },
{ kOID_Extension_SubjectKeyIdentifier, sOID_Extension_SubjectKeyIdentifier, sizeof(sOID_Extension_SubjectKeyIdentifier) },
{ kOID_Extension_AuthorityKeyIdentifier, sOID_Extension_AuthorityKeyIdentifier, sizeof(sOID_Extension_AuthorityKeyIdentifier) },
{ kOID_Extension_CSRRequest, sOID_Extension_CSRRequest, sizeof(sOID_Extension_CSRRequest) },
{ kOID_KeyPurpose_ServerAuth, sOID_KeyPurpose_ServerAuth, sizeof(sOID_KeyPurpose_ServerAuth) },
{ kOID_KeyPurpose_ClientAuth, sOID_KeyPurpose_ClientAuth, sizeof(sOID_KeyPurpose_ClientAuth) },
{ kOID_KeyPurpose_CodeSigning, sOID_KeyPurpose_CodeSigning, sizeof(sOID_KeyPurpose_CodeSigning) },
{ kOID_KeyPurpose_EmailProtection, sOID_KeyPurpose_EmailProtection, sizeof(sOID_KeyPurpose_EmailProtection) },
{ kOID_KeyPurpose_TimeStamping, sOID_KeyPurpose_TimeStamping, sizeof(sOID_KeyPurpose_TimeStamping) },
{ kOID_KeyPurpose_OCSPSigning, sOID_KeyPurpose_OCSPSigning, sizeof(sOID_KeyPurpose_OCSPSigning) },
{ kOID_NotSpecified, NULL, 0 }
};
const size_t sOIDTableSize = sizeof(sOIDTable) / sizeof(OIDTableEntry);
#endif // ASN1_DEFINE_OID_TABLE
#ifdef ASN1_DEFINE_OID_NAME_TABLE
const OIDNameTableEntry sOIDNameTable[] =
{
{ kOID_PubKeyAlgo_ECPublicKey, \"ECPublicKey\" },
{ kOID_SigAlgo_ECDSAWithSHA256, \"ECDSAWithSHA256\" },
{ kOID_AttributeType_CommonName, \"CommonName\" },
{ kOID_AttributeType_Surname, \"Surname\" },
{ kOID_AttributeType_SerialNumber, \"SerialNumber\" },
{ kOID_AttributeType_CountryName, \"CountryName\" },
{ kOID_AttributeType_LocalityName, \"LocalityName\" },
{ kOID_AttributeType_StateOrProvinceName, \"StateOrProvinceName\" },
{ kOID_AttributeType_OrganizationName, \"OrganizationName\" },
{ kOID_AttributeType_OrganizationalUnitName, \"OrganizationalUnitName\" },
{ kOID_AttributeType_Title, \"Title\" },
{ kOID_AttributeType_Name, \"Name\" },
{ kOID_AttributeType_GivenName, \"GivenName\" },
{ kOID_AttributeType_Initials, \"Initials\" },
{ kOID_AttributeType_GenerationQualifier, \"GenerationQualifier\" },
{ kOID_AttributeType_DNQualifier, \"DNQualifier\" },
{ kOID_AttributeType_Pseudonym, \"Pseudonym\" },
{ kOID_AttributeType_DomainComponent, \"DomainComponent\" },
{ kOID_AttributeType_MatterNodeId, \"MatterNodeId\" },
{ kOID_AttributeType_MatterFirmwareSigningId, \"MatterFirmwareSigningId\" },
{ kOID_AttributeType_MatterICACId, \"MatterICACId\" },
{ kOID_AttributeType_MatterRCACId, \"MatterRCACId\" },
{ kOID_AttributeType_MatterFabricId, \"MatterFabricId\" },
{ kOID_AttributeType_MatterCASEAuthTag, \"MatterCASEAuthTag\" },
{ kOID_EllipticCurve_prime256v1, \"prime256v1\" },
{ kOID_Extension_BasicConstraints, \"BasicConstraints\" },
{ kOID_Extension_KeyUsage, \"KeyUsage\" },
{ kOID_Extension_ExtendedKeyUsage, \"ExtendedKeyUsage\" },
{ kOID_Extension_SubjectKeyIdentifier, \"SubjectKeyIdentifier\" },
{ kOID_Extension_AuthorityKeyIdentifier, \"AuthorityKeyIdentifier\" },
{ kOID_Extension_CSRRequest, \"CSRRequest\" },
{ kOID_KeyPurpose_ServerAuth, \"ServerAuth\" },
{ kOID_KeyPurpose_ClientAuth, \"ClientAuth\" },
{ kOID_KeyPurpose_CodeSigning, \"CodeSigning\" },
{ kOID_KeyPurpose_EmailProtection, \"EmailProtection\" },
{ kOID_KeyPurpose_TimeStamping, \"TimeStamping\" },
{ kOID_KeyPurpose_OCSPSigning, \"OCSPSigning\" },
{ kOID_NotSpecified, NULL }
};
#endif // ASN1_DEFINE_OID_NAME_TABLE
} // namespace ASN1
} // namespace chip
")
# Generating ble/BleBuildConfig.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ble/BleBuildConfig.h
"#pragma once\n
#include <sdkconfig.h>\n
#ifdef CONFIG_ENABLE_CHIPOBLE
#define CONFIG_NETWORK_LAYER_BLE 1
#else
#define CONFIG_NETWORK_LAYER_BLE 0
#endif
#define CHIP_ENABLE_CHIPOBLE_TEST 0
#ifndef CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM
#define BLE_PLATFORM_CONFIG_INCLUDE <platform/ESP32/BlePlatformConfig.h>
#endif
")
# Generating core/CHIPBuildConfig.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/core/CHIPBuildConfig.h
"#pragma once\n
#include <sdkconfig.h>\n
#define CHIP_FUZZING_ENABLED 0
#ifdef CONFIG_BUILD_CHIP_TESTS
#define CHIP_CONFIG_TEST 1
#else
#define CHIP_CONFIG_TEST 0
#endif
#define CHIP_ERROR_LOGGING (CONFIG_LOG_DEFAULT_LEVEL >= 1)
#define CHIP_PROGRESS_LOGGING (CONFIG_LOG_DEFAULT_LEVEL >= 3)
#define CHIP_DETAIL_LOGGING (CONFIG_LOG_DEFAULT_LEVEL >= 4)
#define CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE 256
#define CHIP_AUTOMATION_LOGGING (CONFIG_LOG_DEFAULT_LEVEL >= 5)
#define CHIP_PW_TOKENIZER_LOGGING 0
#define CHIP_USE_PW_LOGGING 0
#define CHIP_CONFIG_SHORT_ERROR_STR 1
#define CHIP_CONFIG_ENABLE_ARG_PARSER 1
#define CHIP_TARGET_STYLE_UNIX 0
#define CHIP_TARGET_STYLE_EMBEDDED 1
#define CHIP_CONFIG_MEMORY_MGMT_MALLOC 1
#define HAVE_MALLOC 1
#define HAVE_FREE 1
#define HAVE_NEW 0
#define CHIP_CONFIG_MEMORY_MGMT_PLATFORM 0
#define CHIP_CONFIG_MEMORY_DEBUG_CHECKS 0
#define CHIP_CONFIG_MEMORY_DEBUG_DMALLOC 0
#define CHIP_CONFIG_PROVIDE_OBSOLESCENT_INTERFACES 0
#define CHIP_CONFIG_TRANSPORT_TRACE_ENABLED 0
#define CHIP_CONFIG_TRANSPORT_PW_TRACE_ENABLED 0
#define CHIP_CONFIG_MINMDNS_DYNAMIC_OPERATIONAL_RESPONDER_LIST 0
#define CHIP_CONFIG_MINMDNS_MAX_PARALLEL_RESOLVES 2
#define CHIP_CONFIG_CANCELABLE_HAS_INFO_STRING_FIELD 0
#define CHIP_CONFIG_BIG_ENDIAN_TARGET 0
")
# Generating crypto/CryptoBuildConfig.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/crypto/CryptoBuildConfig.h
"#pragma once\n
#include <sdkconfig.h>\n
#define CHIP_CRYPTO_MBEDTLS 1
#define CHIP_CRYPTO_PSA 0
#define CHIP_CRYPTO_OPENSSL 0
#define CHIP_CRYPTO_BORINGSSL 0
#define CHIP_CRYPTO_PLATFORM 0
")
# Generating inet/InetBuildConfig.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/inet/InetBuildConfig.h
"#pragma once\n
#include <sdkconfig.h>\n
#define INET_CONFIG_TEST 0
#ifdef CONFIG_DISABLE_IPV4
#define INET_CONFIG_ENABLE_IPV4 0
#else
#define INET_CONFIG_ENABLE_IPV4 1
#endif
#define INET_CONFIG_ENABLE_TCP_ENDPOINT 1
#define INET_CONFIG_ENABLE_UDP_ENDPOINT 1
#define HAVE_LWIP_RAW_BIND_NETIF 1
#ifndef CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM
#define INET_PLATFORM_CONFIG_INCLUDE <platform/ESP32/InetPlatformConfig.h>
#endif
#define INET_TCP_END_POINT_IMPL_CONFIG_FILE <inet/TCPEndPointImplLwIP.h>
#define INET_UDP_END_POINT_IMPL_CONFIG_FILE <inet/UDPEndPointImplLwIP.h>
")
# Generating lwip/lwip_buildconfig.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/lwip/lwip_buildconfig.h
"#pragma once\n
#include <sdkconfig.h>\n
#define HAVE_LWIP_UDP_BIND_NETIF 1
")
# Generating matter/tracing/build_config.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/matter/tracing/build_config.h
"#pragma once\n
#include <sdkconfig.h>\n
#ifdef CONFIG_ENABLE_ESP_INSIGHTS_TRACE
#define MATTER_TRACING_ENABLED 1
#else
#define MATTER_TRACING_ENABLED 0
#endif
")
# Generating platform/CHIPDeviceBuildConfig.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/platform/CHIPDeviceBuildConfig.h
"#pragma once\n
#include <sdkconfig.h>\n
#if defined(CONFIG_ENABLE_WIFI_STATION) || defined(CONFIG_ENABLE_WIFI_AP)
#define CHIP_DEVICE_CONFIG_ENABLE_WPA 1
#else
#define CHIP_DEVICE_CONFIG_ENABLE_WPA 0
#endif
#ifdef CONFIG_ENABLE_MATTER_OVER_THREAD
#define CHIP_ENABLE_OPENTHREAD 1
#else
#define CHIP_ENABLE_OPENTHREAD 0
#endif
#ifdef CONFIG_OPENTHREAD_FTD
#define CHIP_DEVICE_CONFIG_THREAD_FTD 1
#else
#define CHIP_DEVICE_CONFIG_THREAD_FTD 0
#endif
#define CHIP_STACK_LOCK_TRACKING_ENABLED 1
#define CHIP_STACK_LOCK_TRACKING_ERROR_FATAL 1
#ifdef CONFIG_ENABLE_ROTATING_DEVICE_ID
#define CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING 1
#else
#define CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING 0
#endif
#define CHIP_DEVICE_CONFIG_RUN_AS_ROOT 1
#define CHIP_DISABLE_PLATFORM_KVS 0
#ifdef CONFIG_ENABLE_OTA_REQUESTOR
#define CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR 1
#else
#define CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR 0
#endif
#ifdef CONFIG_ENABLE_ESP32_FACTORY_DATA_PROVIDER
#define CHIP_USE_TRANSITIONAL_COMMISSIONABLE_DATA_PROVIDER 0
#else
#define CHIP_USE_TRANSITIONAL_COMMISSIONABLE_DATA_PROVIDER 1
#endif
#define CHIP_USE_TRANSITIONAL_DEVICE_INSTANCE_INFO_PROVIDER 1
#define CHIP_DEVICE_LAYER_TARGET_ESP32 1
#ifdef CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM
#define CHIP_DEVICE_PLATFORM_CONFIG_INCLUDE <platform/ESP32_custom/CHIPDevicePlatformConfig.h>
#define BLE_PLATFORM_CONFIG_INCLUDE <platform/ESP32_custom/BlePlatformConfig.h>
#define CHIP_PLATFORM_CONFIG_INCLUDE <platform/ESP32_custom/CHIPPlatformConfig.h>
#define SYSTEM_PLATFORM_CONFIG_INCLUDE <platform/ESP32_custom/SystemPlatformConfig.h>
#define CHIP_DEVICE_LAYER_TARGET ESP32_custom
#else
#define CHIP_DEVICE_PLATFORM_CONFIG_INCLUDE <platform/ESP32/CHIPDevicePlatformConfig.h>
#define CHIP_DEVICE_LAYER_TARGET ESP32
#endif
#define CHIP_DEVICE_CONFIG_MAX_DISCOVERED_IP_ADDRESSES 5
")
# Generating setup_payload/CHIPAdditionalDataPayloadBuildConfig.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/setup_payload/CHIPAdditionalDataPayloadBuildConfig.h
"#pragma once\n
#include <sdkconfig.h>\n
#ifdef CONFIG_ENABLE_ROTATING_DEVICE_ID
#define CHIP_ENABLE_ROTATING_DEVICE_ID 1
#else
#define CHIP_ENABLE_ROTATING_DEVICE_ID 0
#endif
")
# Generating system/SystemBuildConfig.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/system/SystemBuildConfig.h
"#pragma once\n
#include <sdkconfig.h>\n
#define CONFIG_DEVICE_LAYER 1
#ifdef CONFIG_BUILD_CHIP_TESTS
#define CHIP_SYSTEM_CONFIG_TEST 1
#define CHIP_WITH_NLFAULTINJECTION 1
#else
#define CHIP_SYSTEM_CONFIG_TEST 0
#define CHIP_WITH_NLFAULTINJECTION 0
#endif
#define CHIP_SYSTEM_CONFIG_USE_DISPATCH 0
#define CHIP_SYSTEM_CONFIG_USE_LIBEV 0
#define CHIP_SYSTEM_CONFIG_USE_LWIP 1
#define CHIP_SYSTEM_CONFIG_USE_OPEN_THREAD_ENDPOINT 0
#define CHIP_SYSTEM_CONFIG_USE_SOCKETS 0
#define CHIP_SYSTEM_CONFIG_USE_NETWORK_FRAMEWORK 0
#define CHIP_SYSTEM_CONFIG_POSIX_LOCKING 0
#define CHIP_SYSTEM_CONFIG_FREERTOS_LOCKING 1
#define CHIP_SYSTEM_CONFIG_MBED_LOCKING 0
#define CHIP_SYSTEM_CONFIG_CMSIS_RTOS_LOCKING 0
#define CHIP_SYSTEM_CONFIG_ZEPHYR_LOCKING 0
#define CHIP_SYSTEM_CONFIG_NO_LOCKING 0
#define CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS 1
#define HAVE_CLOCK_GETTIME 1
#define HAVE_CLOCK_SETTIME 1
#define HAVE_GETTIMEOFDAY 0
#define HAVE_SYS_TIME_H 1
#define HAVE_NETINET_ICMP6_H 1
#define HAVE_ICMP6_FILTER 1
#define CONFIG_HAVE_VCBPRINTF 0
#define CONFIG_HAVE_VSNPRINTF_EX 0
#define HAVE_SYS_SOCKET_H 0
#ifndef CONFIG_CHIP_ENABLE_EXTERNAL_PLATFORM
#define CHIP_PLATFORM_CONFIG_INCLUDE <platform/ESP32/CHIPPlatformConfig.h>
#define SYSTEM_PLATFORM_CONFIG_INCLUDE <platform/ESP32/SystemPlatformConfig.h>
#endif
#define CHIP_SYSTEM_LAYER_IMPL_CONFIG_FILE <system/SystemLayerImplFreeRTOS.h>
#define CHIP_SYSTEM_CONFIG_MULTICAST_HOMING 0
")
# Generating CHIPVersion.h
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/CHIPVersion.h
"/*
*
* Copyright (c) 2020 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the \"License\");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an \"AS IS\" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* \@file
* This file defines constants and macros for introspecting and
* manipulating CHIP versions.
*
* The constants and macros defined here may be used to, for ,
* example, conditionally-compile older, newer, or changed CHIP
* APIs based on the CHIP version. For example:
*
* \@code
* #if CHIP_VERSION_CODE >= CHIP_VERSION_CODE_ENCODE(1, 5, 0)
* ...
* #else
* ...
* #endif
* \@endcode
*
*/
#pragma once
#define _CHIP_VERSION_CODE_MAJOR_WIDTH 8
#define _CHIP_VERSION_CODE_MINOR_WIDTH 8
#define _CHIP_VERSION_CODE_PATCH_WIDTH 8
#define _CHIP_VERSION_CODE_MAJOR_MASK ((1 << _CHIP_VERSION_CODE_MAJOR_WIDTH) - 1)
#define _CHIP_VERSION_CODE_MINOR_MASK ((1 << _CHIP_VERSION_CODE_MINOR_WIDTH) - 1)
#define _CHIP_VERSION_CODE_PATCH_MASK ((1 << _CHIP_VERSION_CODE_PATCH_WIDTH) - 1)
#define _CHIP_VERSION_CODE_MAJOR_SHIFT 24
#define _CHIP_VERSION_CODE_MINOR_SHIFT 16
#define _CHIP_VERSION_CODE_PATCH_SHIFT 8
/**
* \@def CHIP_VERSION_CODE_ENCODE(major, minor, patch)
*
* \@brief
* Encode a CHIP version code from its constituent \@a major, \@a minor, and \@a patch
* components.
*
* This macro may be used in conjunction with CHIP_VERSION_CODE to, for
* example, conditionally-compile older, newer, or changed CHIP APIs based
* on the CHIP version. For example:
*
* \@code
* #if CHIP_VERSION_CODE >= CHIP_VERSION_CODE_ENCODE(1, 5, 0)
* ...
* #else
* ...
* #endif
* \@endcode
*
*/
#define CHIP_VERSION_CODE_ENCODE(major, minor, patch) \
((((major) & _CHIP_VERSION_CODE_MAJOR_MASK) << _CHIP_VERSION_CODE_MAJOR_SHIFT) | \
(((minor) & _CHIP_VERSION_CODE_MINOR_MASK) << _CHIP_VERSION_CODE_MINOR_SHIFT) | \
(((patch) & _CHIP_VERSION_CODE_PATCH_MASK) << _CHIP_VERSION_CODE_PATCH_SHIFT))
/**
* \@def CHIP_VERSION_CODE_DECODE_MAJOR(code)
*
* \@brief
* Decode a CHIP major version component from a CHIP version \@a code.
*
*/
#define CHIP_VERSION_CODE_DECODE_MAJOR(code) (((code) >> _CHIP_VERSION_CODE_MAJOR_SHIFT) & _CHIP_VERSION_CODE_MAJOR_MASK)
/**
* \@def CHIP_VERSION_CODE_DECODE_MINOR(code)
*
* \@brief
* Decode a CHIP minor version component from a CHIP version \@a code.
*
*/
#define CHIP_VERSION_CODE_DECODE_MINOR(code) (((code) >> _CHIP_VERSION_CODE_MINOR_SHIFT) & _CHIP_VERSION_CODE_MINOR_MASK)
/**
* \@def CHIP_VERSION_CODE_DECODE_PATCH(code)
*
* \@brief
* Decode a CHIP patch version component from a CHIP version \@a code.
*
*/
#define CHIP_VERSION_CODE_DECODE_PATCH(code) (((code) >> _CHIP_VERSION_CODE_PATCH_SHIFT) & _CHIP_VERSION_CODE_PATCH_MASK)
/**
* \@def CHIP_VERSION_MAJOR
*
* \@brief
* The CHIP version major component, as an unsigned integer.
*
*/
#define CHIP_VERSION_MAJOR 0
/**
* \@def CHIP_VERSION_MINOR
*
* \@brief
* The CHIP version minor component, as an unsigned integer.
*
*/
#define CHIP_VERSION_MINOR 0
/**
* \@def CHIP_VERSION_PATCH
*
* \@brief
* The CHIP version patch component, as an unsigned integer.
*
*/
#define CHIP_VERSION_PATCH 0
/**
* \@def CHIP_VERSION_EXTRA
*
* \@brief
* The CHIP version extra component, as a quoted C string.
*
*/
#define CHIP_VERSION_EXTRA \"\"
/**
* \@def CHIP_VERSION_STRING
*
* \@brief
* The CHIP version, as a quoted C string.
*
*/
#define CHIP_VERSION_STRING \"0.0.0\"
/**
* \@def CHIP_VERSION_CODE
*
* \@brief
* The CHIP version, including the major, minor, and patch components,
* encoded as an unsigned integer.
*
* This macro may be used in conjunction with CHIP_VERSION_CODE_ENCODE
* to, for example, conditionally-compile older, newer, or changed CHIP
* APIs based on the CHIP version. For example:
*
* \@code
* #if CHIP_VERSION_CODE >= CHIP_VERSION_CODE_ENCODE(1, 5, 0)
* ...
* #else
* ...
* #endif
* \@endcode
*
*/
#define CHIP_VERSION_CODE CHIP_VERSION_CODE_ENCODE(CHIP_VERSION_MAJOR, CHIP_VERSION_MINOR, CHIP_VERSION_PATCH)
")