mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-26 12:14:56 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a86bc0af2 | ||
|
|
bc9f6ba0b0 | ||
|
|
9e16a0ae42 | ||
|
|
9ccbb49aef | ||
|
|
d59f84fbbc | ||
|
|
4bbb5008b1 | ||
|
|
49ce25511e | ||
|
|
985276665d | ||
|
|
91f553c45f | ||
|
|
38ede8ec58 | ||
|
|
997f6543ce | ||
|
|
b50081a83b | ||
|
|
34f512d244 | ||
|
|
eb5752f41b | ||
|
|
ef8e7419fa | ||
|
|
cfcdd15b89 | ||
|
|
b26debaebc | ||
|
|
6deb061b12 | ||
|
|
4c6745670c | ||
|
|
01c662b7de | ||
|
|
179fe652c2 | ||
|
|
394bc3260d | ||
|
|
ce1a70e2dc | ||
|
|
99022896f6 | ||
|
|
446b400667 | ||
|
|
7d53c21efe | ||
|
|
b78efbac36 | ||
|
|
9be9dcec46 | ||
|
|
3766ab802b | ||
|
|
b9141925a3 | ||
|
|
ed79fe86aa | ||
|
|
2f0b0955a9 | ||
|
|
2f8e15a900 | ||
|
|
b8b3a5c305 | ||
|
|
e7ea421c54 | ||
|
|
8de9699390 | ||
|
|
bf592a22ae | ||
|
|
8d4a619a15 | ||
|
|
1a3588624d | ||
|
|
74b3fd2efc | ||
|
|
091356ed59 | ||
|
|
fc0e1ee311 | ||
|
|
8dbfcbff58 | ||
|
|
317591bc8a | ||
|
|
f71b3b91c0 | ||
|
|
9e255bcbce | ||
|
|
8af319b953 | ||
|
|
f90fd9cec4 | ||
|
|
d386b1c12d | ||
|
|
81551ec50d | ||
|
|
8fafcf6eaa | ||
|
|
f0df6c61c9 | ||
|
|
6cf36b5771 | ||
|
|
54799187e9 | ||
|
|
6d0320be06 | ||
|
|
317a1527ad | ||
|
|
490eb0f57f | ||
|
|
f95283e341 | ||
|
|
837da0e458 | ||
|
|
8ce82a100e | ||
|
|
9ece98c101 | ||
|
|
6a83147b33 | ||
|
|
90e4228e1d | ||
|
|
553aeeef77 | ||
|
|
6147e865f8 | ||
|
|
7b296fabb0 | ||
|
|
00c8f8acd0 | ||
|
|
1e1efa2c5e | ||
|
|
b0b0dd9f0b | ||
|
|
30bb1c52d0 | ||
|
|
7fc96a61ad | ||
|
|
4a164c39b4 | ||
|
|
b0e4069bb7 | ||
|
|
19cbb27b4c | ||
|
|
d44c864387 | ||
|
|
36e21e53e0 | ||
|
|
b7598cc354 | ||
|
|
0a4f322d49 | ||
|
|
bf013fcdae | ||
|
|
fd52fccc15 | ||
|
|
c493d3a4ce | ||
|
|
aeceb2b9e7 | ||
|
|
cb5f833dd2 | ||
|
|
0740ccd9f7 | ||
|
|
716c84c896 | ||
|
|
c5fda07d1e | ||
|
|
7fffe0abaa | ||
|
|
8a42325c23 | ||
|
|
78900304bf | ||
|
|
fb6dfbcd3c | ||
|
|
3dd4c7da2a | ||
|
|
03c955410c | ||
|
|
74f77c9ded | ||
|
|
3caca03e8a | ||
|
|
49469840ab | ||
|
|
85613ab02d | ||
|
|
6e4ce85c87 | ||
|
|
2a093dc183 | ||
|
|
01eeadbaf4 | ||
|
|
851b3a7cfb | ||
|
|
b6dc830bcb | ||
|
|
8ef02aae41 | ||
|
|
423dbd58a1 | ||
|
|
5582db615a | ||
|
|
1479ebfb5d | ||
|
|
4389ef1e77 | ||
|
|
5c305e7fa8 | ||
|
|
0427908eae | ||
|
|
2df53c3d27 | ||
|
|
53ec9adb1b | ||
|
|
8b95a22e75 | ||
|
|
665298a04b | ||
|
|
7e668df1fe | ||
|
|
85414cfec2 | ||
|
|
b973187960 | ||
|
|
991080e613 | ||
|
|
72bf199577 | ||
|
|
7bda43a6ec | ||
|
|
2b8b0ebe95 | ||
|
|
0aa61ce58f | ||
|
|
51a5dc78d7 | ||
|
|
232bd9a22b | ||
|
|
58327a1753 | ||
|
|
7844d84798 | ||
|
|
7a30a42797 | ||
|
|
094202ff16 | ||
|
|
9c4523f4fa | ||
|
|
69859c61e0 | ||
|
|
9878518e29 | ||
|
|
cde270728f | ||
|
|
5559d0fa68 | ||
|
|
8feff78526 | ||
|
|
226a3de55d | ||
|
|
67d0f5f4ae | ||
|
|
192f5e563c | ||
|
|
b6296e7a67 | ||
|
|
67e17d3bc3 | ||
|
|
64a6fef823 | ||
|
|
e0c64cc4ff | ||
|
|
3e55478b3b | ||
|
|
9aef821862 | ||
|
|
f394df840e | ||
|
|
7d33699173 | ||
|
|
d3ffe8c647 | ||
|
|
9b99f62311 | ||
|
|
3319ce78d3 | ||
|
|
8eabf43525 | ||
|
|
adb12bb7be | ||
|
|
3c10b36651 | ||
|
|
d37c300d87 | ||
|
|
9fc92e901e | ||
|
|
5b52529295 | ||
|
|
f77a7ad623 | ||
|
|
504ef9422e | ||
|
|
cbbcec0895 | ||
|
|
32d90c38db | ||
|
|
e1f7f3d7bb | ||
|
|
244536ea72 | ||
|
|
fa24a3e09e | ||
|
|
5ec26a5015 | ||
|
|
8a8ff2aef0 | ||
|
|
069254be6a | ||
|
|
f3cd74cb46 | ||
|
|
4be8aa0f91 | ||
|
|
93dd7a85f6 | ||
|
|
062596e3fb | ||
|
|
5af2de635e | ||
|
|
a16df91fbb | ||
|
|
44178b9103 | ||
|
|
b767f930ad | ||
|
|
ba61a6545a | ||
|
|
23ada5c7a5 | ||
|
|
97c37efffe | ||
|
|
5db95be4fc | ||
|
|
5897422c70 | ||
|
|
a7db0d3cc5 | ||
|
|
c49036a713 | ||
|
|
03246997fa | ||
|
|
f4eac6e4fc | ||
|
|
48f695f3e6 | ||
|
|
3525f044f5 | ||
|
|
b58f8b9d7c | ||
|
|
c00962e881 | ||
|
|
9bcf1d662b | ||
|
|
586e0721d8 | ||
|
|
882dd1f3a7 | ||
|
|
399291d783 | ||
|
|
46ac2e5252 | ||
|
|
a81818b2db | ||
|
|
9b0d112176 | ||
|
|
ac17df0c65 | ||
|
|
c4be4e7928 | ||
|
|
877cbbd11d | ||
|
|
b2bb03310e | ||
|
|
5c8885ee5f | ||
|
|
40ec6b263d | ||
|
|
3742da8770 | ||
|
|
19b06418c5 | ||
|
|
b7b8b9219d | ||
|
|
949966964f | ||
|
|
c0a0f9c1df | ||
|
|
7cff2fa8f1 | ||
|
|
c1b703a039 | ||
|
|
e0eff1d2bb | ||
|
|
037ef76ad8 | ||
|
|
ae8025cd5c | ||
|
|
1804cc3a09 | ||
|
|
2d8e6b45ec | ||
|
|
3fa52d0d7d | ||
|
|
6a7129d7af | ||
|
|
f0e113a532 | ||
|
|
8b3e415201 | ||
|
|
eb6a8afe8d | ||
|
|
a705a89e4a | ||
|
|
ea509c0a36 | ||
|
|
269600d875 | ||
|
|
95e3a8f3cc | ||
|
|
ffeff3ab69 | ||
|
|
bdc009eb65 | ||
|
|
683f65f8ac | ||
|
|
a737698372 | ||
|
|
eeecbbcff9 | ||
|
|
44b3d60692 | ||
|
|
641c7d1967 | ||
|
|
7923d1e930 | ||
|
|
42e072a868 | ||
|
|
97296934ab | ||
|
|
83dbe5fa3e | ||
|
|
b566b8b45a | ||
|
|
ecdfda56c2 | ||
|
|
166c4a244a | ||
|
|
be7bfbac39 | ||
|
|
3c8953672d | ||
|
|
045b196eeb | ||
|
|
d763fce8ed | ||
|
|
15c8ba5d3f | ||
|
|
1b75017c3c | ||
|
|
3ffe5e958f | ||
|
|
4f6a78cde8 | ||
|
|
3081d0766b | ||
|
|
c1e34cb9b5 | ||
|
|
dedf67fb52 | ||
|
|
a74fb940aa | ||
|
|
09275ae4ca | ||
|
|
657717d0fb | ||
|
|
4493d35d26 | ||
|
|
0d26ce9bcc | ||
|
|
fe77075996 | ||
|
|
4d6b126b9d | ||
|
|
7b1900d547 | ||
|
|
5a8c56e784 | ||
|
|
8c4cfc8101 | ||
|
|
5f1f5ffffd | ||
|
|
603c4b7672 | ||
|
|
4b49c63344 | ||
|
|
9bdc910327 | ||
|
|
730f50f770 | ||
|
|
91606a9e3f | ||
|
|
22b52f831b | ||
|
|
071b3f558f | ||
|
|
59cd4004ac | ||
|
|
7f7c1ff6c2 | ||
|
|
ad3acf355e | ||
|
|
4dcc4e3308 | ||
|
|
a9902b55d8 | ||
|
|
d46798c2a7 | ||
|
|
90623492b7 | ||
|
|
ddf3ba8a15 | ||
|
|
0c4d33d558 | ||
|
|
1c3b6ad59b | ||
|
|
473a12d700 | ||
|
|
774cfc4bdc | ||
|
|
509fbcc4f8 | ||
|
|
00862344f7 | ||
|
|
5ad2b0531a | ||
|
|
be8dbb0dc7 | ||
|
|
bdfa0b302b | ||
|
|
7541304a9a | ||
|
|
395a51eeca | ||
|
|
17e2d49c43 | ||
|
|
ac71c320cd | ||
|
|
0356bf6092 | ||
|
|
8bc1edd027 | ||
|
|
403f0dc8a5 | ||
|
|
dffa198ebd | ||
|
|
7028417d88 | ||
|
|
2d4ebba3ed | ||
|
|
aa3fda9c33 | ||
|
|
0f9f0b545e | ||
|
|
9fcc398540 | ||
|
|
61f4ab61cb | ||
|
|
1f481cbe54 | ||
|
|
f4ee10a96a | ||
|
|
9974be3fdc | ||
|
|
793171e9e0 | ||
|
|
cee7087d54 | ||
|
|
f9bcffcbd5 | ||
|
|
8fd7e87333 | ||
|
|
c436194d43 | ||
|
|
fcd160cc8c | ||
|
|
5adbadc901 | ||
|
|
5084279d81 | ||
|
|
bd21d0d0cf | ||
|
|
a3fd81540a | ||
|
|
ba3f6a5e76 | ||
|
|
25c56e86c9 | ||
|
|
0897b0969d | ||
|
|
6cb1c3c0e9 | ||
|
|
df257a8e8a | ||
|
|
71abdc1bda | ||
|
|
22de1dc0f2 | ||
|
|
6357b30712 | ||
|
|
b0e18d5e8a | ||
|
|
be58d73a0a | ||
|
|
c1f630f5ed | ||
|
|
ab75bfa6e7 | ||
|
|
a4e0225c69 | ||
|
|
6d3d6c3601 | ||
|
|
2872de75a0 | ||
|
|
70936e3738 | ||
|
|
c272883ec1 | ||
|
|
d9619a8fa4 | ||
|
|
9ec2022447 | ||
|
|
10f56c55e6 | ||
|
|
69682d6d97 | ||
|
|
b61575eb2b | ||
|
|
6942de4f57 | ||
|
|
8085e21a05 | ||
|
|
0061fe02e6 | ||
|
|
6bb40e6ec9 | ||
|
|
94efcc83a1 | ||
|
|
03402cf359 | ||
|
|
a473cf99b5 | ||
|
|
c26bd2ffe8 | ||
|
|
9dc3d09981 | ||
|
|
76b4c9a6ff | ||
|
|
41add69294 | ||
|
|
c911c9ad19 | ||
|
|
dd883c0563 | ||
|
|
16a0c89d5f | ||
|
|
ac0e6f3377 | ||
|
|
68f7be7a1a | ||
|
|
b796e33ede | ||
|
|
1051ba77c0 | ||
|
|
cb5b6b972a | ||
|
|
925f21aca4 | ||
|
|
dc09851ac8 | ||
|
|
323ba9d90c | ||
|
|
c6ff8ab6dc | ||
|
|
b5443f10c5 | ||
|
|
3ae1a0f82a | ||
|
|
81f0f8a7c2 | ||
|
|
50963df42f | ||
|
|
b316989378 | ||
|
|
23c68e2677 | ||
|
|
b46bee0540 | ||
|
|
4c6c27d8f6 | ||
|
|
3c531897b6 | ||
|
|
6c7672f4af | ||
|
|
2def6e867d | ||
|
|
573f13c1ed | ||
|
|
b7f9e5c947 | ||
|
|
da85affe5c | ||
|
|
3168a2aca0 | ||
|
|
1f5feaa103 | ||
|
|
4be3dfd52b | ||
|
|
1e26983263 | ||
|
|
a620419b59 | ||
|
|
ffdc9b0d3a | ||
|
|
379e047289 | ||
|
|
8e420406b9 | ||
|
|
fc0364b321 | ||
|
|
ea4986dec5 | ||
|
|
2be30a3193 | ||
|
|
81f90c7b51 | ||
|
|
205a564482 | ||
|
|
497df68de1 | ||
|
|
eaf8e24d4c | ||
|
|
1721fb0484 | ||
|
|
fe0b144b84 | ||
|
|
d391bca2d3 | ||
|
|
a0b6e70ff8 | ||
|
|
4f15392440 | ||
|
|
959fcfdf1d | ||
|
|
57f90d200d | ||
|
|
663c645cf1 | ||
|
|
972b255a48 | ||
|
|
8c5dfa4227 | ||
|
|
290d48e1aa | ||
|
|
4eb3a1c978 | ||
|
|
b4a36a8303 | ||
|
|
d08ee4e63a | ||
|
|
42f5802e47 | ||
|
|
120ffb0b1f | ||
|
|
d3a3ba0a32 | ||
|
|
79eebc14bb | ||
|
|
6fc41e2a3c | ||
|
|
4843323f87 | ||
|
|
04c6f3e6ef | ||
|
|
5345c7260e | ||
|
|
71a48ccde0 | ||
|
|
41e24d7733 | ||
|
|
f888b30863 | ||
|
|
10029d6a8d | ||
|
|
6697a2cfaa | ||
|
|
59020e0d5d | ||
|
|
70abd1f98d | ||
|
|
312ca8e978 | ||
|
|
e1ccdc0570 | ||
|
|
c7f9fe4a03 | ||
|
|
89aaf1c30c | ||
|
|
601af780c9 | ||
|
|
93477c8db4 | ||
|
|
ec5531dbf4 | ||
|
|
157f87f01a | ||
|
|
0f4ca8d010 | ||
|
|
0a168b6791 | ||
|
|
a025577b30 | ||
|
|
ef61d6ea48 | ||
|
|
e6bf658271 | ||
|
|
9cccb9839b | ||
|
|
2bd188f3d6 | ||
|
|
9fa840c1c7 | ||
|
|
e0e599ffa1 | ||
|
|
e93d18d200 | ||
|
|
34150f3f71 | ||
|
|
db6730c8a3 | ||
|
|
08cac802a4 | ||
|
|
af6a52e060 | ||
|
|
1c63645254 | ||
|
|
be5d8b1d4f | ||
|
|
2ac3552e6e | ||
|
|
3c3c775213 | ||
|
|
a24b7043ed | ||
|
|
7b621d7b5b | ||
|
|
8a335a8cea | ||
|
|
355c292dbf | ||
|
|
2511d747ae | ||
|
|
03c326a04e | ||
|
|
b3312f3761 | ||
|
|
2e250ee7aa | ||
|
|
924984dde1 | ||
|
|
33b7bb91d9 | ||
|
|
f68fe0fb5c | ||
|
|
e6663ec186 | ||
|
|
6ff0f9ccd8 | ||
|
|
48830aa9a9 | ||
|
|
9276f764e0 | ||
|
|
7876d464f2 | ||
|
|
5d0d01c2c1 | ||
|
|
393418d50d | ||
|
|
23bb912eb5 | ||
|
|
1d5b5296da | ||
|
|
655f5db996 | ||
|
|
c20cc4ae09 | ||
|
|
7581229bbf | ||
|
|
d094e090ff | ||
|
|
c7a13025e4 | ||
|
|
e4cd6bd824 | ||
|
|
f3ad0572e2 | ||
|
|
406d6cc305 | ||
|
|
d042697b10 | ||
|
|
ba678b9ad1 | ||
|
|
7a5cf118e9 | ||
|
|
e9a2da61ef | ||
|
|
d3fe1ef681 | ||
|
|
9725bca966 | ||
|
|
1f627e4263 | ||
|
|
7ac0c5fc2a | ||
|
|
091ebd8a98 | ||
|
|
d9a6e85b65 | ||
|
|
7cc3d89980 | ||
|
|
f58b90f7ea | ||
|
|
fd84109c1d | ||
|
|
626f605835 | ||
|
|
943a8a2708 | ||
|
|
d7b2b3f42e | ||
|
|
fafc5c8348 | ||
|
|
15bd8b4fe9 | ||
|
|
928aed4342 | ||
|
|
98782e44c2 | ||
|
|
65b23777b2 | ||
|
|
c8fd3d6d25 | ||
|
|
01e7cd5f13 | ||
|
|
3ac9bd0468 | ||
|
|
9f498d2eea | ||
|
|
2d2d9ad277 | ||
|
|
2cc18a8ea3 | ||
|
|
25036d5f48 | ||
|
|
defee39ef9 | ||
|
|
c78afb12a3 | ||
|
|
f72b0b5056 | ||
|
|
d46e505a80 | ||
|
|
4027bcf7ea | ||
|
|
2905392665 | ||
|
|
98db3360df | ||
|
|
f26c713482 | ||
|
|
05e55334fc | ||
|
|
01fe61276e | ||
|
|
219253ad71 | ||
|
|
7b125558cb | ||
|
|
02120e24b6 | ||
|
|
91bc79c14c | ||
|
|
5ca552cf1c | ||
|
|
2066304b14 | ||
|
|
1c6f8b95eb | ||
|
|
5384591f5b | ||
|
|
309668ccbc | ||
|
|
06a9fb3f53 | ||
|
|
00db56f7d7 | ||
|
|
cec06eb25c | ||
|
|
73a3897e1b | ||
|
|
100c4c15ce | ||
|
|
c59bf6613a | ||
|
|
ac435bcb91 | ||
|
|
5d0bfccbc7 | ||
|
|
813489dc2f | ||
|
|
828f31d5e6 | ||
|
|
8130f7f25f | ||
|
|
943e1c5f77 | ||
|
|
ecb3301bcb | ||
|
|
a0f33aebf7 | ||
|
|
6862981640 | ||
|
|
f61f2d2e9f | ||
|
|
1743e175cd | ||
|
|
a027f58744 | ||
|
|
c98886402b | ||
|
|
112a1e908a | ||
|
|
01ae80ecd1 | ||
|
|
1c114a279e |
No files matched your search
@@ -0,0 +1 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
@@ -1,3 +1,11 @@
|
|||||||
|
---
|
||||||
|
name: Issue template
|
||||||
|
about: Please fill this issue template for reporting Mongoose issues
|
||||||
|
#title:
|
||||||
|
#labels:
|
||||||
|
#assignees:
|
||||||
|
---
|
||||||
|
|
||||||
- My goal is: _describe_
|
- My goal is: _describe_
|
||||||
- My actions were: _describe_
|
- My actions were: _describe_
|
||||||
- My expectation was: _describe_
|
- My expectation was: _describe_
|
||||||
@@ -9,7 +9,7 @@ jobs:
|
|||||||
Fuzzing:
|
Fuzzing:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^src/' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: if ./test/match_changed_files.sh '^src/' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- name: Build Fuzzers
|
- name: Build Fuzzers
|
||||||
@@ -29,7 +29,7 @@ jobs:
|
|||||||
dry-run: false
|
dry-run: false
|
||||||
language: c++
|
language: c++
|
||||||
- name: Upload Crash
|
- name: Upload Crash
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v4
|
||||||
if: env.GO == 1 && failure() && steps.build.outcome == 'success'
|
if: env.GO == 1 && failure() && steps.build.outcome == 'success'
|
||||||
with:
|
with:
|
||||||
name: artifacts
|
name: artifacts
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ name: "CodeQL Scanning"
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '30 2 * * *' # run at 2:30 AM UTC
|
- cron: '30 23 * * *' # run at 11:30 PM UTC
|
||||||
# Allow manual runs
|
# Allow manual runs
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
@@ -17,16 +17,16 @@ jobs:
|
|||||||
permissions:
|
permissions:
|
||||||
security-events: write
|
security-events: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
- name: Initialize CodeQL
|
||||||
uses: github/codeql-action/init@v2
|
uses: github/codeql-action/init@v3
|
||||||
with:
|
with:
|
||||||
languages: cpp
|
languages: cpp
|
||||||
- run: |
|
- run: |
|
||||||
make test CC=gcc ASAN= ASAN_OPTIONS=
|
make -C test test CC=gcc ASAN= ASAN_OPTIONS=
|
||||||
./test/setup_ga_network.sh && make mip_test CC=gcc ASAN= ASAN_OPTIONS=
|
./test/setup_ga_network.sh && make -C test mip_test CC=gcc ASAN= ASAN_OPTIONS=
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
- name: Perform CodeQL Analysis
|
||||||
uses: github/codeql-action/analyze@v2
|
uses: github/codeql-action/analyze@v3
|
||||||
+317
-105
@@ -1,7 +1,7 @@
|
|||||||
name: Full build and test
|
name: Full build and test
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 1 * * *' # run at 1 AM UTC
|
- cron: '0 22 * * *' # run at 10 PM UTC
|
||||||
# Allow manual runs
|
# Allow manual runs
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
env:
|
env:
|
||||||
@@ -13,8 +13,8 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
cc: [gcc, clang, g++, clang++]
|
cc: [gcc, clang, g++, clang++]
|
||||||
target: [test, mip_test]
|
target: [test]
|
||||||
ssl: ["", MBEDTLS, OPENSSL]
|
ssl: ["", BUILTIN, MBEDTLS, OPENSSL, WOLFSSL]
|
||||||
select: ["-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0", "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0", "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=1"]
|
select: ["-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0", "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0", "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=1"]
|
||||||
exclude:
|
exclude:
|
||||||
- ssl: MBEDTLS
|
- ssl: MBEDTLS
|
||||||
@@ -25,125 +25,345 @@ jobs:
|
|||||||
select: "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0"
|
select: "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0"
|
||||||
- ssl: OPENSSL
|
- ssl: OPENSSL
|
||||||
select: "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0"
|
select: "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0"
|
||||||
|
- ssl: WOLFSSL
|
||||||
|
select: "-DMG_ENABLE_POLL=0 -DMG_ENABLE_EPOLL=0"
|
||||||
|
- ssl: WOLFSSL
|
||||||
|
select: "-DMG_ENABLE_POLL=1 -DMG_ENABLE_EPOLL=0"
|
||||||
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} TFLAGS=${{ matrix.select }}
|
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }} TFLAGS=${{ matrix.select }}
|
||||||
env:
|
env:
|
||||||
CC: ${{ matrix.cc }}
|
CC: ${{ matrix.cc }}
|
||||||
SSL: ${{ matrix.ssl }}
|
SSL: ${{ matrix.ssl }}
|
||||||
TFLAGS: ${{ matrix.select }}
|
TFLAGS: ${{ matrix.select }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: ./test/setup_ga_network.sh && sudo apt -y update ; sudo apt -y install libmbedtls-dev && make ${{ matrix.target }}
|
- run: sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev && make -C test ${{ matrix.target }}
|
||||||
|
mip:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
cc: [gcc, clang, g++, clang++]
|
||||||
|
target: [mip_test, mip_tap_test]
|
||||||
|
ssl: ["", BUILTIN, MBEDTLS, OPENSSL, WOLFSSL]
|
||||||
|
name: ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }}
|
||||||
|
env:
|
||||||
|
CC: ${{ matrix.cc }}
|
||||||
|
SSL: ${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: if [ "${{ matrix.target }}" == "mip_tap_test" ]; then ./test/setup_ga_network.sh ; fi && sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev && make -C test ${{ matrix.target }} IPV6=0
|
||||||
s390:
|
s390:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
|
name: S390 SSL=${{ matrix.ssl }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make s390
|
- run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test s390 SSL=${{ matrix.ssl }}
|
||||||
armhf:
|
armhf:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
|
name: ArmHF SSL=${{ matrix.ssl }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make armhf
|
- run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test armhf SSL=${{ matrix.ssl }}
|
||||||
linux2:
|
unamalgamated-mg_prefix:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN, MBEDTLS, OPENSSL, WOLFSSL]
|
||||||
|
name: unamalgamated-mg_prefix SSL=${{ matrix.ssl }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: sudo apt -y update ; sudo apt -y install libmbedtls-dev valgrind
|
- run: sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev
|
||||||
- run: make unamalgamated && make valgrind && make mg_prefix
|
- run: make -C test unamalgamated && make -C test mg_prefix
|
||||||
|
valgrind:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN, MBEDTLS, OPENSSL, WOLFSSL]
|
||||||
|
name: Valgrind SSL=${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: sudo apt -y update ; sudo apt -y install libmbedtls-dev libwolfssl-dev valgrind
|
||||||
|
- run: make -C test valgrind SSL=${{ matrix.ssl }}
|
||||||
macos:
|
macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
ssl: ["", MBEDTLS, OPENSSL]
|
ssl: ["", BUILTIN, MBEDTLS, OPENSSL, WOLFSSL]
|
||||||
select: [-DMG_ENABLE_POLL=0, -DMG_ENABLE_POLL=1]
|
select: [-DMG_ENABLE_POLL=0, -DMG_ENABLE_POLL=1]
|
||||||
exclude:
|
exclude:
|
||||||
- ssl: MBEDTLS
|
- ssl: MBEDTLS
|
||||||
select: -DMG_ENABLE_POLL=0
|
select: -DMG_ENABLE_POLL=0
|
||||||
- ssl: OPENSSL
|
- ssl: OPENSSL
|
||||||
select: -DMG_ENABLE_POLL=0
|
select: -DMG_ENABLE_POLL=0
|
||||||
|
- ssl: WOLFSSL
|
||||||
|
select: -DMG_ENABLE_POLL=0
|
||||||
name: macos SSL=${{ matrix.ssl }} TFLAGS=${{ matrix.select }}
|
name: macos SSL=${{ matrix.ssl }} TFLAGS=${{ matrix.select }}
|
||||||
env:
|
env:
|
||||||
SSL: ${{ matrix.ssl }}
|
SSL: ${{ matrix.ssl }}
|
||||||
TFLAGS: ${{ matrix.select }} -DNO_SNTP_CHECK -Wno-sign-conversion # Workaround for MbedTLS 3.5.0
|
TFLAGS: ${{ matrix.select }} -Wno-sign-conversion # Workaround for MbedTLS 3.5.0
|
||||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: brew install jq mbedtls openssl
|
- run: brew install mbedtls wolfssl # jq openssl already pre-installed
|
||||||
- run: make test ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*` OPENSSL=`echo /usr/local/Cellar/openssl*/*`
|
- run: make -C test test ASAN_OPTIONS= MBEDTLS=$(echo $(brew --cellar)/mbedtls*/*) OPENSSL=$(echo $(brew --cellar)/openssl*/*) WOLFSSL=$(echo $(brew --cellar)/wolfssl*/*)
|
||||||
- run: make mg_prefix
|
|
||||||
windows:
|
windows:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
max-parallel: 1 # no parallel runs, to minimize MQTT errors
|
||||||
matrix:
|
matrix:
|
||||||
target: [vc98, vc17, vc22, mingw, mingw++]
|
target: [vc98, vc17, vc22, mingw, mingw++]
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
select: [-DMG_ENABLE_POLL=0, -DMG_ENABLE_POLL=1]
|
select: [-DMG_ENABLE_POLL=0, -DMG_ENABLE_POLL=1]
|
||||||
exclude:
|
exclude:
|
||||||
- target: vc98
|
- target: vc98
|
||||||
select: -DMG_ENABLE_POLL=1
|
select: -DMG_ENABLE_POLL=1
|
||||||
name: windows ${{ matrix.target }} TFLAGS=${{ matrix.select }}
|
name: windows ${{ matrix.target }} SSL=${{ matrix.ssl }} TFLAGS=${{ matrix.select }}
|
||||||
env:
|
env:
|
||||||
|
SSL: SSL=${{ matrix.ssl }}
|
||||||
TFLAGS: ${{ matrix.select }}
|
TFLAGS: ${{ matrix.select }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: make ${{ matrix.target }}
|
- run: make -C test ${{ matrix.target }}
|
||||||
arm:
|
arm:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
|
name: Arm SSL=${{ matrix.ssl }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: make arm
|
- run: make -C test arm SSL=${{ matrix.ssl }}
|
||||||
riscv:
|
riscv:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", BUILTIN]
|
||||||
|
name: RISC-V SSL=${{ matrix.ssl }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: make riscv
|
- run: make -C test riscv SSL=${{ matrix.ssl }}
|
||||||
|
|
||||||
examples:
|
examples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: [-DMG_TLS=MG_TLS_NONE, -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: examples ${{ matrix.ssl }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: sudo apt -y install libmbedtls-dev libpcap-dev
|
- run: sudo apt -y install libpcap-dev
|
||||||
- run: make examples
|
- run: make -C test examples CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
- run: make clean
|
- run: make -C test clean_examples
|
||||||
examples_win:
|
examples_win:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: examples_win ${{ matrix.ssl }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
# - uses: egor-tensin/setup-mingw@v2
|
# - uses: egor-tensin/setup-mingw@v2
|
||||||
# with:
|
# with:
|
||||||
# platform: x64
|
# platform: x64
|
||||||
- name: test they build
|
- name: test they build
|
||||||
run: make examples_win
|
run: make -C test examples_win CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
shell: cmd
|
shell: cmd
|
||||||
- name: test they clean
|
- name: test they clean
|
||||||
run: make clean_examples_win
|
run: make -C test clean_examples_win
|
||||||
shell: cmd
|
shell: cmd
|
||||||
examples_mac:
|
examples_mac:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: examples_mac ${{ matrix.ssl }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: make examples_mac
|
- run: make -C test examples_mac CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
- run: make clean_examples_mac
|
- run: make -C test clean_examples_mac
|
||||||
|
|
||||||
|
refprojs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: reference-projects ${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test refprojs CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
|
- run: make -C test clean_refprojs
|
||||||
|
refprojs_win:
|
||||||
|
runs-on: windows-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: reference-projects_win ${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
# - uses: egor-tensin/setup-mingw@v2
|
||||||
|
# with:
|
||||||
|
# platform: x64
|
||||||
|
- name: test they build
|
||||||
|
run: make -C test refprojs_win CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
|
shell: cmd
|
||||||
|
- name: test they clean
|
||||||
|
run: make -C test clean_refprojs_win
|
||||||
|
shell: cmd
|
||||||
|
refprojs_mac:
|
||||||
|
runs-on: macos-latest
|
||||||
|
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: reference-projects_mac ${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test refprojs CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
|
- run: make -C test clean_refprojs
|
||||||
|
|
||||||
|
tutorials:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: tutorials ${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: sudo apt -y install libpcap-dev
|
||||||
|
- run: make -C test tutorials CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
|
- run: make -C test clean_tutorials
|
||||||
|
tutorials_win:
|
||||||
|
runs-on: windows-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: tutorials_win ${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
# - uses: egor-tensin/setup-mingw@v2
|
||||||
|
# with:
|
||||||
|
# platform: x64
|
||||||
|
- name: test they build
|
||||||
|
run: make -C test tutorials_win CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
|
shell: cmd
|
||||||
|
- name: test they clean
|
||||||
|
run: make -C test clean_tutorials_win
|
||||||
|
shell: cmd
|
||||||
|
tutorials_mac:
|
||||||
|
runs-on: macos-latest
|
||||||
|
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
ssl: ["", -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
|
name: tutorials_mac ${{ matrix.ssl }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test tutorials_mac CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
|
- run: make -C test clean_tutorials_mac
|
||||||
|
|
||||||
|
|
||||||
arduino:
|
arduino:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: echo # nothing specific to install or do
|
- run: echo # nothing specific to install or do
|
||||||
- run: make -C examples/arduino arduino-xiao
|
- run: make -C examples/arduino arduino-xiao
|
||||||
|
# TODO(): - run: make -C examples/arduino arduino-esp32
|
||||||
|
# TODO(): - run: make -C examples/arduino arduino-teensy41
|
||||||
# - run: make -C examples/arduino arduino-nano
|
# - run: make -C examples/arduino arduino-nano
|
||||||
- run: make -C examples/arduino clean
|
- run: make -C examples/arduino clean
|
||||||
|
|
||||||
|
|
||||||
|
# wizard_examples:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# strategy:
|
||||||
|
# fail-fast: false
|
||||||
|
# matrix:
|
||||||
|
# example:
|
||||||
|
# - path: esp32/esp32-idf
|
||||||
|
# name: ${{ matrix.example.path }}
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - run: echo # nothing specific to install or do
|
||||||
|
# fi
|
||||||
|
# - run: make -C examples/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
wizard_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: infineon/infineon-xmc7200
|
||||||
|
- path: nxp/frdm-mcxn947-make-baremetal-builtin
|
||||||
|
- path: nxp/frdm-mcxn947-make-freertos-builtin
|
||||||
|
- path: nxp/rt1020-evk-make-baremetal-builtin
|
||||||
|
- path: nxp/rt1060-evk-make-baremetal-builtin
|
||||||
|
- path: nxp/rt1170-evk-make-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-w-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-2-w-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/w5500-evb-pico2-picosdk-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f429zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f429zi-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f746zg-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h563zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h563zi-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h723zg-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h723zg-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h743zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h743zi-make-freertos-builtin
|
||||||
|
- path: stm32/stm32h573i-dk-make-baremetal-builtin
|
||||||
|
- path: stm32/stm32h573i-dk-make-freertos-builtin
|
||||||
|
- path: ti/ek-tm4c1294xl-make-baremetal-builtin
|
||||||
|
- path: ti/ek-tm4c1294xl-make-freertos-builtin
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 2 }
|
||||||
|
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C examples/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
|
||||||
generic_examples:
|
generic_examples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
@@ -157,9 +377,8 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^src|^examples/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi
|
|
||||||
- run: echo # nothing specific to install or do
|
- run: echo # nothing specific to install or do
|
||||||
- run: make -C examples/${{ matrix.example.path }} build
|
- run: make -C examples/${{ matrix.example.path }} build
|
||||||
|
|
||||||
@@ -190,7 +409,7 @@ jobs:
|
|||||||
- path: nxp/nxp-lpcxpresso54628-lwip-freertos
|
- path: nxp/nxp-lpcxpresso54628-lwip-freertos
|
||||||
- path: nxp/nxp-twrk65f180m-lwip-freertos
|
- path: nxp/nxp-twrk65f180m-lwip-freertos
|
||||||
- path: nxp/nxp-twrkv58f220m-lwip-freertos
|
- path: nxp/nxp-twrkv58f220m-lwip-freertos
|
||||||
- path: rp2040/pico-rmii
|
- path: pico-sdk/pico-rmii
|
||||||
- path: stm32/nucleo-f429zi-make-baremetal-builtin-rndis
|
- path: stm32/nucleo-f429zi-make-baremetal-builtin-rndis
|
||||||
- path: stm32/nucleo-f746zg-make-baremetal-builtin-rndis
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin-rndis
|
||||||
- path: stm32/nucleo-g031-make-baremetal-builtin
|
- path: stm32/nucleo-g031-make-baremetal-builtin
|
||||||
@@ -198,7 +417,7 @@ jobs:
|
|||||||
- path: ti/ek-tm4c1294xl-make-baremetal-builtin-rndis
|
- path: ti/ek-tm4c1294xl-make-baremetal-builtin-rndis
|
||||||
name: ${{ matrix.example.path }}
|
name: ${{ matrix.example.path }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
- run: make -C examples/${{ matrix.example.path }} build
|
- run: make -C examples/${{ matrix.example.path }} build
|
||||||
@@ -212,7 +431,7 @@ jobs:
|
|||||||
- path: esp32/device-dashboard
|
- path: esp32/device-dashboard
|
||||||
name: ${{ matrix.example.path }}
|
name: ${{ matrix.example.path }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: echo # nothing specific to install or do
|
- run: echo # nothing specific to install or do
|
||||||
- run: make -C examples/${{ matrix.example.path }} build
|
- run: make -C examples/${{ matrix.example.path }} build
|
||||||
@@ -222,36 +441,24 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
ssl: ["", -DMG_TLS=MG_TLS_BUILTIN]
|
||||||
example:
|
example:
|
||||||
- path: microchip/same54-xpro/device-dashboard
|
- path: microchip/same54-xpro/device-dashboard
|
||||||
- path: nxp/rt1020-evk-make-baremetal-builtin
|
|
||||||
- path: nxp/rt1020-evk-make-freertos-builtin
|
- path: nxp/rt1020-evk-make-freertos-builtin
|
||||||
- path: nxp/rt1060-evk-make-baremetal-builtin
|
|
||||||
- path: nxp/rt1060-evk-make-freertos-builtin
|
- path: nxp/rt1060-evk-make-freertos-builtin
|
||||||
- path: rp2040/pico-rndis-dashboard
|
- path: nxp/rt1170-evk-make-freertos-builtin
|
||||||
- path: rp2040/pico-w
|
- path: renesas/ek-ra6m4-make-baremetal-builtin
|
||||||
- path: rp2040/pico-w5500
|
- path: pico-sdk/pico-rndis-dashboard
|
||||||
- path: stm32/nucleo-f429zi-make-baremetal-builtin
|
- path: pico-sdk/pico-w-picosdk-freertos-lwip
|
||||||
- path: stm32/nucleo-f429zi-make-freertos-builtin
|
- path: pico-sdk/pico-2-w-picosdk-freertos-lwip
|
||||||
- path: stm32/nucleo-f746zg-make-baremetal-builtin
|
|
||||||
- path: stm32/nucleo-f746zg-make-freertos-builtin
|
|
||||||
- path: stm32/nucleo-f746zg-make-freertos-tcp
|
- path: stm32/nucleo-f746zg-make-freertos-tcp
|
||||||
- path: stm32/nucleo-f746zg-make-baremetal-builtin-cmsis_driver
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin-cmsis_driver
|
||||||
- path: stm32/nucleo-h563zi-make-baremetal-builtin
|
name: ${{ matrix.example.path }} ${{ matrix.ssl }}
|
||||||
- path: stm32/nucleo-h563zi-make-freertos-builtin
|
|
||||||
- path: stm32/nucleo-h723zg-make-freertos-builtin
|
|
||||||
- path: stm32/nucleo-h743zi-make-baremetal-builtin
|
|
||||||
- path: stm32/nucleo-h743zi-make-freertos-builtin
|
|
||||||
- path: stm32/stm32h573i-dk-make-baremetal-builtin
|
|
||||||
- path: stm32/stm32h573i-dk-make-freertos-builtin
|
|
||||||
- path: ti/ek-tm4c1294xl-make-baremetal-builtin
|
|
||||||
- path: ti/ek-tm4c1294xl-make-freertos-builtin
|
|
||||||
name: ${{ matrix.example.path }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
- run: make -C examples/${{ matrix.example.path }} build
|
- run: make -C examples/${{ matrix.example.path }} build CFLAGS_EXTRA="${{ matrix.ssl }}"
|
||||||
|
|
||||||
# mqtt_dashboard_examples:
|
# mqtt_dashboard_examples:
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
@@ -262,7 +469,7 @@ jobs:
|
|||||||
# - path:
|
# - path:
|
||||||
# name: ${{ matrix.example.path }}
|
# name: ${{ matrix.example.path }}
|
||||||
# steps:
|
# steps:
|
||||||
# - uses: actions/checkout@v3
|
# - uses: actions/checkout@v4
|
||||||
# with: { fetch-depth: 2 }
|
# with: { fetch-depth: 2 }
|
||||||
# - run: echo # nothing specific to install or do
|
# - run: echo # nothing specific to install or do
|
||||||
# - run: make -C examples/${{ matrix.example.path }} build
|
# - run: make -C examples/${{ matrix.example.path }} build
|
||||||
@@ -273,10 +480,10 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
example:
|
example:
|
||||||
- path: rp2040/pico-rndis-device
|
- path: pico-sdk/pico-rndis-device
|
||||||
name: ${{ matrix.example.path }}
|
name: ${{ matrix.example.path }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
- run: make -C examples/${{ matrix.example.path }} build
|
- run: make -C examples/${{ matrix.example.path }} build
|
||||||
@@ -290,42 +497,27 @@ jobs:
|
|||||||
# - path:
|
# - path:
|
||||||
# name: ${{ matrix.example.path }}
|
# name: ${{ matrix.example.path }}
|
||||||
# steps:
|
# steps:
|
||||||
# - uses: actions/checkout@v3
|
# - uses: actions/checkout@v4
|
||||||
# with: { fetch-depth: 2 }
|
# with: { fetch-depth: 2 }
|
||||||
# - run: echo # nothing specific to install or do
|
# - run: echo # nothing specific to install or do
|
||||||
# - run: make -C examples/${{ matrix.example.path }} device_dashboard
|
# - run: make -C examples/${{ matrix.example.path }} device_dashboard
|
||||||
# - run: make -C examples/${{ matrix.example.path }} mqtt_dashboard
|
# - run: make -C examples/${{ matrix.example.path }} mqtt_dashboard
|
||||||
|
|
||||||
dual_examples_arm:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
example:
|
|
||||||
- path: stm32/nucleo-h723zg-make-baremetal-builtin
|
|
||||||
name: ${{ matrix.example.path }}
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with: { fetch-depth: 2 }
|
|
||||||
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
|
||||||
- run: make -C examples/${{ matrix.example.path }} device_dashboard
|
|
||||||
- run: make -C examples/${{ matrix.example.path }} mqtt_dashboard
|
|
||||||
|
|
||||||
cube_examples:
|
cube_examples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: echo # nothing specific to install or do
|
- run: sudo pip install yq
|
||||||
- run: cd test/cube && make
|
- run: cd test/cube && make
|
||||||
|
|
||||||
zephyr_examples:
|
zephyr_examples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
- run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
- run: make -C examples/zephyr init
|
- run: make -C examples/zephyr init REPO=zephyrprojectrtos/ci:v0.26.14 # "no space left on device" with newers
|
||||||
- name: minify manifest
|
- name: minify manifest
|
||||||
uses: mikefarah/yq@master
|
uses: mikefarah/yq@master
|
||||||
with:
|
with:
|
||||||
@@ -340,7 +532,7 @@ jobs:
|
|||||||
test_f7:
|
test_f7:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
@@ -349,14 +541,14 @@ jobs:
|
|||||||
- run: make -C examples/stm32/nucleo-f746zg-make-freertos-tcp test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
- run: make -C examples/stm32/nucleo-f746zg-make-freertos-tcp test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
- name: Cube
|
- name: Cube
|
||||||
run: echo # nothing specific to install or do
|
run: echo # nothing specific to install or do
|
||||||
- run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
# - run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
- run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
# - run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
- run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-freertos-lwip VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
- run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-freertos-lwip VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
|
|
||||||
test_f4:
|
test_f4:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
@@ -364,28 +556,28 @@ jobs:
|
|||||||
- run: make -C examples/stm32/nucleo-f429zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
- run: make -C examples/stm32/nucleo-f429zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
- name: Cube
|
- name: Cube
|
||||||
run: echo # nothing specific to install or do
|
run: echo # nothing specific to install or do
|
||||||
- run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
# - run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
- run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
# - run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
- run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-freertos-lwip VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
- run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-freertos-lwip VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
|
|
||||||
test_h743:
|
test_h743:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 3 }
|
with: { fetch-depth: 3 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
- run: make -C examples/stm32/nucleo-h743zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
- run: make -C examples/stm32/nucleo-h743zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
- run: make -C examples/stm32/nucleo-h743zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
- run: make -C examples/stm32/nucleo-h743zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
- name: Cube
|
# - name: Cube
|
||||||
run: echo # nothing specific to install or do
|
# run: echo # nothing specific to install or do
|
||||||
- run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-h743zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
# - run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-h743zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
||||||
- run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-h743zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
# - run: make -C test/cube test PROJECTS=../../examples/stm32/nucleo-h743zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
||||||
|
|
||||||
test_h723:
|
test_h723:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 3 }
|
with: { fetch-depth: 3 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
@@ -395,7 +587,7 @@ jobs:
|
|||||||
test_h5:
|
test_h5:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 3 }
|
with: { fetch-depth: 3 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
@@ -405,7 +597,7 @@ jobs:
|
|||||||
test_rt1020:
|
test_rt1020:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 3 }
|
with: { fetch-depth: 3 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
@@ -415,17 +607,37 @@ jobs:
|
|||||||
test_rt1060:
|
test_rt1060:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 3 }
|
with: { fetch-depth: 3 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
- run: make -C examples/nxp/rt1060-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
- run: make -C examples/nxp/rt1060-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
- run: make -C examples/nxp/rt1060-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
- run: make -C examples/nxp/rt1060-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_rt1170:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C examples/nxp/rt1170-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
- run: make -C examples/nxp/rt1170-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
|
test_ra6m4:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
- run: make -C examples/renesas/ek-ra6m4-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# - run: make -C examples/renesas/ek-ra6m4-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
test_tm4c:
|
test_tm4c:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
@@ -435,7 +647,7 @@ jobs:
|
|||||||
test_same54:
|
test_same54:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
@@ -445,9 +657,9 @@ jobs:
|
|||||||
test_pico_w5500:
|
test_pico_w5500:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- name: SDK
|
- name: SDK
|
||||||
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
run: sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
- run: make -C examples/rp2040/pico-w5500 test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
- run: make -C examples/pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
+265
-192
@@ -15,64 +15,58 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
cc: [gcc, clang++]
|
cc: [gcc, clang++]
|
||||||
target: [test, mip_test]
|
target: [test, mip_test]
|
||||||
ssl: ["", MBEDTLS]
|
ssl: ["", BUILTIN]
|
||||||
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }}}
|
name: linux ${{ matrix.target }} CC=${{ matrix.cc }} SSL=${{ matrix.ssl }}
|
||||||
env:
|
env:
|
||||||
CC: ${{ matrix.cc }}
|
CC: ${{ matrix.cc }}
|
||||||
SSL: ${{ matrix.ssl }}
|
SSL: ${{ matrix.ssl }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: ./test/setup_ga_network.sh && sudo apt -y update ; sudo apt -y install libmbedtls-dev && make ${{ matrix.target }}
|
run: make -C test ${{ matrix.target }}
|
||||||
s390:
|
s390:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make s390
|
run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test s390
|
||||||
armhf:
|
armhf:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: sudo apt -y update ; sudo apt -y install qemu binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make armhf
|
run: sudo apt -y update ; sudo apt -y install binfmt-support qemu-user-static && docker run --rm --privileged multiarch/qemu-user-static --reset -p yes && make -C test armhf
|
||||||
linux2:
|
unamalgamated-mg_prefix:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: sudo apt -y update ; sudo apt -y install libmbedtls-dev valgrind
|
run: make -C test unamalgamated && make -C test mg_prefix
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make unamalgamated && make valgrind && make mg_prefix
|
|
||||||
macos:
|
macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
ssl: ["", MBEDTLS]
|
ssl: ["", BUILTIN]
|
||||||
name: macos SSL=${{ matrix.ssl }}
|
name: macos SSL=${{ matrix.ssl }}
|
||||||
env:
|
env:
|
||||||
SSL: ${{ matrix.ssl }}
|
SSL: ${{ matrix.ssl }}
|
||||||
TFLAGS: -DNO_SNTP_CHECK -Wno-sign-conversion # Workaround for MbedTLS 3.5.0
|
#TFLAGS: -DNO_SNTP_CHECK
|
||||||
HOMEBREW_NO_AUTO_UPDATE: 1
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: brew install jq mbedtls openssl
|
run: make -C test test ASAN_OPTIONS=
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make test ASAN_OPTIONS= MBEDTLS=`echo /usr/local/Cellar/mbedtls*/*` OPENSSL=`echo /usr/local/Cellar/openssl*/*`
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make mg_prefix
|
|
||||||
windows:
|
windows:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
@@ -81,75 +75,168 @@ jobs:
|
|||||||
target: [vc98, vc22, mingw++]
|
target: [vc98, vc22, mingw++]
|
||||||
name: windows ${{ matrix.target }}
|
name: windows ${{ matrix.target }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: if ./test/match_changed_files.sh '^test|^src/.*.[ch]' ; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make ${{ matrix.target }}
|
run: make -C test ${{ matrix.target }}
|
||||||
arm:
|
arm:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: make arm
|
- run: make -C test arm
|
||||||
riscv:
|
riscv:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: make riscv
|
- run: make -C test riscv
|
||||||
|
|
||||||
examples:
|
examples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: sudo apt -y install libmbedtls-dev libpcap-dev
|
- run: make -C test examples_essential
|
||||||
- run: make examples
|
- run: make -C test clean_examples_essential
|
||||||
- run: make clean
|
|
||||||
examples_win:
|
examples_win:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
# - uses: egor-tensin/setup-mingw@v2
|
# - uses: egor-tensin/setup-mingw@v2
|
||||||
# with:
|
# with:
|
||||||
# platform: x64
|
# platform: x64
|
||||||
- name: test they build
|
- name: test they build
|
||||||
run: make examples_win
|
run: make -C test examples_win
|
||||||
shell: cmd
|
shell: cmd
|
||||||
- name: test they clean
|
- name: test they clean
|
||||||
run: make clean_examples_win
|
run: make -C test clean_examples_win
|
||||||
shell: cmd
|
shell: cmd
|
||||||
examples_mac:
|
examples_mac:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: make examples_mac
|
- run: make -C test examples_mac
|
||||||
- run: make clean_examples_mac
|
- run: make -C test clean_examples_mac
|
||||||
|
|
||||||
|
refprojs:
|
||||||
arduino:
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test refprojs
|
||||||
|
- run: make -C test clean_refprojs
|
||||||
|
refprojs_win:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
# - uses: egor-tensin/setup-mingw@v2
|
||||||
|
# with:
|
||||||
|
# platform: x64
|
||||||
|
- name: test they build
|
||||||
|
run: make -C test refprojs_win
|
||||||
|
shell: cmd
|
||||||
|
- name: test they clean
|
||||||
|
run: make -C test clean_refprojs_win
|
||||||
|
shell: cmd
|
||||||
|
refprojs_mac:
|
||||||
|
runs-on: macos-latest
|
||||||
|
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test refprojs
|
||||||
|
- run: make -C test clean_refprojs
|
||||||
|
|
||||||
|
tutorials:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test tutorials_essential
|
||||||
|
- run: make -C test clean_tutorials_essential
|
||||||
|
tutorials_win:
|
||||||
|
runs-on: windows-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
# - uses: egor-tensin/setup-mingw@v2
|
||||||
|
# with:
|
||||||
|
# platform: x64
|
||||||
|
- name: test they build
|
||||||
|
run: make -C test tutorials_win
|
||||||
|
shell: cmd
|
||||||
|
- name: test they clean
|
||||||
|
run: make -C test clean_tutorials_win
|
||||||
|
shell: cmd
|
||||||
|
tutorials_mac:
|
||||||
|
runs-on: macos-latest
|
||||||
|
env: { HOMEBREW_NO_AUTO_UPDATE: 1 }
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- run: make -C test tutorials_mac
|
||||||
|
- run: make -C test clean_tutorials_mac
|
||||||
|
|
||||||
|
|
||||||
|
# wizard_examples:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# strategy:
|
||||||
|
# fail-fast: false
|
||||||
|
# matrix:
|
||||||
|
# example:
|
||||||
|
# - path: esp32/esp32-idf
|
||||||
|
# name: ${{ matrix.example.path }}
|
||||||
|
# env:
|
||||||
|
# GO: 0
|
||||||
|
# steps:
|
||||||
|
# - uses: actions/checkout@v4
|
||||||
|
# with: { fetch-depth: 2 }
|
||||||
|
# - run: |
|
||||||
|
# if ./test/match_changed_files.sh '^src'; then
|
||||||
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
|
# # nothing specific to install or do
|
||||||
|
# fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: make -C examples/${{ matrix.example.path }} build
|
||||||
|
|
||||||
|
wizard_examples_arm:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
example:
|
||||||
|
- path: infineon/infineon-xmc7200
|
||||||
|
- path: nxp/frdm-mcxn947-make-baremetal-builtin
|
||||||
|
- path: nxp/frdm-mcxn947-make-freertos-builtin
|
||||||
|
- path: nxp/rt1020-evk-make-baremetal-builtin
|
||||||
|
- path: nxp/rt1060-evk-make-baremetal-builtin
|
||||||
|
- path: nxp/rt1170-evk-make-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-w-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/pico-2-w-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin
|
||||||
|
- path: pico-sdk/w5500-evb-pico2-picosdk-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f429zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f429zi-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-f746zg-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h563zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h563zi-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h723zg-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h723zg-make-freertos-builtin
|
||||||
|
- path: stm32/nucleo-h743zi-make-baremetal-builtin
|
||||||
|
- path: stm32/nucleo-h743zi-make-freertos-builtin
|
||||||
|
- path: stm32/stm32h573i-dk-make-baremetal-builtin
|
||||||
|
- path: stm32/stm32h573i-dk-make-freertos-builtin
|
||||||
|
- path: ti/ek-tm4c1294xl-make-baremetal-builtin
|
||||||
|
- path: ti/ek-tm4c1294xl-make-freertos-builtin
|
||||||
|
name: ${{ matrix.example.path }}
|
||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: |
|
- run: |
|
||||||
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/arduino" ; then
|
if ./test/match_changed_files.sh '^src'; then
|
||||||
echo GO=1 >> $GITHUB_ENV
|
echo GO=1 >> $GITHUB_ENV
|
||||||
# nothing specific to install or do
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
fi
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: |
|
run: make -C examples/${{ matrix.example.path }} build
|
||||||
if ./test/match_changed_files.sh '^src|examples/arduino'; then
|
|
||||||
make -C examples/arduino arduino-xiao
|
|
||||||
fi
|
|
||||||
# - if: ${{ env.GO == 1 }}
|
|
||||||
# run: |
|
|
||||||
# if ./test/match_changed_files.sh '^src|examples/arduino'; then
|
|
||||||
# make -C examples/arduino arduino-nano
|
|
||||||
# fi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: make -C examples/arduino clean
|
|
||||||
|
|
||||||
|
|
||||||
generic_examples:
|
generic_examples:
|
||||||
@@ -164,7 +251,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^src|^examples/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: if ./test/match_changed_files.sh '^src|^examples/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
@@ -185,7 +272,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: if ./test/match_changed_files.sh '^src|^examples/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi
|
- run: if ./test/match_changed_files.sh '^src|^examples/${{ matrix.example.path }}'; then echo GO=1 >> $GITHUB_ENV ; fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
@@ -204,7 +291,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: |
|
- run: |
|
||||||
if ./test/match_changed_files.sh '^src|examples/device-dashboard|^examples/${{ matrix.example.path }}'; then
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|^examples/${{ matrix.example.path }}'; then
|
||||||
@@ -221,33 +308,20 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
example:
|
example:
|
||||||
- path: microchip/same54-xpro/device-dashboard
|
- path: microchip/same54-xpro/device-dashboard
|
||||||
- path: nxp/rt1020-evk-make-baremetal-builtin
|
|
||||||
- path: nxp/rt1020-evk-make-freertos-builtin
|
- path: nxp/rt1020-evk-make-freertos-builtin
|
||||||
- path: nxp/rt1060-evk-make-baremetal-builtin
|
|
||||||
- path: nxp/rt1060-evk-make-freertos-builtin
|
- path: nxp/rt1060-evk-make-freertos-builtin
|
||||||
- path: rp2040/pico-rndis-dashboard
|
- path: nxp/rt1170-evk-make-freertos-builtin
|
||||||
- path: rp2040/pico-w
|
- path: renesas/ek-ra6m4-make-baremetal-builtin
|
||||||
- path: rp2040/pico-w5500
|
- path: pico-sdk/pico-rndis-dashboard
|
||||||
- path: stm32/nucleo-f429zi-make-baremetal-builtin
|
- path: pico-sdk/pico-w-picosdk-freertos-lwip
|
||||||
- path: stm32/nucleo-f429zi-make-freertos-builtin
|
- path: pico-sdk/pico-2-w-picosdk-freertos-lwip
|
||||||
- path: stm32/nucleo-f746zg-make-baremetal-builtin
|
|
||||||
- path: stm32/nucleo-f746zg-make-freertos-builtin
|
|
||||||
- path: stm32/nucleo-f746zg-make-freertos-tcp
|
- path: stm32/nucleo-f746zg-make-freertos-tcp
|
||||||
- path: stm32/nucleo-f746zg-make-baremetal-builtin-cmsis_driver
|
- path: stm32/nucleo-f746zg-make-baremetal-builtin-cmsis_driver
|
||||||
- path: stm32/nucleo-h563zi-make-baremetal-builtin
|
|
||||||
- path: stm32/nucleo-h563zi-make-freertos-builtin
|
|
||||||
- path: stm32/nucleo-h723zg-make-freertos-builtin
|
|
||||||
- path: stm32/nucleo-h743zi-make-baremetal-builtin
|
|
||||||
- path: stm32/nucleo-h743zi-make-freertos-builtin
|
|
||||||
- path: stm32/stm32h573i-dk-make-baremetal-builtin
|
|
||||||
- path: stm32/stm32h573i-dk-make-freertos-builtin
|
|
||||||
- path: ti/ek-tm4c1294xl-make-baremetal-builtin
|
|
||||||
- path: ti/ek-tm4c1294xl-make-freertos-builtin
|
|
||||||
name: ${{ matrix.example.path }}
|
name: ${{ matrix.example.path }}
|
||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: |
|
- run: |
|
||||||
if ./test/match_changed_files.sh '^src|examples/device-dashboard|^examples/${{ matrix.example.path }}'; then
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|^examples/${{ matrix.example.path }}'; then
|
||||||
@@ -268,7 +342,7 @@ jobs:
|
|||||||
# env:
|
# env:
|
||||||
# GO: 0
|
# GO: 0
|
||||||
# steps:
|
# steps:
|
||||||
# - uses: actions/checkout@v3
|
# - uses: actions/checkout@v4
|
||||||
# with: { fetch-depth: 2 }
|
# with: { fetch-depth: 2 }
|
||||||
# - run: |
|
# - run: |
|
||||||
# if ./test/match_changed_files.sh '^src|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
# if ./test/match_changed_files.sh '^src|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
||||||
@@ -284,12 +358,12 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
example:
|
example:
|
||||||
- path: rp2040/pico-rndis-device
|
- path: pico-sdk/pico-rndis-device
|
||||||
name: ${{ matrix.example.path }}
|
name: ${{ matrix.example.path }}
|
||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: |
|
- run: |
|
||||||
if ./test/match_changed_files.sh '^src|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
if ./test/match_changed_files.sh '^src|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
||||||
@@ -299,75 +373,17 @@ jobs:
|
|||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/${{ matrix.example.path }} build
|
run: make -C examples/${{ matrix.example.path }} build
|
||||||
|
|
||||||
# dual_examples:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# strategy:
|
|
||||||
# fail-fast: false
|
|
||||||
# matrix:
|
|
||||||
# example:
|
|
||||||
# - path:
|
|
||||||
# name: ${{ matrix.example.path }}
|
|
||||||
# env:
|
|
||||||
# GO: 0
|
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v3
|
|
||||||
# with: { fetch-depth: 2 }
|
|
||||||
# - run: |
|
|
||||||
# if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
|
||||||
# echo GO=1 >> $GITHUB_ENV
|
|
||||||
# # nothing specific to install or do
|
|
||||||
# fi
|
|
||||||
# - if: ${{ env.GO == 1 }}
|
|
||||||
# run: |
|
|
||||||
# if ./test/match_changed_files.sh '^src|examples/device-dashboard|^examples/${{ matrix.example.path }}'; then
|
|
||||||
# make -C examples/${{ matrix.example.path }} device_dashboard
|
|
||||||
# fi
|
|
||||||
# - if: ${{ env.GO == 1 }}
|
|
||||||
# run: |
|
|
||||||
# if ./test/match_changed_files.sh '^src|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
|
||||||
# make -C examples/${{ matrix.example.path }} mqtt_dashboard
|
|
||||||
# fi
|
|
||||||
|
|
||||||
dual_examples_arm:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
example:
|
|
||||||
- path: stm32/nucleo-h723zg-make-baremetal-builtin
|
|
||||||
name: ${{ matrix.example.path }}
|
|
||||||
env:
|
|
||||||
GO: 0
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with: { fetch-depth: 2 }
|
|
||||||
- run: |
|
|
||||||
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
|
||||||
echo GO=1 >> $GITHUB_ENV
|
|
||||||
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
|
||||||
fi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: |
|
|
||||||
if ./test/match_changed_files.sh '^src|examples/device-dashboard|^examples/${{ matrix.example.path }}'; then
|
|
||||||
make -C examples/${{ matrix.example.path }} device_dashboard
|
|
||||||
fi
|
|
||||||
- if: ${{ env.GO == 1 }}
|
|
||||||
run: |
|
|
||||||
if ./test/match_changed_files.sh '^src|examples/mqtt-dashboard/device|^examples/${{ matrix.example.path }}'; then
|
|
||||||
make -C examples/${{ matrix.example.path }} mqtt_dashboard
|
|
||||||
fi
|
|
||||||
|
|
||||||
cube_examples:
|
cube_examples:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- run: |
|
- run: |
|
||||||
if ./test/match_changed_files.sh '^src|examples/stm32/nucleo-*-cube-*'; then
|
if ./test/match_changed_files.sh '^src|examples/stm32/nucleo-*-cube-*'; then
|
||||||
echo GO=1 >> $GITHUB_ENV
|
echo GO=1 >> $GITHUB_ENV
|
||||||
# nothing specific to install or do
|
sudo pip install yq
|
||||||
fi
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: cd test/cube && make
|
run: cd test/cube && make
|
||||||
@@ -377,7 +393,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: |
|
run: |
|
||||||
@@ -387,6 +403,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
# always run baremetal on core or dashboard or specific example changes; other examples only on specific example changes
|
# always run baremetal on core or dashboard or specific example changes; other examples only on specific example changes
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
|
continue-on-error: true # continue so next test has a chance to re-flash and exit from collisions and flash failures
|
||||||
run: |
|
run: |
|
||||||
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f746zg-make-baremetal-builtin'; then
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f746zg-make-baremetal-builtin'; then
|
||||||
make -C examples/stm32/nucleo-f746zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
make -C examples/stm32/nucleo-f746zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
@@ -408,16 +425,16 @@ jobs:
|
|||||||
echo GO=1 >> $GITHUB_ENV
|
echo GO=1 >> $GITHUB_ENV
|
||||||
# nothing specific to install or do
|
# nothing specific to install or do
|
||||||
fi
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
# - if: ${{ env.GO == 1 }}
|
||||||
run: |
|
# run: |
|
||||||
if ./test/match_changed_files.sh 'examples/stm32/nucleo-f746zg-cube-baremetal-builtin'; then
|
# if ./test/match_changed_files.sh 'examples/stm32/nucleo-f746zg-cube-baremetal-builtin'; then
|
||||||
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
# make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
fi
|
# fi
|
||||||
- if: ${{ env.GO == 1 }}
|
# - if: ${{ env.GO == 1 }}
|
||||||
run: |
|
# run: |
|
||||||
if ./test/match_changed_files.sh 'examples/stm32/nucleo-f746zg-cube-freertos-builtin'; then
|
# if ./test/match_changed_files.sh 'examples/stm32/nucleo-f746zg-cube-freertos-builtin'; then
|
||||||
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
# make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f746zg-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=5
|
||||||
fi
|
# fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: |
|
run: |
|
||||||
if ./test/match_changed_files.sh 'examples/stm32/nucleo-f746zg-cube-freertos-lwip'; then
|
if ./test/match_changed_files.sh 'examples/stm32/nucleo-f746zg-cube-freertos-lwip'; then
|
||||||
@@ -430,7 +447,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: |
|
run: |
|
||||||
@@ -439,6 +456,7 @@ jobs:
|
|||||||
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
fi
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f429zi-make-baremetal-builtin'; then
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-f429zi-make-baremetal-builtin'; then
|
||||||
make -C examples/stm32/nucleo-f429zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
make -C examples/stm32/nucleo-f429zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
@@ -455,16 +473,16 @@ jobs:
|
|||||||
echo GO=1 >> $GITHUB_ENV
|
echo GO=1 >> $GITHUB_ENV
|
||||||
# nothing specific to install or do
|
# nothing specific to install or do
|
||||||
fi
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
# - if: ${{ env.GO == 1 }}
|
||||||
run: |
|
# run: |
|
||||||
if ./test/match_changed_files.sh 'examples/stm32/nucleo-f429zi-cube-baremetal-builtin'; then
|
# if ./test/match_changed_files.sh 'examples/stm32/nucleo-f429zi-cube-baremetal-builtin'; then
|
||||||
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
# make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
fi
|
# fi
|
||||||
- if: ${{ env.GO == 1 }}
|
# - if: ${{ env.GO == 1 }}
|
||||||
run: |
|
# run: |
|
||||||
if ./test/match_changed_files.sh 'examples/stm32/nucleo-f429zi-cube-freertos-builtin'; then
|
# if ./test/match_changed_files.sh 'examples/stm32/nucleo-f429zi-cube-freertos-builtin'; then
|
||||||
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
# make -C test/cube test PROJECTS=../../examples/stm32/nucleo-f429zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=2
|
||||||
fi
|
# fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: |
|
run: |
|
||||||
if ./test/match_changed_files.sh 'examples/stm32/nucleo-f429zi-cube-freertos-lwip'; then
|
if ./test/match_changed_files.sh 'examples/stm32/nucleo-f429zi-cube-freertos-lwip'; then
|
||||||
@@ -476,7 +494,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 3 }
|
with: { fetch-depth: 3 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: |
|
run: |
|
||||||
@@ -485,6 +503,7 @@ jobs:
|
|||||||
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
fi
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h743zi-make-baremetal-builtin'; then
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h743zi-make-baremetal-builtin'; then
|
||||||
make -C examples/stm32/nucleo-h743zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
make -C examples/stm32/nucleo-h743zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
@@ -494,30 +513,30 @@ jobs:
|
|||||||
if ./test/match_changed_files.sh 'examples/stm32/nucleo-h743zi-make-freertos-builtin'; then
|
if ./test/match_changed_files.sh 'examples/stm32/nucleo-h743zi-make-freertos-builtin'; then
|
||||||
make -C examples/stm32/nucleo-h743zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
make -C examples/stm32/nucleo-h743zi-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
fi
|
fi
|
||||||
- name: Cube
|
# - name: Cube
|
||||||
run: |
|
# run: |
|
||||||
echo GO=0 >> $GITHUB_ENV
|
# echo GO=0 >> $GITHUB_ENV
|
||||||
if ./test/match_changed_files.sh 'examples/stm32/nucleo-h74.*-cube-'; then
|
# if ./test/match_changed_files.sh 'examples/stm32/nucleo-h74.*-cube-'; then
|
||||||
echo GO=1 >> $GITHUB_ENV
|
# echo GO=1 >> $GITHUB_ENV
|
||||||
# nothing specific to install or do
|
# # nothing specific to install or do
|
||||||
fi
|
# fi
|
||||||
- if: ${{ env.GO == 1 }}
|
# - if: ${{ env.GO == 1 }}
|
||||||
run: |
|
# run: |
|
||||||
if ./test/match_changed_files.sh 'examples/stm32/nucleo-h743zi-cube-baremetal-builtin'; then
|
# if ./test/match_changed_files.sh 'examples/stm32/nucleo-h743zi-cube-baremetal-builtin'; then
|
||||||
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-h743zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
# make -C test/cube test PROJECTS=../../examples/stm32/nucleo-h743zi-cube-baremetal-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
||||||
fi
|
# fi
|
||||||
- if: ${{ env.GO == 1 }}
|
# - if: ${{ env.GO == 1 }}
|
||||||
run: |
|
# run: |
|
||||||
if ./test/match_changed_files.sh 'examples/stm32/nucleo-h743zi-cube-freertos-builtin'; then
|
# if ./test/match_changed_files.sh 'examples/stm32/nucleo-h743zi-cube-freertos-builtin'; then
|
||||||
make -C test/cube test PROJECTS=../../examples/stm32/nucleo-h743zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
# make -C test/cube test PROJECTS=../../examples/stm32/nucleo-h743zi-cube-freertos-builtin VCON_API_KEY=${{secrets.VCON_API_KEY}} DEVICE=6
|
||||||
fi
|
# fi
|
||||||
|
|
||||||
test_h723:
|
test_h723:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 3 }
|
with: { fetch-depth: 3 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: |
|
run: |
|
||||||
@@ -526,6 +545,7 @@ jobs:
|
|||||||
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
fi
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h723zg-make-baremetal-builtin'; then
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h723zg-make-baremetal-builtin'; then
|
||||||
make -C examples/stm32/nucleo-h723zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
make -C examples/stm32/nucleo-h723zg-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
@@ -541,7 +561,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 3 }
|
with: { fetch-depth: 3 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: |
|
run: |
|
||||||
@@ -550,6 +570,7 @@ jobs:
|
|||||||
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
fi
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h563zi-make-baremetal-builtin'; then
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/stm32/nucleo-h563zi-make-baremetal-builtin'; then
|
||||||
make -C examples/stm32/nucleo-h563zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
make -C examples/stm32/nucleo-h563zi-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
@@ -565,7 +586,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 3 }
|
with: { fetch-depth: 3 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: |
|
run: |
|
||||||
@@ -574,6 +595,7 @@ jobs:
|
|||||||
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
fi
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/nxp/rt1020-evk-make-baremetal-builtin'; then
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/nxp/rt1020-evk-make-baremetal-builtin'; then
|
||||||
make -C examples/nxp/rt1020-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
make -C examples/nxp/rt1020-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
@@ -589,7 +611,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 3 }
|
with: { fetch-depth: 3 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: |
|
run: |
|
||||||
@@ -598,6 +620,7 @@ jobs:
|
|||||||
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
fi
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/nxp/rt1060-evk-make-baremetal-builtin'; then
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/nxp/rt1060-evk-make-baremetal-builtin'; then
|
||||||
make -C examples/nxp/rt1060-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
make -C examples/nxp/rt1060-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
@@ -608,12 +631,62 @@ jobs:
|
|||||||
make -C examples/nxp/rt1060-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
make -C examples/nxp/rt1060-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
test_rt1170:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/nxp/rt1170.*-make-" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/nxp/rt1170-evk-make-baremetal-builtin'; then
|
||||||
|
make -C examples/nxp/rt1170-evk-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh 'examples/nxp/rt1170-evk-make-freertos-builtin'; then
|
||||||
|
make -C examples/nxp/rt1170-evk-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
|
||||||
|
test_ra6m4:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
GO: 0
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with: { fetch-depth: 3 }
|
||||||
|
- name: baremetal
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/renesas/ek-ra6m4.*-make-" ; then
|
||||||
|
echo GO=1 >> $GITHUB_ENV
|
||||||
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
|
fi
|
||||||
|
- if: ${{ env.GO == 1 }}
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
if ./test/match_changed_files.sh '^src|examples/device-dashboard|examples/renesas/ek-ra6m4-make-baremetal-builtin'; then
|
||||||
|
make -C examples/renesas/ek-ra6m4-make-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
fi
|
||||||
|
# - if: ${{ env.GO == 1 }}
|
||||||
|
# run: |
|
||||||
|
# if ./test/match_changed_files.sh 'examples/renesas/ek-ra6m4-make-freertos-builtin'; then
|
||||||
|
# make -C examples/renesas/ek-ra6m4-make-freertos-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
# fi
|
||||||
|
|
||||||
test_tm4c:
|
test_tm4c:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: |
|
run: |
|
||||||
@@ -637,7 +710,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- name: baremetal
|
- name: baremetal
|
||||||
run: |
|
run: |
|
||||||
@@ -661,14 +734,14 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GO: 0
|
GO: 0
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
with: { fetch-depth: 2 }
|
with: { fetch-depth: 2 }
|
||||||
- name: SDK
|
- name: SDK
|
||||||
run: |
|
run: |
|
||||||
if ./test/match_changed_files.sh "^src|examples/device-dashboard|examples/rp2040/pico-w5500" ; then
|
if ./test/match_changed_files.sh "^src" ; then
|
||||||
echo GO=1 >> $GITHUB_ENV
|
echo GO=1 >> $GITHUB_ENV
|
||||||
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
sudo apt -y update && sudo apt -y install gcc-arm-none-eabi
|
||||||
fi
|
fi
|
||||||
- if: ${{ env.GO == 1 }}
|
- if: ${{ env.GO == 1 }}
|
||||||
run: make -C examples/rp2040/pico-w5500 test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
run: make -C examples/pico-sdk/w5500-evb-pico-picosdk-baremetal-builtin test VCON_API_KEY=${{secrets.VCON_API_KEY}}
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: original workflow, updated
|
name: original workflow, outdated # *** YES, OUTDATED *** kept for hystorical/reference purposes, attachment, etc.
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Copyright (c) 2004-2013 Sergey Lyubka
|
Copyright (c) 2004-2013 Sergey Lyubka
|
||||||
Copyright (c) 2013-2023 Cesanta Software Limited
|
Copyright (c) 2013-2025 Cesanta Software Limited
|
||||||
All rights reserved
|
All rights reserved
|
||||||
|
|
||||||
This software is dual-licensed: you can redistribute it and/or modify
|
This software is dual-licensed: you can redistribute it and/or modify
|
||||||
|
|||||||
@@ -1,196 +0,0 @@
|
|||||||
SRCS = mongoose.c test/unit_test.c test/packed_fs.c
|
|
||||||
HDRS = $(wildcard src/*.h) $(wildcard src/drivers/*.h)
|
|
||||||
DEFS ?= -DMG_MAX_HTTP_HEADERS=7 -DMG_ENABLE_LINES -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_SSI=1 -DMG_ENABLE_ASSERT=1
|
|
||||||
WARN ?= -pedantic -W -Wall -Werror -Wshadow -Wdouble-promotion -fno-common -Wconversion -Wundef
|
|
||||||
OPTS ?= -O3 -g3
|
|
||||||
INCS ?= -Isrc -I.
|
|
||||||
SSL ?=
|
|
||||||
CWD ?= $(realpath $(CURDIR))
|
|
||||||
ENV ?= -e Tmp=. -e WINEDEBUG=-all
|
|
||||||
DOCKER_BIN ?= docker
|
|
||||||
DOCKER ?= $(DOCKER_BIN) run --platform linux/amd64 --rm $(ENV) -v $(CWD):$(CWD) -w $(CWD)
|
|
||||||
VCFLAGS = /nologo /W3 /O2 /MD /I. $(DEFS) $(TFLAGS)
|
|
||||||
IPV6 ?= 1
|
|
||||||
ASAN ?= -fsanitize=address,undefined,alignment -fno-sanitize-recover=all -fno-omit-frame-pointer -fno-common
|
|
||||||
ASAN_OPTIONS ?= detect_leaks=1
|
|
||||||
EXAMPLES := $(dir $(wildcard examples/*/Makefile))
|
|
||||||
EXAMPLES_MAC := $(filter-out examples/mip-pcap/ examples/mip-tap/ examples/micropython/, $(EXAMPLES))
|
|
||||||
EXAMPLES_WIN := $(dir $(wildcard examples/device-dashboard/Makefile) $(wildcard examples/file-*/Makefile) $(wildcard examples/http-*/Makefile) $(wildcard examples/mqtt-*/Makefile) $(wildcard examples/websocket-*/Makefile) $(wildcard examples/webui-*/Makefile))
|
|
||||||
EXAMPLES_EMBEDDED := $(filter-out $(wildcard examples/zephyr/*/), $(dir $(wildcard examples/*/*/Makefile)))
|
|
||||||
PREFIX ?= /usr/local
|
|
||||||
LIBDIR ?= $(PREFIX)/lib
|
|
||||||
INCLUDEDIR ?= $(PREFIX)/include
|
|
||||||
VERSION ?= $(shell cut -d'"' -f2 src/version.h)
|
|
||||||
COMMON_CFLAGS ?= $(C_WARN) $(WARN) $(INCS) $(DEFS) -DMG_ENABLE_IPV6=$(IPV6) $(TFLAGS) -pthread
|
|
||||||
CFLAGS ?= $(OPTS) $(ASAN) $(COMMON_CFLAGS)
|
|
||||||
VALGRIND_CFLAGS ?= $(OPTS) $(COMMON_CFLAGS)
|
|
||||||
VALGRIND_RUN ?= valgrind --tool=memcheck --gen-suppressions=all --leak-check=full --show-leak-kinds=all --leak-resolution=high --track-origins=yes --error-exitcode=1 --exit-on-first-error=yes --fair-sched=yes
|
|
||||||
.PHONY: clean_examples examples mip_test test valgrind
|
|
||||||
|
|
||||||
ifeq "$(findstring ++,$(CC))" ""
|
|
||||||
# $(CC) does not end with ++, i.e. we're using C. Apply C flags
|
|
||||||
C_WARN ?= -Wmissing-prototypes -Wstrict-prototypes
|
|
||||||
else
|
|
||||||
# $(CC) ends with ++, i.e. we're using C++. Apply C++ flags
|
|
||||||
C_WARN ?= -Wno-deprecated
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq "$(SSL)" "MBEDTLS"
|
|
||||||
MBEDTLS ?= /usr/local
|
|
||||||
CFLAGS += -DMG_TLS=MG_TLS_MBED -I$(MBEDTLS)/include -I/usr/include
|
|
||||||
LDFLAGS += -L$(MBEDTLS)/lib -lmbedtls -lmbedcrypto -lmbedx509
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq "$(SSL)" "OPENSSL"
|
|
||||||
OPENSSL ?= /usr/local
|
|
||||||
CFLAGS += -DMG_TLS=MG_TLS_OPENSSL -I$(OPENSSL)/include
|
|
||||||
LDFLAGS += -L$(OPENSSL)/lib -lssl -lcrypto
|
|
||||||
endif
|
|
||||||
|
|
||||||
all:
|
|
||||||
$(MAKE) -C examples/http-server
|
|
||||||
|
|
||||||
tall: mg_prefix unamalgamated test mip_test arm examples vc98 vc17 vc22 mingw mingw++ fuzz
|
|
||||||
|
|
||||||
mip_test: test/mip_test.c mongoose.c mongoose.h Makefile mip_tap_test
|
|
||||||
$(CC) test/mip_test.c $(INCS) $(WARN) $(OPTS) $(C_WARN) $(ASAN) -o $@
|
|
||||||
ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./$@
|
|
||||||
|
|
||||||
mip_tap_test: test/mip_tap_test.c mongoose.c mongoose.h Makefile
|
|
||||||
$(CC) test/mip_tap_test.c $(INCS) $(WARN) $(OPTS) $(C_WARN) $(ASAN) -o $@
|
|
||||||
ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./$@
|
|
||||||
|
|
||||||
examples:
|
|
||||||
@for X in $(EXAMPLES); do test -f $$X/Makefile || continue; $(MAKE) -C $$X example || exit 1; done
|
|
||||||
clean_examples:
|
|
||||||
for X in $(EXAMPLES); do test -f $$X/Makefile || continue; $(MAKE) -C $$X clean || exit 1; done
|
|
||||||
|
|
||||||
examples_mac:
|
|
||||||
for X in $(EXAMPLES_MAC); do test -f $$X/Makefile || continue; $(MAKE) -C $$X example || exit 1; done
|
|
||||||
clean_examples_mac:
|
|
||||||
for X in $(EXAMPLES_MAC); do test -f $$X/Makefile || continue; $(MAKE) -C $$X clean || exit 1; done
|
|
||||||
|
|
||||||
examples_win:
|
|
||||||
$(foreach X, $(EXAMPLES_WIN), $(MAKE) -C $(X) example &)
|
|
||||||
clean_examples_win:
|
|
||||||
$(foreach X, $(EXAMPLES_WIN), $(MAKE) -C $(X) clean &)
|
|
||||||
|
|
||||||
test/packed_fs.c: Makefile src/ssi.h test/fuzz.c test/data/a.txt test/data/ca.pem
|
|
||||||
$(CC) $(CFLAGS) test/pack.c -o pack
|
|
||||||
$(RUN) ./pack Makefile src/ssi.h test/fuzz.c test/data/a.txt test/data/range.txt test/data/ca.pem > $@
|
|
||||||
|
|
||||||
# Check that all external (exported) symbols have "mg_" prefix
|
|
||||||
mg_prefix: mongoose.c mongoose.h
|
|
||||||
$(CC) mongoose.c $(CFLAGS) -c -o /tmp/x.o && nm /tmp/x.o | grep ' T ' | grep -v 'mg_' ; test $$? = 1
|
|
||||||
|
|
||||||
musl: test
|
|
||||||
musl: ASAN =
|
|
||||||
musl: WARN += -Wno-sign-conversion
|
|
||||||
musl: CC = $(DOCKER) mdashnet/cc1 gcc
|
|
||||||
musl: RUN = $(DOCKER) mdashnet/cc1
|
|
||||||
|
|
||||||
# Make sure we can build from unamalgamated sources.
|
|
||||||
unamalgamated: CFLAGS += -DMG_ENABLE_MD5=1
|
|
||||||
unamalgamated: $(HDRS) Makefile test/packed_fs.c
|
|
||||||
$(CC) src/*.c test/packed_fs.c test/unit_test.c $(CFLAGS) $(LDFLAGS) -g -o unit_test
|
|
||||||
|
|
||||||
fuzz: ASAN = -fsanitize=fuzzer,signed-integer-overflow,address,undefined
|
|
||||||
fuzz: mongoose.c mongoose.h Makefile test/fuzz.c
|
|
||||||
$(CC) test/fuzz.c $(OPTS) $(WARN) $(INCS) $(TFLAGS) $(ASAN) -o fuzzer
|
|
||||||
$(RUN) ./fuzzer
|
|
||||||
|
|
||||||
FUZZDATA ?= /tmp/fuzzdata
|
|
||||||
fuzz2: mongoose.c mongoose.h Makefile test/fuzz.c
|
|
||||||
$(CC) test/fuzz.c -DMAIN $(OPTS) $(WARN) $(ASAN) $(INCS) -o fuzzer
|
|
||||||
$(RUN) ./fuzzer $(FUZZDATA)
|
|
||||||
|
|
||||||
test: Makefile mongoose.h $(SRCS)
|
|
||||||
$(CC) $(SRCS) $(CFLAGS) $(LDFLAGS) -o unit_test
|
|
||||||
ASAN_OPTIONS=$(ASAN_OPTIONS) $(RUN) ./unit_test
|
|
||||||
|
|
||||||
coverage: CFLAGS += -coverage
|
|
||||||
coverage: test
|
|
||||||
gcov -l -n *.gcno | sed '/^$$/d' | sed 'N;s/\n/ /'
|
|
||||||
gcov -t mongoose.c > mongoose.gcov
|
|
||||||
|
|
||||||
upload-coverage: coverage
|
|
||||||
curl -s https://codecov.io/bash | /bin/bash
|
|
||||||
|
|
||||||
valgrind: Makefile mongoose.h mongoose.c
|
|
||||||
$(CC) $(SRCS) $(VALGRIND_CFLAGS) $(LDFLAGS) -g -o unit_test
|
|
||||||
$(VALGRIND_RUN) ./unit_test
|
|
||||||
|
|
||||||
misra:
|
|
||||||
cppcheck --addon=misra -DMG_ARCH=MG_ARCH_UNIX -DMG_ENABLE_PACKED_FS=1 -DMG_ENABLE_SSI=1 mongoose.c >/tmp/x 2>&1
|
|
||||||
cppcheck --addon=misra -DMG_ARCH=MG_ARCH_CUSTOM -DMG_ENABLE_LINES=1 -DTLS=MG_TLS_BUILTIN -DMG_ENABLE_TCPIP=1 mongoose.c >>/tmp/x 2>&1
|
|
||||||
cppcheck --addon=misra --clang -DMG_ENABLE_LINES=1 -DTLS=MG_TLS_BUILTIN -DMG_ENABLE_TCPIP=1 mongoose.c >>/tmp/x 2>&1
|
|
||||||
cppcheck --addon=misra --clang -DMG_ENABLE_LINES=1 -DMG_ENABLE_SSI=1 mongoose.c >>/tmp/x 2>&1
|
|
||||||
less /tmp/x
|
|
||||||
|
|
||||||
armhf: ASAN=
|
|
||||||
armhf: IPV6=0
|
|
||||||
armhf: CC = $(DOCKER) mdashnet/armhf cc
|
|
||||||
armhf: RUN = $(DOCKER) mdashnet/armhf
|
|
||||||
armhf: test
|
|
||||||
|
|
||||||
s390: ASAN=
|
|
||||||
s390: IPV6=0
|
|
||||||
s390: CC = $(DOCKER) mdashnet/s390 cc
|
|
||||||
s390: RUN = $(DOCKER) mdashnet/s390
|
|
||||||
s390: test
|
|
||||||
|
|
||||||
arm: DEFS += -DMG_ENABLE_POSIX_FS=0 -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB
|
|
||||||
arm: mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/armgcc arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb $(SRCS) $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) -o unit_test -nostartfiles --specs nosys.specs -e 0
|
|
||||||
|
|
||||||
riscv: DEFS += -DMG_ENABLE_POSIX_FS=0 -DMG_ENABLE_TCPIP=1 -DMG_ARCH=MG_ARCH_NEWLIB
|
|
||||||
riscv: mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/riscv riscv-none-elf-gcc -march=rv32imc -mabi=ilp32 $(SRCS) $(OPTS) $(WARN) $(INCS) $(DEFS) $(TFLAGS) -o unit_test
|
|
||||||
|
|
||||||
vc98: Makefile mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/vc98 wine cl $(SRCS) $(VCFLAGS) ws2_32.lib /Fe$@.exe
|
|
||||||
$(DOCKER) mdashnet/vc98 wine $@.exe
|
|
||||||
|
|
||||||
vc17: Makefile mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/vc17 wine64 cl $(SRCS) $(VCFLAGS) ws2_32.lib /Fe$@.exe
|
|
||||||
$(DOCKER) mdashnet/vc17 wine64 $@.exe
|
|
||||||
|
|
||||||
vc22: Makefile mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/vc22 wine64 cl $(SRCS) $(VCFLAGS) ws2_32.lib /Fe$@.exe
|
|
||||||
$(DOCKER) mdashnet/vc22 wine64 $@.exe
|
|
||||||
|
|
||||||
mingw: Makefile mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-gcc $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o $@.exe
|
|
||||||
$(DOCKER) mdashnet/mingw wine64 $@.exe
|
|
||||||
|
|
||||||
mingw++: Makefile mongoose.h $(SRCS)
|
|
||||||
$(DOCKER) mdashnet/mingw x86_64-w64-mingw32-g++ $(SRCS) -W -Wall -Werror -I. $(DEFS) -lwsock32 -o $@.exe
|
|
||||||
|
|
||||||
linux-libs: CFLAGS += -fPIC
|
|
||||||
linux-libs: LDFLAGS += -Wl,-soname,libmongoose.so.$(VERSION)
|
|
||||||
linux-libs: mongoose.o
|
|
||||||
$(CC) mongoose.o $(LDFLAGS) -shared -o libmongoose.so.$(VERSION)
|
|
||||||
$(AR) rcs libmongoose.a mongoose.o
|
|
||||||
|
|
||||||
install: linux-libs
|
|
||||||
install -Dm644 libmongoose.a libmongoose.so.$(VERSION) $(DESTDIR)$(LIBDIR)
|
|
||||||
ln -s libmongoose.so.$(VERSION) $(DESTDIR)$(LIBDIR)/libmongoose.so
|
|
||||||
install -Dm644 mongoose.h $(DESTDIR)$(INCLUDEDIR)/mongoose.h
|
|
||||||
|
|
||||||
uninstall:
|
|
||||||
rm -rf $(DESTDIR)$(LIBDIR)/libmongoose.a $(DESTDIR)$(LIBDIR)/libmongoose.so.$(VERSION) $(DESTDIR)$(INCLUDEDIR)/mongoose.h $(DESTDIR)$(LIBDIR)/libmongoose.so
|
|
||||||
|
|
||||||
mongoose.c: Makefile $(wildcard src/*.c) $(wildcard src/drivers/*.c)
|
|
||||||
(export LC_ALL=C ; cat src/license.h; echo; echo '#include "mongoose.h"' ; (for F in src/*.c src/drivers/*.c ; do echo; echo '#ifdef MG_ENABLE_LINES'; echo "#line 1 \"$$F\""; echo '#endif'; cat $$F | sed -e 's,#include ".*,,'; done))> $@
|
|
||||||
|
|
||||||
mongoose.h: $(HDRS) Makefile
|
|
||||||
(cat src/license.h; echo; echo '#ifndef MONGOOSE_H'; echo '#define MONGOOSE_H'; echo; cat src/version.h ; echo; echo '#ifdef __cplusplus'; echo 'extern "C" {'; echo '#endif'; cat src/arch.h src/arch_*.h src/net_ft.h src/net_lwip.h src/net_rl.h src/config.h src/str.h src/queue.h src/fmt.h src/printf.h src/log.h src/timer.h src/fs.h src/util.h src/url.h src/iobuf.h src/base64.h src/md5.h src/sha1.h src/sha256.h src/tls_aes128.h src/tls_uecc.h src/event.h src/net.h src/http.h src/ssi.h src/tls.h src/tls_mbed.h src/tls_openssl.h src/ws.h src/sntp.h src/mqtt.h src/dns.h src/json.h src/rpc.h src/ota.h src/device.h src/net_builtin.h src/profile.h src/drivers/*.h | sed -e '/keep/! s,#include ".*,,' -e 's,^#pragma once,,'; echo; echo '#ifdef __cplusplus'; echo '}'; echo '#endif'; echo '#endif // MONGOOSE_H')> $@
|
|
||||||
|
|
||||||
|
|
||||||
clean: clean_examples clean_embedded
|
|
||||||
rm -rf $(PROG) *.exe *.o *.dSYM *_test* ut fuzzer *.gcov *.gcno *.gcda *.obj *.exe *.ilk *.pdb slow-unit* _CL_* infer-out data.txt crash-* test/packed_fs.c pack
|
|
||||||
#find examples -maxdepth 3 -name zephyr -prune -o -name Makefile -print | xargs dirname | xargs -n1 make clean -C
|
|
||||||
|
|
||||||
clean_embedded:
|
|
||||||
for X in $(EXAMPLES_EMBEDDED); do test -f $$X/Makefile || continue; $(MAKE) -C $$X clean || exit 1; done
|
|
||||||
|
|
||||||
@@ -1,75 +1,77 @@
|
|||||||
# Mongoose - Embedded Web Server / Embedded Networking Library
|
# Mongoose - Embedded Web Server / Embedded Network Library
|
||||||
|
|
||||||
[](https://opensource.org/licenses/gpl-2.0.php)
|
[](https://opensource.org/licenses/gpl-2.0.php)
|
||||||
[](https://github.com/cesanta/mongoose/actions)
|
[](https://github.com/cesanta/mongoose/actions)
|
||||||
[](https://codecov.io/gh/cesanta/mongoose)
|
[](https://codecov.io/gh/cesanta/mongoose)
|
||||||
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:mongoose)
|
[](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:mongoose)
|
||||||
|
[](https://gurubase.io/g/mongoose)
|
||||||
|
|
||||||
Mongoose is a network library for C/C++.
|
Mongoose is a network library for C/C++. It provides event-driven non-blocking
|
||||||
It implements event-driven
|
APIs for TCP, UDP, HTTP, WebSocket, MQTT, and other protocols. It is designed
|
||||||
non-blocking APIs for TCP, UDP, HTTP, WebSocket, MQTT. It is designed for
|
for connecting devices and bringing them online. On the market since 2004, used
|
||||||
connecting devices and bringing them online. On the market since 2004, used by
|
by vast number of open source and commercial products - it even runs on the
|
||||||
vast number of open source and commercial products - it even runs on the
|
|
||||||
International Space Station! Mongoose makes embedded network programming fast,
|
International Space Station! Mongoose makes embedded network programming fast,
|
||||||
robust, and easy. Features include:
|
robust, and easy. Features include:
|
||||||
|
|
||||||
- Cross-platform:
|
- Cross-platform:
|
||||||
- works on Linux/UNIX, MacOS, Windows, Android
|
- works on Linux/UNIX, MacOS, Windows, Android
|
||||||
- works on STM32, NXP, ESP32, NRF52, TI, Microchip, and other
|
- works on ST, NXP, ESP32, Nordic, TI, Microchip, Infineon, Renesas and other chips
|
||||||
- write code once - and it'll work everywhere
|
- write code once - and it'll work everywhere
|
||||||
- ideal for the unification of the network infrastructure code across company
|
- ideal for the unification of the network infrastructure code across company
|
||||||
- Built-in protocols: plain TCP/UDP, SNTP, HTTP, MQTT, Websocket
|
- Built-in protocols: plain TCP/UDP, SNTP, HTTP, MQTT, Websocket, and other
|
||||||
- SSL/TLS support for mbedTLS and OpenSSL
|
|
||||||
- Asynchronous DNS resolver
|
- Asynchronous DNS resolver
|
||||||
- Tiny static and run-time footprint
|
- Tiny static and run-time footprint
|
||||||
- Source code is both ISO C and ISO C++ compliant
|
- Source code is both ISO C and ISO C++ compliant
|
||||||
- Very easy to integrate: just copy `mongoose.c` and `mongoose.h` files to your source tree. See
|
- Easy to integrate: just copy [mongoose.c](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.c)
|
||||||
[exact steps](https://mongoose.ws/documentation/#2-minute-integration-guide)
|
and [mongoose.h](https://raw.githubusercontent.com/cesanta/mongoose/master/mongoose.h) files to your source tree
|
||||||
- Works in any environment with socket API, like LwIP, Zephyr, Azure
|
|
||||||
- Built-in TCP/IP stack with drivers for bare metal or RTOS systems
|
- Built-in TCP/IP stack with drivers for bare metal or RTOS systems
|
||||||
- Available drivers: STM32F, STM32H; NXP RT1xxx; TI TM4C; Microchip SAME54; Wiznet W5500
|
- Available drivers: STM32F, STM32H; NXP RT1xxx; TI TM4C; Microchip SAME54; Wiznet W5500
|
||||||
- A complete Web device dashboard on bare metal
|
- A complete Web device dashboard on bare metal ST Nucleo boards is only 6 files
|
||||||
[Nucleo-F429ZI](examples/stm32/nucleo-f429zi-baremetal) is only 6 files
|
|
||||||
- For comparison, a CubeIDE generated HTTP example is 400+ files
|
- For comparison, a CubeIDE generated HTTP example is 400+ files
|
||||||
- Built-in TLS 1.3 server-side support
|
- Can run on top of an existing TCP/IP stack with BSD API, e.g. lwIP, Zephyr, Azure, etc
|
||||||
|
- Built-in TLS 1.3 ECC stack. Also can use external TLS libraries - mbedTLS, OpenSSL, or other
|
||||||
- Does not depend on any other software to implement networking
|
- Does not depend on any other software to implement networking
|
||||||
- Built-in firmware updates for STM32H5, STM32H7, and more coming
|
- Built-in firmware updates for STM32 H5, STM32 H7
|
||||||
- Detailed [user guide, API reference and tons of tutorials](https://mongoose.ws/documentation/)
|
|
||||||
|
|
||||||
## Usage
|
See https://mongoose.ws/ for complete documentation, videos, case studies, etc.
|
||||||
|
|
||||||
|
## Usage Examples
|
||||||
|
|
||||||
|
Below are quick snippets that should give an idea how simple the API is and
|
||||||
|
how easy it is to create applications with it.
|
||||||
|
|
||||||
Create a simple web server that serves a directory. The behavior of the
|
Create a simple web server that serves a directory. The behavior of the
|
||||||
HTTP server is specified by its event handler function:
|
HTTP server is specified by its event handler function:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
#include "mongoose.h"
|
#include "mongoose.h" // To build, run: cc main.c mongoose.c
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
struct mg_mgr mgr; // Declare event manager
|
|
||||||
mg_mgr_init(&mgr); // Initialise event manager
|
|
||||||
mg_http_listen(&mgr, "http://0.0.0.0:8000", fn, NULL); // Setup listener
|
|
||||||
for (;;) {
|
|
||||||
mg_mgr_poll(&mgr, 1000); // Run an infinite event loop
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// HTTP server event handler function
|
// HTTP server event handler function
|
||||||
void fn(struct mg_connection *c, int ev, void *ev_data) {
|
void ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
if (ev == MG_EV_HTTP_MSG) {
|
if (ev == MG_EV_HTTP_MSG) {
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
struct mg_http_serve_opts opts = { .root_dir = "./web_root/" };
|
struct mg_http_serve_opts opts = { .root_dir = "./web_root/" };
|
||||||
mg_http_serve_dir(c, hm, &opts);
|
mg_http_serve_dir(c, hm, &opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int main(void) {
|
||||||
|
struct mg_mgr mgr; // Declare event manager
|
||||||
|
mg_mgr_init(&mgr); // Initialise event manager
|
||||||
|
mg_http_listen(&mgr, "http://0.0.0.0:8000", ev_handler, NULL); // Setup listener
|
||||||
|
for (;;) { // Run an infinite event loop
|
||||||
|
mg_mgr_poll(&mgr, 1000);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
HTTP server implements a REST API that returns current time. JSON formatting:
|
HTTP server implements a REST API that returns current time. JSON formatting:
|
||||||
```c
|
```c
|
||||||
static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
static void ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
if (ev == MG_EV_HTTP_MSG) {
|
if (ev == MG_EV_HTTP_MSG) {
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
if (mg_http_match_uri(hm, "/api/time/get")) {
|
if (mg_match(hm->uri, mg_str("/api/time/get"), NULL)) {
|
||||||
mg_http_reply(c, 200, "", "{%m:%lu}\n", MG_ESC("time"), time(NULL));
|
mg_http_reply(c, 200, "", "{%m:%lu}\n", MG_ESC("time"), time(NULL));
|
||||||
} else {
|
} else {
|
||||||
mg_http_reply(c, 500, "", "{%m:%m}\n", MG_ESC("error"), MG_ESC("Unsupported URI"));
|
mg_http_reply(c, 500, "", "{%m:%m}\n", MG_ESC("error"), MG_ESC("Unsupported URI"));
|
||||||
@@ -78,20 +80,55 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
MQTT client that subscribes to a topic `aa/bb` and prints all incoming messages:
|
MQTT client that subscribes to a topic `device1/rx` and
|
||||||
|
echoes incoming messages to `device1/tx`:
|
||||||
|
|
||||||
```c
|
```c
|
||||||
static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
#include "mongoose.h"
|
||||||
if (ev == MG_EV_MQTT_OPEN) {
|
|
||||||
struct mg_mqtt_opts opts = {.qos = 1, .topic = mg_str("aa/bb")};
|
static const char *s_mqtt_url = "mqtt://broker.hivemq.com:1883";
|
||||||
|
static struct mg_connection *s_mqtt_conn = NULL;
|
||||||
|
|
||||||
|
// MQTT connection event handler function
|
||||||
|
static void ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
|
if (ev == MG_EV_OPEN) {
|
||||||
|
MG_INFO(("%lu created, connecting to %s ...", c->id, s_mqtt_url));
|
||||||
|
} else if (ev == MG_EV_MQTT_OPEN) {
|
||||||
|
struct mg_mqtt_opts opts = {.qos = 1, .topic = mg_str("device1/rx")};
|
||||||
mg_mqtt_sub(c, &opts);
|
mg_mqtt_sub(c, &opts);
|
||||||
|
MG_INFO(("%lu connected, subscribing to %s", c->id, opts.topic.buf));
|
||||||
} else if (ev == MG_EV_MQTT_MSG) {
|
} else if (ev == MG_EV_MQTT_MSG) {
|
||||||
|
char response[100];
|
||||||
struct mg_mqtt_message *mm = (struct mg_mqtt_message *) ev_data;
|
struct mg_mqtt_message *mm = (struct mg_mqtt_message *) ev_data;
|
||||||
printf("Topic: %.*s, Message: %.*s",
|
struct mg_mqtt_opts opts = {.qos = 1, .topic = mg_str("device1/tx")};
|
||||||
mm->topic.len, mm->topic.ptr,
|
mg_snprintf(response, sizeof(response), "Received [%.*s] / [%.*s]",
|
||||||
mm->data.len, mm->data.ptr);
|
mm->topic.len, mm->topic.buf, mm->data.len, mm->data.buf);
|
||||||
|
opts.message = mg_str(response);
|
||||||
|
mg_mqtt_pub(c, &opts);
|
||||||
|
} else if (ev == MG_EV_CLOSE) {
|
||||||
|
MG_INFO(("%u closing", c->id));
|
||||||
|
s_mqtt_conn = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reconnection timer function. If we get disconnected, reconnect again
|
||||||
|
static void timer_fn(void *arg) {
|
||||||
|
struct mg_mgr *mgr = (struct mg_mgr *) arg;
|
||||||
|
if (s_mqtt_conn == NULL) {
|
||||||
|
struct mg_mqtt_opts opts = {.clean = true};
|
||||||
|
s_mqtt_conn = mg_mqtt_connect(mgr, s_mqtt_url, &opts, ev_handler, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
struct mg_mgr mgr; // Mongoose event manager. Holds all connections
|
||||||
|
mg_mgr_init(&mgr); // Initialise event manager
|
||||||
|
mg_timer_add(&mgr, 3000, MG_TIMER_REPEAT | MG_TIMER_RUN_NOW, timer_fn, &mgr);
|
||||||
|
for (;;) {
|
||||||
|
mg_mgr_poll(&mgr, 1000); // Infinite event loop
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Commercial use
|
## Commercial use
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ arduino-xiao-board:
|
|||||||
./arduino/arduino --install-boards Seeeduino:samd
|
./arduino/arduino --install-boards Seeeduino:samd
|
||||||
|
|
||||||
arduino-xiao: arduino arduino-xiao-board
|
arduino-xiao: arduino arduino-xiao-board
|
||||||
|
cd sim800-mqtt && ../arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 sim800-mqtt.ino
|
||||||
cd w5500-http && ../arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 w5500-http.ino
|
cd w5500-http && ../arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 w5500-http.ino
|
||||||
cd w5500-mqtt && ../arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 w5500-mqtt.ino
|
cd w5500-mqtt && ../arduino/arduino --verbose --verify --board Seeeduino:samd:seeed_XIAO_m0 w5500-mqtt.ino
|
||||||
|
|
||||||
@@ -21,6 +22,18 @@ arduino-nano: arduino
|
|||||||
cd w5500-http && ../arduino/arduino --pref compiler.cpp.extra_flags=-DMG_ENABLE_LOG=0 --verbose --verify --board arduino:avr:nano w5500-http.ino
|
cd w5500-http && ../arduino/arduino --pref compiler.cpp.extra_flags=-DMG_ENABLE_LOG=0 --verbose --verify --board arduino:avr:nano w5500-http.ino
|
||||||
cd w5500-mqtt && ../arduino/arduino --pref compiler.cpp.extra_flags=-DMG_ENABLE_LOG=0 --verbose --verify --board arduino:avr:nano w5500-mqtt.ino
|
cd w5500-mqtt && ../arduino/arduino --pref compiler.cpp.extra_flags=-DMG_ENABLE_LOG=0 --verbose --verify --board arduino:avr:nano w5500-mqtt.ino
|
||||||
|
|
||||||
|
arduino-esp32: arduino
|
||||||
|
# cd esp32-http && ../arduino/arduino --verbose --verify --board esp32-http.ino
|
||||||
|
# esp32-mqtt
|
||||||
|
|
||||||
|
arduino-teensy41: arduino
|
||||||
|
# cd teensy41-http && ../arduino/arduino --verbose --verify --board teensy41-http.ino
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf arduino
|
rm -rf arduino
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
#include "mongoose.h"
|
||||||
|
#include "WiFi.h"
|
||||||
|
|
||||||
|
#define LED_PIN LED_BUILTIN
|
||||||
|
#define WIFI_SSID "wifi_network_name" // Change this
|
||||||
|
#define WIFI_PASS "wifi_password" // And this
|
||||||
|
|
||||||
|
struct mg_mgr mgr;
|
||||||
|
|
||||||
|
// Crude function to get available RAM, for quick profiling
|
||||||
|
size_t getFreeRAM(void) {
|
||||||
|
size_t size = 0, increment = 1024;
|
||||||
|
void *p;
|
||||||
|
while ((p = malloc(size)) != NULL) free(p), size += increment;
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
void http_ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
|
if (ev == MG_EV_HTTP_MSG) {
|
||||||
|
struct mg_http_message *hm = (struct mg_http_message *)ev_data;
|
||||||
|
if (mg_match(hm->uri, mg_str("/api/led/on"), NULL)) {
|
||||||
|
digitalWrite(LED_PIN, HIGH);
|
||||||
|
mg_http_reply(c, 200, "", "{%m: %d}\n", MG_ESC("led"), digitalRead(LED_PIN));
|
||||||
|
} else if (mg_match(hm->uri, mg_str("/api/led/off"), NULL)) {
|
||||||
|
digitalWrite(LED_PIN, LOW);
|
||||||
|
mg_http_reply(c, 200, "", "{%m: %d}\n", MG_ESC("led"), digitalRead(LED_PIN));
|
||||||
|
} else {
|
||||||
|
mg_http_reply(c, 200, "", "ok, free RAM: %u\n", xPortGetFreeHeapSize());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
pinMode(LED_PIN, OUTPUT);
|
||||||
|
Serial.begin(115200);
|
||||||
|
while (!Serial) delay(50);
|
||||||
|
|
||||||
|
WiFi.mode(WIFI_STA);
|
||||||
|
WiFi.begin(WIFI_SSID, WIFI_PASS);
|
||||||
|
while(WiFi.status() != WL_CONNECTED) Serial.print("."), delay(100);
|
||||||
|
|
||||||
|
Serial.println("\nConnected to the WiFi network");
|
||||||
|
Serial.print("IP Address: ");
|
||||||
|
Serial.println(WiFi.localIP());
|
||||||
|
|
||||||
|
mg_mgr_init(&mgr);
|
||||||
|
mg_log_set(MG_LL_DEBUG);
|
||||||
|
mg_log_set_fn([](char ch, void *) { Serial.print(ch); }, NULL);
|
||||||
|
mg_http_listen(&mgr, "http://0.0.0.0", http_ev_handler, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
mg_mgr_poll(&mgr, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int lwip_hook_ip6_input(struct pbuf *p, struct netif *inp) __attribute__((weak));
|
||||||
|
extern "C" int lwip_hook_ip6_input(struct pbuf *p, struct netif *inp) {
|
||||||
|
if (ip6_addr_isany_val(inp->ip6_addr[0].u_addr.ip6)) {
|
||||||
|
pbuf_free(p);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define MG_ARCH MG_ARCH_ESP32
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
#include "WiFi.h"
|
||||||
|
#include "mongoose.h"
|
||||||
|
|
||||||
|
#define WIFI_SSID "wifi_network_name" // Change this
|
||||||
|
#define WIFI_PASS "wifi_password" // And this
|
||||||
|
|
||||||
|
#define MQTT_SERVER "mqtt://broker.hivemq.com:1883"
|
||||||
|
#define MQTT_SUB_TOPIC "mg/rx" // Subscribe to this topic
|
||||||
|
#define MQTT_PUB_TOPIC "mg/tx" // Publish to this topic
|
||||||
|
|
||||||
|
#define LED_PIN 0
|
||||||
|
|
||||||
|
struct mg_mgr mgr;
|
||||||
|
struct mg_connection *mqtt_connection;
|
||||||
|
|
||||||
|
void mqtt_publish(const char *message) {
|
||||||
|
struct mg_mqtt_opts opts = {};
|
||||||
|
opts.topic = mg_str(MQTT_PUB_TOPIC);
|
||||||
|
opts.message = mg_str(message);
|
||||||
|
if (mqtt_connection) mg_mqtt_pub(mqtt_connection, &opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crude function to get available RAM, for quick profiling
|
||||||
|
size_t getFreeRAM(void) {
|
||||||
|
size_t size = 0, increment = 100;
|
||||||
|
void *p;
|
||||||
|
while ((p = malloc(size)) != NULL) free(p), size += increment;
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implement LED control over MQTT: "on" and "off" commands
|
||||||
|
void handle_command(struct mg_str msg) {
|
||||||
|
if (msg.len == 3 && memcmp(msg.buf, "off", 3) == 0) {
|
||||||
|
digitalWrite(LED_PIN, LOW);
|
||||||
|
mqtt_publish("done - off");
|
||||||
|
} else if (msg.len == 2 && memcmp(msg.buf, "on", 2) == 0) {
|
||||||
|
digitalWrite(LED_PIN, HIGH);
|
||||||
|
mqtt_publish("done - on");
|
||||||
|
}
|
||||||
|
MG_INFO(("Free RAM: %u bytes", getFreeRAM()));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mqtt_ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
|
if (ev == MG_EV_MQTT_OPEN) {
|
||||||
|
MG_INFO(("%lu CONNECTED to %s", c->id, MQTT_SERVER));
|
||||||
|
struct mg_mqtt_opts opts = {};
|
||||||
|
opts.topic = mg_str(MQTT_SUB_TOPIC);
|
||||||
|
mg_mqtt_sub(c, &opts);
|
||||||
|
MG_INFO(("%lu SUBSCRIBED to %s", c->id, MQTT_SUB_TOPIC));
|
||||||
|
} else if (ev == MG_EV_MQTT_MSG) {
|
||||||
|
// Received MQTT message
|
||||||
|
struct mg_mqtt_message *mm = (struct mg_mqtt_message *) ev_data;
|
||||||
|
MG_INFO(("%lu RECEIVED %.*s <- %.*s", c->id, (int) mm->data.len,
|
||||||
|
mm->data.buf, (int) mm->topic.len, mm->topic.buf));
|
||||||
|
handle_command(mm->data);
|
||||||
|
} else if (ev == MG_EV_CLOSE) {
|
||||||
|
MG_INFO(("%lu CLOSED", c->id));
|
||||||
|
mqtt_connection = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void reconnect_if_not_connected(void) {
|
||||||
|
if (mqtt_connection == NULL) {
|
||||||
|
struct mg_mqtt_opts opts = {};
|
||||||
|
opts.clean = true;
|
||||||
|
mqtt_connection =
|
||||||
|
mg_mqtt_connect(&mgr, MQTT_SERVER, &opts, mqtt_ev_handler, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
pinMode(LED_PIN, OUTPUT);
|
||||||
|
Serial.begin(115200);
|
||||||
|
while (!Serial) delay(50);
|
||||||
|
|
||||||
|
WiFi.mode(WIFI_STA);
|
||||||
|
WiFi.begin(WIFI_SSID, WIFI_PASS);
|
||||||
|
while (WiFi.status() != WL_CONNECTED) Serial.print("."), delay(100);
|
||||||
|
|
||||||
|
Serial.println("\nConnected to the WiFi network");
|
||||||
|
Serial.print("IP Address: ");
|
||||||
|
Serial.println(WiFi.localIP());
|
||||||
|
|
||||||
|
mg_mgr_init(&mgr);
|
||||||
|
mg_log_set(MG_LL_DEBUG);
|
||||||
|
mg_log_set_fn([](char ch, void *) { Serial.print(ch); }, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
mg_mgr_poll(&mgr, 1); // Process network events
|
||||||
|
reconnect_if_not_connected(); // Reconnect to MQTT server if needed
|
||||||
|
}
|
||||||
|
|
||||||
|
extern "C" int lwip_hook_ip6_input(struct pbuf *p, struct netif *inp)
|
||||||
|
__attribute__((weak));
|
||||||
|
extern "C" int lwip_hook_ip6_input(struct pbuf *p, struct netif *inp) {
|
||||||
|
if (ip6_addr_isany_val(inp->ip6_addr[0].u_addr.ip6)) {
|
||||||
|
pbuf_free(p);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,3 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define MG_ARCH MG_ARCH_ESP32
|
||||||
File renamed without changes.
File renamed without changes.
+6
-2
@@ -10,6 +10,10 @@
|
|||||||
#define MG_ARCH MG_ARCH_CUSTOM
|
#define MG_ARCH MG_ARCH_CUSTOM
|
||||||
#define MG_ENABLE_SOCKET 0
|
#define MG_ENABLE_SOCKET 0
|
||||||
#define MG_ENABLE_TCPIP 1
|
#define MG_ENABLE_TCPIP 1
|
||||||
#define mkdir(a, b) (-1)
|
#define MG_ENABLE_DRIVER_PPP 1
|
||||||
|
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
|
||||||
|
#define MG_ENABLE_TCPIP_PRINT_DEBUG_STATS 0
|
||||||
|
#define MG_ENABLE_CUSTOM_MILLIS 1
|
||||||
|
#define MG_ENABLE_CUSTOM_RANDOM 1
|
||||||
|
#define MG_TLS MG_TLS_BUILTIN
|
||||||
#define MG_IO_SIZE 128
|
#define MG_IO_SIZE 128
|
||||||
//#define MG_ENABLE_LOG 0
|
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
#include <SoftwareSerial.h>
|
||||||
|
#include "mongoose.h"
|
||||||
|
|
||||||
|
#define MQTT_SERVER "mqtt://broker.hivemq.com:8883"
|
||||||
|
#define MQTT_SUB_TOPIC "mg/rx" // Subscribe to this topic
|
||||||
|
#define MQTT_PUB_TOPIC "mg/tx" // Publish to this topic
|
||||||
|
|
||||||
|
static const char *script[] = {
|
||||||
|
"AT\r\n", "*OK\r\n",
|
||||||
|
"ATZ\r\n", "*OK\r\n",
|
||||||
|
"AT+CPIN?\r\n", "*OK\r\n",
|
||||||
|
"AT+CNMI=0,0,0,0,0\r\n", "*OK\r\n",
|
||||||
|
"AT+CGDCONT=1,\"IP\",\"iot.1nce.net\"\r\n", "*OK\r\n",
|
||||||
|
"AT+CGDATA=\"PPP\",1\r\n", "*CONNECT\r\n",
|
||||||
|
NULL,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Visit https://mongoose.ws/tls/ and copy-paste CA certificate for your server
|
||||||
|
#define TLS_CA \
|
||||||
|
""
|
||||||
|
|
||||||
|
// We use Serial1 or software serial to communicate with the modem
|
||||||
|
#define LED_PIN LED_BUILTIN
|
||||||
|
#define RST_PIN 10
|
||||||
|
#define ModemSerial Serial1
|
||||||
|
//#define RX_PIN 9
|
||||||
|
//#define TX_PIN 8
|
||||||
|
//SoftwareSerial ModemSerial(RX_PIN, TX_PIN);
|
||||||
|
|
||||||
|
struct mg_connection *mqtt_connection;
|
||||||
|
struct mg_tcpip_driver_ppp_data driver_data;
|
||||||
|
struct mg_mgr mgr; // Mongoose event manager
|
||||||
|
struct mg_tcpip_if mif = {.mac = {2, 0, 1, 2, 3, 5}}; // Network interface
|
||||||
|
|
||||||
|
uint64_t mg_millis(void) {
|
||||||
|
return millis();
|
||||||
|
}
|
||||||
|
bool mg_random(void *buf, size_t len) { // For TLS
|
||||||
|
uint8_t *p = (uint8_t *) buf;
|
||||||
|
while (len--) *p++ = (unsigned char) (rand() & 255);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void mqtt_publish(const char *message) {
|
||||||
|
struct mg_mqtt_opts opts = {};
|
||||||
|
opts.topic = mg_str(MQTT_PUB_TOPIC);
|
||||||
|
opts.message = mg_str(message);
|
||||||
|
if (mqtt_connection) mg_mqtt_pub(mqtt_connection, &opts);
|
||||||
|
}
|
||||||
|
|
||||||
|
void handle_command(struct mg_str msg) {
|
||||||
|
if (msg.len == 3 && memcmp(msg.buf, "off", 3) == 0) {
|
||||||
|
digitalWrite(LED_PIN, LOW);
|
||||||
|
mqtt_publish("done - off");
|
||||||
|
} else if (msg.len == 2 && memcmp(msg.buf, "on", 2) == 0) {
|
||||||
|
digitalWrite(LED_PIN, HIGH);
|
||||||
|
mqtt_publish("done - on");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mqtt_ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
|
if (ev == MG_EV_CONNECT && mg_url_is_ssl(MQTT_SERVER)) {
|
||||||
|
struct mg_tls_opts opts = {};
|
||||||
|
opts.ca = mg_str(TLS_CA);
|
||||||
|
mg_tls_init(c, &opts);
|
||||||
|
}
|
||||||
|
if (ev == MG_EV_MQTT_OPEN) {
|
||||||
|
MG_INFO(("%lu CONNECTED to %s", c->id, MQTT_SERVER));
|
||||||
|
struct mg_mqtt_opts opts = {};
|
||||||
|
opts.topic = mg_str(MQTT_SUB_TOPIC);
|
||||||
|
mg_mqtt_sub(c, &opts);
|
||||||
|
MG_INFO(("%lu SUBSCRIBED to %s", c->id, MQTT_SUB_TOPIC));
|
||||||
|
} else if (ev == MG_EV_MQTT_MSG) {
|
||||||
|
// Received MQTT message
|
||||||
|
struct mg_mqtt_message *mm = (struct mg_mqtt_message *) ev_data;
|
||||||
|
MG_INFO(("%lu RECEIVED %.*s <- %.*s", c->id, (int) mm->data.len,
|
||||||
|
mm->data.buf, (int) mm->topic.len, mm->topic.buf));
|
||||||
|
handle_command(mm->data);
|
||||||
|
} else if (ev == MG_EV_CLOSE) {
|
||||||
|
MG_INFO(("%lu CLOSED", c->id));
|
||||||
|
mqtt_connection = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void reconnect_if_not_connected(void) {
|
||||||
|
if (mif.state == MG_TCPIP_STATE_READY && mqtt_connection == NULL) {
|
||||||
|
struct mg_mqtt_opts opts = {};
|
||||||
|
opts.clean = true;
|
||||||
|
mqtt_connection =
|
||||||
|
mg_mqtt_connect(&mgr, MQTT_SERVER, &opts, mqtt_ev_handler, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void setup() {
|
||||||
|
Serial.begin(115200); // Initialise serial for logs
|
||||||
|
while (!Serial) delay(50); // for debug output
|
||||||
|
|
||||||
|
pinMode(LED_PIN, OUTPUT); // Initialise pins
|
||||||
|
pinMode(RST_PIN, OUTPUT);
|
||||||
|
digitalWrite(RST_PIN, HIGH);
|
||||||
|
//pinMode(RX_PIN, INPUT); // Only required for
|
||||||
|
//pinMode(TX_PIN, OUTPUT); // software serial
|
||||||
|
ModemSerial.begin(115200); // Serial for modem communication
|
||||||
|
|
||||||
|
mg_mgr_init(&mgr); // Initialise Mongoose event manager
|
||||||
|
mg_log_set(MG_LL_DEBUG); // Set debug log level
|
||||||
|
mg_log_set_fn([](char c, void *) { Serial.print(c); }, NULL); // Log serial
|
||||||
|
|
||||||
|
mif.driver = &mg_tcpip_driver_ppp; // Initialise built-in TCP/IP stack
|
||||||
|
mif.driver_data = &driver_data; // with the cellular driver
|
||||||
|
driver_data.script = script;
|
||||||
|
driver_data.reset = [](void *) { digitalWrite(RST_PIN, LOW); delay(1); digitalWrite(RST_PIN, HIGH); },
|
||||||
|
driver_data.tx = [](void *, uint8_t c) { ModemSerial.write(c); },
|
||||||
|
driver_data.rx = [](void *) { return ModemSerial.available() ? ModemSerial.read() : -1; },
|
||||||
|
mg_tcpip_init(&mgr, &mif);
|
||||||
|
mif.enable_dhcp_client = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void loop() {
|
||||||
|
mg_mgr_poll(&mgr, 1); // Process network events
|
||||||
|
reconnect_if_not_connected(); // Reconnect to MQTT server if needed
|
||||||
|
}
|
||||||
File renamed without changes.
@@ -32,13 +32,13 @@ static void simple_http_listener(struct mg_connection *c, int ev, void *ev_data)
|
|||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
|
|
||||||
// If the requested URI is "/api/hi", send a simple JSON response back
|
// If the requested URI is "/api/hi", send a simple JSON response back
|
||||||
if (mg_http_match_uri(hm, "/api/hi")) {
|
if (mg_match(hm->uri, mg_str("/api/hi"), NULL)) {
|
||||||
// Use mg_http_reply() API function to generate JSON response. It adds a
|
// Use mg_http_reply() API function to generate JSON response. It adds a
|
||||||
// Content-Length header automatically. In the response, we show
|
// Content-Length header automatically. In the response, we show
|
||||||
// the requested URI and HTTP body:
|
// the requested URI and HTTP body:
|
||||||
mg_http_reply(c, 200, "", "{%m:%m,%m:%m}\n", // See mg_snprintf doc
|
mg_http_reply(c, 200, "", "{%m:%m,%m:%m}\n", // See mg_snprintf doc
|
||||||
MG_ESC("uri"), mg_print_esc, hm->uri.len, hm->uri.ptr,
|
MG_ESC("uri"), mg_print_esc, hm->uri.len, hm->uri.buf,
|
||||||
MG_ESC("body"), mg_print_esc, hm->body.len, hm->body.ptr);
|
MG_ESC("body"), mg_print_esc, hm->body.len, hm->body.buf);
|
||||||
} else {
|
} else {
|
||||||
// For all other URIs, serve some static content
|
// For all other URIs, serve some static content
|
||||||
mg_http_reply(c, 200, "", "<html>millis: %lu</html>", millis());
|
mg_http_reply(c, 200, "", "<html>millis: %lu</html>", millis());
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#define MG_ARCH MG_ARCH_CUSTOM
|
||||||
|
#define MG_ENABLE_TCPIP 1
|
||||||
|
#define MG_ENABLE_DRIVER_W5500 1
|
||||||
|
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
|
||||||
|
#define MG_ENABLE_TCPIP_PRINT_DEBUG_STATS 0
|
||||||
|
#define MG_ENABLE_CUSTOM_MILLIS 1
|
||||||
|
#define MG_ENABLE_CUSTOM_RANDOM 1
|
||||||
|
#define MG_TLS MG_TLS_BUILTIN
|
||||||
|
#define MG_IO_SIZE 256
|
||||||
@@ -1,47 +1,108 @@
|
|||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include "mongoose.h"
|
#include "mongoose.h"
|
||||||
|
|
||||||
#define SS_PIN 3 // Slave select pin
|
#define LED_PIN LED_BUILTIN // LED pin
|
||||||
struct mg_mgr mgr; // Mongoose event manager
|
#define SS_PIN 17 // Slave select pin for the W5500 module
|
||||||
|
|
||||||
struct mg_tcpip_spi spi = {
|
struct mg_tcpip_spi spi = {
|
||||||
NULL, // SPI data
|
NULL, // SPI metadata
|
||||||
[](void *) { digitalWrite(SS_PIN, LOW); }, // begin transation
|
[](void *) { digitalWrite(SS_PIN, LOW); SPI.beginTransaction(SPISettings()); },
|
||||||
[](void *) { digitalWrite(SS_PIN, HIGH); }, // end transaction
|
[](void *) { digitalWrite(SS_PIN, HIGH); SPI.endTransaction(); },
|
||||||
[](void *, uint8_t c) { return SPI.transfer(c); }, // execute transaction
|
[](void *, uint8_t c) { return SPI.transfer(c); }, // Execute transaction
|
||||||
};
|
};
|
||||||
struct mg_tcpip_if mif = {.mac = {2, 0, 1, 2, 3, 5}}; // network interface
|
struct mg_mgr mgr; // Mongoose event manager
|
||||||
|
struct mg_tcpip_if mif = {.mac = {2, 0, 1, 2, 3, 5}}; // Network interface
|
||||||
|
|
||||||
|
// Used by Mongoose for time tracking
|
||||||
|
uint64_t mg_millis(void) {
|
||||||
|
return millis();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Used by Mongoose to generate random data
|
||||||
|
bool mg_random(void *buf, size_t len) { // For TLS
|
||||||
|
uint8_t *p = (uint8_t *) buf;
|
||||||
|
while (len--) *p++ = (unsigned char) (rand() & 255);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Crude function to get available RAM, for quick profiling
|
||||||
|
extern "C" char *sbrk(int);
|
||||||
|
extern char *__brkval;
|
||||||
|
int getFreeRAM() {
|
||||||
|
char top;
|
||||||
|
#ifdef __arm__
|
||||||
|
return &top - (char *) sbrk(0);
|
||||||
|
#elif defined(CORE_TEENSY) || (ARDUINO > 103 && ARDUINO != 151)
|
||||||
|
return &top - __brkval;
|
||||||
|
#else
|
||||||
|
return __brkval ? &top - __brkval : &top - __malloc_heap_start;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void http_ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
|
if (ev == MG_EV_HTTP_MSG) {
|
||||||
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
|
if (mg_match(hm->uri, mg_str("/api/led/on"), NULL)) {
|
||||||
|
digitalWrite(LED_PIN, HIGH);
|
||||||
|
mg_http_reply(c, 200, "", "{%m: %d}\n", MG_ESC("led"), digitalRead(LED_PIN));
|
||||||
|
} else if (mg_match(hm->uri, mg_str("/api/led/off"), NULL)) {
|
||||||
|
digitalWrite(LED_PIN, LOW);
|
||||||
|
mg_http_reply(c, 200, "", "{%m: %d}\n", MG_ESC("led"), digitalRead(LED_PIN));
|
||||||
|
} else {
|
||||||
|
mg_http_reply(c, 200, "", "ok, free RAM: %u\n", getFreeRAM());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Initialise TLS if we're a TLS listener
|
||||||
|
if (ev == MG_EV_ACCEPT && c->fn_data != NULL) {
|
||||||
|
struct mg_tls_opts opts;
|
||||||
|
memset(&opts, 0, sizeof(opts));
|
||||||
|
|
||||||
|
// Generated by https://mongoose.ws/tls/
|
||||||
|
#define TLS_CERT \
|
||||||
|
"-----BEGIN CERTIFICATE-----\n" \
|
||||||
|
"MIIBkzCCATqgAwIBAgIEZ3E9lzAKBggqhkjOPQQDAjATMREwDwYDVQQDEwhNb25n\n" \
|
||||||
|
"b29zZTAeFw0yNDEyMjkxMjE2MjNaFw0zNDEyMjcxMjE2MjNaMBQxEjAQBgNVBAMT\n" \
|
||||||
|
"CWxvY2FsaG9zdDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABHxxuByu5K2k7DYq\n" \
|
||||||
|
"b3eQsHb3VY5NWglWun7axh69OWF7V9OUUyON1y8ISirL0Gj5ZPOogIgrB9iOcz6K\n" \
|
||||||
|
"q9n8NQOjezB5MA4GA1UdDwEB/wQEAwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAM\n" \
|
||||||
|
"BgNVHRMBAf8EAjAAMB8GA1UdIwQYMBaAFGn8GpPWaM0JC7U4zlg+bCljSjLoMCMG\n" \
|
||||||
|
"A1UdEQQcMBqCCWxvY2FsaG9zdIINMTkyLjE2OC4wLjEwMDAKBggqhkjOPQQDAgNH\n" \
|
||||||
|
"ADBEAiAr1fO3QLLm+vjYarctNI+gfnxxB4edRTRmcFWHmBS8oQIgY5lkq2JCwATG\n" \
|
||||||
|
"YsVQUmS+2Tbc7ij7lkduXO42pvr/0fw=\n" \
|
||||||
|
"-----END CERTIFICATE-----"
|
||||||
|
|
||||||
|
#define TLS_KEY \
|
||||||
|
"-----BEGIN EC PRIVATE KEY-----\n" \
|
||||||
|
"MHcCAQEEIHKu84eEw9dX8nez82g3F94OsZJ14LVbAN+OBW+++V2poAoGCCqGSM49\n" \
|
||||||
|
"AwEHoUQDQgAEfHG4HK7kraTsNipvd5CwdvdVjk1aCVa6ftrGHr05YXtX05RTI43X\n" \
|
||||||
|
"LwhKKsvQaPlk86iAiCsH2I5zPoqr2fw1Aw==\n" \
|
||||||
|
"-----END EC PRIVATE KEY-----"
|
||||||
|
|
||||||
|
opts.cert = mg_str(TLS_CERT);
|
||||||
|
opts.key = mg_str(TLS_KEY);
|
||||||
|
|
||||||
|
mg_tls_init(c, &opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200); // Initialise serial
|
||||||
pinMode(SS_PIN, OUTPUT);
|
while (!Serial) delay(50); // for debug output
|
||||||
SPI.begin();
|
|
||||||
|
|
||||||
// Set logging function to a serial print
|
SPI.begin(); // Iniitialise SPI
|
||||||
mg_log_set_fn([](char ch, void *) { Serial.print(ch); }, NULL);
|
pinMode(SS_PIN, OUTPUT); // to communicate with W5500 Ethernet module
|
||||||
mg_mgr_init(&mgr);
|
pinMode(LED_PIN, OUTPUT); // Initialise LED
|
||||||
|
|
||||||
delay(3000);
|
mg_mgr_init(&mgr); // Initialise Mongoose event manager
|
||||||
MG_INFO(("Starting TCP/IP stack..."));
|
mg_log_set(MG_LL_DEBUG); // Set debug log level
|
||||||
|
mg_log_set_fn([](char ch, void *) { Serial.print(ch); }, NULL); // Log serial
|
||||||
|
mif.driver = &mg_tcpip_driver_w5500; // Use W5500 built-in driver
|
||||||
|
mif.driver_data = &spi; // Pass SPI interface to W5500 driver
|
||||||
|
mg_tcpip_init(&mgr, &mif); // Initialise built-in TCP/IP stack
|
||||||
|
|
||||||
mif.driver = &mg_tcpip_driver_w5500;
|
// Setup HTTP & HTTPS listeners. Respond "ok" on any HTTP request
|
||||||
mif.driver_data = &spi;
|
mg_http_listen(&mgr, "http://0.0.0.0:80", http_ev_handler, NULL);
|
||||||
mg_tcpip_init(&mgr, &mif);
|
mg_http_listen(&mgr, "https://0.0.0.0:443", http_ev_handler, (void *) 1);
|
||||||
|
|
||||||
// Start a 5 sec timer, print status message periodically
|
|
||||||
mg_timer_add(
|
|
||||||
&mgr, 5000, MG_TIMER_REPEAT,
|
|
||||||
[](void *) {
|
|
||||||
MG_INFO(("ethernet: %s", mg_tcpip_driver_w5500.up(&mif) ? "up" : "down"));
|
|
||||||
},
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
// Setup HTTP listener. Respond "ok" on any HTTP request
|
|
||||||
mg_http_listen(
|
|
||||||
&mgr, "http://0.0.0.0",
|
|
||||||
[](struct mg_connection *c, int ev, void *ev_data) {
|
|
||||||
if (ev == MG_EV_HTTP_MSG) mg_http_reply(c, 200, "", "ok\n");
|
|
||||||
},
|
|
||||||
&mgr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Arduino.h"
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#define MG_ARCH MG_ARCH_CUSTOM
|
||||||
|
#define MG_ENABLE_SOCKET 0
|
||||||
|
#define MG_ENABLE_TCPIP 1
|
||||||
|
#define MG_ENABLE_DRIVER_W5500 1
|
||||||
|
#define MG_ENABLE_TCPIP_DRIVER_INIT 0
|
||||||
|
#define MG_ENABLE_TCPIP_PRINT_DEBUG_STATS 0
|
||||||
|
#define MG_ENABLE_CUSTOM_MILLIS 1
|
||||||
|
#define MG_ENABLE_CUSTOM_RANDOM 1
|
||||||
|
// #define MG_TLS MG_TLS_BUILTIN
|
||||||
|
#define MG_IO_SIZE 128
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Arduino.h"
|
|
||||||
|
|
||||||
#include <errno.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#define MG_ARCH MG_ARCH_CUSTOM
|
|
||||||
#define MG_ENABLE_SOCKET 0
|
|
||||||
#define MG_ENABLE_TCPIP 1
|
|
||||||
#define mkdir(a, b) (-1)
|
|
||||||
#define MG_IO_SIZE 512
|
|
||||||
//#define MG_ENABLE_LOG 0
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
#include "net.h"
|
|
||||||
|
|
||||||
#define MQTT_SERVER "mqtt://broker.hivemq.com:1883"
|
|
||||||
struct mg_connection *mqtt_connection;
|
|
||||||
const char *mqtt_subscribe_topic = "mg/rx";
|
|
||||||
const char *mqtt_publish_topic = "mg/tx";
|
|
||||||
|
|
||||||
struct mg_mgr mgr; // Mongoose event manager
|
|
||||||
struct mg_tcpip_if mif = {.mac = {2, 0, 1, 2, 3, 5}}; // network interface
|
|
||||||
|
|
||||||
void mqtt_publish(const char *message) {
|
|
||||||
struct mg_mqtt_opts opts = {};
|
|
||||||
opts.topic = mg_str(mqtt_publish_topic);
|
|
||||||
opts.message = mg_str(message);
|
|
||||||
if (mqtt_connection) mg_mqtt_pub(mqtt_connection, &opts);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
|
||||||
if (ev == MG_EV_MQTT_OPEN) {
|
|
||||||
MG_INFO(("%lu CONNECTED to %s", c->id, MQTT_SERVER));
|
|
||||||
struct mg_mqtt_opts opts = {};
|
|
||||||
opts.topic = mg_str(mqtt_subscribe_topic);
|
|
||||||
mg_mqtt_sub(c, &opts);
|
|
||||||
MG_INFO(("%lu SUBSCRIBED to %s", c->id, mqtt_subscribe_topic));
|
|
||||||
} else if (ev == MG_EV_MQTT_MSG) {
|
|
||||||
// Received MQTT message
|
|
||||||
struct mg_mqtt_message *mm = (struct mg_mqtt_message *) ev_data;
|
|
||||||
MG_INFO(("%lu RECEIVED %.*s <- %.*s", c->id, (int) mm->data.len,
|
|
||||||
mm->data.ptr, (int) mm->topic.len, mm->topic.ptr));
|
|
||||||
exec_command(mm->data.ptr, mm->data.len);
|
|
||||||
} else if (ev == MG_EV_CLOSE) {
|
|
||||||
MG_INFO(("%lu CLOSED", c->id));
|
|
||||||
mqtt_connection = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void timer_fn(void *arg) {
|
|
||||||
struct mg_mgr *mgr = (struct mg_mgr *) arg;
|
|
||||||
struct mg_mqtt_opts opts;
|
|
||||||
memset(&opts, 0, sizeof(opts));
|
|
||||||
opts.clean = true;
|
|
||||||
if (mif.state == MG_TCPIP_STATE_READY && mqtt_connection == NULL) {
|
|
||||||
mqtt_connection = mg_mqtt_connect(mgr, MQTT_SERVER, &opts, fn, NULL);
|
|
||||||
}
|
|
||||||
// MG_INFO(("Eth: %d, MQTT: %p", mif.state, mqtt_connection));
|
|
||||||
}
|
|
||||||
|
|
||||||
void net_init(void) {
|
|
||||||
// Set Mongoose logging function to a serial print
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
|
|
||||||
mif.driver = &mg_tcpip_driver_w5500;
|
|
||||||
mif.driver_data = &spi;
|
|
||||||
mg_tcpip_init(&mgr, &mif);
|
|
||||||
|
|
||||||
// Start a timer that keeps MQTT connection alive
|
|
||||||
mg_timer_add(&mgr, 3000, MG_TIMER_REPEAT, timer_fn, &mgr);
|
|
||||||
}
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern struct mg_tcpip_spi spi;
|
|
||||||
extern struct mg_mgr mgr;
|
|
||||||
void mqtt_publish(const char *message);
|
|
||||||
void net_init(void);
|
|
||||||
void exec_command(const char *req, size_t req_len);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -1,51 +1,103 @@
|
|||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include "net.h"
|
#include "mongoose.h"
|
||||||
|
|
||||||
#define SS_PIN 17 // Slave select pin
|
#define MQTT_SERVER "mqtt://broker.hivemq.com:1883"
|
||||||
|
#define MQTT_SUB_TOPIC "mg/rx" // Subscribe to this topic
|
||||||
|
#define MQTT_PUB_TOPIC "mg/tx" // Publish to this topic
|
||||||
|
#define SS_PIN 2 // Slave select pin
|
||||||
|
#define LED_PIN 21 // LED pin
|
||||||
|
|
||||||
|
struct mg_connection *mqtt_connection;
|
||||||
struct mg_tcpip_spi spi = {
|
struct mg_tcpip_spi spi = {
|
||||||
NULL, // SPI data
|
NULL, // SPI metadata
|
||||||
[](void *) { digitalWrite(SS_PIN, LOW); }, // Begin transaction
|
[](void *) { digitalWrite(SS_PIN, LOW); SPI.beginTransaction(SPISettings()); },
|
||||||
[](void *) { digitalWrite(SS_PIN, HIGH); }, // End transaction
|
[](void *) { digitalWrite(SS_PIN, HIGH); SPI.endTransaction(); },
|
||||||
[](void *, uint8_t c) { return SPI.transfer(c); }, // Execute transaction
|
[](void *, uint8_t c) { return SPI.transfer(c); }, // Execute transaction
|
||||||
};
|
};
|
||||||
|
struct mg_mgr mgr; // Mongoose event manager
|
||||||
|
struct mg_tcpip_if mif = {.mac = {2, 0, 1, 2, 3, 5}}; // Network interface
|
||||||
|
|
||||||
void exec_command(const char *req, size_t req_len) {
|
uint64_t mg_millis(void) {
|
||||||
char res[100];
|
return millis();
|
||||||
if (req_len == 2 && strncmp(req, "on", req_len) == 0) {
|
}
|
||||||
digitalWrite(LED_BUILTIN, true);
|
bool mg_random(void *buf, size_t len) { // For TLS
|
||||||
snprintf(res, sizeof(res), "LED on");
|
uint8_t *p = (uint8_t *) buf;
|
||||||
} else if (req_len == 3 && strncmp(req, "off", req_len) == 0) {
|
while (len--) *p++ = (unsigned char) (rand() & 255);
|
||||||
digitalWrite(LED_BUILTIN, false);
|
return true;
|
||||||
snprintf(res, sizeof(res), "LED off");
|
|
||||||
} else {
|
|
||||||
snprintf(res, sizeof(res), "Unknown command: [%.*s]", (int) req_len, req);
|
|
||||||
}
|
|
||||||
Serial.println(res);
|
|
||||||
mqtt_publish(res);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void process_input(char c) {
|
void mqtt_publish(const char *message) {
|
||||||
static char buf[100];
|
struct mg_mqtt_opts opts = {};
|
||||||
static size_t len = 0;
|
opts.topic = mg_str(MQTT_PUB_TOPIC);
|
||||||
char response[100];
|
opts.message = mg_str(message);
|
||||||
if (c != '\n' && c != '\0') buf[len++] = c; // Append to the buffer
|
if (mqtt_connection) mg_mqtt_pub(mqtt_connection, &opts);
|
||||||
if (len >= sizeof(buf)) len = 0; // On overflow, reset
|
}
|
||||||
if (c == '\n' && len > 0) {
|
|
||||||
exec_command(buf, len);
|
// Crude function to get available RAM, for quick profiling
|
||||||
len = 0;
|
size_t getFreeRAM(void) {
|
||||||
|
size_t size = 0, increment = 100;
|
||||||
|
void *p;
|
||||||
|
while ((p = malloc(size)) != NULL) free(p), size += increment;
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Implement LED control over MQTT: "on" and "off" commands
|
||||||
|
void handle_command(struct mg_str msg) {
|
||||||
|
if (msg.len == 3 && memcmp(msg.buf, "off", 3) == 0) {
|
||||||
|
digitalWrite(LED_PIN, LOW);
|
||||||
|
mqtt_publish("done - off");
|
||||||
|
} else if (msg.len == 2 && memcmp(msg.buf, "on", 2) == 0) {
|
||||||
|
digitalWrite(LED_PIN, HIGH);
|
||||||
|
mqtt_publish("done - on");
|
||||||
|
}
|
||||||
|
MG_INFO(("Free RAM: %u bytes", getFreeRAM()));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void mqtt_ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
|
if (ev == MG_EV_MQTT_OPEN) {
|
||||||
|
MG_INFO(("%lu CONNECTED to %s", c->id, MQTT_SERVER));
|
||||||
|
struct mg_mqtt_opts opts = {};
|
||||||
|
opts.topic = mg_str(MQTT_SUB_TOPIC);
|
||||||
|
mg_mqtt_sub(c, &opts);
|
||||||
|
MG_INFO(("%lu SUBSCRIBED to %s", c->id, MQTT_SUB_TOPIC));
|
||||||
|
} else if (ev == MG_EV_MQTT_MSG) {
|
||||||
|
// Received MQTT message
|
||||||
|
struct mg_mqtt_message *mm = (struct mg_mqtt_message *) ev_data;
|
||||||
|
MG_INFO(("%lu RECEIVED %.*s <- %.*s", c->id, (int) mm->data.len,
|
||||||
|
mm->data.buf, (int) mm->topic.len, mm->topic.buf));
|
||||||
|
handle_command(mm->data);
|
||||||
|
} else if (ev == MG_EV_CLOSE) {
|
||||||
|
MG_INFO(("%lu CLOSED", c->id));
|
||||||
|
mqtt_connection = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void reconnect_if_not_connected(void) {
|
||||||
|
if (mif.state == MG_TCPIP_STATE_READY && mqtt_connection == NULL) {
|
||||||
|
struct mg_mqtt_opts opts = {};
|
||||||
|
opts.clean = true;
|
||||||
|
mqtt_connection =
|
||||||
|
mg_mqtt_connect(&mgr, MQTT_SERVER, &opts, mqtt_ev_handler, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200); // Initialise serial
|
||||||
SPI.begin();
|
while (!Serial) delay(50); // for debug output
|
||||||
pinMode(SS_PIN, OUTPUT);
|
|
||||||
pinMode(LED_BUILTIN, OUTPUT);
|
SPI.begin(); // Iniitialise SPI
|
||||||
mg_log_set_fn([](char ch, void *) { Serial.print(ch); }, NULL);
|
pinMode(SS_PIN, OUTPUT); // to communicate with W5500 Ethernet module
|
||||||
net_init();
|
pinMode(LED_PIN, OUTPUT); // Initialise LED
|
||||||
|
|
||||||
|
mg_mgr_init(&mgr); // Initialise Mongoose event manager
|
||||||
|
mg_log_set(MG_LL_DEBUG); // Set debug log level
|
||||||
|
mg_log_set_fn([](char ch, void *) { Serial.print(ch); }, NULL); // Log serial
|
||||||
|
mif.driver = &mg_tcpip_driver_w5500; // Use W5500 built-in driver
|
||||||
|
mif.driver_data = &spi; // Pass SPI interface to W5500 driver
|
||||||
|
mg_tcpip_init(&mgr, &mif); // Initialise built-in TCP/IP stack
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
if (Serial.available()) process_input(Serial.read());
|
mg_mgr_poll(&mgr, 1); // Process network events
|
||||||
mg_mgr_poll(&mgr, 1);
|
reconnect_if_not_connected(); // Reconnect to MQTT server if needed
|
||||||
}
|
}
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/captive-dns-server/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -10,17 +10,4 @@ following features:
|
|||||||
needing a filesystem to serve it; so being resilient to FS problems
|
needing a filesystem to serve it; so being resilient to FS problems
|
||||||
- All changes are propagated to all connected clients
|
- All changes are propagated to all connected clients
|
||||||
|
|
||||||
## Screenshots
|
|
||||||
|
|
||||||
This is a login screen that prompts for user/password
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Main dashboard
|
|
||||||
|
|
||||||
The main dashboard page shows the interactive console
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
See a detailed tutorial at https://mongoose.ws/tutorials/device-dashboard/
|
See a detailed tutorial at https://mongoose.ws/tutorials/device-dashboard/
|
||||||
@@ -26,12 +26,6 @@ static struct settings s_settings = {true, 1, 57, NULL};
|
|||||||
static const char *s_json_header =
|
static const char *s_json_header =
|
||||||
"Content-Type: application/json\r\n"
|
"Content-Type: application/json\r\n"
|
||||||
"Cache-Control: no-cache\r\n";
|
"Cache-Control: no-cache\r\n";
|
||||||
static uint64_t s_boot_timestamp = 0; // Updated by SNTP
|
|
||||||
|
|
||||||
// This is for newlib and TLS (mbedTLS)
|
|
||||||
uint64_t mg_now(void) {
|
|
||||||
return mg_millis() + s_boot_timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ui_event_next(int no, struct ui_event *e) {
|
int ui_event_next(int no, struct ui_event *e) {
|
||||||
if (no < 0 || no >= MAX_EVENTS_NO) return 0;
|
if (no < 0 || no >= MAX_EVENTS_NO) return 0;
|
||||||
@@ -49,23 +43,8 @@ int ui_event_next(int no, struct ui_event *e) {
|
|||||||
return no + 1;
|
return no + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// SNTP connection event handler. When we get a response from an SNTP server,
|
|
||||||
// adjust s_boot_timestamp. We'll get a valid time from that point on
|
|
||||||
static void sfn(struct mg_connection *c, int ev, void *ev_data) {
|
|
||||||
uint64_t *expiration_time = (uint64_t *) c->data;
|
|
||||||
if (ev == MG_EV_OPEN) {
|
|
||||||
*expiration_time = mg_millis() + 3000; // Store expiration time in 3s
|
|
||||||
} else if (ev == MG_EV_SNTP_TIME) {
|
|
||||||
uint64_t t = *(uint64_t *) ev_data;
|
|
||||||
s_boot_timestamp = t - mg_millis();
|
|
||||||
c->is_closing = 1;
|
|
||||||
} else if (ev == MG_EV_POLL) {
|
|
||||||
if (mg_millis() > *expiration_time) c->is_closing = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void timer_sntp_fn(void *param) { // SNTP timer function. Sync up time
|
static void timer_sntp_fn(void *param) { // SNTP timer function. Sync up time
|
||||||
mg_sntp_connect(param, "udp://time.google.com:123", sfn, NULL);
|
mg_sntp_connect(param, "udp://time.google.com:123", NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse HTTP requests, return authenticated user or NULL
|
// Parse HTTP requests, return authenticated user or NULL
|
||||||
@@ -98,19 +77,22 @@ static struct user *authenticate(struct mg_http_message *hm) {
|
|||||||
|
|
||||||
static void handle_login(struct mg_connection *c, struct user *u) {
|
static void handle_login(struct mg_connection *c, struct user *u) {
|
||||||
char cookie[256];
|
char cookie[256];
|
||||||
|
const char *cookie_name = c->is_tls ? "secure_access_token" : "access_token";
|
||||||
mg_snprintf(cookie, sizeof(cookie),
|
mg_snprintf(cookie, sizeof(cookie),
|
||||||
"Set-Cookie: access_token=%s; Path=/; "
|
"Set-Cookie: %s=%s; Path=/; "
|
||||||
"%sHttpOnly; SameSite=Lax; Max-Age=%d\r\n",
|
"%sHttpOnly; SameSite=Lax; Max-Age=%d\r\n",
|
||||||
u->access_token, c->is_tls ? "Secure; " : "", 3600 * 24);
|
cookie_name, u->access_token,
|
||||||
|
c->is_tls ? "Secure; " : "", 3600 * 24);
|
||||||
mg_http_reply(c, 200, cookie, "{%m:%m}", MG_ESC("user"), MG_ESC(u->name));
|
mg_http_reply(c, 200, cookie, "{%m:%m}", MG_ESC("user"), MG_ESC(u->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_logout(struct mg_connection *c) {
|
static void handle_logout(struct mg_connection *c) {
|
||||||
char cookie[256];
|
char cookie[256];
|
||||||
|
const char *cookie_name = c->is_tls ? "secure_access_token" : "access_token";
|
||||||
mg_snprintf(cookie, sizeof(cookie),
|
mg_snprintf(cookie, sizeof(cookie),
|
||||||
"Set-Cookie: access_token=; Path=/; "
|
"Set-Cookie: %s=; Path=/; "
|
||||||
"Expires=Thu, 01 Jan 1970 00:00:00 UTC; "
|
"Expires=Thu, 01 Jan 1970 00:00:00 UTC; "
|
||||||
"%sHttpOnly; Max-Age=0; \r\n",
|
"%sHttpOnly; Max-Age=0; \r\n", cookie_name,
|
||||||
c->is_tls ? "Secure; " : "");
|
c->is_tls ? "Secure; " : "");
|
||||||
mg_http_reply(c, 200, cookie, "true\n");
|
mg_http_reply(c, 200, cookie, "true\n");
|
||||||
}
|
}
|
||||||
@@ -210,56 +192,16 @@ static void handle_firmware_upload(struct mg_connection *c,
|
|||||||
mg_http_reply(c, 500, "", "offset and total not set\n");
|
mg_http_reply(c, 500, "", "offset and total not set\n");
|
||||||
} else if (ofs == 0 && mg_ota_begin((size_t) tot) == false) {
|
} else if (ofs == 0 && mg_ota_begin((size_t) tot) == false) {
|
||||||
mg_http_reply(c, 500, "", "mg_ota_begin(%ld) failed\n", tot);
|
mg_http_reply(c, 500, "", "mg_ota_begin(%ld) failed\n", tot);
|
||||||
} else if (data.len > 0 && mg_ota_write(data.ptr, data.len) == false) {
|
} else if (data.len > 0 && mg_ota_write(data.buf, data.len) == false) {
|
||||||
mg_http_reply(c, 500, "", "mg_ota_write(%lu) @%ld failed\n", data.len, ofs);
|
mg_http_reply(c, 500, "", "mg_ota_write(%lu) @%ld failed\n", data.len, ofs);
|
||||||
mg_ota_end();
|
mg_ota_end();
|
||||||
} else if (data.len == 0 && mg_ota_end() == false) {
|
} else if (data.len == 0 && mg_ota_end() == false) {
|
||||||
mg_http_reply(c, 500, "", "mg_ota_end() failed\n", tot);
|
mg_http_reply(c, 500, "", "mg_ota_end() failed\n", tot);
|
||||||
} else {
|
} else {
|
||||||
mg_http_reply(c, 200, s_json_header, "true\n");
|
mg_http_reply(c, 200, s_json_header, "true\n");
|
||||||
if (data.len == 0) {
|
|
||||||
// Successful mg_ota_end() called, schedule device reboot
|
|
||||||
mg_timer_add(c->mgr, 500, 0, (void (*)(void *)) mg_device_reset, NULL);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_firmware_commit(struct mg_connection *c) {
|
|
||||||
mg_http_reply(c, 200, s_json_header, "%s\n",
|
|
||||||
mg_ota_commit() ? "true" : "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_firmware_rollback(struct mg_connection *c) {
|
|
||||||
mg_http_reply(c, 200, s_json_header, "%s\n",
|
|
||||||
mg_ota_rollback() ? "true" : "false");
|
|
||||||
}
|
|
||||||
|
|
||||||
static size_t print_status(void (*out)(char, void *), void *ptr, va_list *ap) {
|
|
||||||
int fw = va_arg(*ap, int);
|
|
||||||
return mg_xprintf(out, ptr, "{%m:%d,%m:%c%lx%c,%m:%u,%m:%u}\n",
|
|
||||||
MG_ESC("status"), mg_ota_status(fw), MG_ESC("crc32"), '"',
|
|
||||||
mg_ota_crc32(fw), '"', MG_ESC("size"), mg_ota_size(fw),
|
|
||||||
MG_ESC("timestamp"), mg_ota_timestamp(fw));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_firmware_status(struct mg_connection *c) {
|
|
||||||
mg_http_reply(c, 200, s_json_header, "[%M,%M]\n", print_status,
|
|
||||||
MG_FIRMWARE_CURRENT, print_status, MG_FIRMWARE_PREVIOUS);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_device_reset(struct mg_connection *c) {
|
|
||||||
mg_http_reply(c, 200, s_json_header, "true\n");
|
|
||||||
mg_timer_add(c->mgr, 500, 0, (void (*)(void *)) mg_device_reset, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handle_device_eraselast(struct mg_connection *c) {
|
|
||||||
size_t ss = mg_flash_sector_size(), size = mg_flash_size();
|
|
||||||
char *base = (char *) mg_flash_start(), *last = base + size - ss;
|
|
||||||
if (mg_flash_bank() == 2) last -= size / 2;
|
|
||||||
mg_flash_erase(last);
|
|
||||||
mg_http_reply(c, 200, s_json_header, "true\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
// HTTP request handler function
|
// HTTP request handler function
|
||||||
static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
if (ev == MG_EV_ACCEPT) {
|
if (ev == MG_EV_ACCEPT) {
|
||||||
@@ -273,34 +215,24 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
|||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
struct user *u = authenticate(hm);
|
struct user *u = authenticate(hm);
|
||||||
|
|
||||||
if (mg_http_match_uri(hm, "/api/#") && u == NULL) {
|
if (mg_match(hm->uri, mg_str("/api/#"), NULL) && u == NULL) {
|
||||||
mg_http_reply(c, 403, "", "Not Authorised\n");
|
mg_http_reply(c, 403, "", "Not Authorised\n");
|
||||||
} else if (mg_http_match_uri(hm, "/api/login")) {
|
} else if (mg_match(hm->uri, mg_str("/api/login"), NULL)) {
|
||||||
handle_login(c, u);
|
handle_login(c, u);
|
||||||
} else if (mg_http_match_uri(hm, "/api/logout")) {
|
} else if (mg_match(hm->uri, mg_str("/api/logout"), NULL)) {
|
||||||
handle_logout(c);
|
handle_logout(c);
|
||||||
} else if (mg_http_match_uri(hm, "/api/debug")) {
|
} else if (mg_match(hm->uri, mg_str("/api/debug"), NULL)) {
|
||||||
handle_debug(c, hm);
|
handle_debug(c, hm);
|
||||||
} else if (mg_http_match_uri(hm, "/api/stats/get")) {
|
} else if (mg_match(hm->uri, mg_str("/api/stats/get"), NULL)) {
|
||||||
handle_stats_get(c);
|
handle_stats_get(c);
|
||||||
} else if (mg_http_match_uri(hm, "/api/events/get")) {
|
} else if (mg_match(hm->uri, mg_str("/api/events/get"), NULL)) {
|
||||||
handle_events_get(c, hm);
|
handle_events_get(c, hm);
|
||||||
} else if (mg_http_match_uri(hm, "/api/settings/get")) {
|
} else if (mg_match(hm->uri, mg_str("/api/settings/get"), NULL)) {
|
||||||
handle_settings_get(c);
|
handle_settings_get(c);
|
||||||
} else if (mg_http_match_uri(hm, "/api/settings/set")) {
|
} else if (mg_match(hm->uri, mg_str("/api/settings/set"), NULL)) {
|
||||||
handle_settings_set(c, hm->body);
|
handle_settings_set(c, hm->body);
|
||||||
} else if (mg_http_match_uri(hm, "/api/firmware/upload")) {
|
} else if (mg_match(hm->uri, mg_str("/api/firmware/upload"), NULL)) {
|
||||||
handle_firmware_upload(c, hm);
|
handle_firmware_upload(c, hm);
|
||||||
} else if (mg_http_match_uri(hm, "/api/firmware/commit")) {
|
|
||||||
handle_firmware_commit(c);
|
|
||||||
} else if (mg_http_match_uri(hm, "/api/firmware/rollback")) {
|
|
||||||
handle_firmware_rollback(c);
|
|
||||||
} else if (mg_http_match_uri(hm, "/api/firmware/status")) {
|
|
||||||
handle_firmware_status(c);
|
|
||||||
} else if (mg_http_match_uri(hm, "/api/device/reset")) {
|
|
||||||
handle_device_reset(c);
|
|
||||||
} else if (mg_http_match_uri(hm, "/api/device/eraselast")) {
|
|
||||||
handle_device_eraselast(c);
|
|
||||||
} else {
|
} else {
|
||||||
struct mg_http_serve_opts opts;
|
struct mg_http_serve_opts opts;
|
||||||
memset(&opts, 0, sizeof(opts));
|
memset(&opts, 0, sizeof(opts));
|
||||||
@@ -313,7 +245,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
|||||||
mg_http_serve_dir(c, ev_data, &opts);
|
mg_http_serve_dir(c, ev_data, &opts);
|
||||||
}
|
}
|
||||||
MG_DEBUG(("%lu %.*s %.*s -> %.*s", c->id, (int) hm->method.len,
|
MG_DEBUG(("%lu %.*s %.*s -> %.*s", c->id, (int) hm->method.len,
|
||||||
hm->method.ptr, (int) hm->uri.len, hm->uri.ptr, (int) 3,
|
hm->method.buf, (int) hm->uri.len, hm->uri.buf, (int) 3,
|
||||||
&c->send.buf[9]));
|
&c->send.buf[9]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 24 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB |
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/embedded-filesystem/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -3,8 +3,5 @@ idf_component_register(SRCS "main.c"
|
|||||||
"net.c"
|
"net.c"
|
||||||
"packed_fs.c"
|
"packed_fs.c"
|
||||||
"mongoose.c")
|
"mongoose.c")
|
||||||
component_compile_options(-DMG_ENABLE_LINES)
|
|
||||||
component_compile_options(-DMG_ENABLE_PACKED_FS)
|
|
||||||
component_compile_options(-DHTTP_URL="http://0.0.0.0:80")
|
component_compile_options(-DHTTP_URL="http://0.0.0.0:80")
|
||||||
component_compile_options(-DHTTPS_URL="https://0.0.0.0:443")
|
component_compile_options(-DHTTPS_URL="https://0.0.0.0:443")
|
||||||
component_compile_options(-DMG_TLS=MG_TLS_NONE) # change to 'MG_TLS_MBED' to enable TLS
|
|
||||||
@@ -1,22 +1,13 @@
|
|||||||
// Copyright (c) 2020 Cesanta Software Limited
|
// Copyright (c) 2020 Cesanta Software Limited
|
||||||
// All rights reserved
|
// All rights reserved
|
||||||
|
|
||||||
#include "esp_spiffs.h"
|
|
||||||
#include "mongoose.h"
|
#include "mongoose.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
|
||||||
#define WIFI_SSID "YOUR_WIFI_NETWORK_NAME" // SET THIS!
|
#define WIFI_SSID "YOUR_WIFI_NETWORK_NAME" // SET THIS!
|
||||||
#define WIFI_PASS "YOUR_WIFI_PASSWORD" // SET THIS!
|
#define WIFI_PASS "YOUR_WIFI_PASSWORD" // SET THIS!
|
||||||
#define FS_ROOT "/spiffs"
|
|
||||||
|
|
||||||
void app_main(void) {
|
void app_main(void) {
|
||||||
// Mount filesystem
|
|
||||||
esp_vfs_spiffs_conf_t conf = {
|
|
||||||
.base_path = FS_ROOT, .max_files = 20, .format_if_mount_failed = true};
|
|
||||||
int res = esp_vfs_spiffs_register(&conf);
|
|
||||||
MG_INFO(("FS %s, %d", conf.base_path, res));
|
|
||||||
mg_file_printf(&mg_fs_posix, FS_ROOT "/hello.txt", "%s", "hello from ESP");
|
|
||||||
|
|
||||||
// Setup wifi. This function is implemented in wifi.c
|
// Setup wifi. This function is implemented in wifi.c
|
||||||
// It blocks until connected to the configured WiFi network
|
// It blocks until connected to the configured WiFi network
|
||||||
void wifi_init(const char *ssid, const char *pass);
|
void wifi_init(const char *ssid, const char *pass);
|
||||||
@@ -35,3 +26,247 @@ void app_main(void) {
|
|||||||
web_init(&mgr);
|
web_init(&mgr);
|
||||||
for (;;) mg_mgr_poll(&mgr, 1000); // Infinite event loop
|
for (;;) mg_mgr_poll(&mgr, 1000); // Infinite event loop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if MG_OTA == MG_OTA_CUSTOM
|
||||||
|
enum {
|
||||||
|
MG_OTA_UNAVAILABLE = 0, // No OTA information is present
|
||||||
|
MG_OTA_FIRST_BOOT = 1, // Device booting the first time after the OTA
|
||||||
|
MG_OTA_UNCOMMITTED = 2, // Ditto, but marking us for the rollback
|
||||||
|
MG_OTA_COMMITTED = 3 // The firmware is good
|
||||||
|
};
|
||||||
|
enum { MG_FIRMWARE_CURRENT = 0, MG_FIRMWARE_PREVIOUS = 1 };
|
||||||
|
|
||||||
|
void *mg_flash_start(void) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
size_t mg_flash_size(void) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
size_t mg_flash_sector_size(void) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
size_t mg_flash_write_align(void) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int mg_flash_bank(void) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
bool mg_flash_erase(void *location) {
|
||||||
|
(void) location;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
bool mg_flash_swap_bank(void) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool mg_flash_write(void *addr, const void *buf, size_t len) {
|
||||||
|
(void) addr, (void) buf, (void) len;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
void mg_device_reset(void) {
|
||||||
|
esp_restart();
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "esp_app_format.h"
|
||||||
|
#include "esp_ota_ops.h"
|
||||||
|
|
||||||
|
static size_t s_size = 0; // Firmware size to flash. In-progress indicator
|
||||||
|
static bool rx_checked = false; // Whether firmware being received has been checked as valid
|
||||||
|
const esp_partition_t * update_partition = NULL; // The partition the update is being applied to
|
||||||
|
esp_ota_handle_t update_handle = 0; // Handle of the current update process
|
||||||
|
|
||||||
|
const esp_partition_t * get_partition_from_fw(int fw) {
|
||||||
|
if (MG_FIRMWARE_CURRENT == fw) {
|
||||||
|
return esp_ota_get_running_partition();
|
||||||
|
}
|
||||||
|
const esp_partition_t * p = esp_ota_get_last_invalid_partition();
|
||||||
|
if (NULL == p) {
|
||||||
|
p = esp_ota_get_next_update_partition(NULL);
|
||||||
|
}
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Returns true if the data buffer contains the header of a valid firmware
|
||||||
|
const size_t fw_size_required = sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t) + sizeof(esp_app_desc_t);
|
||||||
|
bool check_fw_header(const void* buf, size_t len) {
|
||||||
|
// Ensure we have received enough data to do the check
|
||||||
|
if (len < fw_size_required) {
|
||||||
|
MG_ERROR(("Insufficient data to check firmware header - %d bytes, require %d bytes", len, fw_size_required));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the magic word of the received firmare
|
||||||
|
esp_app_desc_t* rx_app_info = (esp_app_desc_t*)(((char*)buf) + sizeof(esp_image_header_t) + sizeof(esp_image_segment_header_t));
|
||||||
|
if (ESP_APP_DESC_MAGIC_WORD != rx_app_info->magic_word) {
|
||||||
|
MG_ERROR(("Invalid app - invalid magic word"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
MG_INFO(("Received firmware: %s %s", rx_app_info->project_name, rx_app_info->version));
|
||||||
|
|
||||||
|
// Get the name/version of the running firmware
|
||||||
|
const esp_partition_t *current = esp_ota_get_running_partition();
|
||||||
|
esp_app_desc_t curr_app_info;
|
||||||
|
esp_err_t res = esp_ota_get_partition_description(current, &curr_app_info);
|
||||||
|
if (ESP_OK != res) {
|
||||||
|
MG_ERROR(("Unable to get name/version of running firmware"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
MG_INFO(("Running firmware: %s %s", curr_app_info.project_name, curr_app_info.version));
|
||||||
|
|
||||||
|
// Check the name of the new firmware is the same as the old firmware
|
||||||
|
if (memcmp(curr_app_info.project_name, rx_app_info->project_name, sizeof(curr_app_info.project_name)) != 0) {
|
||||||
|
MG_ERROR(("Firmware name is different. Wrong firmware uploaded! Current %s Uploaded %s", curr_app_info.project_name, rx_app_info->project_name));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check the version of the new firmware is different from the old firmware
|
||||||
|
if (memcmp(curr_app_info.version, rx_app_info->version, sizeof(curr_app_info.version)) == 0) {
|
||||||
|
MG_ERROR(("Firmware version is the same. Wrong firmware uploaded! Current %s, Uploaded %s", curr_app_info.version, rx_app_info->version));
|
||||||
|
//return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t mg_ota_size(int fw) {
|
||||||
|
const esp_partition_t *p = get_partition_from_fw(fw);
|
||||||
|
if (NULL == p) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return p->size;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool mg_ota_begin(size_t new_firmware_size) {
|
||||||
|
rx_checked = false;
|
||||||
|
if (s_size) {
|
||||||
|
MG_ERROR(("OTA already in progress. Call mg_ota_end()"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
int partition_size = mg_ota_size(MG_FIRMWARE_PREVIOUS);
|
||||||
|
if (new_firmware_size > partition_size) {
|
||||||
|
MG_ERROR(("Firmware %lu bytes, max %lu", new_firmware_size, partition_size));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
update_partition = esp_ota_get_next_update_partition(NULL);
|
||||||
|
if (NULL == update_partition) {
|
||||||
|
MG_ERROR(("esp_ota_get_next_update_partition returned NULL"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
esp_err_t res = esp_ota_begin(update_partition, OTA_WITH_SEQUENTIAL_WRITES, &update_handle);
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
esp_ota_abort(update_handle);
|
||||||
|
MG_ERROR(("esp_ota_begin failed (%s)", esp_err_to_name(res)));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
s_size = new_firmware_size;
|
||||||
|
MG_INFO(("Starting OTA, firmware size %lu", s_size));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool mg_ota_write(const void *buf, size_t len) {
|
||||||
|
if (s_size == 0) {
|
||||||
|
MG_ERROR(("OTA is not started, call mg_ota_begin()"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!rx_checked) {
|
||||||
|
if (!check_fw_header(buf, len)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
rx_checked = true;
|
||||||
|
}
|
||||||
|
esp_err_t res = esp_ota_write(update_handle, buf, len);
|
||||||
|
if (res != ESP_OK) {
|
||||||
|
esp_ota_abort(update_handle);
|
||||||
|
MG_ERROR(("esp_ota_write FAILED (%s)", esp_err_to_name(res)));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool mg_ota_end(void) {
|
||||||
|
if (0 == s_size) {
|
||||||
|
MG_INFO(("Finishing OTA: fail"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
s_size = 0;
|
||||||
|
esp_err_t err = esp_ota_end(update_handle);
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
MG_ERROR(("esp_ota_end failed (%s)!", esp_err_to_name(err)));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
err = esp_ota_set_boot_partition(update_partition);
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
MG_ERROR(("esp_ota_set_boot_partition failed (%s)!", esp_err_to_name(err)));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool mg_ota_commit(void) {
|
||||||
|
esp_ota_mark_app_valid_cancel_rollback();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool mg_ota_rollback(void) {
|
||||||
|
if(esp_ota_check_rollback_is_possible()) {
|
||||||
|
esp_ota_mark_app_invalid_rollback_and_reboot();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
MG_ERROR(("Rollback NOT possible"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mg_ota_status(int fw) {
|
||||||
|
const esp_partition_t *p = get_partition_from_fw(fw);
|
||||||
|
if (NULL == p) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int status = MG_OTA_UNAVAILABLE;
|
||||||
|
|
||||||
|
esp_ota_img_states_t img_state = ESP_OTA_IMG_UNDEFINED;
|
||||||
|
esp_err_t res = esp_ota_get_state_partition(p, &img_state);
|
||||||
|
if (ESP_OK == res) {
|
||||||
|
if (ESP_OTA_IMG_VALID == img_state) {
|
||||||
|
status = MG_OTA_COMMITTED;
|
||||||
|
} else if (ESP_OTA_IMG_UNDEFINED == img_state) {
|
||||||
|
status = MG_OTA_UNCOMMITTED;
|
||||||
|
} else if (ESP_OTA_IMG_INVALID == img_state) {
|
||||||
|
status = MG_OTA_UNAVAILABLE;
|
||||||
|
} else if (ESP_OTA_IMG_ABORTED == img_state) {
|
||||||
|
status = MG_OTA_UNAVAILABLE;
|
||||||
|
} else if (ESP_OTA_IMG_NEW == img_state) {
|
||||||
|
status = MG_OTA_FIRST_BOOT;
|
||||||
|
} else if (ESP_OTA_IMG_PENDING_VERIFY == img_state) {
|
||||||
|
status = MG_OTA_UNCOMMITTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t mg_ota_crc32(int fw) {
|
||||||
|
(void) fw;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t mg_ota_timestamp(int fw) {
|
||||||
|
const esp_partition_t *p = get_partition_from_fw(fw);
|
||||||
|
|
||||||
|
esp_app_desc_t app;
|
||||||
|
esp_err_t res = esp_ota_get_partition_description(p, &app);
|
||||||
|
if (ESP_OK != res)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct tm datetime = {};
|
||||||
|
if (NULL == strptime(app.date, "%b %d %Y", &datetime))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if (NULL == strptime(app.time, "%H:%M:%S", &datetime))
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return mktime(&datetime);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
#define MG_ARCH MG_ARCH_ESP32
|
||||||
|
|
||||||
|
#define MG_ENABLE_PACKED_FS 1
|
||||||
|
#define MG_TLS MG_TLS_NONE // change to 'MG_TLS_MBED' to enable TLS
|
||||||
|
#define MG_OTA MG_OTA_CUSTOM
|
||||||
@@ -32,7 +32,7 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
|||||||
esp_wifi_connect();
|
esp_wifi_connect();
|
||||||
} else if (event_base == WIFI_EVENT &&
|
} else if (event_base == WIFI_EVENT &&
|
||||||
event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
event_id == WIFI_EVENT_STA_DISCONNECTED) {
|
||||||
if (s_retry_num < 3) {
|
if (s_retry_num < 10) {
|
||||||
esp_wifi_connect();
|
esp_wifi_connect();
|
||||||
s_retry_num++;
|
s_retry_num++;
|
||||||
MG_INFO(("retry to connect to the AP"));
|
MG_INFO(("retry to connect to the AP"));
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
# Name, Type, SubType, Offset, Size, Flags
|
# Name, Type, SubType, Offset, Size, Flags
|
||||||
nvs, data, nvs, 0x9000, 0x6000,
|
nvs, data, nvs, , 0x6000
|
||||||
phy_init, data, phy, 0xf000, 0x1000,
|
otadata, data, ota, , 0x2000,
|
||||||
storage, data, spiffs, 0x10000, 0x10000,
|
phy_init, data, phy, , 0x1000,
|
||||||
factory, app, factory, 0x100000, 1M,
|
ota_0, app, ota_0, , 948K,
|
||||||
|
ota_1, app, ota_1, , 948K,
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions.csv"
|
||||||
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
CONFIG_PARTITION_TABLE_FILENAME="partitions.csv"
|
||||||
|
CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE=y
|
||||||
#CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
|
#CONFIG_ESP_MAIN_TASK_STACK_SIZE=8192
|
||||||
@@ -15,7 +15,7 @@ build: micropython
|
|||||||
$(DOCKER) $(CMD)
|
$(DOCKER) $(CMD)
|
||||||
|
|
||||||
micropython:
|
micropython:
|
||||||
$(DOCKER) git clone https://github.com/micropython/micropython.git
|
$(DOCKER) git clone --depth 1 -b v1.22.2 https://github.com/micropython/micropython.git
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
test -d micropython && $(DOCKER) rm -rf micropython || true
|
test -d micropython && $(DOCKER) rm -rf micropython || true
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
#define MG_ARCH MG_ARCH_ESP32
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
// For some reason, IDF detection at build time does not work here
|
|
||||||
#define MG_ARCH MG_ARCH_ESP32
|
|
||||||
@@ -5,6 +5,4 @@ idf_component_register(SRCS "main.c"
|
|||||||
"net.c"
|
"net.c"
|
||||||
"packed_fs.c"
|
"packed_fs.c"
|
||||||
"mongoose.c")
|
"mongoose.c")
|
||||||
component_compile_options(-DMG_ENABLE_LINES=1)
|
|
||||||
component_compile_options(-DMG_ENABLE_PACKED_FS=1)
|
|
||||||
component_compile_options(-DUART_API_IMPLEMENTED=1)
|
component_compile_options(-DUART_API_IMPLEMENTED=1)
|
||||||
@@ -5,14 +5,12 @@
|
|||||||
|
|
||||||
const char *s_listening_url = "http://0.0.0.0:80";
|
const char *s_listening_url = "http://0.0.0.0:80";
|
||||||
|
|
||||||
#if 0
|
struct mg_str config_read(void) {
|
||||||
char *config_read(void) {
|
return mg_file_read(&mg_fs_posix, FS_ROOT "/config.json");
|
||||||
return mg_file_read(&mg_fs_posix, FS_ROOT "/config.json", NULL);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
void config_write(struct mg_str config) {
|
void config_write(struct mg_str config) {
|
||||||
mg_file_write(&mg_fs_posix, FS_ROOT "/config.json", config.ptr, config.len);
|
mg_file_write(&mg_fs_posix, FS_ROOT "/config.json", config.buf, config.len);
|
||||||
}
|
}
|
||||||
|
|
||||||
void app_main(void) {
|
void app_main(void) {
|
||||||
@@ -24,13 +22,13 @@ void app_main(void) {
|
|||||||
|
|
||||||
// Try to connect to wifi by using saved WiFi credentials
|
// Try to connect to wifi by using saved WiFi credentials
|
||||||
struct mg_str json = mg_file_read(&mg_fs_posix, WIFI_FILE);
|
struct mg_str json = mg_file_read(&mg_fs_posix, WIFI_FILE);
|
||||||
if (json.ptr != NULL) {
|
if (json.buf != NULL) {
|
||||||
char *ssid = mg_json_get_str(json, "$.ssid");
|
char *ssid = mg_json_get_str(json, "$.ssid");
|
||||||
char *pass = mg_json_get_str(json, "$.pass");
|
char *pass = mg_json_get_str(json, "$.pass");
|
||||||
while (!wifi_init(ssid, pass)) (void) 0;
|
while (!wifi_init(ssid, pass)) (void) 0;
|
||||||
free(ssid);
|
free(ssid);
|
||||||
free(pass);
|
free(pass);
|
||||||
free((void *) json.ptr);
|
free((void *) json.buf);
|
||||||
} else {
|
} else {
|
||||||
// If WiFi is not configured, run CLI until configured
|
// If WiFi is not configured, run CLI until configured
|
||||||
MG_INFO(("WiFi is not configured, running CLI. Press enter"));
|
MG_INFO(("WiFi is not configured, running CLI. Press enter"));
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
#define MG_ARCH MG_ARCH_ESP32
|
||||||
|
|
||||||
|
#define MG_ENABLE_PACKED_FS 1
|
||||||
@@ -7,4 +7,3 @@
|
|||||||
# please read the ESP-IDF documents if you need to do this.
|
# please read the ESP-IDF documents if you need to do this.
|
||||||
#
|
#
|
||||||
|
|
||||||
COMPONENT_INCLUDES += ../../../../../..
|
|
||||||
@@ -23,10 +23,10 @@ static void cb(struct mg_connection *c, int ev, void *ev_data) {
|
|||||||
static void cb2(struct mg_connection *c, int ev, void *ev_data) {
|
static void cb2(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
if (ev == MG_EV_CONNECT) {
|
if (ev == MG_EV_CONNECT) {
|
||||||
struct mg_str s = mg_url_host(CLIENT_URL);
|
struct mg_str s = mg_url_host(CLIENT_URL);
|
||||||
mg_printf(c, "GET / HTTP/1.0\r\nHost: %.*s\r\n\r\n", (int) s.len, s.ptr);
|
mg_printf(c, "GET / HTTP/1.0\r\nHost: %.*s\r\n\r\n", (int) s.len, s.buf);
|
||||||
} else if (ev == MG_EV_HTTP_MSG) {
|
} else if (ev == MG_EV_HTTP_MSG) {
|
||||||
struct mg_http_message *hm = ev_data; // Print HTTP response
|
struct mg_http_message *hm = ev_data; // Print HTTP response
|
||||||
MG_INFO(("Fetched:\n%.*s", (int) hm->message.len, hm->message.ptr));
|
MG_INFO(("Fetched:\n%.*s", (int) hm->message.len, hm->message.buf));
|
||||||
c->is_draining = 1;
|
c->is_draining = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File renamed without changes.
@@ -0,0 +1,2 @@
|
|||||||
|
#define MG_ARCH MG_ARCH_ESP8266
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
|||||||
"Host: %.*s\r\n"
|
"Host: %.*s\r\n"
|
||||||
"Content-Type: octet-stream\r\n"
|
"Content-Type: octet-stream\r\n"
|
||||||
"Content-Length: %d\r\n",
|
"Content-Length: %d\r\n",
|
||||||
mg_url_uri(s_url), (int) host.len, host.ptr, fsize);
|
mg_url_uri(s_url), (int) host.len, host.buf, fsize);
|
||||||
mg_http_bauth(c, s_user, s_pass); // Add Basic auth header
|
mg_http_bauth(c, s_user, s_pass); // Add Basic auth header
|
||||||
mg_printf(c, "%s", "\r\n"); // End HTTP headers
|
mg_printf(c, "%s", "\r\n"); // End HTTP headers
|
||||||
} else if (ev == MG_EV_WRITE && c->send.len < MG_IO_SIZE) {
|
} else if (ev == MG_EV_WRITE && c->send.len < MG_IO_SIZE) {
|
||||||
@@ -53,7 +53,7 @@ static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
|||||||
MG_DEBUG(("MSG"));
|
MG_DEBUG(("MSG"));
|
||||||
// Response is received. Print it
|
// Response is received. Print it
|
||||||
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
printf("%.*s", (int) hm->body.len, hm->body.ptr);
|
printf("%.*s", (int) hm->body.len, hm->body.buf);
|
||||||
c->is_draining = 1; // Tell mongoose to close this connection
|
c->is_draining = 1; // Tell mongoose to close this connection
|
||||||
mg_fs_close(fd);
|
mg_fs_close(fd);
|
||||||
*(bool *) c->fn_data = true; // Tell event loop to stop
|
*(bool *) c->fn_data = true; // Tell event loop to stop
|
||||||
|
|||||||
@@ -25,79 +25,89 @@ static bool authuser(struct mg_http_message *hm) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Streaming upload example. Demonstrates how to use MG_EV_READ events
|
struct upload_state {
|
||||||
// to get large payload in smaller chunks. To test, use curl utility:
|
size_t expected; // POST data length, bytes
|
||||||
static void cb(struct mg_connection *c, int ev, void *ev_data) {
|
size_t received; // Already received bytes
|
||||||
if (ev == MG_EV_READ) {
|
void *fp; // Opened uploaded file
|
||||||
// Parse the incoming data ourselves. If we can parse the request,
|
};
|
||||||
// store two size_t variables in c->data: expected len and recv len.
|
|
||||||
size_t *data = (size_t *) c->data;
|
static void handle_uploads(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
struct mg_fd *fd = (struct mg_fd *) c->fn_data; // get file descriptor
|
struct upload_state *us = (struct upload_state *) c->data;
|
||||||
if (data[0]) { // Already parsed, receiving body
|
struct mg_fs *fs = &mg_fs_posix;
|
||||||
data[1] += c->recv.len;
|
|
||||||
MG_DEBUG(("Got chunk len %lu, %lu total", c->recv.len, data[1]));
|
// Catch /upload requests early, without buffering whole body
|
||||||
fd->fs->wr(fd->fd, c->recv.buf, c->recv.len);
|
// When we receive MG_EV_HTTP_HDRS event, that means we've received all
|
||||||
c->recv.len = 0; // And cleanup the receive buffer. Streaming!
|
// HTTP headers but not necessarily full HTTP body
|
||||||
if (data[1] >= data[0]) {
|
if (ev == MG_EV_HTTP_HDRS) {
|
||||||
mg_fs_close(fd);
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
mg_http_reply(c, 200, "", "ok\n");
|
if (mg_match(hm->uri, mg_str("/upload/#"), NULL)) {
|
||||||
}
|
c->pfn = NULL; // Silence HTTP protocol handler, we'll take over
|
||||||
} else if (c->is_resp == 0) {
|
if (!authuser(hm)) {
|
||||||
struct mg_http_message hm;
|
mg_http_reply(c, 403, "", "Denied\n");
|
||||||
int n = mg_http_parse((char *) c->recv.buf, c->recv.len, &hm);
|
c->is_draining = 1; // Tell mongoose to close this connection
|
||||||
if (n < 0) mg_error(c, "Bad response");
|
} else if (hm->body.len > (size_t) s_max_size) {
|
||||||
if (n > 0) {
|
mg_http_reply(c, 400, "", "Too long\n");
|
||||||
if (mg_http_match_uri(&hm, "/upload/#")) {
|
c->is_draining = 1; // Tell mongoose to close this connection
|
||||||
if (!authuser(&hm)) {
|
} else if (hm->uri.len == 8) { // 8: /upload/
|
||||||
mg_http_reply(c, 403, "", "Denied\n");
|
mg_http_reply(c, 400, "", "Name required\n");
|
||||||
c->is_draining = 1; // Tell mongoose to close this connection
|
c->is_draining = 1; // Tell mongoose to close this connection
|
||||||
} else if (hm.body.len > (size_t) s_max_size) {
|
} else if (strlen(s_upld_dir) + (hm->uri.len - 8) + 2 >
|
||||||
mg_http_reply(c, 400, "", "Too long\n");
|
MG_PATH_MAX) { // 2: MG_DIRSEP + NUL
|
||||||
c->is_draining = 1; // Tell mongoose to close this connection
|
mg_http_reply(c, 400, "", "Path is too long\n");
|
||||||
} else if (hm.uri.len == 8) { // 8: /upload/
|
c->is_draining = 1; // Tell mongoose to close this connection
|
||||||
mg_http_reply(c, 400, "", "Name required\n");
|
} else {
|
||||||
c->is_draining = 1; // Tell mongoose to close this connection
|
char fpath[MG_PATH_MAX];
|
||||||
} else if (strlen(s_upld_dir) + (hm.uri.len - 8) + 2 >
|
snprintf(fpath, MG_PATH_MAX, "%s%c", s_upld_dir, MG_DIRSEP);
|
||||||
MG_PATH_MAX) { // 2: MG_DIRSEP + NUL
|
strncat(fpath, hm->uri.buf + 8, hm->uri.len - 8);
|
||||||
mg_http_reply(c, 400, "", "Path is too long\n");
|
if (!mg_path_is_sane(mg_str(fpath))) {
|
||||||
|
mg_http_reply(c, 400, "", "Invalid path\n");
|
||||||
|
c->is_draining = 1; // Tell mongoose to close this connection
|
||||||
|
} else {
|
||||||
|
struct mg_fd *fd;
|
||||||
|
MG_DEBUG(("Got request"));
|
||||||
|
fs->rm(fpath); // Delete file if it exists
|
||||||
|
if ((fd = fs->op(fpath, MG_FS_WRITE)) == NULL) {
|
||||||
|
mg_http_reply(c, 400, "", "open failed: %d\n", errno);
|
||||||
c->is_draining = 1; // Tell mongoose to close this connection
|
c->is_draining = 1; // Tell mongoose to close this connection
|
||||||
} else {
|
} else {
|
||||||
char fpath[MG_PATH_MAX];
|
us->fp = fd;
|
||||||
snprintf(fpath, MG_PATH_MAX, "%s%c", s_upld_dir, MG_DIRSEP);
|
us->expected = hm->body.len; // Store number of bytes we expect
|
||||||
strncat(fpath, hm.uri.ptr + 8, hm.uri.len - 8);
|
mg_iobuf_del(&c->recv, 0, hm->head.len); // Delete HTTP headers
|
||||||
if (!mg_path_is_sane(fpath)) {
|
|
||||||
mg_http_reply(c, 400, "", "Invalid path\n");
|
|
||||||
c->is_draining = 1; // Tell mongoose to close this connection
|
|
||||||
} else {
|
|
||||||
MG_DEBUG(("Got request, chunk len %lu", c->recv.len - n));
|
|
||||||
if ((fd = mg_fs_open(&mg_fs_posix, fpath, MG_FS_WRITE)) == NULL) {
|
|
||||||
mg_http_reply(c, 400, "", "open failed: %d\n", errno);
|
|
||||||
c->is_draining = 1; // Tell mongoose to close this connection
|
|
||||||
} else {
|
|
||||||
c->fn_data = fd;
|
|
||||||
c->recv.len -= n; // remove headers
|
|
||||||
data[0] = hm.body.len;
|
|
||||||
data[1] = c->recv.len;
|
|
||||||
if (c->recv.len)
|
|
||||||
fd->fs->wr(fd->fd, c->recv.buf + n, c->recv.len);
|
|
||||||
c->recv.len = 0; // consume data
|
|
||||||
if (data[1] >= data[0]) {
|
|
||||||
mg_fs_close(fd);
|
|
||||||
mg_http_reply(c, 200, "", "ok\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
c->is_resp = 1; // ignore the rest of the body
|
|
||||||
} else {
|
|
||||||
struct mg_http_serve_opts opts = {0};
|
|
||||||
opts.root_dir = s_root_dir;
|
|
||||||
mg_http_serve_dir(c, &hm, &opts);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(void) ev_data;
|
|
||||||
|
// Catch uploaded file data for both MG_EV_READ and MG_EV_HTTP_HDRS
|
||||||
|
if (us->expected > 0 && c->recv.len > 0) {
|
||||||
|
us->received += c->recv.len;
|
||||||
|
MG_DEBUG(("Got chunk: %lu bytes, %lu so far, %lu total", c->recv.len,
|
||||||
|
us->received, us->expected));
|
||||||
|
if (us->fp) fs->wr(us->fp, c->recv.buf, c->recv.len); // Write to file
|
||||||
|
c->recv.len = 0; // Delete received data
|
||||||
|
if (us->received >= us->expected) {
|
||||||
|
// Uploaded everything. Send response back
|
||||||
|
MG_INFO(("Uploaded %lu bytes", us->received));
|
||||||
|
mg_http_reply(c, 200, NULL, "%lu ok\n", us->received);
|
||||||
|
if (us->fp) fs->cl(us->fp); // Close file
|
||||||
|
memset(us, 0, sizeof(*us)); // Cleanup upload state
|
||||||
|
c->is_draining = 1; // Close connection when response gets sent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void cb(struct mg_connection *c, int ev, void *ev_data) {
|
||||||
|
if (ev == MG_EV_READ || ev == MG_EV_HTTP_HDRS) {
|
||||||
|
handle_uploads(c, ev, ev_data);
|
||||||
|
} else if (ev == MG_EV_HTTP_MSG && c->pfn != NULL) {
|
||||||
|
// Non-upload requests, we serve normally
|
||||||
|
// NOTE: handle_uploads() may delete request and reset c->pfn
|
||||||
|
struct mg_http_message *hm = (struct mg_http_message *) ev_data;
|
||||||
|
struct mg_http_serve_opts opts = {0};
|
||||||
|
opts.root_dir = s_root_dir;
|
||||||
|
mg_http_serve_dir(c, hm, &opts);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(const char *prog) {
|
static void usage(const char *prog) {
|
||||||
@@ -159,9 +169,7 @@ int main(int argc, char *argv[]) {
|
|||||||
signal(SIGTERM, signal_handler);
|
signal(SIGTERM, signal_handler);
|
||||||
mg_log_set(s_debug_level);
|
mg_log_set(s_debug_level);
|
||||||
mg_mgr_init(&mgr);
|
mg_mgr_init(&mgr);
|
||||||
// use mg_listen instead of mg_http_listen to be able to override the parser
|
if (mg_http_listen(&mgr, s_listening_address, cb, NULL) == NULL) {
|
||||||
// and shape buffering
|
|
||||||
if (mg_listen(&mgr, s_listening_address, cb, NULL) == NULL) {
|
|
||||||
MG_ERROR(("Cannot listen on %s.", s_listening_address));
|
MG_ERROR(("Cannot listen on %s.", s_listening_address));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/file-uploads/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/file-uploads/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/file-uploads/
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
// Copyright (c) 2020-2024 Cesanta Software Limited
|
|
||||||
// All rights reserved
|
|
||||||
//
|
|
||||||
// Streaming upload example. Demonstrates how to use MG_EV_READ events
|
|
||||||
// to get large payload in smaller chunks. To test, use curl utility:
|
|
||||||
//
|
|
||||||
// curl http://localhost:8000/upload?name=a.txt --data-binary @large_file.txt
|
|
||||||
|
|
||||||
#include "mongoose.h"
|
|
||||||
|
|
||||||
// HTTP request handler function. It implements the following endpoints:
|
|
||||||
// /upload - Saves the next file chunk
|
|
||||||
// all other URI - serves web_root/ directory
|
|
||||||
static void fn(struct mg_connection *c, int ev, void *ev_data) {
|
|
||||||
if (ev == MG_EV_READ) {
|
|
||||||
// Parse the incoming data ourselves. If we can parse the request,
|
|
||||||
// store two size_t variables in the c->data: expected len and recv len.
|
|
||||||
size_t *data = (size_t *) c->data;
|
|
||||||
if (data[0]) { // Already parsed, simply print received data
|
|
||||||
data[1] += c->recv.len;
|
|
||||||
MG_INFO(("Got chunk len %lu, %lu total", c->recv.len, data[1]));
|
|
||||||
c->recv.len = 0; // And cleanup the receive buffer. Streaming!
|
|
||||||
if (data[1] >= data[0]) mg_http_reply(c, 200, "", "ok\n");
|
|
||||||
} else {
|
|
||||||
struct mg_http_message hm;
|
|
||||||
int n = mg_http_parse((char *) c->recv.buf, c->recv.len, &hm);
|
|
||||||
if (n < 0) mg_error(c, "Bad response");
|
|
||||||
if (n > 0) {
|
|
||||||
if (mg_http_match_uri(&hm, "/upload")) {
|
|
||||||
MG_INFO(("Got chunk len %lu", c->recv.len - n));
|
|
||||||
data[0] = hm.body.len;
|
|
||||||
data[1] = c->recv.len - n;
|
|
||||||
if (data[1] >= data[0]) mg_http_reply(c, 200, "", "ok\n");
|
|
||||||
} else {
|
|
||||||
struct mg_http_serve_opts opts = {.root_dir = "web_root"};
|
|
||||||
mg_http_serve_dir(c, &hm, &opts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(void) ev_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(void) {
|
|
||||||
struct mg_mgr mgr;
|
|
||||||
|
|
||||||
mg_mgr_init(&mgr);
|
|
||||||
mg_log_set(MG_LL_DEBUG); // Set debug log level
|
|
||||||
mg_listen(&mgr, "http://localhost:8000", fn, NULL);
|
|
||||||
|
|
||||||
for (;;) mg_mgr_poll(&mgr, 50);
|
|
||||||
mg_mgr_free(&mgr);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/http-client/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../test/data/ca.pem
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/http-proxy-client/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/http-server/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/http-reverse-proxy/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/http-server/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/huge-response/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
BOARD = xmc7200
|
||||||
|
IDE = GCC+make
|
||||||
|
RTOS = baremetal
|
||||||
|
WIZARD_URL ?= http://mongoose.ws/wizard
|
||||||
|
|
||||||
|
all build example: firmware.bin
|
||||||
|
|
||||||
|
firmware.bin: wizard
|
||||||
|
make -C wizard CFLAGS_EXTRA=$(CFLAGS_EXTRA) && mv wizard/firmware.bin ./
|
||||||
|
|
||||||
|
wizard:
|
||||||
|
hash=$$(curl -s -X POST -H "Content-Type: application/json" -d '{"build":{"board":"$(BOARD)","ide":"$(IDE)","rtos":"$(RTOS)"}}' $(WIZARD_URL)/api/hash | jq -r '.hash') \
|
||||||
|
&& curl -s $(WIZARD_URL)/api/zip/$(BOARD)/$(IDE)/$(RTOS)/$$hash -o wizard.zip
|
||||||
|
unzip wizard.zip
|
||||||
|
cd wizard ; rm mongoose.[ch] ; ln -s ../../../../mongoose.c ; ln -s ../../../../mongoose.h
|
||||||
|
|
||||||
|
|
||||||
|
# Automated remote test. Requires env variable VCON_API_KEY set. See https://vcon.io/automated-firmware-tests/
|
||||||
|
DEVICE_URL ?= https://dash.vcon.io/api/v3/devices/??
|
||||||
|
update: firmware.bin
|
||||||
|
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/ota --data-binary @$<
|
||||||
|
|
||||||
|
test update: CFLAGS_EXTRA ="-DUART_DEBUG=USART1"
|
||||||
|
test: update
|
||||||
|
curl --fail-with-body -su :$(VCON_API_KEY) $(DEVICE_URL)/tx?t=15 | tee /tmp/output.txt
|
||||||
|
grep 'READY, IP:' /tmp/output.txt # Check for network init
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf firmware.* wizard*
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
See [Wizard](https://mongoose.ws/wizard/#/output?board=xmc7200&ide=GCC+make&rtos=baremetal&file=README.md)
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/json-rpc-over-websocket/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
See detailed tutorial at https://mongoose.ws/tutorials/webui-push/
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.c
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../mongoose.h
|
|
||||||
@@ -36,7 +36,7 @@ flash: firmware.bin
|
|||||||
cmsis_core:
|
cmsis_core:
|
||||||
git clone --depth 1 -b 5.9.0 https://github.com/ARM-software/CMSIS_5 $@
|
git clone --depth 1 -b 5.9.0 https://github.com/ARM-software/CMSIS_5 $@
|
||||||
cmsis_sam:
|
cmsis_sam:
|
||||||
curl -sL https://packs.download.microchip.com/Microchip.SAME54_DFP.3.8.234.pack -o $@.zip
|
curl -sL https://packs.download.microchip.com/Microchip.SAME54_DFP.3.9.244.atpack -o $@.zip
|
||||||
mkdir $@ && cd $@ && unzip ../$@.zip
|
mkdir $@ && cd $@ && unzip ../$@.zip
|
||||||
|
|
||||||
# Automated test via https://vcon.io/automated-firmware-tests/. Set VCON_API_KEY and update DEVICE_URL
|
# Automated test via https://vcon.io/automated-firmware-tests/. Set VCON_API_KEY and update DEVICE_URL
|
||||||
|
|||||||
Loaded 100 of 1831 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user