SiFive HiFive1 Rev B

Today, I got a very BAD news: one of my BEST classmates in my senior middle school has been staying in the hospital for OVER 3 months. The very serious pancreatitis has used up ALL his family's savings. That is the current Chinese medical system. Chinese people have NO 2nd choice: * either be the ruled class, who need to pay unaffordable medical service fee * or be the ruling class, who have THE RIGHT to enjoy ALL types of FREE medical service

SiFive is a NEW birth in the CHIP industry, which is based on RISC-V, started by University of California, Berkeley. I don't know where it will go, and how well it can do. But, innovation is just the right way to breakthrough the STALE ruling class.

1. Zephyr

There are plenty of popular RTOSes for MCUs with different architectures, including ARM, RISC-V, etc.

In my personal point of view: * MCUs: are based on microcontrollers, which are normally single user single thread. * SBCs: come with a true multi-user multi-threading operating system, for instance, Linux.

A detailed summary can be found on Wikipedia.

1.2 Getting Started With Zephyr

Over 150 boards are NOW supported by Zephyr, including today's leading role: HiFive1 Rev B. Let's just test out Zephyr right away.

In the following, we strictly follow Zephyr Getting Started Guide, with trivial customization.

1.2.1 Get the source code

Make sure west has been installed by pip install -U west --user, and then initialize and update Zephyr project contents as:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
➜  Zephyr pip show west
Name: west
Version: 0.6.0
Summary: Zephyr RTOS Project meta-tool
Home-page: https://github.com/zephyrproject-rtos/west
Author: Zephyr Project
Author-email: devel@lists.zephyrproject.org
License: UNKNOWN
Location: ~/.local/lib/python3.7/site-packages
Requires: PyYAML, configobj, colorama, pykwalify, setuptools
Required-by:
➜ Zephyr west init zephyrproject
=== Initializing in ....../zephyrproject
--- Cloning manifest repository from https://github.com/zephyrproject-rtos/zephyr, rev. master
Initialized empty Git repository in ....../zephyrproject/.west/manifest-tmp/.git/
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (7/7), done.
remote: Total 359884 (delta 1), reused 0 (delta 0), pack-reused 359877
Receiving objects: 100% (359884/359884), 254.15 MiB | 12.49 MiB/s, done.
Resolving deltas: 100% (267566/267566), done.
From https://github.com/zephyrproject-rtos/zephyr
* branch master -> FETCH_HEAD
* [new branch] arm -> origin/arm
* [new branch] backport-14980-to-v1.14-branch -> origin/backport-14980-to-v1.14-branch
* [new branch] backport-15780-to-v1.14-branch -> origin/backport-15780-to-v1.14-branch
* [new branch] backport-17058-to-v1.14-branch -> origin/backport-17058-to-v1.14-branch
* [new branch] backport-17066-to-v1.14-branch -> origin/backport-17066-to-v1.14-branch
* [new branch] backport-17067-to-v1.14-branch -> origin/backport-17067-to-v1.14-branch
* [new branch] backport-17141-to-v1.14-branch -> origin/backport-17141-to-v1.14-branch
* [new branch] backport-17146-to-v1.14-branch -> origin/backport-17146-to-v1.14-branch
* [new branch] backport-17159-to-v1.14-branch -> origin/backport-17159-to-v1.14-branch
* [new branch] backport-17227-to-v1.14-branch -> origin/backport-17227-to-v1.14-branch
* [new branch] backport-17263-to-v1.14-branch -> origin/backport-17263-to-v1.14-branch
* [new branch] backport-17289-to-v1.14-branch -> origin/backport-17289-to-v1.14-branch
* [new branch] backport-17298-to-v1.14-branch -> origin/backport-17298-to-v1.14-branch
* [new branch] backport-17305-to-v1.14-branch -> origin/backport-17305-to-v1.14-branch
* [new branch] backport-17308-to-v1.14-branch -> origin/backport-17308-to-v1.14-branch
* [new branch] backport-17351-to-v1.14-branch -> origin/backport-17351-to-v1.14-branch
* [new branch] backport-17360-to-v1.14-branch -> origin/backport-17360-to-v1.14-branch
* [new branch] backport-17369-to-v1.14-branch -> origin/backport-17369-to-v1.14-branch
* [new branch] backport-17400-to-v1.14-branch -> origin/backport-17400-to-v1.14-branch
* [new branch] backport-17402-to-v1.14-branch -> origin/backport-17402-to-v1.14-branch
* [new branch] backport-17404-to-v1.14-branch -> origin/backport-17404-to-v1.14-branch
* [new branch] backport-17405-to-v1.14-branch -> origin/backport-17405-to-v1.14-branch
* [new branch] backport-17428-to-v1.14-branch -> origin/backport-17428-to-v1.14-branch
* [new branch] backport-17451-to-v1.14-branch -> origin/backport-17451-to-v1.14-branch
* [new branch] backport-17465-to-v1.14-branch -> origin/backport-17465-to-v1.14-branch
* [new branch] backport-17474-to-v1.14-branch -> origin/backport-17474-to-v1.14-branch
* [new branch] backport-17489-to-v1.14-branch -> origin/backport-17489-to-v1.14-branch
* [new branch] backport-17575-to-v1.14-branch -> origin/backport-17575-to-v1.14-branch
* [new branch] backport-17596-to-v1.14-branch -> origin/backport-17596-to-v1.14-branch
* [new branch] backport-17601-to-v1.14-branch -> origin/backport-17601-to-v1.14-branch
* [new branch] backport-17602-to-v1.14-branch -> origin/backport-17602-to-v1.14-branch
* [new branch] backport-17603-to-v1.14-branch -> origin/backport-17603-to-v1.14-branch
* [new branch] backport-17605-to-v1.14-branch -> origin/backport-17605-to-v1.14-branch
* [new branch] backport-17606-to-v1.14-branch -> origin/backport-17606-to-v1.14-branch
* [new branch] backport-17614-to-v1.14-branch -> origin/backport-17614-to-v1.14-branch
* [new branch] backport-17618-to-v1.14-branch -> origin/backport-17618-to-v1.14-branch
* [new branch] backport-17705-to-v1.14-branch -> origin/backport-17705-to-v1.14-branch
* [new branch] backport-17724-to-v1.14-branch -> origin/backport-17724-to-v1.14-branch
* [new branch] backport-17798-to-v1.14-branch -> origin/backport-17798-to-v1.14-branch
* [new branch] backport-17836-to-v1.14-branch -> origin/backport-17836-to-v1.14-branch
* [new branch] backport-17859-to-v1.14-branch -> origin/backport-17859-to-v1.14-branch
* [new branch] master -> origin/master
* [new branch] pull/17988/head -> origin/pull/17988/head
* [new branch] topic-EDTS -> origin/topic-EDTS
* [new branch] topic-sensors -> origin/topic-sensors
* [new branch] v1.10-branch -> origin/v1.10-branch
* [new branch] v1.11-branch -> origin/v1.11-branch
* [new branch] v1.12-branch -> origin/v1.12-branch
* [new branch] v1.13-branch -> origin/v1.13-branch
* [new branch] v1.14-branch -> origin/v1.14-branch
* [new branch] v1.5-branch -> origin/v1.5-branch
* [new branch] v1.6-branch -> origin/v1.6-branch
* [new branch] v1.7-branch -> origin/v1.7-branch
* [new branch] v1.8-branch -> origin/v1.8-branch
* [new branch] v1.9-branch -> origin/v1.9-branch
* [new tag] v1.0.0 -> v1.0.0
* [new tag] v1.1.0 -> v1.1.0
* [new tag] v1.1.0-rc1 -> v1.1.0-rc1
* [new tag] v1.10.0 -> v1.10.0
* [new tag] v1.10.0-rc1 -> v1.10.0-rc1
* [new tag] v1.10.0-rc2 -> v1.10.0-rc2
* [new tag] v1.10.0-rc3 -> v1.10.0-rc3
* [new tag] v1.11.0 -> v1.11.0
* [new tag] v1.11.0-rc1 -> v1.11.0-rc1
* [new tag] v1.11.0-rc2 -> v1.11.0-rc2
* [new tag] v1.11.0-rc3 -> v1.11.0-rc3
* [new tag] v1.12.0 -> v1.12.0
* [new tag] v1.12.0-rc1 -> v1.12.0-rc1
* [new tag] v1.12.0-rc2 -> v1.12.0-rc2
* [new tag] v1.12.0-rc3 -> v1.12.0-rc3
* [new tag] v1.13.0 -> v1.13.0
* [new tag] v1.13.0-rc1 -> v1.13.0-rc1
* [new tag] v1.13.0-rc2 -> v1.13.0-rc2
* [new tag] v1.13.0-rc3 -> v1.13.0-rc3
* [new tag] v1.14.0 -> v1.14.0
* [new tag] v1.14.0-rc1 -> v1.14.0-rc1
* [new tag] v1.14.0-rc2 -> v1.14.0-rc2
* [new tag] v1.14.0-rc3 -> v1.14.0-rc3
* [new tag] v1.14.1-rc1 -> v1.14.1-rc1
* [new tag] v1.2.0 -> v1.2.0
* [new tag] v1.2.0-rc1 -> v1.2.0-rc1
* [new tag] v1.2.0-rc2 -> v1.2.0-rc2
* [new tag] v1.3.0 -> v1.3.0
* [new tag] v1.3.0-rc1 -> v1.3.0-rc1
* [new tag] v1.3.0-rc2 -> v1.3.0-rc2
* [new tag] v1.4.0 -> v1.4.0
* [new tag] v1.4.0-rc1 -> v1.4.0-rc1
* [new tag] v1.4.0-rc2 -> v1.4.0-rc2
* [new tag] v1.4.0-rc3 -> v1.4.0-rc3
* [new tag] v1.5.0 -> v1.5.0
* [new tag] v1.5.0-rc0 -> v1.5.0-rc0
* [new tag] v1.5.0-rc1 -> v1.5.0-rc1
* [new tag] v1.5.0-rc2 -> v1.5.0-rc2
* [new tag] v1.5.0-rc3 -> v1.5.0-rc3
* [new tag] v1.5.0-rc4 -> v1.5.0-rc4
* [new tag] v1.6.0 -> v1.6.0
* [new tag] v1.6.0-rc1 -> v1.6.0-rc1
* [new tag] v1.6.0-rc2 -> v1.6.0-rc2
* [new tag] v1.6.0-rc3 -> v1.6.0-rc3
* [new tag] v1.6.0-rc4 -> v1.6.0-rc4
* [new tag] v1.6.1 -> v1.6.1
* [new tag] v1.6.1-rc -> v1.6.1-rc
* [new tag] v1.6.99 -> v1.6.99
* [new tag] v1.7.0 -> v1.7.0
* [new tag] v1.7.0-rc1 -> v1.7.0-rc1
* [new tag] v1.7.0-rc2 -> v1.7.0-rc2
* [new tag] v1.7.0-rc3 -> v1.7.0-rc3
* [new tag] v1.7.0-rc4 -> v1.7.0-rc4
* [new tag] v1.7.1 -> v1.7.1
* [new tag] v1.7.1-rc -> v1.7.1-rc
* [new tag] v1.7.99 -> v1.7.99
* [new tag] v1.8.0 -> v1.8.0
* [new tag] v1.8.0-rc1 -> v1.8.0-rc1
* [new tag] v1.8.0-rc2 -> v1.8.0-rc2
* [new tag] v1.8.0-rc3 -> v1.8.0-rc3
* [new tag] v1.8.0-rc4 -> v1.8.0-rc4
* [new tag] v1.8.99 -> v1.8.99
* [new tag] v1.9.0 -> v1.9.0
* [new tag] v1.9.0-rc1 -> v1.9.0-rc1
* [new tag] v1.9.0-rc2 -> v1.9.0-rc2
* [new tag] v1.9.0-rc3 -> v1.9.0-rc3
* [new tag] v1.9.0-rc4 -> v1.9.0-rc4
* [new tag] v1.9.1 -> v1.9.1
* [new tag] v1.9.2 -> v1.9.2
* [new tag] zephyr-v1.0.0 -> zephyr-v1.0.0
* [new tag] zephyr-v1.1.0 -> zephyr-v1.1.0
* [new tag] zephyr-v1.10.0 -> zephyr-v1.10.0
* [new tag] zephyr-v1.11.0 -> zephyr-v1.11.0
* [new tag] zephyr-v1.12.0 -> zephyr-v1.12.0
* [new tag] zephyr-v1.13.0 -> zephyr-v1.13.0
* [new tag] zephyr-v1.14.0 -> zephyr-v1.14.0
* [new tag] zephyr-v1.2.0 -> zephyr-v1.2.0
* [new tag] zephyr-v1.3.0 -> zephyr-v1.3.0
* [new tag] zephyr-v1.4.0 -> zephyr-v1.4.0
* [new tag] zephyr-v1.5.0 -> zephyr-v1.5.0
* [new tag] zephyr-v1.6.0 -> zephyr-v1.6.0
* [new tag] zephyr-v1.6.1 -> zephyr-v1.6.1
* [new tag] zephyr-v1.7.0 -> zephyr-v1.7.0
* [new tag] zephyr-v1.7.1 -> zephyr-v1.7.1
* [new tag] zephyr-v1.8.0 -> zephyr-v1.8.0
* [new tag] zephyr-v1.9.0 -> zephyr-v1.9.0
* [new tag] zephyr-v1.9.1 -> zephyr-v1.9.1
* [new tag] zephyr-v1.9.2 -> zephyr-v1.9.2
77db273f6f84b3d94d34b5e72070ec6bc31e41cf refs/remotes/origin/master
Checking out files: 100% (11758/11758), done.
Branch 'master' set up to track remote branch 'master' from 'origin'.
Already on 'master'
=== Initialized. Now run "west update" inside ....../zephyrproject.
➜ Zephyr cd zephyrproject
➜ zephyrproject west update
=== updating ci-tools (tools/ci-tools):
--- ci-tools: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/tools/ci-tools/.git/
--- ci-tools: fetching changes
remote: Enumerating objects: 40, done.
remote: Counting objects: 100% (40/40), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 396 (delta 27), reused 15 (delta 3), pack-reused 356
Receiving objects: 100% (396/396), 114.12 KiB | 990.00 KiB/s, done.
Resolving deltas: 100% (259/259), done.
From https://github.com/zephyrproject-rtos/ci-tools
* [new branch] cc-crlf -> refs/west/cc-crlf
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
* [new branch] whatchanged -> refs/west/whatchanged
HEAD is now at d56f2dd compliance: clarify CODEOWNER message
--- ci-tools: checked out d56f2dd3510e20fa8cf4aad442495c08a658113f as detached HEAD
=== updating civetweb (modules/lib/civetweb):
--- civetweb: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/lib/civetweb/.git/
--- civetweb: fetching changes
remote: Enumerating objects: 112, done.
remote: Counting objects: 100% (112/112), done.
remote: Compressing objects: 100% (72/72), done.
remote: Total 21202 (delta 57), reused 81 (delta 37), pack-reused 21090
Receiving objects: 100% (21202/21202), 24.50 MiB | 21.95 MiB/s, done.
Resolving deltas: 100% (13585/13585), done.
From https://github.com/antmicro/civetweb
* [new branch] 1.9 -> refs/west/1.9
* [new branch] array_size_check -> refs/west/array_size_check
* [new branch] initial-dirty-zephyr-port -> refs/west/initial-dirty-zephyr-port
* [new branch] master -> refs/west/master
* [new branch] no-filesystems -> refs/west/no-filesystems
* [new branch] no-filesystems-fixes -> refs/west/no-filesystems-fixes
* [new branch] no-filesystems-follow-up -> refs/west/no-filesystems-follow-up
* [new branch] no-filesytems-followup -> refs/west/no-filesytems-followup
* [new branch] wip-ssl-error-queue -> refs/west/wip-ssl-error-queue
* [new branch] wip-zephyr-port -> refs/west/wip-zephyr-port
* [new branch] zephyr-buildsystem-fix -> refs/west/zephyr-buildsystem-fix
* [new branch] zephyr-rtos-port -> refs/west/zephyr-rtos-port
* [new branch] zephyr-sample -> refs/west/zephyr-sample
* [new tag] v1.1 -> v1.1
* [new tag] v1.10 -> v1.10
* [new tag] v1.11 -> v1.11
* [new tag] v1.2 -> v1.2
* [new tag] v1.3 -> v1.3
* [new tag] v1.4 -> v1.4
* [new tag] v1.5 -> v1.5
* [new tag] v1.6 -> v1.6
* [new tag] v1.7 -> v1.7
* [new tag] v1.8 -> v1.8
* [new tag] v1.9 -> v1.9
* [new tag] v1.9.1 -> v1.9.1
HEAD is now at 7ffad765 Merge pull request #773 from antmicro/zephyr-buildsystem-fix
--- civetweb: checked out 7ffad765f9a63a7bab3432ca45248981f559d559 as detached HEAD
=== updating esp-idf (modules/hal/esp-idf):
--- esp-idf: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/hal/esp-idf/.git/
--- esp-idf: fetching changes
remote: Enumerating objects: 76449, done.
remote: Counting objects: 100% (76449/76449), done.
remote: Compressing objects: 100% (19840/19840), done.
remote: Total 76449 (delta 54455), reused 76449 (delta 54455), pack-reused 0
Receiving objects: 100% (76449/76449), 69.09 MiB | 24.97 MiB/s, done.
Resolving deltas: 100% (54455/54455), done.
From https://github.com/zephyrproject-rtos/esp-idf
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
* [new branch] zephyr -> refs/west/zephyr
HEAD is now at 6835bfc74 module: add zephyr integration
--- esp-idf: checked out 6835bfc741bf15e98fb7971293913f770df6081f as detached HEAD
=== updating fatfs (modules/fs/fatfs):
--- fatfs: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/fs/fatfs/.git/
--- fatfs: fetching changes
remote: Enumerating objects: 92, done.
remote: Counting objects: 100% (92/92), done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 92 (delta 45), reused 92 (delta 45), pack-reused 0
Unpacking objects: 100% (92/92), done.
From https://github.com/zephyrproject-rtos/fatfs
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
HEAD is now at df96914 zephyr: add fatfs as a module
--- fatfs: checked out df96914dd989907f3a5de4cb95b116c2f305820d as detached HEAD
=== updating hal_qmsi (modules/hal/qmsi):
--- hal_qmsi: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/hal/qmsi/.git/
--- hal_qmsi: fetching changes
remote: Enumerating objects: 803, done.
remote: Counting objects: 100% (803/803), done.
remote: Compressing objects: 100% (253/253), done.
remote: Total 803 (delta 490), reused 800 (delta 488), pack-reused 0
Receiving objects: 100% (803/803), 517.11 KiB | 1.78 MiB/s, done.
Resolving deltas: 100% (490/490), done.
From https://github.com/zephyrproject-rtos/hal_qmsi
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
HEAD is now at 9195fe6 zephyr: remove kconfig from module
--- hal_qmsi: checked out 9195fe6f97e4f7f25a3fc9e5a515f1b7af13762c as detached HEAD
=== updating hal_cypress (modules/hal/cypress):
--- hal_cypress: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/hal/cypress/.git/
--- hal_cypress: fetching changes
remote: Enumerating objects: 305, done.
remote: Counting objects: 100% (305/305), done.
remote: Compressing objects: 100% (198/198), done.
remote: Total 305 (delta 97), reused 305 (delta 97), pack-reused 0
Receiving objects: 100% (305/305), 954.91 KiB | 2.44 MiB/s, done.
Resolving deltas: 100% (97/97), done.
From https://github.com/zephyrproject-rtos/hal_cypress
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
HEAD is now at a12d928 zephyr: move kconfig to the zephyr tree
--- hal_cypress: checked out a12d92816a53a521d79cefcf5c38b9dc8a4fed6e as detached HEAD
=== updating hal_silabs (modules/hal/silabs):
--- hal_silabs: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/hal/silabs/.git/
--- hal_silabs: fetching changes
remote: Enumerating objects: 1175, done.
remote: Counting objects: 100% (1175/1175), done.
remote: Compressing objects: 100% (299/299), done.
remote: Total 1175 (delta 857), reused 1175 (delta 857), pack-reused 0
Receiving objects: 100% (1175/1175), 3.33 MiB | 6.52 MiB/s, done.
Resolving deltas: 100% (857/857), done.
From https://github.com/zephyrproject-rtos/hal_silabs
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
HEAD is now at 9151e61 zephyr: move kconfig to the zephyr tree
--- hal_silabs: checked out 9151e614c23997074acd1096a3e8a9e5c255d5b9 as detached HEAD
=== updating hal_st (modules/hal/st):
--- hal_st: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/hal/st/.git/
--- hal_st: fetching changes
remote: Enumerating objects: 7103, done.
remote: Counting objects: 100% (7103/7103), done.
remote: Compressing objects: 100% (1018/1018), done.
remote: Total 7103 (delta 5953), reused 7094 (delta 5946), pack-reused 0
Receiving objects: 100% (7103/7103), 22.25 MiB | 15.60 MiB/s, done.
Resolving deltas: 100% (5953/5953), done.
From https://github.com/zephyrproject-rtos/hal_st
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
HEAD is now at 0ec40ae sensor/stmemsc: Introduce STMEMS Standard C Drivers
--- hal_st: checked out 0ec40aed8087f26bd9ac1b70fb5a6c326a6451aa as detached HEAD
=== updating hal_stm32 (modules/hal/stm32):
--- hal_stm32: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/hal/stm32/.git/
--- hal_stm32: fetching changes
remote: Enumerating objects: 44, done.
remote: Counting objects: 100% (44/44), done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 9226 (delta 15), reused 26 (delta 6), pack-reused 9182
Receiving objects: 100% (9226/9226), 29.54 MiB | 20.52 MiB/s, done.
Resolving deltas: 100% (7787/7787), done.
From https://github.com/zephyrproject-rtos/hal_stm32
* [new branch] fix_l4_can -> refs/west/fix_l4_can
* [new branch] master -> refs/west/master
HEAD is now at 49c2685 stm32mp1: add i2c ll driver
--- hal_stm32: checked out 49c26855a651087578b79707fae4ddbb1c0b207d as detached HEAD
=== updating libmetal (modules/hal/libmetal):
--- libmetal: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/hal/libmetal/.git/
--- libmetal: fetching changes
remote: Enumerating objects: 412, done.
remote: Counting objects: 100% (412/412), done.
remote: Compressing objects: 100% (208/208), done.
remote: Total 412 (delta 200), reused 412 (delta 200), pack-reused 0
Receiving objects: 100% (412/412), 143.22 KiB | 971.00 KiB/s, done.
Resolving deltas: 100% (200/200), done.
From https://github.com/zephyrproject-rtos/libmetal
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
HEAD is now at 45e630d zephyr: move kconfig to the zephyr tree
--- libmetal: checked out 45e630d6152824f807d3f919958605c4626cbdff as detached HEAD
=== updating lvgl (modules/lib/gui/lvgl):
--- lvgl: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/lib/gui/lvgl/.git/
--- lvgl: fetching changes
remote: Enumerating objects: 21, done.
remote: Counting objects: 100% (21/21), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 19509 (delta 5), reused 15 (delta 4), pack-reused 19488
Receiving objects: 100% (19509/19509), 14.28 MiB | 16.21 MiB/s, done.
Resolving deltas: 100% (15472/15472), done.
From https://github.com/zephyrproject-rtos/lvgl
* [new branch] master -> refs/west/master
* [new branch] zephyr -> refs/west/zephyr
HEAD is now at a4626e82 lv_canvas: fix with LV_COLOR_16_SWAP
--- lvgl: checked out a4626e82781aecec137250f56d79961ca2f50b7b as detached HEAD
=== updating mbedtls (modules/crypto/mbedtls):
--- mbedtls: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/crypto/mbedtls/.git/
--- mbedtls: fetching changes
remote: Enumerating objects: 1029, done.
remote: Counting objects: 100% (1029/1029), done.
remote: Compressing objects: 100% (249/249), done.
remote: Total 1029 (delta 767), reused 1024 (delta 762), pack-reused 0
Receiving objects: 100% (1029/1029), 1.14 MiB | 3.30 MiB/s, done.
Resolving deltas: 100% (767/767), done.
From https://github.com/zephyrproject-rtos/mbedtls
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
HEAD is now at ca32746 kconfig: move to main tree
--- mbedtls: checked out ca32746072ce3381f1c9ae46ba6cd34c69f8c0ee as detached HEAD
=== updating mcumgr (modules/lib/mcumgr):
--- mcumgr: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/lib/mcumgr/.git/
--- mcumgr: fetching changes
remote: Enumerating objects: 271, done.
remote: Counting objects: 100% (271/271), done.
remote: Compressing objects: 100% (94/94), done.
remote: Total 271 (delta 129), reused 268 (delta 127), pack-reused 0
Receiving objects: 100% (271/271), 74.20 KiB | 1.03 MiB/s, done.
Resolving deltas: 100% (129/129), done.
From https://github.com/zephyrproject-rtos/mcumgr
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
HEAD is now at 8493495 kconfig: move Kconfig to main tree
--- mcumgr: checked out 84934959d2d1722a23b7e7e200191ae4a6f96168 as detached HEAD
=== updating net-tools (tools/net-tools):
--- net-tools: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/tools/net-tools/.git/
--- net-tools: fetching changes
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 1341 (delta 1), reused 2 (delta 1), pack-reused 1336
Receiving objects: 100% (1341/1341), 2.56 MiB | 5.37 MiB/s, done.
Resolving deltas: 100% (445/445), done.
From https://github.com/zephyrproject-rtos/net-tools
* [new branch] master -> refs/west/master
HEAD is now at 30b7efa net-setup: zeth-vlan.conf: Add IP addresses to zeth
--- net-tools: checked out 30b7efa827b04d2e47840716b0372737fe7d6c92 as detached HEAD
=== updating nffs (modules/fs/nffs):
--- nffs: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/fs/nffs/.git/
--- nffs: fetching changes
remote: Enumerating objects: 62, done.
remote: Counting objects: 100% (62/62), done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 62 (delta 19), reused 61 (delta 18), pack-reused 0
Unpacking objects: 100% (62/62), done.
From https://github.com/zephyrproject-rtos/nffs
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
HEAD is now at bc62a2f zephyr: add as a zephyr module
--- nffs: checked out bc62a2fa9d98ddb5d633c932ea199bc68e10f194 as detached HEAD
=== updating open-amp (modules/lib/open-amp):
--- open-amp: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/lib/open-amp/.git/
--- open-amp: fetching changes
remote: Enumerating objects: 204, done.
remote: Counting objects: 100% (204/204), done.
remote: Compressing objects: 100% (139/139), done.
remote: Total 204 (delta 57), reused 200 (delta 54), pack-reused 0
Receiving objects: 100% (204/204), 1.44 MiB | 3.89 MiB/s, done.
Resolving deltas: 100% (57/57), done.
From https://github.com/zephyrproject-rtos/open-amp
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
HEAD is now at 9b591b2 cmake: fix zephyr library abstraction violation
--- open-amp: checked out 9b591b289e1f37339bd038b5a1f0e6c8ad39c63a as detached HEAD
=== updating openthread (modules/lib/openthread):
--- openthread: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/lib/openthread/.git/
--- openthread: fetching changes
remote: Enumerating objects: 5810, done.
remote: Counting objects: 100% (5810/5810), done.
remote: Compressing objects: 100% (2007/2007), done.
remote: Total 48001 (delta 4409), reused 4649 (delta 3782), pack-reused 42191
Receiving objects: 100% (48001/48001), 59.56 MiB | 24.88 MiB/s, done.
Resolving deltas: 100% (36241/36241), done.
From https://github.com/zephyrproject-rtos/openthread
* [new branch] master -> refs/west/master
* [new branch] zephyr -> refs/west/zephyr
HEAD is now at 0dbecf50 west: add zephyr module
--- openthread: checked out 0dbecf508e7a79aae8ed9631f1a63fc65478b213 as detached HEAD
=== updating segger (modules/debug/segger):
--- segger: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/debug/segger/.git/
--- segger: fetching changes
remote: Enumerating objects: 140, done.
remote: Counting objects: 100% (140/140), done.
remote: Compressing objects: 100% (68/68), done.
remote: Total 140 (delta 69), reused 140 (delta 69), pack-reused 0
Receiving objects: 100% (140/140), 73.45 KiB | 529.00 KiB/s, done.
Resolving deltas: 100% (69/69), done.
From https://github.com/zephyrproject-rtos/segger
* [new branch] master -> refs/west/master
* [new branch] v1.14-branch -> refs/west/v1.14-branch
HEAD is now at 6fcf616 ext: segger: update to SystemView v2.52h
--- segger: checked out 6fcf61606d6012d2c44129edc033f59331e268bc as detached HEAD
=== updating tinycbor (modules/lib/tinycbor):
--- tinycbor: cloning and initializing
Initialized empty Git repository in ....../zephyrproject/modules/lib/tinycbor/.git/
--- tinycbor: fetching changes
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 1729 (delta 0), reused 2 (delta 0), pack-reused 1725
Receiving objects: 100% (1729/1729), 1.11 MiB | 2.90 MiB/s, done.
Resolving deltas: 100% (1086/1086), done.
From https://github.com/zephyrproject-rtos/tinycbor
* [new branch] dev -> refs/west/dev
* [new branch] gh-pages -> refs/west/gh-pages
* [new branch] master -> refs/west/master
* [new branch] zephyr -> refs/west/zephyr
* [new tag] v0.1 -> v0.1
* [new tag] v0.2 -> v0.2
* [new tag] v0.2.1 -> v0.2.1
* [new tag] v0.3 -> v0.3
* [new tag] v0.3.1 -> v0.3.1
* [new tag] v0.3.2 -> v0.3.2
* [new tag] v0.4 -> v0.4
* [new tag] v0.4.1 -> v0.4.1
* [new tag] v0.4.2 -> v0.4.2
* [new tag] v0.5-beta1 -> v0.5-beta1
* [new tag] v0.5.0 -> v0.5.0
HEAD is now at 31ae89e zephyr: remove kconfig from module
--- tinycbor: checked out 31ae89e4b768612722620cb6cb173a0de4a19cc9 as detached HEAD
➜ zephyrproject

1.2.2 Update All Required Python Packages

Then, we manually modify/update the file ./zephyr/scripts/requirements.txt as:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
wheel>=0.30.0
breathe>=4.9.1
sphinx>=1.7.5
docutils>=0.14
sphinx_rtd_theme
sphinxcontrib-svg2pdfconverter
junit2html
PyYAML>=3.13
ply>=3.10
hub>=2.0
gitlint
pyelftools>=0.24
pyocd>=0.21.0
pyserial
pykwalify
# "win32" is used for 64-bit Windows as well
# windows-curses; sys_platform == "win32"
colorama
Pillow
intelhex
pytest
gcovr

Make sure all required python packages have been installed by command:

1
➜  zephyrproject pip3 install --user -r zephyr/scripts/requirements.txt

1.2.3 Install the Zephyr Software Development Kit (Zephyr SDK)

Step 1: Download the latest Zephyr Software Development Kit

You can either directly download the latest package from Zephyr project Downloads, or get the package by the following command:

1
2
3
4
5
➜  zephyrproject cd..
➜ Zephyr
➜ Zephyr mkdir release
➜ Zephyr cd release
➜ release wget https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.10.1/zephyr-sdk-0.10.1-setup.run

Step 2: Installation of Zephyr SDK

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
➜  release chmod +x zephyr-sdk-0.10.1-setup.run
➜ release ./zephyr-sdk-0.10.1-setup.run
Verifying archive integrity... All good.
Uncompressing SDK for Zephyr 100%
Enter target directory for SDK (default: /opt/zephyr-sdk/):
Installing SDK to /opt/zephyr-sdk
Creating directory /opt/zephyr-sdk
Success
[*] Installing x86 tools...
[*] Installing arm tools...
[*] Installing arc tools...
[*] Installing iamcu tools...
[*] Installing mips tools...
[*] Installing nios2 tools...
[*] Installing xtensa tools...
[*] Installing riscv32 tools...
[*] Installing x86_64 tools...
[*] Installing additional host tools...
Success installing SDK. SDK is ready to be used.

Step 3: Set Up Toolchain For RISC-V

Using Zephyr's own toolchain is strongly recommended for Zephyr projects (refer to Zephyr Project's Official Documentation ).

1
2
3
4
➜  release export ZEPHYR_TOOLCHAIN_VARIANT=zephyr
➜ release export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk
➜ release cd ../zephyrproject
➜ zephyrproject

1.2.4 Build and Run an Application

Before building and run an application, please make sure you have all required tools ALREADY installed on the host computer. On my HOST Ubuntu 19.04, I've got to manually install dtc (the latest release is version 1.5.0). I'm NOT going to talk about how go figure out installing any REQUIRED packages at this moment. Supposing you've got ALL REQUIRED tools successfully installed ALREADY.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
➜  zephyrproject cd zephyr 
➜ zephyr git:(master) ✗ source zephyr-env.sh
➜ zephyr git:(master) ✗ west build -b hifive1_revb samples/hello_world
-- west build: build configuration:
source directory: ....../zephyrproject/zephyr/samples/hello_world
build directory: ....../zephyrproject/zephyr/build
BOARD: hifive1_revb (origin: command line)
-- west build: generating a build system
Zephyr version: 1.14.99
-- Found PythonInterp: /usr/bin/python (found suitable version "3.7.3", minimum required is "3.4")
-- Selected BOARD hifive1_revb
-- Found west: ~/.local/bin/west (found suitable version "0.6.0", minimum required is "0.5.6")
-- Loading ....../zephyrproject/zephyr/boards/riscv/hifive1_revb/hifive1_revb.dts as base
-- Overlaying ....../zephyrproject/zephyr/dts/common/common.dts
Device tree configuration written to ....../zephyrproject/zephyr/build/zephyr/include/generated/generated_dts_board.conf
Parsing Kconfig tree in ....../zephyrproject/zephyr/Kconfig
Loaded configuration '....../zephyrproject/zephyr/boards/riscv/hifive1_revb/hifive1_revb_defconfig'
Merged configuration '....../zephyrproject/zephyr/samples/hello_world/prj.conf'
Configuration saved to '....../zephyrproject/zephyr/build/zephyr/.config'
-- Cache files will be written to: ~/.cache/zephyr
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- The ASM compiler identification is GNU
-- Found assembler: /opt/zephyr-sdk/riscv32-zephyr-elf/bin/riscv32-zephyr-elf-gcc
-- Performing Test toolchain_is_ok
-- Performing Test toolchain_is_ok - Success
Including module: civetweb in path: ....../zephyrproject/modules/lib/civetweb
-- Target architecture - riscv32
-- Enabling tests in the build - ON
-- Thread Stack Size - 102400
-- Enabling server executable - ON
-- Serve no static files - OFF
-- Disable CGI support - OFF
-- Disable caching support - OFF
-- C++ wrappers - OFF
-- IP Version 6 - OFF
-- Websockets support - OFF
-- Server statistics support - OFF
-- Memory Debugging - OFF
-- ASAN in debug mode - ON
-- Force x32 / x64 architecture - OFF
-- Lua CGI support - OFF
-- Executable installation - ON
-- Build if there are warnings - ON
-- Duktape CGI support - OFF
-- SSL support - ON
-- Compile for OpenSSL 1.1 API - OFF
-- Dynamically load SSL libraries - ON
-- Configuring C Compiler
-- Performing Test HAVE_C_FLAG_STD_C11
-- Performing Test HAVE_C_FLAG_STD_C11 - Success
-- Performing Test HAVE_C_FLAG_FSANITIZE_UNDEFINED
-- Performing Test HAVE_C_FLAG_FSANITIZE_UNDEFINED - Failed
-- Performing Test HAVE_C_FLAG_FSANITIZE_ADDRESS
-- Performing Test HAVE_C_FLAG_FSANITIZE_ADDRESS - Failed
-- Performing Test HAVE_C_FLAG_COVERAGE
-- Performing Test HAVE_C_FLAG_COVERAGE - Success
Including module: esp-idf in path: ....../zephyrproject/modules/hal/esp-idf/zephyr
Including module: fatfs in path: ....../zephyrproject/modules/fs/fatfs
Including module: qmsi in path: ....../zephyrproject/modules/hal/qmsi
Including module: cypress in path: ....../zephyrproject/modules/hal/cypress
Including module: silabs in path: ....../zephyrproject/modules/hal/silabs
Including module: st in path: ....../zephyrproject/modules/hal/st
Including module: stm32 in path: ....../zephyrproject/modules/hal/stm32
Including module: libmetal in path: ....../zephyrproject/modules/hal/libmetal
Including module: lvgl in path: ....../zephyrproject/modules/lib/gui/lvgl
Including module: mbedtls in path: ....../zephyrproject/modules/crypto/mbedtls
Including module: mcumgr in path: ....../zephyrproject/modules/lib/mcumgr
Including module: nffs in path: ....../zephyrproject/modules/fs/nffs
Including module: open-amp in path: ....../zephyrproject/modules/lib/open-amp
Including module: openthread in path: ....../zephyrproject/modules/lib/openthread
Including module: segger in path: ....../zephyrproject/modules/debug/segger
Including module: tinycbor in path: ....../zephyrproject/modules/lib/tinycbor
-- Configuring done
-- Generating done
-- Build files have been written to: ....../zephyrproject/zephyr/build
-- west build: building application
[0/1] Re-running CMake...
Zephyr version: 1.14.99
-- Selected BOARD hifive1_revb
-- Found west: ~/.local/bin/west (found suitable version "0.6.0", minimum required is "0.5.6")
/usr/bin/dtc
-- Loading ....../zephyrproject/zephyr/boards/riscv/hifive1_revb/hifive1_revb.dts as base
-- Overlaying ....../zephyrproject/zephyr/dts/common/common.dts
Device tree configuration written to ....../zephyrproject/zephyr/build/zephyr/include/generated/generated_dts_board.conf
Parsing Kconfig tree in ....../zephyrproject/zephyr/Kconfig
Loaded configuration '....../zephyrproject/zephyr/build/zephyr/.config'
No change to '....../zephyrproject/zephyr/build/zephyr/.config'
-- Cache files will be written to: ~/.cache/zephyr
Including module: civetweb in path: ....../zephyrproject/modules/lib/civetweb
-- Target architecture - riscv32
-- Enabling tests in the build - ON
-- Thread Stack Size - 102400
-- Enabling server executable - ON
-- Serve no static files - OFF
-- Disable CGI support - OFF
-- Disable caching support - OFF
-- C++ wrappers - OFF
-- IP Version 6 - OFF
-- Websockets support - OFF
-- Server statistics support - OFF
-- Memory Debugging - OFF
-- ASAN in debug mode - ON
-- Force x32 / x64 architecture - OFF
-- Lua CGI support - OFF
-- Executable installation - ON
-- Build if there are warnings - ON
-- Duktape CGI support - OFF
-- SSL support - ON
-- Compile for OpenSSL 1.1 API - OFF
-- Dynamically load SSL libraries - ON
-- Configuring C Compiler
Including module: esp-idf in path: ....../zephyrproject/modules/hal/esp-idf/zephyr
Including module: fatfs in path: ....../zephyrproject/modules/fs/fatfs
Including module: qmsi in path: ....../zephyrproject/modules/hal/qmsi
Including module: cypress in path: ....../zephyrproject/modules/hal/cypress
Including module: silabs in path: ....../zephyrproject/modules/hal/silabs
Including module: st in path: ....../zephyrproject/modules/hal/st
Including module: stm32 in path: ....../zephyrproject/modules/hal/stm32
Including module: libmetal in path: ....../zephyrproject/modules/hal/libmetal
Including module: lvgl in path: ....../zephyrproject/modules/lib/gui/lvgl
Including module: mbedtls in path: ....../zephyrproject/modules/crypto/mbedtls
Including module: mcumgr in path: ....../zephyrproject/modules/lib/mcumgr
Including module: nffs in path: ....../zephyrproject/modules/fs/nffs
Including module: open-amp in path: ....../zephyrproject/modules/lib/open-amp
Including module: openthread in path: ....../zephyrproject/modules/lib/openthread
Including module: segger in path: ....../zephyrproject/modules/debug/segger
Including module: tinycbor in path: ....../zephyrproject/modules/lib/tinycbor
-- Configuring done
-- Generating done
-- Build files have been written to: ....../zephyrproject/zephyr/build
[95/100] Linking C executable zephyr/zephyr_prebuilt.elf
Memory region Used Size Region Size %age Used
ROM: 15836 B 3842 KB 0.40%
RAM: 4064 B 16 KB 24.80%
IDT_LIST: 553 B 2 KB 27.00%
[100/100] Linking C executable zephyr/zephyr.elf

And during the building process while you run west build -b hifive1_revb samples/hello_world, you may meet the following headache issues:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
➜  zephyr git:(master) ✗ west build -b hifive1_revb samples/hello_world
-- west build: build configuration:
source directory: ....../Zephyr/zephyrproject/zephyr/samples/hello_world
build directory: ....../Zephyr/zephyrproject/zephyr/build
BOARD: hifive1_revb (origin: command line)
-- west build: generating a build system
Zephyr version: 1.14.99
-- Selected BOARD hifive1_revb
-- Found west: ~/.local/bin/west (found suitable version "0.6.0", minimum required is "0.5.6")
CMake Error at ....../Zephyr/zephyrproject/zephyr/cmake/host-tools.cmake:69 (message):
message called with incorrect number of arguments
Call Stack (most recent call first):
....../Zephyr/zephyrproject/zephyr/cmake/app/boilerplate.cmake:414 (include)
CMakeLists.txt:5 (include)


CMake Error at ....../Zephyr/zephyrproject/zephyr/cmake/host-tools.cmake:70 (string):
string sub-command REGEX, mode MATCH needs at least 5 arguments total to
command.
Call Stack (most recent call first):
....../Zephyr/zephyrproject/zephyr/cmake/app/boilerplate.cmake:414 (include)
CMakeLists.txt:5 (include)


CMake Error at ....../Zephyr/zephyrproject/zephyr/cmake/extensions.cmake:1324 (message):
Assertion failed: The detected dtc version is unsupported.

The version was found to be 0.6.0
But the minimum supported version is 1.4.6
See https://docs.zephyrproject.org/latest/getting_started/
for how to use the SDK's dtc alongside a custom toolchain.
Call Stack (most recent call first):
....../Zephyr/zephyrproject/zephyr/cmake/host-tools.cmake:72 (assert)
....../Zephyr/zephyrproject/zephyr/cmake/app/boilerplate.cmake:414 (include)
CMakeLists.txt:5 (include)


-- Configuring incomplete, errors occurred!
ERROR: command exited with status 1: /usr/bin/cmake -B....../Zephyr/zephyrproject/zephyr/build -S....../Zephyr/zephyrproject/zephyr/samples/hello_world -GNinja -DBOARD=hifive1_revb

In my case, it's because DTC is wrongly and automatically set to:

1
DTC:FILEPATH=/opt/zephyr-sdk/sysroots/x86_64-pokysdk-linux/usr/bin/dtc

even if

1
2
3
4
➜  zephyr whereis dtc
dtc: /usr/bin/dtc
➜ zephyr git:(master) ✗ dtc --version
Version: DTC 1.5.0-gb8d6eca7-dirty

Solution 1: Temporary Solution

Reset DTC to value /usr/bin/dtc in file build/CMakeCache.txt

Solution 2: Permanent Solution

Modify file ./cmake/toolchain/zephyr/0.10.1/host-tools.cmake as follows

  • Replace set(HOST_TOOLS_HOME ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${TOOLCHAIN_ARCH}-pokysdk-linux) with set(HOST_TOOLS_HOME /usr)
  • Remove list(APPEND CMAKE_PREFIX_PATH ${HOST_TOOLS_HOME}/usr)
  • Replace set_ifndef(QEMU_BIOS ${HOST_TOOLS_HOME}/usr/share/qemu) with set_ifndef(QEMU_BIOS /usr/local/share/qemu)
  • Replace set_ifndef(OPENOCD_DEFAULT_PATH ${HOST_TOOLS_HOME}/usr/share/openocd/scripts) with set_ifndef(OPENOCD_DEFAULT_PATH /usr/local/share/openocd/scripts)

Then, rebuild everything with west build -b hifive1_revb samples/hello_world.

2. Running Zephyr on SiFive HiFive1 Rev B01

2.1 Connect SiFive HiFive1 Rev B01

Now, let's plug in SiFive HiFive1 Rev B01 with a QUALIFIED Micro-B USB to USB Type A cable. SiFive HiFive1 Rev B01 will be prompted as a massive storage hard drive as:

HiFive1 Content Readme.html
HiFive1 Rev B01 Content Readme.html

Readme.html shows the following message: This board uses SEGGER J-Link OB technology to connect to the target CPU. More information

, and lsusb shows a SEGGER device:

1
2
3
4
➜  ~ lsusb
......
Bus 001 Device 010: ID 1366:1051 SEGGER
......

2.2 Flash SiFive HiFive1 Rev B01

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
➜  build git:(master) ✗ west flash
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner jlink
-- runners.jlink: Flashing Target Device
SEGGER J-Link Commander V6.48b (Compiled Aug 2 2019 10:20:30)
DLL version V6.48b, compiled Aug 2 2019 10:20:19


J-Link Command File read successfully.
Processing script file...

J-Link connection not established yet but required for command.
Connecting to J-Link via USB...Updating firmware: J-Link OB-K22-SiFive compiled Jul 30 2019 12:24:12
Replacing firmware: J-Link OB-K22-SiFive compiled Mar 15 2019 12:47:14
Waiting for new firmware to boot
New firmware booted successfully
O.K.
Firmware: J-Link OB-K22-SiFive compiled Jul 30 2019 12:24:12
Hardware version: V1.00
S/N: 979000238
VTref=3.300V
Target connection not established yet but required for command.
Device "FE310" selected.


Connecting to target via JTAG
ConfigTargetSettings() start
ConfigTargetSettings() end
TotalIRLen = 5, IRPrint = 0x01
JTAG chain detection found 1 devices:
#0 Id: 0x20000913, IRLen: 05, Unknown device
Debug architecture:
RISC-V debug: 0.13
AddrBits: 7
DataBits: 32
IdleClks: 5
Stat: 0
Memory access:
Via system bus: No
Via ProgBuf: Yes (16 ProgBuf entries)
DataBuf: 1 entries
autoexec[0] implemented: Yes
Detected: RV32 core
CSR access via abs. commands: No
Temp. halted CPU for NumHWBP detection
HW instruction/data BPs: 8
Support set/clr BPs while running: No
HW data BPs trigger before execution of inst
RISC-V identified.
Reset delay: 0 ms
Reset type Normal: Resets core & peripherals using <ndmreset> bit in <dmcontrol> debug register.

Downloading file [....../zephyrproject/zephyr/build/zephyr/zephyr.bin]...
Comparing flash [100%] Done.
Erasing flash [100%] Done.
Programming flash [100%] Done.
Verifying flash [100%] Done.
J-Link: Flash download: Bank 0 @ 0x20000000: 1 range affected (65536 bytes)
J-Link: Flash download: Total time needed: 1.157s (Prepare: 0.081s, Compare: 0.318s, Erase: 0.128s, Program: 0.298s, Verify: 0.318s, Restore: 0.012s)
O.K.



Script processing completed.

2.3 Demonstrate Via Serial Port

By following HiFive1 Rev B01 Getting Started Guide, Chapter 6 Section 2: Console Configuration, we'll have:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
➜  ~ tail -n 15 -F /etc/udev/rules.d/99-jlink.rules
ATTR{idProduct}=="106b", ATTR{idVendor}=="1366", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTR{idProduct}=="106c", ATTR{idVendor}=="1366", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTR{idProduct}=="106d", ATTR{idVendor}=="1366", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTR{idProduct}=="106e", ATTR{idVendor}=="1366", ENV{ID_MM_DEVICE_IGNORE}="1"
ATTR{idProduct}=="106f", ATTR{idVendor}=="1366", ENV{ID_MM_DEVICE_IGNORE}="1"
#
# Make sure that VCOM ports of J-Links can be opened with user rights
# We simply say that all devices from SEGGER which are in the "tty" domain are enumerated with normal user == R/W
#
SUBSYSTEM=="tty", ATTRS{idVendor}=="1366", MODE="0666", GROUP="dialout"
#
# End of list
#
SUBSYSTEM=="tty", ATTRS{idVendor}=="1366", ATTRS{idProduct}=="1051", MODE="664", GROUP="plugdev"
LABEL="jlink_rules_end"
➜ ~ groups
lvision adm dialout cdrom sudo dip plugdev lpadmin sambashare
➜ ~ ll /dev/ttyACM*
crw-rw-rw- 1 root dialout 166, 0 Aug 7 00:05 /dev/ttyACM0
crw-rw-rw- 1 root dialout 166, 1 Aug 6 23:10 /dev/ttyACM1

Let's start monitoring the serial port by:

1
➜  ~ screen /dev/ttyACM0 115200
HiFive1 Rev B01 Serial Port screen

The CORRECT demo should give the following ERROR message:

1
2
3
4
5
6
7
8
9
Bench Clock Reset Complete

ATE0-->ATE0
OK
AT+BLEINIT=0-->OK
AT+CWMODE=0-->OK

***** Booting Zephyr OS build zephyr-v1.14.0-2842-g0440a815a91b *****
Hello World! hifive1_revb

However, I've got NO idea why sometimes there is an Send Flag error:

1
ATE0--> Send Flag error: #0 #0 #0 #0 AT+BLEINIT=0-->AT+BLEINIT=0

It seems the messages are from bootloader, sometimes it fails to initialize ESP32 module.

Alright, it's TOO late already. I'll have to go to bed... ALL the BEST to my classmate.