Compare commits
771 Commits
OpenHarmon
...
OpenHarmon
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d7641af53 | ||
|
|
143309945a | ||
|
|
9c1e902b55 | ||
|
|
84011c89a5 | ||
|
|
89154a3765 | ||
|
|
8e6f3f1bfb | ||
|
|
d5c8341bb0 | ||
|
|
157fb8b212 | ||
|
|
95f7cf16d0 | ||
|
|
790573d018 | ||
|
|
246bdd11d8 | ||
|
|
017d8163ea | ||
|
|
f6d727fed8 | ||
|
|
a771e39988 | ||
|
|
594f50733e | ||
|
|
10bf30f91f | ||
|
|
60e77d0ea7 | ||
|
|
68b477588f | ||
|
|
2f8d12ece1 | ||
|
|
12d4bc05f4 | ||
|
|
b9d012b026 | ||
|
|
b0f642b493 | ||
|
|
6c36623ac7 | ||
|
|
9078efccd1 | ||
|
|
b7c4acfb78 | ||
|
|
aaa3cc9d7b | ||
|
|
dc8853bb78 | ||
|
|
892201f67b | ||
|
|
91709a3599 | ||
|
|
332ba8fd65 | ||
|
|
d9752abcb4 | ||
|
|
12cc392f46 | ||
|
|
62aa4aa0b1 | ||
|
|
929a282bad | ||
|
|
8bb15bf8e7 | ||
|
|
aec7840626 | ||
|
|
e43e252e14 | ||
|
|
ba4ed5a599 | ||
|
|
55bdf174b8 | ||
|
|
c8c3034709 | ||
|
|
f32154f9cb | ||
|
|
60d3f6d5da | ||
|
|
44279b256a | ||
|
|
951d233676 | ||
|
|
ca70dc4dd1 | ||
|
|
a693cd4198 | ||
|
|
f249db759d | ||
|
|
6f0c5d10e2 | ||
|
|
ca8909b8e3 | ||
|
|
431c9e9d61 | ||
|
|
d71db99932 | ||
|
|
6b54224726 | ||
|
|
9ac04e886a | ||
|
|
06b0396945 | ||
|
|
bb3590a448 | ||
|
|
027fa6136a | ||
|
|
532f96d746 | ||
|
|
d2bc8f2f1b | ||
|
|
e5c7549bc2 | ||
|
|
832001a6af | ||
|
|
7d7188c737 | ||
|
|
88a0caae24 | ||
|
|
99824916dd | ||
|
|
42fdaffe76 | ||
|
|
ed7defbd43 | ||
|
|
de8257bc82 | ||
|
|
19b39b1bff | ||
|
|
5e07663374 | ||
|
|
f9a907772f | ||
|
|
007f385396 | ||
|
|
463bc0546f | ||
|
|
0c93a9b4f8 | ||
|
|
d30a009ba5 | ||
|
|
4bee53a610 | ||
|
|
81b474813b | ||
|
|
dc9ec6856f | ||
|
|
658fafe83b | ||
|
|
f3562e490c | ||
|
|
9888185fcb | ||
|
|
055295b6d1 | ||
|
|
c26ca519f7 | ||
|
|
df35eb513d | ||
|
|
7cb2ad67bf | ||
|
|
98ca8441fe | ||
|
|
3393479c52 | ||
|
|
aa5b2c7641 | ||
|
|
7661aedcc9 | ||
|
|
c97178f2f6 | ||
|
|
8839fdd399 | ||
|
|
a3b480b18e | ||
|
|
defedb6fdf | ||
|
|
1ec8d5a454 | ||
|
|
7c577d8963 | ||
|
|
6e2a4be155 | ||
|
|
682ae82158 | ||
|
|
e828cbdeac | ||
|
|
45a128a4f0 | ||
|
|
83bff88f7f | ||
|
|
181322a3c1 | ||
|
|
5369b6aa23 | ||
|
|
0e260949c9 | ||
|
|
8b267dc690 | ||
|
|
d16bfd005a | ||
|
|
40297a6dbc | ||
|
|
752aa49018 | ||
|
|
5569b1d1ec | ||
|
|
9549f5ebd0 | ||
|
|
aa1cd245a5 | ||
|
|
36cfc68a54 | ||
|
|
4dc059f207 | ||
|
|
f4409babd4 | ||
|
|
e1b9a6b185 | ||
|
|
b5528e1d17 | ||
|
|
2db80ecb38 | ||
|
|
ec366df863 | ||
|
|
e1472b494f | ||
|
|
67ac8c4c58 | ||
|
|
555e0681be | ||
|
|
fb5df47b6c | ||
|
|
339e937a6a | ||
|
|
5910c9ab8d | ||
|
|
9fa8d27c6c | ||
|
|
7bc68f454f | ||
|
|
dc3cc094a7 | ||
|
|
1aa9f98858 | ||
|
|
42a3a6c51b | ||
|
|
bbdb977b5e | ||
|
|
87c2d4f7e4 | ||
|
|
0f4d5a4b0c | ||
|
|
dd91c5c772 | ||
|
|
da43449939 | ||
|
|
d6e0d3ee7d | ||
|
|
27dca4d857 | ||
|
|
70a8901c72 | ||
|
|
2f214bf4de | ||
|
|
76507c05a8 | ||
|
|
9b24cc4915 | ||
|
|
e64ee0f4e6 | ||
|
|
e13cb3bcc4 | ||
|
|
51da89a3fb | ||
|
|
42f374dd7a | ||
|
|
689c2e90cf | ||
|
|
cdf96fef0c | ||
|
|
26ee8b836e | ||
|
|
6917e08431 | ||
|
|
4c57aa26ad | ||
|
|
007c75eb18 | ||
|
|
8118408123 | ||
|
|
8df3e8c965 | ||
|
|
5edd78e756 | ||
|
|
ba16cd34d4 | ||
|
|
77dcef4bc0 | ||
|
|
024a8f2771 | ||
|
|
3bfa995a9d | ||
|
|
6549fd8be6 | ||
|
|
9ec208a273 | ||
|
|
53ced1a85e | ||
|
|
2b9c55fd90 | ||
|
|
7a98cad11a | ||
|
|
827e060606 | ||
|
|
78e8d86611 | ||
|
|
30b7d34eb4 | ||
|
|
a23b491f8c | ||
|
|
72734a335c | ||
|
|
626b6600c0 | ||
|
|
e8037dc56a | ||
|
|
4c8a86ece7 | ||
|
|
3cc09763f2 | ||
|
|
3bb3173604 | ||
|
|
d2fe0e788b | ||
|
|
6a5a0326d2 | ||
|
|
c3245b3ce3 | ||
|
|
e425187d17 | ||
|
|
a6c02e29c1 | ||
|
|
d169cad6b4 | ||
|
|
4875707b37 | ||
|
|
9b4fd13c3c | ||
|
|
343b92661d | ||
|
|
79982895ec | ||
|
|
7f7eb8374f | ||
|
|
1c8f3b98c9 | ||
|
|
8de96bba65 | ||
|
|
c66681a1f9 | ||
|
|
8696e1c6cb | ||
|
|
4dc421e3de | ||
|
|
ce66a234fc | ||
|
|
f85c27de59 | ||
|
|
9c291a4361 | ||
|
|
1722aaa80d | ||
|
|
88358ab302 | ||
|
|
1e5d01360b | ||
|
|
a7a25bb0a3 | ||
|
|
1394b3be26 | ||
|
|
590c7b4e22 | ||
|
|
698756d1e6 | ||
|
|
7819d15b36 | ||
|
|
11a9b00d43 | ||
|
|
2ad176e587 | ||
|
|
c54bfa16e3 | ||
|
|
187884937c | ||
|
|
2d8e59ccf3 | ||
|
|
85b4cb7a67 | ||
|
|
66764e48fb | ||
|
|
def22d3fd1 | ||
|
|
08878bd99f | ||
|
|
468c47b6b1 | ||
|
|
f3beb4b273 | ||
|
|
c71ec9d7e8 | ||
|
|
787fae2eec | ||
|
|
875c46290b | ||
|
|
09d5bcc22d | ||
|
|
abf4d8fb25 | ||
|
|
0dc79479ff | ||
|
|
0dfa58ca5a | ||
|
|
4427142d73 | ||
|
|
a531bcf389 | ||
|
|
9458de9ac6 | ||
|
|
76f45b3fb2 | ||
|
|
aaa9018acf | ||
|
|
3b5268f02a | ||
|
|
fa056ce246 | ||
|
|
0ad91713f6 | ||
|
|
9e9c7b28d4 | ||
|
|
8f6a1dd33c | ||
|
|
77270dd783 | ||
|
|
8755dc9d35 | ||
|
|
a8805a65aa | ||
|
|
4adc15e630 | ||
|
|
d9774e016e | ||
|
|
c610578d73 | ||
|
|
3b9e3f8471 | ||
|
|
58d4366e1d | ||
|
|
650d2b91cd | ||
|
|
35a2f3af33 | ||
|
|
2ff44c4938 | ||
|
|
7b7d64cc87 | ||
|
|
70c18b4a75 | ||
|
|
14bd753aa8 | ||
|
|
8729f6ee57 | ||
|
|
51a50c95b4 | ||
|
|
9d3e872454 | ||
|
|
80473f0975 | ||
|
|
7a6e4c8155 | ||
|
|
c40e1464b9 | ||
|
|
700c3415c4 | ||
|
|
0973004870 | ||
|
|
c9d69e2d1b | ||
|
|
d79fd50693 | ||
|
|
9547133e64 | ||
|
|
2d31aed27b | ||
|
|
d9ed4b4bf6 | ||
|
|
60bf2fc517 | ||
|
|
cb17fa50ed | ||
|
|
09c491ca1f | ||
|
|
a531da901d | ||
|
|
a195aac9fb | ||
|
|
1157c4a289 | ||
|
|
0056b4ade5 | ||
|
|
78a50aff99 | ||
|
|
7240fe3bd4 | ||
|
|
e7c4b1963a | ||
|
|
fd6f91bc9f | ||
|
|
33f5c70e6c | ||
|
|
ec977a1c7e | ||
|
|
92d7672b19 | ||
|
|
390159f58a | ||
|
|
d8be8aad65 | ||
|
|
6d948a42bb | ||
|
|
72d9aa1bcb | ||
|
|
8390738de5 | ||
|
|
40f239a7d4 | ||
|
|
cacb4f0103 | ||
|
|
ee54cd8b7e | ||
|
|
f523d7a98c | ||
|
|
d7387508e3 | ||
|
|
e4ff04586f | ||
|
|
8784694686 | ||
|
|
b29d9d88ab | ||
|
|
d8263b1e91 | ||
|
|
9304a683ad | ||
|
|
78906f4a6c | ||
|
|
ee7eb89354 | ||
|
|
55e5e29005 | ||
|
|
ac8c2c6d5b | ||
|
|
feae60c8fe | ||
|
|
425975e481 | ||
|
|
cc731d1e69 | ||
|
|
56a95b9ec9 | ||
|
|
3e7622ca78 | ||
|
|
b1b4ddcc7d | ||
|
|
e567a10d02 | ||
|
|
23fd4e55a3 | ||
|
|
e57dc7762b | ||
|
|
003810284c | ||
|
|
379d602ab6 | ||
|
|
bf7b2c0a3e | ||
|
|
4e4f2d6d7e | ||
|
|
d7672d47f2 | ||
|
|
abbeca1cb2 | ||
|
|
50c8abc521 | ||
|
|
0469e5b849 | ||
|
|
dfea902a08 | ||
|
|
339c467e71 | ||
|
|
455e42e5b9 | ||
|
|
6f6dc4f24c | ||
|
|
9e45086d19 | ||
|
|
9515d53dcc | ||
|
|
e0a27badde | ||
|
|
49856dc1e0 | ||
|
|
43bdf2f1d3 | ||
|
|
eb1900d4db | ||
|
|
7de43bb004 | ||
|
|
1d952a254a | ||
|
|
9db3407589 | ||
|
|
bb6abd8c6b | ||
|
|
3cddcb9f66 | ||
|
|
bfd27e78b2 | ||
|
|
a8384b5db2 | ||
|
|
5db839acef | ||
|
|
f4626985fd | ||
|
|
68da7aefc5 | ||
|
|
f1b4c87bc4 | ||
|
|
1348809807 | ||
|
|
eb72f78cf1 | ||
|
|
12577eade5 | ||
|
|
de6db86df3 | ||
|
|
56b8ecaf17 | ||
|
|
1e345f18b3 | ||
|
|
f793dc1097 | ||
|
|
112cdebe41 | ||
|
|
a28dcc38c9 | ||
|
|
3d1cf683f3 | ||
|
|
a9fc1e0e5d | ||
|
|
2e2b14205f | ||
|
|
b8e18ffdf1 | ||
|
|
21d8ac8752 | ||
|
|
008fa8660d | ||
|
|
6860246cfa | ||
|
|
8a3d188240 | ||
|
|
8f0d25225e | ||
|
|
8fe0cc7770 | ||
|
|
ee4cf83121 | ||
|
|
702d8d9dde | ||
|
|
290a3c6f92 | ||
|
|
600dded31e | ||
|
|
67806596a3 | ||
|
|
88fe4eb3e1 | ||
|
|
ca40c79761 | ||
|
|
231cb6be27 | ||
|
|
7f484dfa09 | ||
|
|
1fa6ba3389 | ||
|
|
b7f2df0350 | ||
|
|
8bb4538de1 | ||
|
|
99d7072332 | ||
|
|
30f5ab89b7 | ||
|
|
fd3f4072b5 | ||
|
|
143efc0fab | ||
|
|
2f3d7efc24 | ||
|
|
e76c0046f7 | ||
|
|
b3120b5498 | ||
|
|
53c6d96c6f | ||
|
|
3f84ed5075 | ||
|
|
e9ad6b71c3 | ||
|
|
e5a3ee6f33 | ||
|
|
fbfd71dfe3 | ||
|
|
36e5124c0a | ||
|
|
73a777777e | ||
|
|
e4b6ba56b9 | ||
|
|
5f970888ef | ||
|
|
6e95771303 | ||
|
|
f8cf6e6439 | ||
|
|
ed0041ac65 | ||
|
|
acda419a2d | ||
|
|
dca42b9ef6 | ||
|
|
fa6993381a | ||
|
|
37d80146db | ||
|
|
7e2aef2480 | ||
|
|
9169637084 | ||
|
|
acb24924be | ||
|
|
bfb74b2027 | ||
|
|
f0b419099d | ||
|
|
81f3d59717 | ||
|
|
eca711bb64 | ||
|
|
900269bd46 | ||
|
|
e50cf0be6f | ||
|
|
a760c268f4 | ||
|
|
5c78236428 | ||
|
|
7ffc996b0a | ||
|
|
23937a239f | ||
|
|
b91fabb76c | ||
|
|
e36b0fd4d5 | ||
|
|
4e269d7071 | ||
|
|
6eddc869d3 | ||
|
|
561831928b | ||
|
|
6dee4ae603 | ||
|
|
413e02304d | ||
|
|
8c5b358bb1 | ||
|
|
3bf8cbc728 | ||
|
|
36462bcd7e | ||
|
|
1f8e5424f3 | ||
|
|
ebb1305ba4 | ||
|
|
565b2e85cd | ||
|
|
44ce696904 | ||
|
|
3fa315ab0b | ||
|
|
e5ba92b4b9 | ||
|
|
6352d6e1da | ||
|
|
1a3f3f54e7 | ||
|
|
7d10057103 | ||
|
|
a94c6b09bd | ||
|
|
647f3defcd | ||
|
|
101a55d119 | ||
|
|
09756fe55b | ||
|
|
3457c0b11d | ||
|
|
0676578aae | ||
|
|
b5370af822 | ||
|
|
744b2021b2 | ||
|
|
c39c10c978 | ||
|
|
efbab200aa | ||
|
|
a580754751 | ||
|
|
e5bfe19b28 | ||
|
|
4f514a16af | ||
|
|
c4595d2504 | ||
|
|
eb7d977b3e | ||
|
|
f10dd7c135 | ||
|
|
e5f6bf0556 | ||
|
|
c54879b548 | ||
|
|
e93c52c091 | ||
|
|
042f06e2b1 | ||
|
|
0db43f24f5 | ||
|
|
2067b2f648 | ||
|
|
e59693e7fa | ||
|
|
4d07d2e954 | ||
|
|
db38464778 | ||
|
|
071cd6268a | ||
|
|
2e82c361f7 | ||
|
|
a00cce8128 | ||
|
|
25f1051d7a | ||
|
|
4c024159a9 | ||
|
|
9bdf716407 | ||
|
|
cf89f016e9 | ||
|
|
3f16f1684a | ||
|
|
bfc788e27b | ||
|
|
0ea476b974 | ||
|
|
f5c5a69162 | ||
|
|
a3cef3f176 | ||
|
|
d2f2679071 | ||
|
|
2a3e6b6d12 | ||
|
|
7388c746a8 | ||
|
|
5e3b50497a | ||
|
|
471de3663e | ||
|
|
73223ae7e6 | ||
|
|
d25560f8ac | ||
|
|
9b364500ad | ||
|
|
04ecd87a23 | ||
|
|
419f467df1 | ||
|
|
61f2c55476 | ||
|
|
21fca7c546 | ||
|
|
8cde768588 | ||
|
|
8a48f4926a | ||
|
|
2b643b04c1 | ||
|
|
6f99abfc7b | ||
|
|
9b4129c949 | ||
|
|
a5de5e0cff | ||
|
|
e1d427f8c8 | ||
|
|
001fdd9511 | ||
|
|
87a0006d5e | ||
|
|
a68295d2a9 | ||
|
|
8c8a0b398d | ||
|
|
4d863e985b | ||
|
|
d632356413 | ||
|
|
12d98b144b | ||
|
|
2534c86d6f | ||
|
|
e8427a45c5 | ||
|
|
e7c0c5173a | ||
|
|
8f8c038b21 | ||
|
|
471e47c1c2 | ||
|
|
fe05df40ae | ||
|
|
fbe98af997 | ||
|
|
854a0c53c3 | ||
|
|
29fc5b3e3d | ||
|
|
8b7d1a70a4 | ||
|
|
616ca955d5 | ||
|
|
fa273ca817 | ||
|
|
935aada8bb | ||
|
|
e70c0b7f0f | ||
|
|
8da10b9439 | ||
|
|
a89fb57f57 | ||
|
|
8d419bb029 | ||
|
|
967607e1c8 | ||
|
|
a53ad12907 | ||
|
|
4abd2e0247 | ||
|
|
d724a975b5 | ||
|
|
e38f9a98c9 | ||
|
|
bef4ab9835 | ||
|
|
842399a4af | ||
|
|
937734b1e9 | ||
|
|
044f2c7c17 | ||
|
|
0cf9748ce0 | ||
|
|
e840188a65 | ||
|
|
bcf7a0701a | ||
|
|
122517716e | ||
|
|
fdbd0820c2 | ||
|
|
f76fa4a344 | ||
|
|
ca5555e6a5 | ||
|
|
b27264b9f3 | ||
|
|
3aa14c9ae7 | ||
|
|
1e308db64e | ||
|
|
5ce46e2499 | ||
|
|
f99e7b3388 | ||
|
|
c66fe0313f | ||
|
|
9503c4a9fc | ||
|
|
6012acb509 | ||
|
|
f8441a0cde | ||
|
|
f375e50f2d | ||
|
|
f6c4f6f5da | ||
|
|
27ab6247a6 | ||
|
|
be4d8e74cc | ||
|
|
e03370f6ef | ||
|
|
41c7689dfa | ||
|
|
41f207516e | ||
|
|
d846035f3e | ||
|
|
6cf17edfac | ||
|
|
78f1de69f4 | ||
|
|
aa8d38ce38 | ||
|
|
0e0ab81ff9 | ||
|
|
1323874389 | ||
|
|
58e5632714 | ||
|
|
92a2aa6f77 | ||
|
|
db16ef1430 | ||
|
|
e52144539b | ||
|
|
4e24b57289 | ||
|
|
04bcb11c3c | ||
|
|
6fe4a3f946 | ||
|
|
206f818666 | ||
|
|
022768ab58 | ||
|
|
e64e1e7260 | ||
|
|
2fb1f0e77c | ||
|
|
de3b0d7fb4 | ||
|
|
c14d95f8b5 | ||
|
|
4b0e47fd03 | ||
|
|
89e9820189 | ||
|
|
c1b2b3c73e | ||
|
|
68f62d9de8 | ||
|
|
3d77526160 | ||
|
|
749420308e | ||
|
|
8592e04c78 | ||
|
|
cb140a4442 | ||
|
|
1d0a3f022b | ||
|
|
6467ebb2dd | ||
|
|
67f9f7506c | ||
|
|
673918d0fc | ||
|
|
2e011b672f | ||
|
|
b78b185e07 | ||
|
|
46b63f7153 | ||
|
|
77fca10032 | ||
|
|
d5eaed63c0 | ||
|
|
5f6656cb36 | ||
|
|
87da7c794c | ||
|
|
aa34ffe7c7 | ||
|
|
28df6989f9 | ||
|
|
e5cb9cb56e | ||
|
|
9b2b700fa0 | ||
|
|
34f35524aa | ||
|
|
7e698f4b22 | ||
|
|
db6ac1f57a | ||
|
|
e28e06b08f | ||
|
|
5bf4d1c712 | ||
|
|
bc67393a67 | ||
|
|
6d63f75e7f | ||
|
|
f13b90e430 | ||
|
|
af61187587 | ||
|
|
20754539e4 | ||
|
|
28aa777191 | ||
|
|
0ed8adfe3a | ||
|
|
778c5e17c3 | ||
|
|
806ce4eb26 | ||
|
|
deaa564a66 | ||
|
|
be40fa1381 | ||
|
|
fbdb808d11 | ||
|
|
677c5624e6 | ||
|
|
9e7af58b2d | ||
|
|
9f47faff73 | ||
|
|
06576f4c07 | ||
|
|
9ab63a41b3 | ||
|
|
e93ff481bb | ||
|
|
6085048a95 | ||
|
|
35f7957975 | ||
|
|
f32caa52c6 | ||
|
|
dc90400456 | ||
|
|
3e5dec4dc9 | ||
|
|
ba778ec212 | ||
|
|
0c1ff2ef76 | ||
|
|
e8178d5917 | ||
|
|
3027cfe543 | ||
|
|
21bf2b8899 | ||
|
|
89ed41a016 | ||
|
|
f305d1f702 | ||
|
|
ac0d083b1c | ||
|
|
18a98d1cb4 | ||
|
|
84f1519486 | ||
|
|
b9c544d898 | ||
|
|
da6ca200fb | ||
|
|
55f84a2ead | ||
|
|
5f6f683fab | ||
|
|
6ee33eb893 | ||
|
|
7dd3b59fb0 | ||
|
|
41c86df7ca | ||
|
|
d7798fd0ab | ||
|
|
5605063950 | ||
|
|
0566bccffa | ||
|
|
ef4341acea | ||
|
|
9bcead9a8f | ||
|
|
c6e921241b | ||
|
|
9fcb67f731 | ||
|
|
902a11de9a | ||
|
|
08980eac3c | ||
|
|
7ba0bfa800 | ||
|
|
ef37bf9037 | ||
|
|
2131237057 | ||
|
|
8f2e4bb8c9 | ||
|
|
81cdf0c6c3 | ||
|
|
7e73c929a2 | ||
|
|
2da9dfe67f | ||
|
|
1ea9610ffd | ||
|
|
0857e6f2ec | ||
|
|
e14558a834 | ||
|
|
3b2ff4b71f | ||
|
|
901b21e4d9 | ||
|
|
75a85e4483 | ||
|
|
23ee3689da | ||
|
|
23037dfd38 | ||
|
|
74af06d5cb | ||
|
|
9920e359f8 | ||
|
|
296274b60f | ||
|
|
9c13a59ac0 | ||
|
|
0e56ee6509 | ||
|
|
b684b0c85d | ||
|
|
78e1fdb971 | ||
|
|
ea794ac751 | ||
|
|
c6b898ea30 | ||
|
|
098da53afe | ||
|
|
af2b0ac75b | ||
|
|
580ed3ea62 | ||
|
|
77e8075f2f | ||
|
|
62e708c70f | ||
|
|
b9b9d6dbaf | ||
|
|
a7c5abf64c | ||
|
|
7e0e46828b | ||
|
|
b56c8392fd | ||
|
|
7332c00077 | ||
|
|
beca52b61b | ||
|
|
b19527c5a4 | ||
|
|
d2197c801f | ||
|
|
08543cea6c | ||
|
|
2026102cdf | ||
|
|
8ba225700b | ||
|
|
f0fc5db72d | ||
|
|
fdae508932 | ||
|
|
b9a4f8b3f1 | ||
|
|
432907dbf6 | ||
|
|
ca41a70d7d | ||
|
|
9dd5d56f9c | ||
|
|
ee8ae574ec | ||
|
|
78a6bd9416 | ||
|
|
67b7f730d1 | ||
|
|
c5233a5b9f | ||
|
|
cd9c1d9789 | ||
|
|
3e317714fd | ||
|
|
ce849f2145 | ||
|
|
14362a6eda | ||
|
|
3d3f0710f9 | ||
|
|
ed7c8e4798 | ||
|
|
13451e9d10 | ||
|
|
6ba93994cb | ||
|
|
58f07f94a0 | ||
|
|
cf5baa29f2 | ||
|
|
a8d057b8b4 | ||
|
|
f995312f55 | ||
|
|
91b3d9f744 | ||
|
|
a27be4a334 | ||
|
|
31b387fdf1 | ||
|
|
c2e7879dbc | ||
|
|
03a64228ed | ||
|
|
a550fcc410 | ||
|
|
62c039b287 | ||
|
|
9fc6241057 | ||
|
|
18d5e25373 | ||
|
|
7c3c92f87a | ||
|
|
c13366fd92 | ||
|
|
a2e59ba316 | ||
|
|
d634ce46f7 | ||
|
|
acc1b904bf | ||
|
|
1ce743344a | ||
|
|
a041342a69 | ||
|
|
e04f712511 | ||
|
|
3fe7ec0200 | ||
|
|
3194fcca08 | ||
|
|
d8f89448ba | ||
|
|
90b9c37b66 | ||
|
|
be5e5fdf42 | ||
|
|
b1655de5ab | ||
|
|
2eaf88ecbb | ||
|
|
25ab07f136 | ||
|
|
704f60f687 | ||
|
|
c959d43684 | ||
|
|
36032f117a | ||
|
|
1c901dce3a | ||
|
|
349c1e46de | ||
|
|
7256d67a1c | ||
|
|
c70335c80d | ||
|
|
014b40b2a2 | ||
|
|
f82be437b9 | ||
|
|
d3e78a2cac | ||
|
|
f2e1e18fb4 | ||
|
|
e3ca50e8ad | ||
|
|
b9683cf2c8 | ||
|
|
5ee7973b9c | ||
|
|
7387d410bf | ||
|
|
7d8b70e677 | ||
|
|
ea9791f8e1 | ||
|
|
2e47684d15 | ||
|
|
ee740f627f | ||
|
|
1763f37811 | ||
|
|
c5643b6216 | ||
|
|
23c2c270b8 | ||
|
|
b9d22b21e8 | ||
|
|
f2ba6f956e | ||
|
|
c9f2b730f1 | ||
|
|
b1be50cdb9 | ||
|
|
b75c5f3cca | ||
|
|
195172e655 | ||
|
|
157dfa4532 | ||
|
|
51e587ca44 | ||
|
|
7d8d337b52 | ||
|
|
da15b665b1 | ||
|
|
8472f4d774 | ||
|
|
61531ce9e0 | ||
|
|
0f841d0eca | ||
|
|
1884fa0523 | ||
|
|
a50adf047a | ||
|
|
63edd9afd1 | ||
|
|
9601ecc131 | ||
|
|
04820a2840 | ||
|
|
6ee066ad14 | ||
|
|
996047a7e2 | ||
|
|
6af9d2ff16 | ||
|
|
8d0e58f98c | ||
|
|
e272340b72 | ||
|
|
8ac55beb4e | ||
|
|
4c012ea536 | ||
|
|
f890dc8473 | ||
|
|
d970750808 | ||
|
|
eb474b86bb | ||
|
|
0593715e39 | ||
|
|
cc8570587f | ||
|
|
307c3d6fad | ||
|
|
e95772c326 | ||
|
|
3c849fa44f | ||
|
|
72082cfc71 | ||
|
|
885f349192 | ||
|
|
2d1ad5e9f4 | ||
|
|
36eb117140 | ||
|
|
c29806a316 | ||
|
|
5b03c42d9a | ||
|
|
3fe1a89b49 | ||
|
|
b527fded62 | ||
|
|
5c1c24137f | ||
|
|
6e8603557e | ||
|
|
c2548abc2f | ||
|
|
cfec7a63a5 | ||
|
|
91e4e73dab |
11
.gitee/ISSUE_TEMPLATE.zh-CN.md
Normal file
11
.gitee/ISSUE_TEMPLATE.zh-CN.md
Normal file
@@ -0,0 +1,11 @@
|
||||
### 该问题是怎么引起的?
|
||||
|
||||
|
||||
|
||||
### 重现步骤
|
||||
|
||||
|
||||
|
||||
### 报错信息
|
||||
|
||||
|
||||
12
.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
Normal file
12
.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md
Normal file
@@ -0,0 +1,12 @@
|
||||
### 相关的Issue
|
||||
|
||||
|
||||
### 原因(目的、解决的问题等)
|
||||
|
||||
|
||||
### 描述(做了什么,变更了什么)
|
||||
|
||||
|
||||
### 测试用例(新增、改动、可能影响的功能)
|
||||
|
||||
|
||||
35
.gitignore
vendored
35
.gitignore
vendored
@@ -1,23 +1,24 @@
|
||||
/out
|
||||
/test
|
||||
/include
|
||||
.config*
|
||||
cscope*
|
||||
tags
|
||||
.vscode
|
||||
# General ignored file types
|
||||
*.o
|
||||
.idea
|
||||
*.img
|
||||
*.swp
|
||||
*.rej
|
||||
*.orig
|
||||
*.a
|
||||
*.so
|
||||
.config.cmd
|
||||
*.swp
|
||||
|
||||
# IDE settings
|
||||
.vscode
|
||||
.idea
|
||||
.settings
|
||||
.cproject
|
||||
.project
|
||||
platform/include/menuconfig.h
|
||||
platform/board.ld
|
||||
apps/init/init
|
||||
apps/shell/shell
|
||||
|
||||
# VIM files
|
||||
cscope*
|
||||
tags
|
||||
|
||||
# Menuconfig temp files
|
||||
/config.h
|
||||
/.config
|
||||
/.config.old
|
||||
|
||||
# Build temp files
|
||||
/out
|
||||
|
||||
374
BUILD.gn
Executable file → Normal file
374
BUILD.gn
Executable file → Normal file
@@ -28,55 +28,361 @@
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
import("//build/lite/config/subsystem/lite_subsystem.gni")
|
||||
|
||||
declare_args() {
|
||||
tee_enable = false
|
||||
liteos_name = "OHOS_Image"
|
||||
liteos_skip_make = false
|
||||
}
|
||||
|
||||
cmd = "if [ -f $device_path/BUILD.gn ]; then echo true; else echo false; fi"
|
||||
HAVE_DEVICE_SDK = exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value")
|
||||
|
||||
LITEOS_MENUCONFIG_H = rebase_path("$root_out_dir/config.h")
|
||||
|
||||
tee = ""
|
||||
if (tee_enable) {
|
||||
tee = "_tee"
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
liteos_config_file = "${ohos_build_type}${tee}.config"
|
||||
}
|
||||
|
||||
liteos_config_file = rebase_path(liteos_config_file, "", "$product_path/kernel_configs")
|
||||
print("liteos_config_file:", liteos_config_file)
|
||||
|
||||
exec_script("//build/lite/run_shell_cmd.py",
|
||||
[
|
||||
"env" +
|
||||
" CONFIG_=LOSCFG_" +
|
||||
" KCONFIG_CONFIG_HEADER='y=true'" +
|
||||
" KCONFIG_CONFIG=$liteos_config_file" +
|
||||
" DEVICE_PATH=$device_path" +
|
||||
" srctree=" + rebase_path(".") +
|
||||
" genconfig" +
|
||||
" --header-path $LITEOS_MENUCONFIG_H" +
|
||||
" --file-list kconfig_files.txt" +
|
||||
" --env-list kconfig_env.txt" +
|
||||
" --config-out config.gni",
|
||||
], "", [ liteos_config_file ])
|
||||
|
||||
import("liteos.gni")
|
||||
|
||||
assert(ARCH != "", "ARCH not set!")
|
||||
assert(ARCH == arch, "ARCH not match! details: $ARCH != $arch")
|
||||
assert(tee_enable == defined(LOSCFG_TEE_ENABLE), "TEE switch not match!")
|
||||
|
||||
generate_notice_file("kernel_notice_file") {
|
||||
module_name = "kernel"
|
||||
module_source_dir_list = [
|
||||
"//third_party/FreeBSD",
|
||||
"//third_party/musl",
|
||||
"//third_party/zlib",
|
||||
"//third_party/FatFs",
|
||||
"//third_party/Linux_Kernel",
|
||||
"//third_party/lwip",
|
||||
"//third_party/NuttX",
|
||||
"//third_party/mtd-utils",
|
||||
"$LITEOSTHIRDPARTY/FreeBSD",
|
||||
"$LITEOSTHIRDPARTY/musl",
|
||||
"$LITEOSTHIRDPARTY/zlib",
|
||||
"$LITEOSTHIRDPARTY/FatFs",
|
||||
"$LITEOSTHIRDPARTY/Linux_Kernel",
|
||||
"$LITEOSTHIRDPARTY/lwip",
|
||||
"$LITEOSTHIRDPARTY/NuttX",
|
||||
"$LITEOSTHIRDPARTY/mtd-utils",
|
||||
]
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
enable_ohos_kernel_liteos_a_ext_build = true
|
||||
LOSCFG_TEST_APPS = false
|
||||
tee_enable = ""
|
||||
liteos_arch_cflags = []
|
||||
if (defined(LOSCFG_ARCH_ARM)) {
|
||||
mcpu = LOSCFG_ARCH_CPU
|
||||
if (defined(LOSCFG_ARCH_ARM_AARCH64) && defined(LOSCFG_ARCH_FPU_DISABLE)) {
|
||||
mcpu += "+nofp"
|
||||
}
|
||||
liteos_arch_cflags += [ "-mcpu=$mcpu" ]
|
||||
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
|
||||
liteos_arch_cflags += [
|
||||
"-mfloat-abi=softfp",
|
||||
"-mfpu=$LOSCFG_ARCH_FPU",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
lite_subsystem("kernel") {
|
||||
subsystem_components = []
|
||||
cc = "$ohos_current_cc_command " + string_join(" ", liteos_arch_cflags)
|
||||
if (ohos_build_compiler == "clang") {
|
||||
cc += " --target=$target_triple"
|
||||
}
|
||||
|
||||
if (enable_ohos_kernel_liteos_a_ext_build == false) {
|
||||
subsystem_components += [
|
||||
"//kernel/liteos_a/kernel",
|
||||
"//kernel/liteos_a/net",
|
||||
"//kernel/liteos_a/lib",
|
||||
"//kernel/liteos_a/compat",
|
||||
"//kernel/liteos_a/fs",
|
||||
"//kernel/liteos_a/arch:platform_cpu",
|
||||
]
|
||||
if (LOSCFG_SHELL) {
|
||||
subsystem_components += [ "//kernel/liteos_a/shell" ]
|
||||
config("arch_config") {
|
||||
cflags = liteos_arch_cflags
|
||||
asmflags = cflags
|
||||
ldflags = cflags
|
||||
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
|
||||
if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += ["-mthumb-interwork"]
|
||||
}
|
||||
} else {
|
||||
deps = [ ":make" ]
|
||||
}
|
||||
if (defined(LOSCFG_THUMB)) {
|
||||
cflags += [ "-mthumb" ]
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += [ "-mimplicit-it=thumb" ]
|
||||
} else {
|
||||
cflags += [ "-Wa,-mimplicit-it=thumb" ]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
config("stdinc_config") {
|
||||
std_include = exec_script("//build/lite/run_shell_cmd.py", [ "$cc -print-file-name=include" ], "trim string")
|
||||
cflags = [
|
||||
"-isystem",
|
||||
std_include,
|
||||
]
|
||||
cflags += [ "-nostdinc" ]
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("ssp_config") {
|
||||
cflags = []
|
||||
if (defined(LOSCFG_CC_STACKPROTECTOR_ALL)) {
|
||||
cflags += [ "-fstack-protector-all" ]
|
||||
} else if (defined(LOSCFG_CC_STACKPROTECTOR_STRONG)) {
|
||||
cflags += [ "-fstack-protector-strong" ]
|
||||
} else if (defined(LOSCFG_CC_STACKPROTECTOR)) {
|
||||
cflags += [
|
||||
"-fstack-protector",
|
||||
"--param",
|
||||
"ssp-buffer-size=4",
|
||||
]
|
||||
} else {
|
||||
cflags += [ "-fno-stack-protector" ]
|
||||
}
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("optimize_config") {
|
||||
cflags = []
|
||||
if (defined(LOSCFG_COMPILE_DEBUG)) {
|
||||
cflags += [
|
||||
"-g",
|
||||
"-gdwarf-2",
|
||||
]
|
||||
optimization_cflag = "-O0"
|
||||
}
|
||||
if (defined(LOSCFG_COMPILE_OPTIMIZE)) {
|
||||
optimization_cflag = "-O2"
|
||||
}
|
||||
if (defined(LOSCFG_COMPILE_OPTIMIZE_SIZE)) {
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
optimization_cflag = "-Oz"
|
||||
} else {
|
||||
optimization_cflag = "-Os"
|
||||
}
|
||||
}
|
||||
if (defined(LOSCFG_COMPILE_LTO)) {
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += [ "-flto=thin" ]
|
||||
} else {
|
||||
cflags += [ "-flto" ]
|
||||
}
|
||||
}
|
||||
cflags += [ optimization_cflag ]
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("kconfig_config") {
|
||||
cflags = [
|
||||
"-imacros",
|
||||
"$LITEOS_MENUCONFIG_H",
|
||||
]
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("warn_config") {
|
||||
cflags = [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wpointer-arith",
|
||||
"-Wstrict-prototypes",
|
||||
"-Winvalid-pch",
|
||||
"-Wno-address-of-packed-member",
|
||||
]
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("dialect_config") {
|
||||
cflags_c = [ "-std=c99" ]
|
||||
cflags_cc = [ "-std=c++11" ]
|
||||
}
|
||||
|
||||
config("misc_config") {
|
||||
defines = [ "__LITEOS__" ]
|
||||
if (!defined(LOSCFG_DEBUG_VERSION)) {
|
||||
defines += [ "NDEBUG" ]
|
||||
}
|
||||
|
||||
cflags = [
|
||||
"-fno-pic",
|
||||
"-fno-builtin",
|
||||
"-fms-extensions",
|
||||
"-fno-strict-aliasing",
|
||||
"-fno-common",
|
||||
"-fsigned-char",
|
||||
"-ffunction-sections",
|
||||
"-fdata-sections",
|
||||
"-fno-exceptions",
|
||||
"-fno-omit-frame-pointer",
|
||||
"-fno-short-enums",
|
||||
"-mno-unaligned-access",
|
||||
]
|
||||
|
||||
if (!defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += [ "-fno-aggressive-loop-optimizations" ]
|
||||
}
|
||||
|
||||
asmflags = cflags
|
||||
}
|
||||
|
||||
config("los_config") {
|
||||
configs = [
|
||||
":arch_config",
|
||||
":kconfig_config",
|
||||
":stdinc_config",
|
||||
":dialect_config",
|
||||
":optimize_config",
|
||||
":ssp_config",
|
||||
":warn_config",
|
||||
":misc_config",
|
||||
]
|
||||
}
|
||||
|
||||
executable("liteos") {
|
||||
configs = [] # clear default configs
|
||||
configs += [ ":arch_config" ]
|
||||
configs += [ ":public" ]
|
||||
|
||||
ldflags = [
|
||||
"-static",
|
||||
"-nostdlib",
|
||||
"-Wl,--gc-sections",
|
||||
"-Wl,-Map=$liteos_name.map",
|
||||
"-Wl,--no-eh-frame-hdr",
|
||||
]
|
||||
|
||||
libgcc = exec_script("//build/lite/run_shell_cmd.py", [ "$cc -print-libgcc-file-name" ], "trim string")
|
||||
libs = [ libgcc ]
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
ldflags += [ "-Wl,-T" + rebase_path("tools/build/liteos_llvm.ld", root_build_dir) ]
|
||||
inputs = [ "tools/build/liteos_llvm.ld" ]
|
||||
} else {
|
||||
ldflags += [ "-Wl,-T" + rebase_path("tools/build/liteos.ld", root_build_dir) ]
|
||||
ldflags += [ "-Wl,-nostartfiles" ]
|
||||
inputs = [ "tools/build/liteos.ld" ]
|
||||
}
|
||||
|
||||
inputs += [ "$root_out_dir/board.ld" ]
|
||||
|
||||
output_dir = target_out_dir
|
||||
|
||||
deps = [
|
||||
"platform:copy_board.ld",
|
||||
":modules",
|
||||
]
|
||||
}
|
||||
|
||||
copy("copy_liteos") {
|
||||
deps = [ ":liteos" ]
|
||||
sources = [ "$target_out_dir/unstripped/bin/liteos" ]
|
||||
outputs = [ "$root_out_dir/$liteos_name" ]
|
||||
}
|
||||
|
||||
build_ext_component("build_kernel_image") {
|
||||
deps = [ ":copy_liteos" ]
|
||||
exec_path = rebase_path(root_out_dir)
|
||||
|
||||
objcopy = "${compile_prefix}objcopy$toolchain_cmd_suffix"
|
||||
objdump = "${compile_prefix}objdump$toolchain_cmd_suffix"
|
||||
|
||||
command = "$objcopy -O binary $liteos_name $liteos_name.bin"
|
||||
command += " && sh -c '$objdump -t $liteos_name | sort >$liteos_name.sym.sorted'"
|
||||
command += " && sh -c '$objdump -d $liteos_name >$liteos_name.asm'"
|
||||
}
|
||||
|
||||
config("public") {
|
||||
configs = [
|
||||
"arch:public",
|
||||
"platform:public",
|
||||
"kernel:public",
|
||||
"compat:public",
|
||||
"bsd:public",
|
||||
"fs:public",
|
||||
"drivers:public",
|
||||
"security:public",
|
||||
"net:public",
|
||||
"shell:public",
|
||||
"lib:public",
|
||||
]
|
||||
|
||||
configs += [
|
||||
"$HDFTOPDIR:public",
|
||||
"//drivers/liteos:public",
|
||||
]
|
||||
|
||||
if (HAVE_DEVICE_SDK) {
|
||||
configs += [ "$device_path:public" ]
|
||||
}
|
||||
}
|
||||
|
||||
group("modules") {
|
||||
deps = [
|
||||
"arch",
|
||||
"bsd",
|
||||
"compat",
|
||||
"drivers",
|
||||
"fs",
|
||||
"kernel",
|
||||
"lib",
|
||||
"net",
|
||||
"platform",
|
||||
"security",
|
||||
"shell",
|
||||
"syscall",
|
||||
]
|
||||
|
||||
deps += [
|
||||
HDFTOPDIR,
|
||||
"//drivers/liteos",
|
||||
]
|
||||
|
||||
if (HAVE_DEVICE_SDK) {
|
||||
deps += [ device_path ]
|
||||
}
|
||||
}
|
||||
|
||||
group("apps") {
|
||||
deps = [ "apps" ]
|
||||
}
|
||||
|
||||
group("tests") {
|
||||
deps = [ "testsuites" ]
|
||||
}
|
||||
|
||||
group("kernel") {
|
||||
deps = [ ":build_kernel_image" ]
|
||||
}
|
||||
|
||||
group("liteos_a") {
|
||||
deps = [
|
||||
":apps",
|
||||
":kernel",
|
||||
":tests",
|
||||
]
|
||||
}
|
||||
|
||||
build_ext_component("make") {
|
||||
exec_path = rebase_path(".", root_build_dir)
|
||||
tee_enable = "false"
|
||||
if (board_name == "hi3516dv300" && enable_tee_ree) {
|
||||
tee_enable = "tee"
|
||||
outdir = rebase_path("$target_out_dir/${target_name}_out")
|
||||
sysroot_path = rebase_path(ohos_current_sysroot)
|
||||
arch_cflags = string_join(" ", target_arch_cflags)
|
||||
command = "./build.sh \"$board_name\" \"$ohos_build_compiler\" \"$root_build_dir\" \"$ohos_build_type\" \"$tee_enable\""
|
||||
command += " \"$device_company\" \"$product_path\" \"$outdir\" \"$ohos_version\" \"$sysroot_path\" \"$arch_cflags\""
|
||||
command += " \"$device_path\" \"$compile_prefix\" \"$liteos_config_file\""
|
||||
if (liteos_skip_make) {
|
||||
print("build_ext_component \"$target_name\" skipped:", command)
|
||||
command = "true"
|
||||
}
|
||||
prebuilts = "sh build.sh ${board_name} ${ohos_build_compiler} ${root_build_dir} ${ohos_build_type} ${tee_enable} \"${device_company}\" \"${product_path}\""
|
||||
outdir = rebase_path(get_path_info(".", "out_dir"))
|
||||
command = "make clean OUTDIR=$outdir && make rootfs VERSION=\"${ohos_version}\" -j 16 OUTDIR=$outdir"
|
||||
}
|
||||
|
||||
174
Kconfig
Executable file → Normal file
174
Kconfig
Executable file → Normal file
@@ -26,43 +26,82 @@
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
#
|
||||
# For a description of the syntax of this configuration file,
|
||||
# see extra/config/Kconfig-language.txt
|
||||
#
|
||||
|
||||
mainmenu "Huawei LiteOS Configuration"
|
||||
|
||||
menu "Compiler"
|
||||
choice
|
||||
prompt "LiteOS_Compiler_Type"
|
||||
prompt "Compiler type"
|
||||
default COMPILER_CLANG_LLVM
|
||||
help
|
||||
Enable arm-himix100 or aarch64-himix100 or compiler.
|
||||
Choose compiler type.
|
||||
|
||||
config COMPILER_HIMIX_32
|
||||
bool "arm-linux-ohoseabi"
|
||||
depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
config COMPILER_GCC
|
||||
bool "GCC"
|
||||
|
||||
config CROSS_COMPILE
|
||||
string "GCC cross-compile toolchain prefix"
|
||||
depends on COMPILER_GCC
|
||||
default "arm-linux-ohoseabi-" if ARCH_ARM_AARCH32
|
||||
|
||||
config COMPILER_CLANG_LLVM
|
||||
bool "clang-llvm"
|
||||
depends on PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_QEMU_ARM_VIRT_CA7
|
||||
bool "Clang"
|
||||
|
||||
config LLVM_TARGET
|
||||
string "Clang LLVM target"
|
||||
depends on COMPILER_CLANG_LLVM
|
||||
default "arm-liteos" if ARCH_ARM_AARCH32
|
||||
|
||||
endchoice
|
||||
|
||||
config COMPILE_DEBUG
|
||||
bool "Enable debug options"
|
||||
default n
|
||||
help
|
||||
Answer Y to add -g option in compile command.
|
||||
|
||||
config COMPILE_OPTIMIZE
|
||||
bool "Enable code optimization options"
|
||||
default y
|
||||
help
|
||||
Answer Y to add optimization options for efficient code.
|
||||
The final binary size will be smaller and execute faster.
|
||||
But the debugging experience may be worst somehow.
|
||||
|
||||
config COMPILE_OPTIMIZE_SIZE
|
||||
bool "Enable code size optimization options" if COMPILE_OPTIMIZE
|
||||
default y
|
||||
help
|
||||
Answer Y to add optimization options for small code size.
|
||||
The final binary size will be smaller.
|
||||
But the compile time may be a bit longer.
|
||||
|
||||
config COMPILE_LTO
|
||||
bool "Enable link time optimization (LTO)" if COMPILE_OPTIMIZE_SIZE
|
||||
default y
|
||||
help
|
||||
Answer Y to add lto options for more smaller code size.
|
||||
The final binary size will be smaller.
|
||||
But the compile time may be much longer.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Platform"
|
||||
|
||||
######################### config options of bsp #####################
|
||||
source "../../kernel/liteos_a/platform/Kconfig"
|
||||
source "platform/Kconfig"
|
||||
|
||||
######################### config options of cpu arch ################
|
||||
source "../../kernel/liteos_a/arch/Kconfig"
|
||||
source "arch/Kconfig"
|
||||
|
||||
######################### config options of rootfs #####################
|
||||
source "../../kernel/liteos_a/kernel/common/Kconfig"
|
||||
source "kernel/common/rootfs/Kconfig"
|
||||
######################### config options of patchfs #####################
|
||||
source "../../kernel/liteos_a/kernel/common/patchfs/Kconfig"
|
||||
source "kernel/common/patchfs/Kconfig"
|
||||
######################### config options of blackbox #####################
|
||||
source "kernel/common/blackbox/Kconfig"
|
||||
######################### config options of hidumper #####################
|
||||
source "kernel/common/hidumper/Kconfig"
|
||||
|
||||
config QUICK_START
|
||||
bool "Enable QUICK_START"
|
||||
@@ -73,44 +112,59 @@ config QUICK_START
|
||||
endmenu
|
||||
|
||||
######################### config options of kernel #####################
|
||||
source "../../kernel/liteos_a/kernel/Kconfig"
|
||||
source "kernel/Kconfig"
|
||||
######################### config options of lib ########################
|
||||
source "../../kernel/liteos_a/lib/Kconfig"
|
||||
source "lib/Kconfig"
|
||||
######################### config options of compatibility ##############
|
||||
menu "Compat"
|
||||
source "../../kernel/liteos_a/compat/posix/Kconfig"
|
||||
source "../../kernel/liteos_a/bsd/Kconfig"
|
||||
source "compat/posix/Kconfig"
|
||||
source "bsd/Kconfig"
|
||||
endmenu
|
||||
|
||||
######################### config options of framework ##################
|
||||
#source "../../frameworks/m2mcomm/Kconfig"
|
||||
|
||||
######################## config options of filesystem ##################
|
||||
menu "FileSystem"
|
||||
source "../../kernel/liteos_a/fs/vfs/Kconfig"
|
||||
source "../../kernel/liteos_a/fs/fat/Kconfig"
|
||||
source "../../kernel/liteos_a/fs/ramfs/Kconfig"
|
||||
source "../../kernel/liteos_a/fs/nfs/Kconfig"
|
||||
source "../../kernel/liteos_a/fs/proc/Kconfig"
|
||||
source "../../kernel/liteos_a/fs/jffs2/Kconfig"
|
||||
source "../../kernel/liteos_a/fs/zpfs/Kconfig"
|
||||
source "fs/vfs/Kconfig"
|
||||
source "fs/fat/Kconfig"
|
||||
source "fs/ramfs/Kconfig"
|
||||
source "fs/romfs/Kconfig"
|
||||
source "fs/nfs/Kconfig"
|
||||
source "fs/proc/Kconfig"
|
||||
source "fs/jffs2/Kconfig"
|
||||
source "fs/zpfs/Kconfig"
|
||||
config ENABLE_READ_BUFFER
|
||||
bool "Enable read buffer Option"
|
||||
default n
|
||||
depends on FS_VFS
|
||||
help
|
||||
Answer Y to add enable read buffer Option.
|
||||
|
||||
config MAX_VNODE_SIZE
|
||||
int "Vnode max number"
|
||||
range 0 512
|
||||
default 512
|
||||
depends on FS_VFS
|
||||
help
|
||||
vnode number, range from 0 to 512.
|
||||
|
||||
config MAX_PATH_CACHE_SIZE
|
||||
int "PathCache max number"
|
||||
range 0 1024
|
||||
default 512
|
||||
depends on FS_VFS
|
||||
help
|
||||
pathCache number, range from 0 to 1024.
|
||||
endmenu
|
||||
|
||||
######################## config options of net ############################
|
||||
source "../../kernel/liteos_a/net/Kconfig"
|
||||
source "net/Kconfig"
|
||||
|
||||
######################## config options of debug ########################
|
||||
menu "Debug"
|
||||
config COMPILE_DEBUG
|
||||
bool "Enable GCC -g Option"
|
||||
config GDB
|
||||
bool "Enable gdb functions"
|
||||
default n
|
||||
help
|
||||
Answer Y to add -g option in gcc command. But the LiteOS size will be much larger.
|
||||
Answer Y to enable gdb functions.
|
||||
|
||||
config PLATFORM_ADAPT
|
||||
bool "Enable Os_adapt"
|
||||
@@ -121,6 +175,7 @@ config PLATFORM_ADAPT
|
||||
config ENABLE_OOM_LOOP_TASK
|
||||
bool "Enable Oom loop task"
|
||||
default n
|
||||
depends on KERNEL_VM
|
||||
help
|
||||
Answer Y to enable oom loop kthread to check system out of memory.
|
||||
|
||||
@@ -146,8 +201,10 @@ config ENABLE_MAGICKEY
|
||||
config THUMB
|
||||
bool "Enable Thumb"
|
||||
default n
|
||||
depends on ARCH_ARM
|
||||
help
|
||||
Answer Y to build thumb version. This will make LiteOS smaller.
|
||||
|
||||
config PLATFORM_DVFS
|
||||
bool "Enable Dvfs"
|
||||
default n
|
||||
@@ -156,13 +213,19 @@ config PLATFORM_DVFS
|
||||
Answer Y to enable LiteOS support dynamic voltage and frequency scaling feature for
|
||||
low power consumption.
|
||||
|
||||
config SAVE_EXCINFO
|
||||
bool "Enable Saving Exception Information"
|
||||
default n
|
||||
help
|
||||
Answer Y to enable LiteOS support saving exception information to storage medium.
|
||||
|
||||
config DEBUG_VERSION
|
||||
bool "Enable a Debug Version"
|
||||
default n
|
||||
help
|
||||
If you do not select this option that means you enable a release version for LiteOS.
|
||||
It also means you do not want to use debug modules, like shell,telnet,tftp,
|
||||
,nfs,ramfs proc and memory check.
|
||||
It also means you do not want to use debug modules, like shell,telnet,tftp,nfs and
|
||||
memory check, etc.
|
||||
If you select this option that means you enable a debug version for LiteOS.
|
||||
That means you want a opposite behaviour compared to release version.
|
||||
|
||||
@@ -196,22 +259,14 @@ config DEBUG_SEMAPHORE
|
||||
help
|
||||
Answer Y to enable debug semaphore.
|
||||
|
||||
source "../../kernel/liteos_a/shell/Kconfig"
|
||||
source "shell/Kconfig"
|
||||
config NET_LWIP_SACK_TFTP
|
||||
bool "Enable Tftp"
|
||||
default y
|
||||
depends on SHELL && NET_LWIP_SACK && DEBUG_VERSION
|
||||
help
|
||||
Answer Y to enable LiteOS support tftp cmd and tftp tool.
|
||||
source "../../kernel/liteos_a/net/telnet/Kconfig"
|
||||
config EXC_INTERACTION
|
||||
bool "Enable exc interaction"
|
||||
default n
|
||||
depends on SHELL
|
||||
help
|
||||
Answer Y to enable exception interaction for LiteOS, when the system enter exception, user can also interact with system by shell
|
||||
command like readreg, writereg,task,hwi.
|
||||
|
||||
source "net/telnet/Kconfig"
|
||||
config SCHED_DEBUG
|
||||
bool "Enable sched debug Feature"
|
||||
default n
|
||||
@@ -250,7 +305,7 @@ config MEM_LEAKCHECK
|
||||
help
|
||||
Answer Y to enable record the LR of Function call stack of Mem operation, it can check the mem leak through the infomations of mem node.
|
||||
config BASE_MEM_NODE_INTEGRITY_CHECK
|
||||
bool "Enable integrity check or not "
|
||||
bool "Enable integrity check or not"
|
||||
default n
|
||||
depends on DEBUG_VERSION && MEM_DEBUG
|
||||
config MEM_WATERLINE
|
||||
@@ -265,13 +320,6 @@ config VM_OVERLAP_CHECK
|
||||
help
|
||||
Answer Y to enable vm overlap check.
|
||||
|
||||
config NULL_ADDRESS_PROTECT
|
||||
bool "Enable NULL Address protect"
|
||||
default n
|
||||
depends on (PLATFORM_HI3518EV200 || PLATFORM_HI3516CV300 || PLATFORM_HI3518EV300 || PLATFORM_HI3516DV300 || PLATFORM_QEMU_ARM_VIRT_CA7) && DEBUG_VERSION
|
||||
help
|
||||
Answer Y to set mem address 0~1M prohibit to access, read or write will trigger exception.
|
||||
|
||||
endmenu
|
||||
|
||||
######################## config options os drivers ########################
|
||||
@@ -282,19 +330,31 @@ config DRIVERS
|
||||
help
|
||||
Answer Y to enable LiteOS support driver.
|
||||
|
||||
source "../../kernel/liteos_a/bsd/dev/usb/Kconfig"
|
||||
source "bsd/dev/usb/Kconfig"
|
||||
source "../../drivers/adapter/khdf/liteos/Kconfig"
|
||||
|
||||
# Device driver Kconfig import
|
||||
source "$(DEVICE_PATH)/drivers/Kconfig"
|
||||
|
||||
source "drivers/char/mem/Kconfig"
|
||||
source "drivers/char/quickstart/Kconfig"
|
||||
source "drivers/char/random/Kconfig"
|
||||
source "../../drivers/liteos/tzdriver/Kconfig"
|
||||
source "drivers/char/video/Kconfig"
|
||||
source "drivers/char/trace/Kconfig"
|
||||
|
||||
source "../../drivers/liteos/tzdriver/Kconfig"
|
||||
source "../../drivers/liteos/hievent/Kconfig"
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Security"
|
||||
source "../../kernel/liteos_a/security/Kconfig"
|
||||
source "security/Kconfig"
|
||||
endmenu
|
||||
|
||||
menu "Test"
|
||||
config ENABLE_KERNEL_TEST
|
||||
bool "Enable Kernel Test"
|
||||
default n
|
||||
endmenu
|
||||
|
||||
menu "Stack Smashing Protector (SSP) Compiler Feature"
|
||||
|
||||
284
Makefile
Executable file → Normal file
284
Makefile
Executable file → Normal file
@@ -27,45 +27,57 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
LITEOSTOPDIR := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
|
||||
export OS=$(shell uname -s)
|
||||
ifneq ($(OS), Linux)
|
||||
LITEOSTOPDIR := $(shell dirname $(subst \,/,$(LITEOSTOPDIR))/./)
|
||||
endif
|
||||
|
||||
LITEOSTHIRDPARTY := $(LITEOSTOPDIR)/../../third_party
|
||||
|
||||
LITEOSTOPDIR := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
|
||||
export LITEOSTOPDIR
|
||||
export LITEOSTHIRDPARTY
|
||||
|
||||
RM = -rm -rf
|
||||
MAKE = make
|
||||
__LIBS = libs
|
||||
APPS = apps
|
||||
ROOTFSDIR = rootfsdir
|
||||
ROOTFS = rootfs
|
||||
|
||||
LITEOS_TARGET = liteos
|
||||
LITEOS_LIBS_TARGET = libs_target
|
||||
LITEOS_MENUCONFIG_H = $(LITEOSTOPDIR)/include/generated/autoconf.h
|
||||
LITEOS_PLATFORM_BASE = $(LITEOSTOPDIR)/platform
|
||||
LITEOS_PLATFORM_MENUCONFIG_H = $(LITEOS_PLATFORM_BASE)/include/menuconfig.h
|
||||
LITEOS_LIBS_TARGET = libs
|
||||
KCONFIG_CMDS := $(notdir $(wildcard $(dir $(shell which menuconfig))*config))
|
||||
|
||||
export CONFIG_=LOSCFG_
|
||||
MENUCONFIG_PATH = $(LITEOSTOPDIR)/tools/menuconfig
|
||||
KCONFIG_FILE_PATH = $(LITEOSTOPDIR)/Kconfig
|
||||
|
||||
ifeq ($(OS), Linux)
|
||||
MENUCONFIG_MCONF := $(MENUCONFIG_PATH)/mconf
|
||||
MENUCONFIG_CONF := $(MENUCONFIG_PATH)/conf
|
||||
else
|
||||
MENUCONFIG_MCONF := $(MENUCONFIG_PATH)/kconfig-mconf.exe
|
||||
MENUCONFIG_CONF := $(MENUCONFIG_PATH)/kconfig-conf.exe
|
||||
ohos_kernel ?= liteos_a
|
||||
$(foreach line,$(shell hb env | sed 's/\[OHOS INFO\]/ohos/g;s/ /_/g;s/:_/=/g' || true),$(eval $(line)))
|
||||
ifneq ($(ohos_kernel),liteos_a)
|
||||
$(error The selected product ($(ohos_product)) is not a liteos_a kernel type product)
|
||||
endif
|
||||
|
||||
$(shell env CONFIG_=$(CONFIG_) $(MENUCONFIG_CONF) -s --olddefconfig $(KCONFIG_FILE_PATH))
|
||||
ifeq ($(PRODUCT_PATH),)
|
||||
PRODUCT_PATH:=$(ohos_product_path)
|
||||
endif
|
||||
|
||||
-include $(LITEOSTOPDIR)/tools/build/config.mk
|
||||
ifeq ($(DEVICE_PATH),)
|
||||
DEVICE_PATH:=$(ohos_device_path)
|
||||
endif
|
||||
|
||||
ifeq ($(TEE:1=y),y)
|
||||
tee = _tee
|
||||
endif
|
||||
ifeq ($(RELEASE:1=y),y)
|
||||
CONFIG ?= $(PRODUCT_PATH)/kernel_configs/release$(tee).config
|
||||
else
|
||||
CONFIG ?= $(PRODUCT_PATH)/kernel_configs/debug$(tee).config
|
||||
endif
|
||||
|
||||
KCONFIG_CONFIG ?= $(CONFIG)
|
||||
SYSROOT_PATH ?= $(OUT)/sysroot
|
||||
LITEOS_MENUCONFIG_H ?= $(LITEOSTOPDIR)/config.h
|
||||
LITEOS_CONFIG_FILE ?= $(LITEOSTOPDIR)/.config
|
||||
|
||||
# export los_config.mk related environment variables
|
||||
export LITEOS_MENUCONFIG_H
|
||||
export LITEOS_CONFIG_FILE
|
||||
|
||||
# export subdir Makefile related environment variables
|
||||
export SYSROOT_PATH
|
||||
export PRODUCT_PATH
|
||||
export DEVICE_PATH
|
||||
|
||||
# export kconfig related environment variables
|
||||
export CONFIG_=LOSCFG_
|
||||
export srctree=$(LITEOSTOPDIR)
|
||||
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
ifeq ($(LOSCFG_STORAGE_SPINOR), y)
|
||||
FSTYPE = jffs2
|
||||
@@ -81,150 +93,118 @@ FSTYPE = jffs2
|
||||
endif
|
||||
ROOTFS_DIR = $(OUT)/rootfs
|
||||
ROOTFS_ZIP = $(OUT)/rootfs.zip
|
||||
VERSION =
|
||||
|
||||
all: $(OUT) $(BUILD) $(LITEOS_TARGET) $(APPS)
|
||||
lib: $(OUT) $(BUILD) $(LITEOS_LIBS_TARGET)
|
||||
define HELP =
|
||||
Usage: make [TARGET]... [PARAMETER=VALUE]...
|
||||
|
||||
Targets:
|
||||
help: display this help and exit
|
||||
clean: clean compiled objects
|
||||
cleanall: clean all build outputs
|
||||
all: make liteos kernel image and rootfs image (Default target)
|
||||
$(APPS): build all apps
|
||||
$(ROOTFS): make a original rootfs image
|
||||
$(LITEOS_LIBS_TARGET): compile all kernel modules (libraries)
|
||||
$(LITEOS_TARGET): make liteos kernel image
|
||||
update_config: update product kernel config (use menuconfig)
|
||||
xxconfig: invoke xxconfig command of kconfiglib (xxconfig is one of $(KCONFIG_CMDS))
|
||||
|
||||
Parameters:
|
||||
FSTYPE: value should be one of (jffs2 vfat yaffs2)
|
||||
TEE: boolean value(1 or y for true), enable tee
|
||||
RELEASE: boolean value(1 or y for true), build release version
|
||||
CONFIG: kernel config file to be use
|
||||
args: arguments for xxconfig command
|
||||
endef
|
||||
export HELP
|
||||
|
||||
all: $(LITEOS_TARGET) $(ROOTFS)
|
||||
|
||||
help:
|
||||
$(HIDE)echo "-------------------------------------------------------"
|
||||
$(HIDE)echo "1.====make help: get help infomation of make"
|
||||
$(HIDE)echo "2.====make: make a debug version based the .config"
|
||||
$(HIDE)echo "3.====make debug: make a debug version based the .config"
|
||||
$(HIDE)echo "4.====make release: make a release version for all platform"
|
||||
$(HIDE)echo "5.====make release PLATFORM=xxx: make a release version only for platform xxx"
|
||||
$(HIDE)echo "6.====make rootfsdir: make a original rootfs dir"
|
||||
$(HIDE)echo "7.====make rootfs FSTYPE=***: make a original rootfs img"
|
||||
$(HIDE)echo "8.====make test: make the testsuits_app and put it into the rootfs dir"
|
||||
$(HIDE)echo "9.====make test_apps FSTYPE=***: make a rootfs img with the testsuits_app in it"
|
||||
$(HIDE)echo "xxx should be one of (hi3516cv300 hi3516ev200 hi3556av100/cortex-a53_aarch32 hi3559av100/cortex-a53_aarch64)"
|
||||
$(HIDE)echo "*** should be one of (jffs2)"
|
||||
$(HIDE)echo "-------------------------------------------------------"
|
||||
$(HIDE)echo "$$HELP"
|
||||
|
||||
debug:
|
||||
$(HIDE)echo "=============== make a debug version ==============="
|
||||
$(HIDE) $(MAKE) all
|
||||
|
||||
release:
|
||||
ifneq ($(PLATFORM),)
|
||||
$(HIDE)echo "=============== make a release version for platform $(PLATFORM) ==============="
|
||||
$(HIDE)$(SCRIPTS_PATH)/mklibversion.sh $(PLATFORM)
|
||||
else
|
||||
$(HIDE)echo "================make a release version for all platform ==============="
|
||||
$(HIDE)$(SCRIPTS_PATH)/mklibversion.sh
|
||||
sysroot:
|
||||
$(HIDE)echo "sysroot:" $(abspath $(SYSROOT_PATH))
|
||||
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
|
||||
ifeq ($(origin SYSROOT_PATH),file)
|
||||
$(HIDE)mkdir -p $(SYSROOT_PATH)/build && cd $(SYSROOT_PATH)/build && \
|
||||
ln -snf $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/build/Makefile && \
|
||||
$(MAKE) TARGETS=liteos_a_user \
|
||||
ARCH=$(ARCH) \
|
||||
TARGET=$(LOSCFG_LLVM_TARGET) \
|
||||
ARCH_CFLAGS="$(LITEOS_CORE_COPTS) -w" \
|
||||
TOPDIR="$(LITEOSTOPDIR)/../.." \
|
||||
SYSROOTDIR="$(SYSROOT_PATH)" \
|
||||
CLANG="$(LITEOS_COMPILER_PATH)clang" \
|
||||
BUILD_ALL_MULTILIB=false \
|
||||
BUILD_DEBUG=$(if $(patsubst y,,$(or $(RELEASE:1=y),n)),true,false)
|
||||
endif
|
||||
endif
|
||||
|
||||
##### make dynload #####
|
||||
-include $(LITEOS_MK_PATH)/dynload.mk
|
||||
$(filter-out menuconfig,$(KCONFIG_CMDS)):
|
||||
$(HIDE)$@ $(args)
|
||||
|
||||
#-----need move when make version-----#
|
||||
##### make lib #####
|
||||
$(__LIBS): $(OUT) $(CXX_INCLUDE)
|
||||
$(LITEOS_CONFIG_FILE): $(KCONFIG_CONFIG)
|
||||
$(HIDE)env KCONFIG_CONFIG=$< genconfig --config-out $@ --header-path $(LITEOS_MENUCONFIG_H)
|
||||
|
||||
$(OUT): $(LITEOS_MENUCONFIG_H)
|
||||
$(HIDE)mkdir -p $(OUT)/lib
|
||||
$(HIDE)$(CC) -I$(LITEOSTOPDIR)/kernel/base/include -I$(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) \
|
||||
-I$(LITEOS_PLATFORM_BASE)/include -E $(LITEOS_PLATFORM_BASE)/board.ld.S \
|
||||
-o $(LITEOS_PLATFORM_BASE)/board.ld -P
|
||||
update_config menuconfig:
|
||||
$(HIDE)test -f "$(CONFIG)" && cp -v "$(CONFIG)" .config && menuconfig $(args) && savedefconfig --out "$(CONFIG)"
|
||||
|
||||
$(BUILD):
|
||||
$(HIDE)mkdir -p $(BUILD)
|
||||
$(LITEOS_LIBS_TARGET): sysroot
|
||||
$(HIDE)for dir in $(LIB_SUBDIRS); do $(MAKE) -C $$dir all || exit 1; done
|
||||
|
||||
$(LITEOS_LIBS_TARGET): $(__LIBS)
|
||||
$(HIDE)for dir in $(LIB_SUBDIRS); \
|
||||
do $(MAKE) -C $$dir all || exit 1; \
|
||||
done
|
||||
$(HIDE)echo "=============== make lib done ==============="
|
||||
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET)
|
||||
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).map
|
||||
#$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).objsize
|
||||
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).bin
|
||||
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).sym.sorted
|
||||
$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).asm
|
||||
#$(LITEOS_TARGET): $(OUT)/$(LITEOS_TARGET).size
|
||||
|
||||
##### make menuconfig #####
|
||||
menuconfig:$(MENUCONFIG_MCONF)
|
||||
$< $(KCONFIG_FILE_PATH)
|
||||
$(OUT)/$(LITEOS_TARGET): $(LITEOS_LIBS_TARGET)
|
||||
$(LD) $(LITEOS_LDFLAGS) $(LITEOS_TABLES_LDFLAGS) -Map=$@.map -o $@ --start-group $(LITEOS_LIBDEP) --end-group
|
||||
$(OUT)/$(LITEOS_TARGET).map: $(OUT)/$(LITEOS_TARGET)
|
||||
$(OUT)/$(LITEOS_TARGET).objsize: $(LITEOS_LIBS_TARGET)
|
||||
$(SIZE) -t --common $(OUT)/lib/*.a >$@
|
||||
$(OUT)/$(LITEOS_TARGET).bin: $(OUT)/$(LITEOS_TARGET)
|
||||
$(OBJCOPY) -O binary $< $@
|
||||
$(OUT)/$(LITEOS_TARGET).sym.sorted: $(OUT)/$(LITEOS_TARGET)
|
||||
$(OBJDUMP) -t $< |sort >$@
|
||||
$(OUT)/$(LITEOS_TARGET).asm: $(OUT)/$(LITEOS_TARGET)
|
||||
$(OBJDUMP) -d $< >$@
|
||||
$(OUT)/$(LITEOS_TARGET).size: $(OUT)/$(LITEOS_TARGET)
|
||||
$(NM) -S --size-sort $< >$@
|
||||
|
||||
genconfig:$(MENUCONFIG_CONF)
|
||||
$(HIDE)mkdir -p include/config include/generated
|
||||
$< --olddefconfig $(KCONFIG_FILE_PATH)
|
||||
$< --silentoldconfig $(KCONFIG_FILE_PATH)
|
||||
-mv -f $(LITEOS_MENUCONFIG_H) $(LITEOS_PLATFORM_MENUCONFIG_H)
|
||||
##### menuconfig end #######
|
||||
|
||||
$(LITEOS_MENUCONFIG_H):
|
||||
ifneq ($(LITEOS_PLATFORM_MENUCONFIG_H), $(wildcard $(LITEOS_PLATFORM_MENUCONFIG_H)))
|
||||
$(HIDE)$(MAKE) genconfig
|
||||
endif
|
||||
$(LITEOS_TARGET): $(__LIBS)
|
||||
$(HIDE)touch $(LOSCFG_ENTRY_SRC)
|
||||
|
||||
$(HIDE)for dir in $(LITEOS_SUBDIRS); \
|
||||
do $(MAKE) -C $$dir all || exit 1; \
|
||||
done
|
||||
|
||||
$(LD) $(LITEOS_LDFLAGS) $(LITEOS_TABLES_LDFLAGS) $(LITEOS_DYNLDFLAGS) -Map=$(OUT)/$@.map -o $(OUT)/$@ --start-group $(LITEOS_LIBDEP) --end-group
|
||||
# $(SIZE) -t --common $(OUT)/lib/*.a >$(OUT)/$@.objsize
|
||||
$(OBJCOPY) -O binary $(OUT)/$@ $(LITEOS_TARGET_DIR)/$@.bin
|
||||
$(OBJDUMP) -t $(OUT)/$@ |sort >$(OUT)/$@.sym.sorted
|
||||
$(OBJDUMP) -d $(OUT)/$@ >$(OUT)/$@.asm
|
||||
# $(NM) -S --size-sort $(OUT)/$@ >$(OUT)/$@.size
|
||||
|
||||
$(APPS): $(LITEOS_TARGET)
|
||||
$(APPS): sysroot
|
||||
$(HIDE)$(MAKE) -C apps all
|
||||
|
||||
prepare:
|
||||
$(ROOTFS): $(APPS)
|
||||
$(HIDE)mkdir -p $(OUT)/musl
|
||||
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
|
||||
$(HIDE)cp -f $(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/usr/lib/$(LLVM_TARGET)/a7_softfp_neon-vfpv4/libc.so $(OUT)/musl
|
||||
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/lib/$(LLVM_TARGET)/c++/a7_softfp_neon-vfpv4/libc++.so $(OUT)/musl
|
||||
$(HIDE)cp -fp $$($(CC) $(LITEOS_CFLAGS) -print-file-name=libc.so) $(OUT)/musl
|
||||
$(HIDE)cp -fp $$($(GPP) $(LITEOS_CXXFLAGS) -print-file-name=libc++.so) $(OUT)/musl
|
||||
else
|
||||
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/target/usr/lib/libc.so $(OUT)/musl
|
||||
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/arm-linux-musleabi/lib/libstdc++.so.6 $(OUT)/musl
|
||||
$(HIDE)cp -f $(LITEOS_COMPILER_PATH)/arm-linux-musleabi/lib/libgcc_s.so.1 $(OUT)/musl
|
||||
$(STRIP) $(OUT)/musl/*
|
||||
$(HIDE)cp -fp $$($(CC) $(LITEOS_CFLAGS) -print-file-name=libc.so) $(OUT)/musl
|
||||
$(HIDE)cp -fp $$($(CC) $(LITEOS_CFLAGS) -print-file-name=libgcc_s.so.1) $(OUT)/musl
|
||||
$(HIDE)cp -fp $$($(GPP) $(LITEOS_CXXFLAGS) -print-file-name=libstdc++.so.6) $(OUT)/musl
|
||||
endif
|
||||
|
||||
$(ROOTFSDIR): prepare $(APPS)
|
||||
$(HIDE)$(MAKE) clean -C apps
|
||||
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsdir.sh $(OUT)/bin $(OUT)/musl $(ROOTFS_DIR)
|
||||
$(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/rootfsdir.sh $(OUT) $(ROOTFS_DIR)
|
||||
$(HIDE)shopt -s nullglob && $(STRIP) $(ROOTFS_DIR)/bin/* $(ROOTFS_DIR)/lib/*
|
||||
ifneq ($(VERSION),)
|
||||
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR)
|
||||
$(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/releaseinfo.sh "$(VERSION)" $(ROOTFS_DIR)
|
||||
endif
|
||||
|
||||
$(ROOTFS): $(ROOTFSDIR)
|
||||
$(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsimg.sh $(ROOTFS_DIR) $(FSTYPE)
|
||||
$(HIDE)$(LITEOS_SCRIPTPATH)/make_rootfs/rootfsimg.sh $(ROOTFS_DIR) $(FSTYPE)
|
||||
$(HIDE)cd $(ROOTFS_DIR)/.. && zip -r $(ROOTFS_ZIP) $(ROOTFS)
|
||||
ifneq ($(OUT), $(LITEOS_TARGET_DIR))
|
||||
rm -rf $(LITEOS_TARGET_DIR)rootfs
|
||||
$(HIDE)mv $(ROOTFS_DIR) $(LITEOS_TARGET_DIR)rootfs
|
||||
endif
|
||||
|
||||
clean:
|
||||
$(HIDE)for dir in $(LITEOS_SUBDIRS); \
|
||||
do $(MAKE) -C $$dir clean|| exit 1; \
|
||||
done
|
||||
$(HIDE)$(MAKE) -C apps clean
|
||||
$(HIDE)$(RM) $(__OBJS) $(LITEOS_TARGET) $(BUILD) $(LITEOS_MENUCONFIG_H) *.bak *~
|
||||
$(HIDE)$(RM) $(LITEOS_PLATFORM_MENUCONFIG_H)
|
||||
$(HIDE)$(RM) include
|
||||
$(HIDE)$(MAKE) cleanrootfs
|
||||
$(HIDE)echo "clean $(LITEOS_PLATFORM) finish"
|
||||
$(HIDE)if [ -d $(SYSROOT_PATH)/build ]; then $(MAKE) -C $(SYSROOT_PATH)/build clean; fi
|
||||
$(HIDE)for dir in $(LIB_SUBDIRS) apps; do $(MAKE) -C $$dir clean || exit 1; done
|
||||
$(HIDE)$(RM) $(LITEOS_MENUCONFIG_H)
|
||||
$(HIDE)echo "clean $(LOSCFG_PLATFORM) finish"
|
||||
|
||||
cleanall:
|
||||
$(HIDE)$(RM) $(LITEOSTOPDIR)/out
|
||||
$(HIDE)find $(LITEOS_PLATFORM_BASE)/ -name board.ld -exec rm -rf {} \;
|
||||
$(HIDE)cd sample/sample_osdrv;make clean;cd ../..;
|
||||
$(HIDE)echo "clean all"
|
||||
cleanall: clean
|
||||
$(HIDE)$(RM) $(LITEOSTOPDIR)/out $(LITEOS_CONFIG_FILE)
|
||||
$(HIDE)echo "clean all done"
|
||||
|
||||
cleanrootfs:
|
||||
$(HIDE)$(RM) $(OUT)/rootfs
|
||||
$(HIDE)$(RM) $(OUT)/rootfs.zip
|
||||
$(HIDE)$(RM) $(OUT)/rootfs.img
|
||||
|
||||
update_all_config:
|
||||
$(HIDE)shopt -s globstar && for f in tools/build/config/**/*.config ; \
|
||||
do \
|
||||
echo updating $$f; \
|
||||
test -f $$f && cp $$f .config && $(MENUCONFIG_CONF) -s --olddefconfig $(KCONFIG_FILE_PATH) && $(MENUCONFIG_CONF) --savedefconfig $$f $(KCONFIG_FILE_PATH); \
|
||||
done
|
||||
|
||||
%.config:
|
||||
$(HIDE)test -f tools/build/config/$@ && cp tools/build/config/$@ .config && $(MENUCONFIG_MCONF) $(KCONFIG_FILE_PATH) && $(MENUCONFIG_CONF) --savedefconfig tools/build/config/$@ $(KCONFIG_FILE_PATH)
|
||||
|
||||
.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config
|
||||
.PHONY: all clean cleanall sysroot help update_config
|
||||
.PHONY: $(LITEOS_TARGET) $(ROOTFS) $(APPS) $(KCONFIG_CMDS) $(LITEOS_LIBS_TARGET) $(KCONFIG_CONFIG)
|
||||
|
||||
83
OAT.xml
Normal file
83
OAT.xml
Normal file
@@ -0,0 +1,83 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Copyright (c) 2021 Huawei Device Co., Ltd.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
This is the configuration file template for OpenHarmony OSS Audit Tool, please copy it to your project root dir and modify it refer to OpenHarmony/tools_oat/README.
|
||||
|
||||
-->
|
||||
|
||||
<configuration>
|
||||
<oatconfig>
|
||||
<licensefile></licensefile>
|
||||
<policylist>
|
||||
<policy name="projectPolicy" desc="">
|
||||
<policyitem type="copyright" name="Huawei Technologies Co., Ltd. All rights reserved." path=".*" desc="original liteos copyright"/>
|
||||
<policyitem type="license" name="BSD-3-Clause" path=".*" desc="Liteos kernel use bsd3 license"/>
|
||||
</policy>
|
||||
</policylist>
|
||||
<filefilterlist>
|
||||
<filefilter name="defaultFilter" desc="文件属于FreeBSD仓库软连接,本仓库屏蔽告警,在FreeBSD仓库进行处理">
|
||||
<filteritem type="filepath" name="bsd/.*" desc="文件属于FreeBSD仓库软连接,本仓库屏蔽告警,在FreeBSD仓库进行处理"/>
|
||||
<filteritem type="filepath" name="kernel/extended" desc="文件属于Nuttx仓库软连接,本仓库屏蔽告警,在Nuttx仓库进行处理"/>
|
||||
<filteritem type="filepath" name="fs/include/fs" desc="文件属于Nuttx仓库软连接,本仓库屏蔽告警,在Nuttx仓库进行处理"/>
|
||||
</filefilter>
|
||||
<filefilter name="defaultFilter" desc="Files not to check">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility,license header policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="copyrightPolicyFilter" desc="Filters for copyright header policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="licenseFileNamePolicyFilter" desc="Filters for LICENSE file policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="readmeFileNamePolicyFilter" desc="Filters for README file policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="readmeOpenSourcefileNamePolicyFilter" desc="Filters for README.OpenSource file policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||
<!--filteritem type="filename" name="*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="abcdefg/.*.uvwxyz" desc="Describe the reason for filtering scan results"/-->
|
||||
<!--filteritem type="filepath" name="projectroot/[a-zA-Z0-9]{20,}.sh" desc="Temp files"/-->
|
||||
</filefilter>
|
||||
|
||||
</filefilterlist>
|
||||
<licensematcherlist>
|
||||
<!--licensematcher name="uvwxyz License" desc="If the scanning result is InvalidLicense, you can define matching rules here. Note that quotation marks must be escaped.">
|
||||
<licensetext name="
|
||||
uvwxyz license textA xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
" desc=""/>
|
||||
<licensetext name="
|
||||
uvwxyz license textB xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
" desc=""/>
|
||||
</licensematcher-->
|
||||
</licensematcherlist>
|
||||
</oatconfig>
|
||||
</configuration>
|
||||
25
README.md
25
README.md
@@ -12,7 +12,7 @@
|
||||
|
||||
## Introduction<a name="section11660541593"></a>
|
||||
|
||||
The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on the Huawei LiteOS kernel. Huawei LiteOS is a lightweight operating system \(OS\) built for the Internet of Things \(IoT\) field. With the rapid development of the IoT industry, OpenHarmony LiteOS Cortex-A brings small-sized, low-power, and high-performance experience and builds a unified and open ecosystem for developers. In addition, it provides rich kernel mechanisms, more comprehensive Portable Operating System Interface \(POSIX\), and a unified driver framework, Hardware Driver Foundation \(HDF\), which offers unified access for device developers and friendly development experience for application developers. [Figure1](#fig27311582210) shows the architecture of the OpenHarmony LiteOS Cortex-A kernel.
|
||||
The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on the Huawei LiteOS kernel. Huawei LiteOS is a lightweight operating system \(OS\) built for the Internet of Things \(IoT\) field. With the rapid development of the IoT industry, OpenHarmony LiteOS Cortex-A brings small-sized, low-power, and high-performance experience and builds a unified and open ecosystem for developers. In addition, it provides rich kernel mechanisms, more comprehensive Portable Operating System Interface \(POSIX\), and a unified driver framework, Hardware Driver Foundation \(HDF\), which offers unified access for device developers and friendly development experience for application developers. [Figure 1](#fig27311582210) shows the architecture of the OpenHarmony LiteOS Cortex-A kernel.
|
||||
|
||||
**Figure 1** Architecture of the OpenHarmony LiteOS Cortex-A kernel<a name="fig27311582210"></a>
|
||||

|
||||
@@ -27,7 +27,7 @@ The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on th
|
||||
├── bsd # Code of the driver and adaptation layer module related to the FreeBSD, such as the USB module
|
||||
├── compat # Kernel API compatibility
|
||||
│ └── posix # POSIX APIs
|
||||
├── drivers # Kernel driver
|
||||
├── drivers # Kernel drivers
|
||||
│ └── char # Character device
|
||||
│ ├── mem # Driver for accessing physical input/output (I/O) devices
|
||||
│ ├── quickstart # APIs for quick start of the system
|
||||
@@ -50,7 +50,7 @@ The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on th
|
||||
├── lib # Kernel library
|
||||
├── net # Network module, which mainly derives from the lwIP open-source project
|
||||
├── platform # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300
|
||||
│ ├── hw # Logic code related to clocks and interupts
|
||||
│ ├── hw # Logic code related to clocks and interrupts
|
||||
│ ├── include # Header files exposed externally
|
||||
│ └── uart # Logic code related to the serial port
|
||||
├── platform # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300
|
||||
@@ -67,30 +67,33 @@ The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on th
|
||||
|
||||
## Usage<a name="section741617511812"></a>
|
||||
|
||||
OpenHarmony LiteOS Cortex-A supports the [Hi3518E V300](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/introduction-to-the-hi3518-development-board.md) and [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/introduction-to-the-hi3516-development-board.md). You can develop and run your applications based on both development boards.
|
||||
OpenHarmony LiteOS Cortex-A supports the [Hi3518E V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-introduction-hi3518.md) and [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-introduction-hi3516.md). You can develop and run your applications based on both development boards.
|
||||
|
||||
### Preparations<a name="section1579912573329"></a>
|
||||
|
||||
You need to set up the compilation environment on Linux.
|
||||
|
||||
- For Hi3518E V300, see [Setting Up the Hi3518 Development Environment](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/setting-up-the-hi3518-development-environment.md).
|
||||
- For Hi3516D V300, see [Setting Up the Hi3516 Development Environment](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/setting-up-the-hi3516-development-environment.md).
|
||||
- [Compilation environment on Linux](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-env-setup-lin.md)
|
||||
- For Hi3518E V300, see [Setting Up the Hi3518 Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-board3518-setting.md).
|
||||
- For Hi3516D V300, see [Setting Up the Hi3516 Development Environment](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-board3516-setting.md).
|
||||
|
||||
### Source Code Acquisition<a name="section11443189655"></a>
|
||||
|
||||
Download and decompress a set of source code on a Linux server to acquire the [source code](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz). For more acquisition methods, see [Source Code Acquisition](https://gitee.com/openharmony/docs/blob/master/docs-en/get-code/source-code-acquisition.md).
|
||||
Download and decompress a set of source code on a Linux server to acquire the [source code](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md).
|
||||
|
||||
### Compilation and Building<a name="section2081013992812"></a>
|
||||
|
||||
For details about how to develop the first application, see:
|
||||
|
||||
- [Developing the First Example Program Running on Hi3518](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/developing-the-first-example-program-running-on-hi3518.md)
|
||||
- [Developing the First Example Program Running on Hi3518](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-board3518-running.md)
|
||||
|
||||
- [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/developing-the-first-example-program-running-on-hi3516.md)
|
||||
- [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/en/device-dev/quick-start/quickstart-lite-steps-board3516-running.md)
|
||||
|
||||
## Repositories Involved<a name="section1371113476307"></a>
|
||||
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos)
|
||||
[Kernel subsystem](https://gitee.com/openharmony/docs/blob/master/en/readme/kernel.md)
|
||||
|
||||
**[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a)**
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README.md)
|
||||
|
||||
**kernel\_liteos\_a**
|
||||
|
||||
|
||||
99
README_zh-HK.md
Normal file
99
README_zh-HK.md
Normal file
@@ -0,0 +1,99 @@
|
||||
# LiteOS-A內核<a name="ZH-CN_TOPIC_0000001096612501"></a>
|
||||
|
||||
- [簡介](#section11660541593)
|
||||
- [目錄](#section161941989596)
|
||||
- [約束](#section119744591305)
|
||||
- [使用說明](#section741617511812)
|
||||
- [準備](#section1579912573329)
|
||||
- [獲取源碼](#section11443189655)
|
||||
- [編譯構建](#section2081013992812)
|
||||
|
||||
- [相關倉](#section1371113476307)
|
||||
|
||||
## 簡介<a name="section11660541593"></a>
|
||||
|
||||
OpenHarmony LiteOS-A內核是基於Huawei LiteOS內核演進發展的新一代內核,Huawei LiteOS是面向IoT領域構建的輕量級物聯網操作系統。在IoT產業高速發展的潮流中,OpenHarmony LiteOS-A內核能夠帶給用戶小體積、低功耗、高性能的體驗以及統一開放的生態系統能力,新增了豐富的內核機制、更加全面的POSIX標準接口以及統一驅動框架**HDF**(OpenHarmony Driver Foundation)等,為設備廠商提供了更統一的接入方式,為OpenHarmony的應用開發者提供了更友好的開發體驗。圖1為OpenHarmony LiteOS-A內核架構圖:
|
||||
|
||||
**圖 1** OpenHarmony LiteOS-A內核架構圖<a name="fig27311582210"></a>
|
||||
|
||||

|
||||
|
||||
## 目錄<a name="section161941989596"></a>
|
||||
|
||||
```
|
||||
/kernel/liteos_a
|
||||
├── apps # 用戶態的init和shell應用程序
|
||||
├── arch # 體系架構的目錄,如arm等
|
||||
│ └── arm # arm架構代碼
|
||||
├── bsd # freebsd相關的驅動和適配層模塊代碼引入,例如USB等
|
||||
├── compat # 內核接口兼容性目錄
|
||||
│ └── posix # posix相關接口
|
||||
├── drivers # 內核驅動
|
||||
│ └── char # 字符設備
|
||||
│ ├── mem # 訪問物理IO設備驅動
|
||||
│ ├── quickstart # 系統快速啟動接口目錄
|
||||
│ ├── random # 隨機數設備驅動
|
||||
│ └── video # framebuffer驅動框架
|
||||
├── fs # 文件系統模塊,主要來源於NuttX開源項目
|
||||
│ ├── fat # fat文件系統
|
||||
│ ├── jffs2 # jffs2文件系統
|
||||
│ ├── include # 對外暴露頭文件存放目錄
|
||||
│ ├── nfs # nfs文件系統
|
||||
│ ├── proc # proc文件系統
|
||||
│ ├── ramfs # ramfs文件系統
|
||||
│ └── vfs # vfs層
|
||||
├── kernel # 進程、內存、IPC等模塊
|
||||
│ ├── base # 基礎內核,包括調度、內存等模塊
|
||||
│ ├── common # 內核通用組件
|
||||
│ ├── extended # 擴展內核,包括動態加載、vdso、liteipc等模塊
|
||||
│ ├── include # 對外暴露頭文件存放目錄
|
||||
│ └── user # 加載init進程
|
||||
├── lib # 內核的lib庫
|
||||
├── net # 網絡模塊,主要來源於lwip開源項目
|
||||
├── platform # 支持不同的芯片平台代碼,如Hi3516DV300等
|
||||
│ ├── hw # 時鐘與中斷相關邏輯代碼
|
||||
│ ├── include # 對外暴露頭文件存放目錄
|
||||
│ └── uart # 串口相關邏輯代碼
|
||||
├── platform # 支持不同的芯片平台代碼,如Hi3516DV300等
|
||||
├── security # 安全特性相關的代碼,包括進程權限管理和虛擬id映射管理
|
||||
├── syscall # 系統調用
|
||||
└── tools # 構建工具及相關配置和代碼
|
||||
```
|
||||
|
||||
## 約束<a name="section119744591305"></a>
|
||||
|
||||
- 開發語言:C/C++;
|
||||
- 適用於Hi3518EV300、Hi3516DV300單板;
|
||||
- Hi3518EV300默認使用jffs2文件系統,Hi3516DV300默認使用FAT文件系統。
|
||||
|
||||
## 使用說明<a name="section741617511812"></a>
|
||||
|
||||
OpenHarmony LiteOS-A內核支持Hi3518EV300([介紹](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/oem_minitinier_des_3518.md))、Hi3516DV300([介紹](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/oem_minitinier_des_3516.md))單板,開發者可基於兩種單板開發運行自己的應用程序。
|
||||
|
||||
### 準備<a name="section1579912573329"></a>
|
||||
|
||||
開發者需要在Linux上搭建編譯環境:
|
||||
|
||||
- [Ubuntu編譯環境凖備](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-linux.md);
|
||||
- Hi3518EV300單板:參考[環境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-setting.md);
|
||||
- Hi3516DV300單板:參考[環境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md)。
|
||||
|
||||
### 獲取源碼<a name="section11443189655"></a>
|
||||
|
||||
在Linux服務器上下載並解壓一套源代碼,源碼獲取方式參考[源碼獲取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
|
||||
|
||||
### 編譯構建<a name="section2081013992812"></a>
|
||||
|
||||
開發者開發第一個應用程序可參考:
|
||||
|
||||
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md);
|
||||
|
||||
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)。
|
||||
|
||||
## 相關倉<a name="section1371113476307"></a>
|
||||
|
||||
[內核子系統](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%86%85%E6%A0%B8%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
|
||||
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README_zh.md)
|
||||
|
||||
**kernel\_liteos\_a**
|
||||
19
README_zh.md
19
README_zh.md
@@ -67,30 +67,33 @@ OpenHarmony LiteOS-A内核是基于Huawei LiteOS内核演进发展的新一代
|
||||
|
||||
## 使用说明<a name="section741617511812"></a>
|
||||
|
||||
OpenHarmony LiteOS-A内核支持Hi3518EV300([介绍](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3518%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BB%8B%E7%BB%8D.md))、Hi3516DV300([介绍](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3516%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BB%8B%E7%BB%8D.md))单板,开发者可基于两种单板开发运行自己的应用程序。
|
||||
OpenHarmony LiteOS-A内核支持Hi3518EV300([介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/oem_minitinier_des_3518.md))、Hi3516DV300([介绍](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/oem_minitinier_des_3516.md))单板,开发者可基于两种单板开发运行自己的应用程序。
|
||||
|
||||
### 准备<a name="section1579912573329"></a>
|
||||
|
||||
开发者需要在Linux上搭建编译环境:
|
||||
|
||||
- Hi3518EV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3518%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83.md);
|
||||
- Hi3516DV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3516%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83.md)。
|
||||
- [Ubuntu编译环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-linux.md);
|
||||
- Hi3518EV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-setting.md);
|
||||
- Hi3516DV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md)。
|
||||
|
||||
### 获取源码<a name="section11443189655"></a>
|
||||
|
||||
在Linux服务器上下载并解压一套源代码,获取源码([下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式,参考[源码获取](https://gitee.com/openharmony/docs/blob/master/get-code/%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96.md)。
|
||||
在Linux服务器上下载并解压一套源代码,源码获取方式参考[源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。
|
||||
|
||||
### 编译构建<a name="section2081013992812"></a>
|
||||
|
||||
开发者开发第一个应用程序可参考:
|
||||
|
||||
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/quick-start/%E5%BC%80%E5%8F%91Hi3518%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A4%BA%E4%BE%8B%E7%A8%8B%E5%BA%8F.md);
|
||||
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md);
|
||||
|
||||
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/quick-start/%E5%BC%80%E5%8F%91Hi3516%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E7%A4%BA%E4%BE%8B.md)。
|
||||
- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md)。
|
||||
|
||||
## 相关仓<a name="section1371113476307"></a>
|
||||
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos)
|
||||
[内核子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%86%85%E6%A0%B8%E5%AD%90%E7%B3%BB%E7%BB%9F.md)
|
||||
|
||||
**[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a)**
|
||||
[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README_zh.md)
|
||||
|
||||
**kernel\_liteos\_a**
|
||||
|
||||
|
||||
54
apps/BUILD.gn
Normal file
54
apps/BUILD.gn
Normal file
@@ -0,0 +1,54 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
group("apps") {
|
||||
deps = []
|
||||
|
||||
if (defined(LOSCFG_SHELL)) {
|
||||
deps += [
|
||||
"shell",
|
||||
"mksh",
|
||||
"toybox",
|
||||
]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_USER_INIT_DEBUG)) {
|
||||
deps += [ "init" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_NET_LWIP_SACK_TFTP)) {
|
||||
deps += [ "tftp" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_DRIVERS_TRACE)) {
|
||||
deps += [ "trace" ]
|
||||
}
|
||||
}
|
||||
20
apps/Makefile
Executable file → Normal file
20
apps/Makefile
Executable file → Normal file
@@ -27,23 +27,21 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include ../.config
|
||||
include ./module.mk
|
||||
APPSTOPDIR := $(shell pwd)
|
||||
LITEOSTOPDIR ?= $(APPSTOPDIR)/..
|
||||
export LITEOSTOPDIR
|
||||
export APPSTOPDIR
|
||||
|
||||
HIDE := @
|
||||
APPS := app
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
all: $(APPS)
|
||||
|
||||
# Make
|
||||
$(APPS):
|
||||
all:
|
||||
ifneq ($(APP_SUBDIRS), )
|
||||
$(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir || exit 1; done
|
||||
$(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir all || exit 1; done
|
||||
endif
|
||||
|
||||
clean:
|
||||
ifneq ($(APP_SUBDIRS), )
|
||||
$(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir clean; done
|
||||
$(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir clean || exit 1; done
|
||||
endif
|
||||
|
||||
.PHONY: all $(APPS) clean
|
||||
.PHONY: all clean
|
||||
|
||||
114
apps/app.mk
Normal file
114
apps/app.mk
Normal file
@@ -0,0 +1,114 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
OBJOUT := $(BUILD)$(dir $(subst $(LITEOSTOPDIR),,$(shell pwd)))$(APP_NAME)
|
||||
|
||||
APP := $(OUT)/bin/$(APP_NAME)
|
||||
|
||||
# create a separate list of objects per source type
|
||||
|
||||
LOCAL_CSRCS := $(filter %.c,$(LOCAL_SRCS))
|
||||
LOCAL_CPPSRCS := $(filter %.cpp,$(LOCAL_SRCS))
|
||||
LOCAL_ASMSRCS := $(filter %.S,$(LOCAL_SRCS))
|
||||
LOCAL_ASMSRCS2 := $(filter %.s,$(LOCAL_SRCS))
|
||||
LOCAL_CCSRCS := $(filter %.cc,$(LOCAL_SRCS))
|
||||
|
||||
LOCAL_COBJS := $(patsubst %.c,$(OBJOUT)/%.o,$(LOCAL_CSRCS))
|
||||
LOCAL_CPPOBJS := $(patsubst %.cpp,$(OBJOUT)/%.o,$(LOCAL_CPPSRCS))
|
||||
LOCAL_ASMOBJS := $(patsubst %.S,$(OBJOUT)/%.o,$(LOCAL_ASMSRCS))
|
||||
LOCAL_ASMOBJS2 := $(patsubst %.s,$(OBJOUT)/%.o,$(LOCAL_ASMSRCS2))
|
||||
LOCAL_CCOBJS := $(patsubst %.cc,$(OBJOUT)/%.o,$(LOCAL_CCSRCS))
|
||||
|
||||
LOCAL_OBJS := $(LOCAL_COBJS) $(LOCAL_CPPOBJS) $(LOCAL_ASMOBJS) $(LOCAL_ASMOBJS2) $(LOCAL_CCOBJS)
|
||||
|
||||
LOCAL_CGCH := $(patsubst %.h,%.h.gch,$(LOCAL_CHS))
|
||||
LOCAL_CPPGCH := $(patsubst %.h,%.h.gch,$(LOCAL_CPPHS))
|
||||
|
||||
all : $(APP)
|
||||
|
||||
define ECHO =
|
||||
ifeq ($$(HIDE),@)
|
||||
_$(1) := $($(1))
|
||||
$(1) = echo " $(1)" $$(patsubst $$(OUT)/%,%,$$@) && $$(_$(1))
|
||||
endif
|
||||
endef
|
||||
$(foreach cmd,CC GPP AS,$(eval $(call ECHO,$(cmd))))
|
||||
|
||||
LOCAL_FLAGS += -MD -MP
|
||||
-include $(LOCAL_OBJS:%.o=%.d)
|
||||
|
||||
$(LOCAL_COBJS): $(OBJOUT)/%.o: %.c
|
||||
$(HIDE)$(OBJ_MKDIR)
|
||||
$(HIDE)$(CC) $(CFLAGS) $(LOCAL_FLAGS) $(LOCAL_CFLAGS) -c $< -o $@
|
||||
|
||||
$(LOCAL_CPPOBJS): $(OBJOUT)/%.o: %.cpp
|
||||
$(HIDE)$(OBJ_MKDIR)
|
||||
$(HIDE)$(GPP) $(CXXFLAGS) $(LOCAL_FLAGS) $(LOCAL_CPPFLAGS) -c $< -o $@
|
||||
|
||||
$(LOCAL_ASMOBJS): $(OBJOUT)/%.o: %.S
|
||||
$(HIDE)$(OBJ_MKDIR)
|
||||
$(HIDE)$(CC) $(CFLAGS) $(LOCAL_FLAGS) $(LOCAL_ASFLAGS) -c $< -o $@
|
||||
|
||||
$(LOCAL_ASMOBJS2): $(OBJOUT)/%.o: %.s
|
||||
$(HIDE)$(OBJ_MKDIR)
|
||||
$(HIDE)$(AS) $(ASFLAGS) $(LOCAL_FLAGS) $(LOCAL_ASFLAGS) -c $< -o $@
|
||||
|
||||
$(LOCAL_CCOBJS): $(OBJOUT)/%.o: %.cc
|
||||
$(HIDE)$(OBJ_MKDIR)
|
||||
$(HIDE)$(GPP) $(CXXFLAGS) $(LOCAL_FLAGS) $(LOCAL_CPPFLAGS) -c $< -o $@
|
||||
|
||||
$(LOCAL_CGCH): %.h.gch : %.h
|
||||
$(HIDE)$(CC) $(CFLAGS) $(LOCAL_FLAGS) $(LOCAL_CFLAGS) $> $^
|
||||
|
||||
$(LOCAL_CPPGCH): %.h.gch : %.h
|
||||
$(HIDE)$(GPP) $(CXXFLAGS) $(LOCAL_FLAGS) $(LOCAL_CPPFLAGS) -x c++-header $> $^
|
||||
|
||||
LOCAL_GCH := $(LOCAL_CGCH) $(LOCAL_CPPGCH)
|
||||
|
||||
$(LOCAL_OBJS): $(LOCAL_GCH)
|
||||
$(APP): $(LOCAL_OBJS)
|
||||
$(HIDE)$(OBJ_MKDIR)
|
||||
$(HIDE)$(GPP) $(LDFLAGS) -o $@ $^
|
||||
|
||||
clean:
|
||||
$(HIDE)$(RM) $(APP) $(OBJOUT) $(LOCAL_GCH) *.bak *~
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
# clear some variables we set here
|
||||
LOCAL_CSRCS :=
|
||||
LOCAL_CPPSRCS :=
|
||||
LOCAL_ASMSRCS :=
|
||||
LOCAL_COBJS :=
|
||||
LOCAL_CPPOBJS :=
|
||||
LOCAL_ASMOBJS :=
|
||||
LOCAL_ASMOBJS2 :=
|
||||
|
||||
# LOCAL_OBJS is passed back
|
||||
#LOCAL_OBJS :=
|
||||
66
apps/config.mk
Executable file → Normal file
66
apps/config.mk
Executable file → Normal file
@@ -27,34 +27,54 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# common dir config
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
# output dir config
|
||||
OBJOUT := $(APPSTOPDIR)/out
|
||||
APPSOUT := $(OBJOUT)/apps
|
||||
LIBSOUT := $(OBJOUT)/libs
|
||||
IMGOUT := $(OUT)
|
||||
|
||||
# common flags config
|
||||
BASE_OPTS := -ffunction-sections -fdata-sections -fno-omit-frame-pointer -D_GNU_SOURCE \
|
||||
$(LITEOS_SSP) $(LITEOS_CORE_COPTS) $(WARNING_AS_ERROR) $(LLVM_EXTRA_OPTS) $(LITEOS_GCOV_OPTS)
|
||||
BASE_OPTS := -D_FORTIFY_SOURCE=2 -D_XOPEN_SOURCE=700 $(LITEOS_GCOV_OPTS)
|
||||
|
||||
CFLAGS := -std=c99 -fno-exceptions $(BASE_OPTS) $(LITEOS_COPTS_OPTMIZE)
|
||||
CXXFLAGS := -std=c++11 -fexceptions -fpermissive -frtti $(BASE_OPTS) $(LITEOS_COPTS_OPTMIZE)
|
||||
LDCFLAGS := -lc
|
||||
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
|
||||
LLVM_SYSROOT := --sysroot=$(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/
|
||||
LDCXXFLGS := -lc++ -lc++abi -lc
|
||||
else
|
||||
BASE_OPTS += -Wl,-z,relro,-z,now
|
||||
LDCXXFLGS := -lstdc++ -lsupc++ -lc
|
||||
endif
|
||||
COMMON_INCLUDE := -I $(LITEOSTHIRDPARTY)/bounds_checking_function/include
|
||||
ASFLAGS :=
|
||||
CFLAGS := $(LITEOS_COPTS) $(BASE_OPTS) -fPIE
|
||||
CXXFLAGS := $(LITEOS_CXXOPTS) $(BASE_OPTS) -fPIE
|
||||
LDFLAGS := $(LITEOS_CORE_COPTS) -pie -Wl,-z,relro,-z,now -O2
|
||||
|
||||
CFLAGS := $(filter-out -fno-pic -fno-builtin -nostdinc -nostdlib,$(CFLAGS))
|
||||
CXXFLAGS := $(filter-out -fno-pic -fno-builtin -nostdinc -nostdlib -nostdinc++,$(CXXFLAGS))
|
||||
|
||||
# alias variable config
|
||||
HIDE := @
|
||||
MAKE := make
|
||||
RM := -rm -rf
|
||||
CP := -cp -rf
|
||||
MV := -mv
|
||||
RM := rm -rf
|
||||
CP := cp -rf
|
||||
MV := mv -f
|
||||
|
||||
APP := $(APPSTOPDIR)/app.mk
|
||||
|
||||
##build modules config##
|
||||
APP_SUBDIRS :=
|
||||
|
||||
ifeq ($(LOSCFG_SHELL), y)
|
||||
APP_SUBDIRS += shell
|
||||
APP_SUBDIRS += mksh
|
||||
APP_SUBDIRS += toybox
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_USER_INIT_DEBUG), y)
|
||||
APP_SUBDIRS += init
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_NET_LWIP_SACK_TFTP), y)
|
||||
APP_SUBDIRS += tftp
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_DRIVERS_TRACE), y)
|
||||
APP_SUBDIRS += trace
|
||||
endif
|
||||
|
||||
# clear all local variables
|
||||
LOCAL_FLAGS :=
|
||||
LOCAL_CFLAGS :=
|
||||
LOCAL_CPPFLAGS :=
|
||||
LOCAL_ASFLAGS :=
|
||||
LOCAL_SRCS :=
|
||||
LOCAL_CHS :=
|
||||
LOCAL_CPPHS :=
|
||||
|
||||
20
tools/scripts/make_rootfs/rootfs.sh → apps/init/BUILD.gn
Executable file → Normal file
20
tools/scripts/make_rootfs/rootfs.sh → apps/init/BUILD.gn
Executable file → Normal file
@@ -1,5 +1,3 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
@@ -28,12 +26,14 @@
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
set -e
|
||||
|
||||
BIN_DIR=$1
|
||||
LIB_DIR=$2
|
||||
ROOTFS_DIR=$3
|
||||
FSTYPE=$4
|
||||
CUR_DIR=$(dirname $(readlink -f "$0"))
|
||||
. ${CUR_DIR}/rootfsdir.sh ${BIN_DIR} ${LIB_DIR} ${ROOTFS_DIR}
|
||||
. ${CUR_DIR}/rootfsimg.sh ${ROOTFS_DIR} ${FSTYPE}
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
executable("init") {
|
||||
sources = [ "src/init.c" ]
|
||||
|
||||
if (defined(LOSCFG_QUICK_START)) {
|
||||
ldflags = [ "--static" ]
|
||||
defines = [ "LOSCFG_QUICK_START" ]
|
||||
}
|
||||
}
|
||||
36
apps/init/Makefile
Executable file → Normal file
36
apps/init/Makefile
Executable file → Normal file
@@ -27,43 +27,15 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
INIT_DIR := $(dir $(shell pwd))/init/
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
ifeq ($(APPSTOPDIR), )
|
||||
APPSTOPDIR := $(shell pwd)/../
|
||||
LITEOSTOPDIR = $(APPSTOPDIR)/../
|
||||
endif
|
||||
include $(INIT_DIR)/../config.mk
|
||||
APP_NAME := $(notdir $(shell pwd))
|
||||
|
||||
APPS_OUT := $(OUT)/bin
|
||||
LOCAL_SRCS := src/init.c
|
||||
LOCAL_OBJ := src/init.o
|
||||
|
||||
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
|
||||
LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses -Wnonnull $(LLVM_SYSROOT)
|
||||
LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT)
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_QUICK_START), y)
|
||||
LDCFLAGS += --static
|
||||
LDFLAGS += --static
|
||||
CFLAGS += -DLOSCFG_QUICK_START
|
||||
endif
|
||||
|
||||
INITNAME := init
|
||||
|
||||
all: $(INITNAME)
|
||||
|
||||
$(LOCAL_OBJ): %.o : %.c
|
||||
$(HIDE) $(CC) $(CFLAGS) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@
|
||||
|
||||
$(INITNAME):$(LOCAL_OBJ)
|
||||
$(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(INITNAME) $^ $(LDCFLAGS)
|
||||
$(HIDE) mkdir -p $(APPS_OUT)
|
||||
$(HIDE) $(MV) $(INITNAME) $(APPS_OUT)
|
||||
$(HIDE) $(RM) $(LOCAL_OBJ)
|
||||
|
||||
clean:
|
||||
$(HIDE) $(RM) $(LOCAL_OBJ)
|
||||
$(HIDE) $(RM) $(INITNAME)
|
||||
|
||||
.PHONY: all $(INITNAME) clean
|
||||
include $(APP)
|
||||
|
||||
13
apps/init/src/init.c
Executable file → Normal file
13
apps/init/src/init.c
Executable file → Normal file
@@ -49,7 +49,8 @@
|
||||
int main(int argc, char * const *argv)
|
||||
{
|
||||
int ret;
|
||||
const char *shellPath = "/bin/shell";
|
||||
pid_t gid;
|
||||
const char *shellPath = "/bin/mksh";
|
||||
|
||||
#ifdef LOSCFG_QUICK_START
|
||||
const char *samplePath = "/dev/shm/sample_quickstart";
|
||||
@@ -74,6 +75,16 @@ int main(int argc, char * const *argv)
|
||||
if (ret < 0) {
|
||||
printf("Failed to fork for shell\n");
|
||||
} else if (ret == 0) {
|
||||
gid = getpgrp();
|
||||
if (gid < 0) {
|
||||
printf("get group id failed, pgrpid %d, errno %d\n", gid, errno);
|
||||
exit(0);
|
||||
}
|
||||
ret = tcsetpgrp(STDIN_FILENO, gid);
|
||||
if (ret != 0) {
|
||||
printf("tcsetpgrp failed, errno %d\n", errno);
|
||||
exit(0);
|
||||
}
|
||||
(void)execve(shellPath, NULL, NULL);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
99
apps/mksh/BUILD.gn
Normal file
99
apps/mksh/BUILD.gn
Normal file
@@ -0,0 +1,99 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
group("mksh") {
|
||||
deps = [ ":build_mksh" ]
|
||||
}
|
||||
|
||||
copy("copy_mksh_src") {
|
||||
sources = [ "$LITEOSTHIRDPARTY/mksh" ]
|
||||
outputs = [ "$target_out_dir/mksh_build" ]
|
||||
}
|
||||
|
||||
build_ext_component("build_mksh") {
|
||||
deps = [ ":copy_mksh_src" ]
|
||||
deps += [ "//prebuilts/lite/sysroot" ]
|
||||
exec_path = rebase_path("$target_out_dir/mksh_build")
|
||||
|
||||
cflags = [
|
||||
"-flto",
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections",
|
||||
"-fstack-protector-strong",
|
||||
"-D_FORTIFY_SOURCE=2",
|
||||
"-DMKSH_DISABLE_TTY_WARNING",
|
||||
"-DMKSH_SMALL=1",
|
||||
"-DMKSH_ASSUME_UTF8=1",
|
||||
"-DMKSH_SMALL_BUT_FAST=0",
|
||||
"-DMKSH_S_NOVI=1",
|
||||
"-DHAVE_CAN_FSTACKPROTECTORSTRONG=1",
|
||||
"-DMKSH_LESS_CMDLINE_EDITING",
|
||||
"-DMKSH_LESS_BUILDINS",
|
||||
"-DMKSH_NO_INITCOMS",
|
||||
"-DADAPT_FOR_LITEOS_A",
|
||||
]
|
||||
if (defined(LOSCFG_COMPILER_CLANG_LLVM)) {
|
||||
cflags += [ "-Oz" ]
|
||||
} else {
|
||||
cflags += [ "-O2" ]
|
||||
}
|
||||
cflags = string_join(" ", cflags)
|
||||
|
||||
extra_flags = string_join(" ", target_arch_cflags)
|
||||
if (ohos_build_compiler == "clang") {
|
||||
extra_flags += " --target=$target_triple"
|
||||
extra_flags += " --sysroot=" + rebase_path(ohos_current_sysroot)
|
||||
}
|
||||
|
||||
command = "rm -rf .git && env"
|
||||
command += " CC=\"$ohos_current_cc_command\""
|
||||
command += " TARGET_OS=OpenHarmony"
|
||||
command += " CFLAGS=\"$cflags $extra_flags\""
|
||||
command += " LDFLAGS=\"-Wl,--gc-sections -flto -O2\""
|
||||
command += " sh ./Build.sh -r"
|
||||
|
||||
# copy mksh and .mkshrc to out dir
|
||||
command += " && mkdir -p "
|
||||
command += rebase_path("$root_out_dir/bin", exec_path)
|
||||
command += " && install -D mksh "
|
||||
command += rebase_path("$root_out_dir/unstripped/bin/mksh", exec_path)
|
||||
command += " && $ohos_current_strip_command mksh -o "
|
||||
command += rebase_path("$root_out_dir/bin/mksh", exec_path)
|
||||
command += " && install -D .mkshrc "
|
||||
command += rebase_path("$root_out_dir/etc/.mkshrc", exec_path)
|
||||
|
||||
outputs = [
|
||||
"$root_out_dir/unstripped/bin/mksh",
|
||||
"$root_out_dir/bin/mksh",
|
||||
"$root_out_dir/etc/.mkshrc",
|
||||
]
|
||||
}
|
||||
56
apps/mksh/Makefile
Executable file
56
apps/mksh/Makefile
Executable file
@@ -0,0 +1,56 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
BUILD_DIR := $(OUT)/mksh_build
|
||||
BUILD_LOG := $(BUILD_DIR)/build.log
|
||||
|
||||
CFLAGS += -DMKSH_DISABLE_TTY_WARNING -DMKSH_SMALL=1 -DMKSH_ASSUME_UTF8=1 -DMKSH_SMALL_BUT_FAST=0 -DMKSH_S_NOVI=1 -DHAVE_CAN_FSTACKPROTECTORSTRONG=1
|
||||
CFLAGS += -DMKSH_LESS_CMDLINE_EDITING -DMKSH_LESS_BUILDINS -DMKSH_NO_INITCOMS -DADAPT_FOR_LITEOS_A
|
||||
CFLAGS += -Wno-error
|
||||
LDFLAGS += -Wl,--gc-sections
|
||||
|
||||
all:
|
||||
ifneq ($(wildcard $(BUILD_DIR)/Rebuild.sh),)
|
||||
$(HIDE)echo "not clean, rebuilding now"
|
||||
$(HIDE)cd $(BUILD_DIR) && sh ./Rebuild.sh > $(BUILD_LOG) 2>&1
|
||||
else
|
||||
$(HIDE)mkdir -p $(BUILD_DIR)
|
||||
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/mksh/. $(BUILD_DIR)
|
||||
$(HIDE)cd $(BUILD_DIR) && CC="$(CC)" TARGET_OS=OpenHarmony CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" sh ./Build.sh -r > $(BUILD_LOG) 2>&1
|
||||
endif
|
||||
$(HIDE)mkdir -p $(OUT)/bin/ $(OUT)/etc/
|
||||
$(HIDE)$(STRIP) $(BUILD_DIR)/mksh -o $(OUT)/bin/mksh
|
||||
$(HIDE)$(CP) $(BUILD_DIR)/.mkshrc $(OUT)/etc/
|
||||
|
||||
clean:
|
||||
$(HIDE)$(RM) $(BUILD_DIR)
|
||||
|
||||
.PHONY: all clean
|
||||
44
apps/shell/BUILD.gn
Normal file
44
apps/shell/BUILD.gn
Normal file
@@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
executable("shell") {
|
||||
sources = [
|
||||
"builtin/cd.c",
|
||||
"src/main.c",
|
||||
"src/shcmd.c",
|
||||
"src/shcmdparse.c",
|
||||
"src/shmsg.c",
|
||||
]
|
||||
|
||||
deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ]
|
||||
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
51
apps/shell/Makefile
Executable file → Normal file
51
apps/shell/Makefile
Executable file → Normal file
@@ -27,52 +27,19 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
SHELL_DIR := $(dir $(shell pwd))/shell/
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
ifeq ($(APPSTOPDIR), )
|
||||
APPSTOPDIR := $(shell pwd)/../
|
||||
LITEOSTOPDIR = $(APPSTOPDIR)/../
|
||||
endif
|
||||
include $(SHELL_DIR)/../config.mk
|
||||
APPS_OUT := $(OUT)/bin
|
||||
APP_NAME := $(notdir $(shell pwd))
|
||||
|
||||
SECUREC_INCLUDE := $(LITEOSTHIRDPARTY)/bounds_checking_function/include
|
||||
SECUREC_DIR := $(LITEOSTHIRDPARTY)/bounds_checking_function
|
||||
|
||||
LOCAL_SRCS = $(wildcard src/main.c)\
|
||||
$(wildcard src/shcmd.c)\
|
||||
$(wildcard src/shmsg.c)\
|
||||
$(wildcard src/shcmdparse.c)\
|
||||
$(wildcard builtin/cd.c)
|
||||
LOCAL_SRCS += $(wildcard $(LITEOSTHIRDPARTY)/bounds_checking_function/src/*.c)
|
||||
LOCAL_OBJ := $(LOCAL_SRCS:.c=.o)
|
||||
LOCAL_SRCS = $(wildcard src/*.c builtin/*.c)
|
||||
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/*.c)
|
||||
|
||||
LOCAL_INCLUDE := \
|
||||
-I $(SHELL_DIR)/include/ \
|
||||
-I $(SECUREC_INCLUDE)\
|
||||
-I include \
|
||||
-I $(SECUREC_DIR)/include
|
||||
|
||||
LOCAL_FLAGS += $(CFLAGS)
|
||||
LOCAL_FLAGS += $(LOCAL_INCLUDE)
|
||||
|
||||
LDPATH := -L$(SHELL_DIR)/
|
||||
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
|
||||
LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses $(LLVM_SYSROOT)
|
||||
LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT)
|
||||
endif
|
||||
|
||||
SHELLNAME := shell
|
||||
|
||||
all: $(SHELLNAME)
|
||||
|
||||
$(LOCAL_OBJ): %.o : %.c
|
||||
$(HIDE) $(CC) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@
|
||||
|
||||
$(SHELLNAME): $(LOCAL_OBJ)
|
||||
$(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(SHELLNAME) $^ $(LDCFLAGS)
|
||||
$(HIDE) mkdir -p $(APPS_OUT)
|
||||
$(HIDE) $(MV) $(SHELLNAME) $(APPS_OUT)
|
||||
$(HIDE) $(RM) $(LOCAL_OBJ)
|
||||
|
||||
clean:
|
||||
$(HIDE) $(RM) $(LOCAL_OBJ)
|
||||
$(HIDE) $(RM) $(SHELLNAME)
|
||||
|
||||
.PHONY: all $(SHELLNAME) clean
|
||||
include $(APP)
|
||||
|
||||
17
apps/shell/builtin/cd.c
Executable file → Normal file
17
apps/shell/builtin/cd.c
Executable file → Normal file
@@ -29,19 +29,12 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _GNU_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
#include "unistd.h"
|
||||
#include "shcmd.h"
|
||||
#include "sherr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
int Chdir(const char *tgtDir)
|
||||
{
|
||||
@@ -53,17 +46,9 @@ int Chdir(const char *tgtDir)
|
||||
|
||||
ret = chdir(tgtDir);
|
||||
if (ret == 0) {
|
||||
ret = OsShellSetWorkingDirtectory(tgtDir, strlen(tgtDir) + 1); /* 1: the length of '\0' */
|
||||
if (ret != SH_NOK) {
|
||||
return ret;
|
||||
}
|
||||
ret = OsShellSetWorkingDirtectory(tgtDir, strlen(tgtDir) + 1); /* 1: the length of '\0' */
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
0
apps/shell/include/shcmd.h
Executable file → Normal file
0
apps/shell/include/shcmd.h
Executable file → Normal file
0
apps/shell/include/shell.h
Executable file → Normal file
0
apps/shell/include/shell.h
Executable file → Normal file
@@ -350,35 +350,14 @@ static inline void SH_ListHeadInsertList(SH_List *oldList, SH_List *newList)
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param type [IN] Structure name.
|
||||
* @param field [IN] Name of the field of which the offset is to be measured.
|
||||
* @param type [IN] Structure name.
|
||||
* @param member [IN] Name of the member of which the offset is to be measured.
|
||||
*
|
||||
* @retval Offset of the field to the structure address.
|
||||
* @par Dependency:
|
||||
* <ul><li>shell_list.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
*/
|
||||
#define OFFSET_OF_FIELD(type, field) ((uintptr_t)&((type *)0)->field)
|
||||
|
||||
/**
|
||||
* @ingroup shell_list
|
||||
* @brief Obtain the pointer to a doubly linked list in a structure.
|
||||
*
|
||||
* @par Description:
|
||||
* This API is used to obtain the pointer to a doubly linked list in a structure.
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>None.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param type [IN] Structure name.
|
||||
* @param member [IN] Member name of the doubly linked list in the structure.
|
||||
*
|
||||
* @retval Pointer to the doubly linked list in the structure.
|
||||
* @par Dependency:
|
||||
* <ul><li>shell_list.h: the header file that contains the API declaration.</li></ul>
|
||||
* @see
|
||||
*/
|
||||
#define LOS_OFF_SET_OF(type, member) ((uintptr_t)&((type *)0)->member)
|
||||
|
||||
/**
|
||||
|
||||
10
apps/shell/include/shmsg.h
Executable file → Normal file
10
apps/shell/include/shmsg.h
Executable file → Normal file
@@ -43,8 +43,13 @@ extern "C" {
|
||||
#define SHELL_ENTRY_STACKSIZE 0x1000
|
||||
#define SHELL_TASK_STACKSIZE 0x3000
|
||||
|
||||
#define SHELL_EXEC_COMMAND "exec "
|
||||
#define SHELL_EXEC_COMMAND_BYTES 5
|
||||
#define SHELL_EXEC_COMMAND "exec"
|
||||
#define SHELL_EXEC_COMMAND_BYTES 4
|
||||
#define CMD_EXEC_COMMAND SHELL_EXEC_COMMAND" "
|
||||
#define CMD_EXEC_COMMAND_BYTES (SHELL_EXEC_COMMAND_BYTES+1)
|
||||
#define CMD_EXIT_COMMAND "exit"
|
||||
#define CMD_EXIT_COMMAND_BYTES 4
|
||||
#define CMD_EXIT_CODE_BASE_DEC 10
|
||||
|
||||
#define CONSOLE_IOC_MAGIC 'c'
|
||||
#define CONSOLE_CONTROL_REG_USERTASK _IO(CONSOLE_IOC_MAGIC, 7)
|
||||
@@ -57,6 +62,7 @@ extern "C" {
|
||||
typedef void (*OutputFunc)(const char *fmt, ...);
|
||||
extern int ShellTaskInit(ShellCB *shellCB);
|
||||
extern int ShellEntryInit(ShellCB *shellCB);
|
||||
extern void ChildExec(const char *cmdName, char *const paramArray[]);
|
||||
extern void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB);
|
||||
extern int ShellNotify(ShellCB *shellCB);
|
||||
|
||||
|
||||
6
apps/shell/include/show.h
Executable file → Normal file
6
apps/shell/include/show.h
Executable file → Normal file
@@ -42,10 +42,10 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern char *OsShellGetWorkingDirtectory();
|
||||
extern unsigned int OsShellInit();
|
||||
extern char *OsShellGetWorkingDirtectory(void);
|
||||
extern unsigned int OsShellInit(void);
|
||||
extern int OsShellDeinit(ShellCB *shellCB);
|
||||
extern ShellCB *OsGetShellCb();
|
||||
extern ShellCB *OsGetShellCb(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
52
apps/shell/src/main.c
Executable file → Normal file
52
apps/shell/src/main.c
Executable file → Normal file
@@ -29,18 +29,15 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "show.h"
|
||||
#include "shmsg.h"
|
||||
#include "shcmd.h"
|
||||
#include "semaphore.h"
|
||||
#include "securec.h"
|
||||
#include "unistd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#include <sys/syscall.h>
|
||||
|
||||
ShellCB *g_shellCB = NULL;
|
||||
|
||||
@@ -93,11 +90,47 @@ OUT:
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main()
|
||||
static int DoShellExec(char **argv)
|
||||
{
|
||||
int i, j;
|
||||
int len = 0;
|
||||
int ret = SH_NOK;
|
||||
char *cmdLine = NULL;
|
||||
|
||||
if (strncmp(argv[0], SHELL_EXEC_COMMAND, SHELL_EXEC_COMMAND_BYTES) == 0) {
|
||||
ChildExec(argv[1], argv + 1);
|
||||
}
|
||||
for (i = 0; argv[i]; i++) {
|
||||
len += strlen(argv[i]);
|
||||
}
|
||||
len += i + 1;
|
||||
cmdLine = (char *)malloc(len);
|
||||
if (!cmdLine) {
|
||||
return ret;
|
||||
}
|
||||
memset_s(cmdLine, len, 0, len);
|
||||
|
||||
for(j = 0; j < i; j++) {
|
||||
strcat_s(cmdLine, len, argv[j]);
|
||||
strcat_s(cmdLine, len, " ");
|
||||
}
|
||||
|
||||
cmdLine[len - 2] = '\0';
|
||||
ret = syscall(__NR_shellexec, argv[0], cmdLine);
|
||||
free(cmdLine);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int ret = SH_NOK;
|
||||
ShellCB *shellCB = NULL;
|
||||
|
||||
if (argc > 1) {
|
||||
ret = DoShellExec(argv + 1);
|
||||
return ret;
|
||||
}
|
||||
|
||||
setbuf(stdout, NULL);
|
||||
|
||||
shellCB = (ShellCB *)malloc(sizeof(ShellCB));
|
||||
@@ -139,8 +172,3 @@ ERR_OUT1:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
21
apps/shell/src/shcmd.c
Executable file → Normal file
21
apps/shell/src/shcmd.c
Executable file → Normal file
@@ -36,11 +36,6 @@
|
||||
#include "dirent.h"
|
||||
#include "securec.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define SHELL_INIT_MAGIC_FLAG 0xABABABAB
|
||||
#define CTRL_C 0x03 /* 0x03: ctrl+c ASCII */
|
||||
@@ -85,7 +80,7 @@ static int OsStrSeparateTabStrGet(const char **tabStr, CmdParsed *parsed, unsign
|
||||
if ((strlen(shiftStr) == 0) || (tempStr[strlen(tempStr) - 1] != shiftStr[strlen(shiftStr) - 1])) {
|
||||
*tabStr = "";
|
||||
} else {
|
||||
if (OsCmdTokenSplit(shiftStr, ' ', parsed)) {
|
||||
if (OsCmdParse(shiftStr, parsed)) {
|
||||
free(tempStr);
|
||||
return (int)SH_ERROR;
|
||||
}
|
||||
@@ -201,7 +196,7 @@ static int OsSurePrintAll(unsigned int count)
|
||||
char readChar = 0;
|
||||
printf("\nDisplay all %u possibilities?(y/n)", count);
|
||||
while (1) {
|
||||
if (read(0, &readChar, 1) != 1) {
|
||||
if (read(STDIN_FILENO, &readChar, 1) != 1) {
|
||||
return (int)SH_ERROR;
|
||||
}
|
||||
if ((readChar == 'n') || (readChar == 'N') || (readChar == CTRL_C)) {
|
||||
@@ -453,20 +448,15 @@ unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size)
|
||||
free(outputBak);
|
||||
return SH_OK;
|
||||
}
|
||||
|
||||
int OsTabCompletion(char *cmdKey, unsigned int *len)
|
||||
{
|
||||
int count;
|
||||
char *cmdMainStr = cmdKey;
|
||||
|
||||
if ((cmdKey == NULL) || (len == NULL)) {
|
||||
return (int)SH_ERROR;
|
||||
}
|
||||
|
||||
/* cut left space */
|
||||
while (*cmdMainStr == 0x20) {
|
||||
cmdMainStr++;
|
||||
}
|
||||
|
||||
count = OsTabMatchFile(cmdKey, len);
|
||||
|
||||
return count;
|
||||
@@ -604,8 +594,3 @@ unsigned int OsCmdExec(CmdParsed *cmdParsed, char *cmdStr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
10
apps/shell/src/shcmdparse.c
Executable file → Normal file
10
apps/shell/src/shcmdparse.c
Executable file → Normal file
@@ -32,11 +32,6 @@
|
||||
#include "shcmd.h"
|
||||
#include "sherr.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Filter out double quote or single-quoted strings at both ends
|
||||
@@ -157,8 +152,3 @@ unsigned int OsCmdParse(char *cmdStr, CmdParsed *cmdParsed)
|
||||
return OsCmdTokenSplit(cmdStr, ' ', cmdParsed);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
121
apps/shell/src/shmsg.c
Executable file → Normal file
121
apps/shell/src/shmsg.c
Executable file → Normal file
@@ -29,6 +29,8 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "stdio.h"
|
||||
#include "unistd.h"
|
||||
@@ -42,12 +44,10 @@
|
||||
#include "shell_pri.h"
|
||||
#include "shcmd.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#define CHAR_CTRL_C '\x03'
|
||||
#define CHAR_CTRL_DEL '\x7F'
|
||||
|
||||
#define VISIABLE_CHAR(ch) ((ch) > 0x1F && (ch) < 0x7F)
|
||||
|
||||
char *GetCmdline(ShellCB *shellCB)
|
||||
{
|
||||
@@ -205,7 +205,21 @@ void ParseEnterKey(OutputFunc outputFunc, ShellCB *shellCB)
|
||||
shellCB->shellBuf[shellCB->shellBufOffset] = '\0';
|
||||
}
|
||||
NOTIFY:
|
||||
outputFunc("\n");
|
||||
shellCB->shellBufOffset = 0;
|
||||
ShellTaskNotify(shellCB);
|
||||
}
|
||||
|
||||
void ParseCancelKey(OutputFunc outputFunc, ShellCB *shellCB)
|
||||
{
|
||||
if ((shellCB == NULL) || (outputFunc == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (shellCB->shellBufOffset <= (SHOW_MAX_LEN - 1)) {
|
||||
shellCB->shellBuf[0] = CHAR_CTRL_C;
|
||||
shellCB->shellBuf[1] = '\0';
|
||||
}
|
||||
|
||||
shellCB->shellBufOffset = 0;
|
||||
ShellTaskNotify(shellCB);
|
||||
}
|
||||
@@ -241,7 +255,7 @@ void ParseTabKey(OutputFunc outputFunc, ShellCB *shellCB)
|
||||
|
||||
void ParseNormalChar(char ch, OutputFunc outputFunc, ShellCB *shellCB)
|
||||
{
|
||||
if ((shellCB == NULL) || (outputFunc == NULL)) {
|
||||
if ((shellCB == NULL) || (outputFunc == NULL) || !VISIABLE_CHAR(ch)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -259,7 +273,7 @@ void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB)
|
||||
const char ch = c;
|
||||
int ret;
|
||||
|
||||
if ((shellCB->shellBufOffset == 0) && (ch != '\n') && (ch != '\0')) {
|
||||
if ((shellCB->shellBufOffset == 0) && (ch != '\n') && (ch != CHAR_CTRL_C) && (ch != '\0')) {
|
||||
(void)memset_s(shellCB->shellBuf, SHOW_MAX_LEN, 0, SHOW_MAX_LEN);
|
||||
}
|
||||
|
||||
@@ -268,8 +282,11 @@ void ShellCmdLineParse(char c, OutputFunc outputFunc, ShellCB *shellCB)
|
||||
case '\n': /* enter */
|
||||
ParseEnterKey(outputFunc, shellCB);
|
||||
break;
|
||||
case CHAR_CTRL_C: /* ctrl + c */
|
||||
ParseCancelKey(outputFunc, shellCB);
|
||||
break;
|
||||
case '\b': /* backspace */
|
||||
case 0x7F: /* delete(0x7F) */
|
||||
case CHAR_CTRL_DEL: /* delete(0x7F) */
|
||||
ParseDeleteKey(outputFunc, shellCB);
|
||||
break;
|
||||
case '\t': /* tab */
|
||||
@@ -334,29 +351,80 @@ char *GetCmdName(const char *cmdline, unsigned int len)
|
||||
return cmdName;
|
||||
}
|
||||
|
||||
void ChildExec(const char *cmdName, char *const paramArray[])
|
||||
{
|
||||
int ret;
|
||||
pid_t gid;
|
||||
|
||||
ret = setpgrp();
|
||||
if (ret == -1) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
gid = getpgrp();
|
||||
if (gid < 0) {
|
||||
printf("get group id failed, pgrpid %d, errno %d\n", gid, errno);
|
||||
}
|
||||
|
||||
ret = tcsetpgrp(STDIN_FILENO, gid);
|
||||
if (ret != 0) {
|
||||
printf("tcsetpgrp failed, errno %d\n", errno);
|
||||
}
|
||||
|
||||
ret = execve(cmdName, paramArray, NULL);
|
||||
if (ret == -1) {
|
||||
perror("execve");
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
int CheckExit(const char *cmdName, const CmdParsed *cmdParsed)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if (strlen(cmdName) != CMD_EXIT_COMMAND_BYTES || strncmp(cmdName, CMD_EXIT_COMMAND, CMD_EXIT_COMMAND_BYTES) != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cmdParsed->paramCnt > 1) {
|
||||
printf("exit: too many arguments\n");
|
||||
return -1;
|
||||
}
|
||||
if (cmdParsed->paramCnt == 1) {
|
||||
char *p;
|
||||
ret = strtol(cmdParsed->paramArray[0], &p, CMD_EXIT_CODE_BASE_DEC);
|
||||
if (*p != '\0') {
|
||||
printf("exit: bad number: %s\n", cmdParsed->paramArray[0]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
static void DoCmdExec(const char *cmdName, const char *cmdline, unsigned int len, const CmdParsed *cmdParsed)
|
||||
{
|
||||
int ret;
|
||||
pid_t forkPid;
|
||||
|
||||
if (strncmp(cmdline, SHELL_EXEC_COMMAND, SHELL_EXEC_COMMAND_BYTES) == 0) {
|
||||
if (strncmp(cmdline, CMD_EXEC_COMMAND, CMD_EXEC_COMMAND_BYTES) == 0) {
|
||||
forkPid = fork();
|
||||
if (forkPid < 0) {
|
||||
printf("Faild to fork from shell\n");
|
||||
return;
|
||||
} else if (forkPid == 0) {
|
||||
ret = setpgrp();
|
||||
if (ret == -1) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
ret = execve((const char *)cmdParsed->paramArray[0], (char * const *)cmdParsed->paramArray, NULL);
|
||||
if (ret == -1) {
|
||||
perror("execve");
|
||||
exit(-1);
|
||||
ChildExec(cmdParsed->paramArray[0], cmdParsed->paramArray);
|
||||
} else {
|
||||
waitpid(forkPid, 0, 0);
|
||||
ret = tcsetpgrp(STDIN_FILENO, getpid());
|
||||
if (ret != 0) {
|
||||
printf("tcsetpgrp failed, errno %d\n", errno);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (CheckExit(cmdName, cmdParsed) < 0) {
|
||||
return;
|
||||
}
|
||||
(void)syscall(__NR_shellexec, cmdName, cmdline);
|
||||
}
|
||||
}
|
||||
@@ -411,7 +479,7 @@ unsigned int PreHandleCmdline(const char *input, char **output, unsigned int *ou
|
||||
unsigned int removeLen = strlen("./"); /* "./" needs to be removed if it exists */
|
||||
unsigned int ret;
|
||||
char *newCmd = NULL;
|
||||
char *execCmd = SHELL_EXEC_COMMAND;
|
||||
char *execCmd = CMD_EXEC_COMMAND;
|
||||
const char *cmdBuf = input;
|
||||
unsigned int cmdBufLen = strlen(cmdBuf);
|
||||
char *shiftStr = (char *)malloc(cmdBufLen + 1);
|
||||
@@ -514,7 +582,11 @@ static void ShellCmdProcess(ShellCB *shellCB)
|
||||
if (buf == NULL) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (buf[0] == CHAR_CTRL_C) {
|
||||
printf("^C");
|
||||
buf[0] = '\n';
|
||||
}
|
||||
printf("\n");
|
||||
ExecCmdline(buf);
|
||||
ShellSaveHistoryCmd(buf, shellCB);
|
||||
shellCB->cmdMaskKeyLink = shellCB->cmdHistoryKeyLink;
|
||||
@@ -577,7 +649,7 @@ int ShellTaskInit(ShellCB *shellCB)
|
||||
|
||||
static int ShellKernelReg(unsigned int shellHandle)
|
||||
{
|
||||
return ioctl(0, CONSOLE_CONTROL_REG_USERTASK, shellHandle);
|
||||
return ioctl(STDIN_FILENO, CONSOLE_CONTROL_REG_USERTASK, shellHandle);
|
||||
}
|
||||
|
||||
void *ShellEntry(void *argv)
|
||||
@@ -640,8 +712,3 @@ int ShellEntryInit(ShellCB *shellCB)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
21
apps/module.mk → apps/tftp/BUILD.gn
Executable file → Normal file
21
apps/module.mk → apps/tftp/BUILD.gn
Executable file → Normal file
@@ -27,18 +27,15 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
APP_SUBDIRS :=
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
##compile modules config##
|
||||
executable("tftp") {
|
||||
sources = [
|
||||
"src/main.c",
|
||||
"src/tftpc.c",
|
||||
]
|
||||
|
||||
ifeq ($(LOSCFG_SHELL), y)
|
||||
APP_SUBDIRS += shell
|
||||
endif
|
||||
deps = [ "$LITEOSTHIRDPARTY/bounds_checking_function:libsec_static" ]
|
||||
|
||||
ifeq ($(LOSCFG_USER_INIT_DEBUG), y)
|
||||
APP_SUBDIRS += init
|
||||
endif
|
||||
|
||||
ifeq ($(LOSCFG_NET_LWIP_SACK_TFTP), y)
|
||||
APP_SUBDIRS += tftp
|
||||
endif
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
@@ -27,51 +27,19 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
ROOT_DIR := $(dir $(shell pwd))/tftp/
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
ifeq ($(APPSTOPDIR), )
|
||||
APPSTOPDIR := $(shell pwd)/../
|
||||
LITEOSTOPDIR = $(APPSTOPDIR)/../
|
||||
endif
|
||||
include $(ROOT_DIR)/../config.mk
|
||||
APPS_OUT := $(OUT)/bin
|
||||
APP_NAME := $(notdir $(shell pwd))
|
||||
|
||||
SECUREC_DIR := $(LITEOSTHIRDPARTY)/bounds_checking_function
|
||||
|
||||
LOCAL_SRCS = $(wildcard src/*.c)
|
||||
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/strncpy_s.c)
|
||||
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/memcpy_s.c)
|
||||
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/memset_s.c)
|
||||
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/strncat_s.c)
|
||||
LOCAL_OBJ := $(LOCAL_SRCS:.c=.o)
|
||||
LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/*.c)
|
||||
|
||||
LOCAL_INCLUDE := \
|
||||
-I $(ROOT_DIR)/include/ \
|
||||
-I $(SECUREC_DIR)/include/\
|
||||
-I include \
|
||||
-I $(SECUREC_DIR)/include
|
||||
|
||||
LOCAL_FLAGS += $(CFLAGS)
|
||||
LOCAL_FLAGS += $(LOCAL_INCLUDE)
|
||||
|
||||
LDPATH := -L$(ROOT_DIR)/
|
||||
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
|
||||
LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses $(LLVM_SYSROOT)
|
||||
LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT)
|
||||
endif
|
||||
|
||||
TARGETNAME := tftp
|
||||
|
||||
all: $(TARGETNAME)
|
||||
|
||||
$(LOCAL_OBJ): %.o : %.c
|
||||
$(HIDE) $(CC) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@
|
||||
|
||||
$(TARGETNAME): $(LOCAL_OBJ)
|
||||
$(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(TARGETNAME) $^ $(LDCFLAGS)
|
||||
$(HIDE) mkdir -p $(APPS_OUT)
|
||||
$(HIDE) $(MV) $(TARGETNAME) $(APPS_OUT)
|
||||
$(HIDE) $(RM) $(LOCAL_OBJ)
|
||||
|
||||
clean:
|
||||
$(HIDE) $(RM) $(LOCAL_OBJ)
|
||||
$(HIDE) $(RM) $(TARGETNAME)
|
||||
|
||||
.PHONY: all $(TARGETNAME) clean
|
||||
include $(APP)
|
||||
|
||||
80
apps/toybox/BUILD.gn
Normal file
80
apps/toybox/BUILD.gn
Normal file
@@ -0,0 +1,80 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//build/lite/config/component/lite_component.gni")
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
group("toybox") {
|
||||
deps = [ ":build_toybox" ]
|
||||
}
|
||||
|
||||
copy("copy_toybox_src") {
|
||||
sources = [ "$LITEOSTHIRDPARTY/toybox" ]
|
||||
outputs = [ "$target_out_dir/toybox_build" ]
|
||||
}
|
||||
|
||||
copy("copy_toybox_config") {
|
||||
deps = [ ":copy_toybox_src" ]
|
||||
sources = [ "liteos_a_custom.config" ]
|
||||
outputs = [ "$target_out_dir/{{source_file_part}}" ]
|
||||
}
|
||||
|
||||
build_ext_component("build_toybox") {
|
||||
deps = [ ":copy_toybox_src", ":copy_toybox_config" ]
|
||||
deps += [ "//prebuilts/lite/sysroot" ]
|
||||
exec_path = rebase_path("$target_out_dir/toybox_build")
|
||||
|
||||
cflags = [
|
||||
"-fstack-protector-strong",
|
||||
"-D_FORTIFY_SOURCE=2",
|
||||
]
|
||||
cflags = string_join(" ", cflags)
|
||||
|
||||
extra_flags = string_join(" ", target_arch_cflags)
|
||||
if (ohos_build_compiler == "clang") {
|
||||
extra_flags += " --target=$target_triple"
|
||||
extra_flags += " --sysroot=" + rebase_path(ohos_current_sysroot)
|
||||
}
|
||||
|
||||
command = "rm -rf .git && cp -rfp porting/liteos_a/. . && env"
|
||||
command += " CC=\"$ohos_current_cc_command\""
|
||||
command += " STRIP=\"$ohos_current_strip_command\""
|
||||
command += " OUTNAME=toybox"
|
||||
command += " CFLAGS=\"$cflags $extra_flags\""
|
||||
command += " make toybox"
|
||||
command += " && install -D toybox "
|
||||
command += rebase_path("$root_out_dir/bin/toybox", exec_path)
|
||||
command += " && install -D generated/unstripped/toybox "
|
||||
command += rebase_path("$root_out_dir/unstripped/bin/toybox", exec_path)
|
||||
|
||||
outputs = [
|
||||
"$root_out_dir/unstripped/bin/toybox",
|
||||
"$root_out_dir/bin/toybox",
|
||||
]
|
||||
}
|
||||
53
apps/toybox/Makefile
Normal file
53
apps/toybox/Makefile
Normal file
@@ -0,0 +1,53 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
BUILD_DIR := $(OUT)/toybox_build
|
||||
BUILD_LOG := $(BUILD_DIR)/build.log
|
||||
|
||||
CFLAGS += -Wno-error
|
||||
|
||||
all:
|
||||
ifneq ($(wildcard $(BUILD_DIR)),)
|
||||
$(HIDE)echo "not clean, rebuilding now"
|
||||
else
|
||||
$(HIDE)mkdir -p $(BUILD_DIR)
|
||||
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/toybox/. $(BUILD_DIR)
|
||||
$(HIDE)$(CP) $(LITEOSTHIRDPARTY)/toybox/porting/liteos_a/. $(BUILD_DIR)
|
||||
$(HIDE)$(CP) liteos_a_custom.config $(BUILD_DIR)/../
|
||||
endif
|
||||
$(HIDE)unset KCONFIG_CONFIG CROSS_COMPILE && \
|
||||
env CC="$(CC)" OUTNAME="$(OUT)/bin/toybox" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" STRIP="$(STRIP)" \
|
||||
make -C $(BUILD_DIR) toybox -j> $(BUILD_LOG) 2>&1
|
||||
|
||||
clean:
|
||||
$(HIDE)$(RM) $(BUILD_DIR)
|
||||
|
||||
.PHONY: all clean
|
||||
186
apps/toybox/liteos_a_custom.config
Normal file
186
apps/toybox/liteos_a_custom.config
Normal file
@@ -0,0 +1,186 @@
|
||||
# CONFIG_BASENAME is not set
|
||||
# CONFIG_CAL is not set
|
||||
# CONFIG_CAT is not set
|
||||
# CONFIG_CATV is not set
|
||||
# CONFIG_CKSUM is not set
|
||||
# CONFIG_CRC32 is not set
|
||||
# CONFIG_CMP is not set
|
||||
# CONFIG_COMM is not set
|
||||
# CONFIG_CP_PRESERVE is not set
|
||||
# CONFIG_INSTALL is not set
|
||||
# CONFIG_CPIO is not set
|
||||
# CONFIG_CUT is not set
|
||||
# CONFIG_DF is not set
|
||||
# CONFIG_DIRNAME is not set
|
||||
# CONFIG_ECHO is not set
|
||||
# CONFIG_ENV is not set
|
||||
# CONFIG_EXPAND is not set
|
||||
# CONFIG_FALSE is not set
|
||||
# CONFIG_FILE is not set
|
||||
# CONFIG_FIND is not set
|
||||
# CONFIG_GETCONF is not set
|
||||
# CONFIG_GREP is not set
|
||||
# CONFIG_EGREP is not set
|
||||
# CONFIG_FGREP is not set
|
||||
# CONFIG_HEAD is not set
|
||||
# CONFIG_ICONV is not set
|
||||
# CONFIG_ID is not set
|
||||
# CONFIG_GROUPS is not set
|
||||
# CONFIG_LOGNAME is not set
|
||||
# CONFIG_WHOAMI is not set
|
||||
# CONFIG_LINK is not set
|
||||
# CONFIG_LN is not set
|
||||
# CONFIG_LOGGER is not set
|
||||
# CONFIG_MKFIFO is not set
|
||||
# CONFIG_NICE is not set
|
||||
# CONFIG_NL is not set
|
||||
# CONFIG_NOHUP is not set
|
||||
# CONFIG_OD is not set
|
||||
# CONFIG_PASTE is not set
|
||||
# CONFIG_PATCH is not set
|
||||
# CONFIG_PRINTF is not set
|
||||
# CONFIG_IOTOP is not set
|
||||
# CONFIG_PGREP is not set
|
||||
# CONFIG_PKILL is not set
|
||||
# CONFIG_PWD is not set
|
||||
# CONFIG_RENICE is not set
|
||||
# CONFIG_SED is not set
|
||||
# CONFIG_SLEEP is not set
|
||||
# CONFIG_SORT is not set
|
||||
# CONFIG_SORT_FLOAT is not set
|
||||
# CONFIG_SPLIT is not set
|
||||
# CONFIG_STRINGS is not set
|
||||
# CONFIG_TAIL is not set
|
||||
# CONFIG_TAR is not set
|
||||
# CONFIG_TEE is not set
|
||||
# CONFIG_TEST is not set
|
||||
# CONFIG_TIME is not set
|
||||
# CONFIG_TRUE is not set
|
||||
# CONFIG_TTY is not set
|
||||
# CONFIG_ULIMIT is not set
|
||||
# CONFIG_ARCH is not set
|
||||
# CONFIG_UNIQ is not set
|
||||
# CONFIG_UNLINK is not set
|
||||
# CONFIG_UUDECODE is not set
|
||||
# CONFIG_UUENCODE is not set
|
||||
# CONFIG_WC is not set
|
||||
# CONFIG_WHO is not set
|
||||
# CONFIG_XARGS is not set
|
||||
# CONFIG_ACPI is not set
|
||||
# CONFIG_ASCII is not set
|
||||
# CONFIG_BASE64 is not set
|
||||
# CONFIG_BLKID is not set
|
||||
# CONFIG_FSTYPE is not set
|
||||
# CONFIG_BLOCKDEV is not set
|
||||
# CONFIG_BUNZIP2 is not set
|
||||
# CONFIG_BZCAT is not set
|
||||
# CONFIG_CHROOT is not set
|
||||
# CONFIG_CHRT is not set
|
||||
# CONFIG_CHVT is not set
|
||||
# CONFIG_CLEAR is not set
|
||||
# CONFIG_COUNT is not set
|
||||
# CONFIG_DEVMEM is not set
|
||||
# CONFIG_DOS2UNIX is not set
|
||||
# CONFIG_UNIX2DOS is not set
|
||||
# CONFIG_EJECT is not set
|
||||
# CONFIG_FACTOR is not set
|
||||
# CONFIG_FALLOCATE is not set
|
||||
# CONFIG_FLOCK is not set
|
||||
# CONFIG_FMT is not set
|
||||
# CONFIG_FREERAMDISK is not set
|
||||
# CONFIG_FSFREEZE is not set
|
||||
# CONFIG_FSYNC is not set
|
||||
# CONFIG_HELP_EXTRAS is not set
|
||||
# CONFIG_HEXEDIT is not set
|
||||
# CONFIG_HWCLOCK is not set
|
||||
# CONFIG_I2CDETECT is not set
|
||||
# CONFIG_I2CDUMP is not set
|
||||
# CONFIG_I2CGET is not set
|
||||
# CONFIG_I2CSET is not set
|
||||
# CONFIG_INOTIFYD is not set
|
||||
# CONFIG_INSMOD is not set
|
||||
# CONFIG_IONICE is not set
|
||||
# CONFIG_IORENICE is not set
|
||||
# CONFIG_LOGIN is not set
|
||||
# CONFIG_LOSETUP is not set
|
||||
# CONFIG_LSATTR is not set
|
||||
# CONFIG_CHATTR is not set
|
||||
# CONFIG_LSMOD is not set
|
||||
# CONFIG_LSPCI is not set
|
||||
# CONFIG_LSPCI_TEXT is not set
|
||||
# CONFIG_LSUSB is not set
|
||||
# CONFIG_MAKEDEVS is not set
|
||||
# CONFIG_MCOOKIE is not set
|
||||
# CONFIG_MIX is not set
|
||||
# CONFIG_MKPASSWD is not set
|
||||
# CONFIG_MKSWAP is not set
|
||||
# CONFIG_MODINFO is not set
|
||||
# CONFIG_MOUNTPOINT is not set
|
||||
# CONFIG_NBD_CLIENT is not set
|
||||
# CONFIG_UNSHARE is not set
|
||||
# CONFIG_NSENTER is not set
|
||||
# CONFIG_ONEIT is not set
|
||||
# CONFIG_PARTPROBE is not set
|
||||
# CONFIG_PIVOT_ROOT is not set
|
||||
# CONFIG_PMAP is not set
|
||||
# CONFIG_PRINTENV is not set
|
||||
# CONFIG_PWDX is not set
|
||||
# CONFIG_READAHEAD is not set
|
||||
# CONFIG_READLINK is not set
|
||||
# CONFIG_REALPATH is not set
|
||||
# CONFIG_RESET is not set
|
||||
# CONFIG_REV is not set
|
||||
# CONFIG_RMMOD is not set
|
||||
# CONFIG_SETFATTR is not set
|
||||
# CONFIG_SETSID is not set
|
||||
# CONFIG_SHRED is not set
|
||||
# CONFIG_STAT is not set
|
||||
# CONFIG_SWAPOFF is not set
|
||||
# CONFIG_SWAPON is not set
|
||||
# CONFIG_SWITCH_ROOT is not set
|
||||
# CONFIG_SYSCTL is not set
|
||||
# CONFIG_TAC is not set
|
||||
# CONFIG_NPROC is not set
|
||||
# CONFIG_TASKSET is not set
|
||||
# CONFIG_TIMEOUT is not set
|
||||
# CONFIG_TRUNCATE is not set
|
||||
# CONFIG_UPTIME is not set
|
||||
# CONFIG_USLEEP is not set
|
||||
# CONFIG_UUIDGEN is not set
|
||||
# CONFIG_VCONFIG is not set
|
||||
# CONFIG_VMSTAT is not set
|
||||
# CONFIG_W is not set
|
||||
# CONFIG_WATCH is not set
|
||||
# CONFIG_WHICH is not set
|
||||
# CONFIG_XXD is not set
|
||||
# CONFIG_YES is not set
|
||||
# CONFIG_FTPGET is not set
|
||||
# CONFIG_FTPPUT is not set
|
||||
# CONFIG_MICROCOM is not set
|
||||
# CONFIG_NETCAT is not set
|
||||
# CONFIG_NETCAT_LISTEN is not set
|
||||
# CONFIG_NETSTAT is not set
|
||||
# CONFIG_RFKILL is not set
|
||||
# CONFIG_SNTP is not set
|
||||
# CONFIG_TUNCTL is not set
|
||||
# CONFIG_DMESG is not set
|
||||
# CONFIG_GUNZIP is not set
|
||||
# CONFIG_ZCAT is not set
|
||||
# CONFIG_HOSTNAME is not set
|
||||
# CONFIG_DNSDOMAINNAME is not set
|
||||
# CONFIG_KILLALL is not set
|
||||
# CONFIG_MD5SUM is not set
|
||||
# CONFIG_SHA1SUM is not set
|
||||
# CONFIG_MKNOD is not set
|
||||
# CONFIG_MKTEMP is not set
|
||||
# CONFIG_PASSWD is not set
|
||||
# CONFIG_PIDOF is not set
|
||||
# CONFIG_SEQ is not set
|
||||
# CONFIG_SU is not set
|
||||
# CONFIG_SYNC is not set
|
||||
#
|
||||
# pending (see toys/pending/README)
|
||||
#
|
||||
# CONFIG_GETTY is not set
|
||||
# CONFIG_MDEV is not set
|
||||
# CONFIG_MDEV_CONF is not set
|
||||
8
tools/fsimage/MakeVersion.sh → apps/trace/BUILD.gn
Executable file → Normal file
8
tools/fsimage/MakeVersion.sh → apps/trace/BUILD.gn
Executable file → Normal file
@@ -1,5 +1,3 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
@@ -29,4 +27,8 @@
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
./mkfs.jffs2 -s 0x1000 -e 0x10000 -p 0x100000 -d rootfs/ -o rootfs_64k.jffs2
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
executable("trace") {
|
||||
sources = [ "src/trace.c" ]
|
||||
}
|
||||
70
tools/build/mk/dynload.mk → apps/trace/Makefile
Executable file → Normal file
70
tools/build/mk/dynload.mk → apps/trace/Makefile
Executable file → Normal file
@@ -1,34 +1,36 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
DYNLOADTESTDIR := $(LITEOSTOPDIR)/test/kernel/sample/kernel_extend/dynload
|
||||
export DYNLOADTESTDIR
|
||||
|
||||
##### command to test dynload #####
|
||||
-include $(DYNLOADTESTDIR)/test_dynload.mk
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(APPSTOPDIR)/config.mk
|
||||
|
||||
APP_NAME := $(notdir $(shell pwd))
|
||||
|
||||
LOCAL_SRCS := src/trace.c
|
||||
|
||||
include $(APP)
|
||||
135
apps/trace/src/trace.c
Normal file
135
apps/trace/src/trace.c
Normal file
@@ -0,0 +1,135 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#define TRACE_IOC_MAGIC 'T'
|
||||
#define TRACE_START _IO(TRACE_IOC_MAGIC, 1)
|
||||
#define TRACE_STOP _IO(TRACE_IOC_MAGIC, 2)
|
||||
#define TRACE_RESET _IO(TRACE_IOC_MAGIC, 3)
|
||||
#define TRACE_DUMP _IO(TRACE_IOC_MAGIC, 4)
|
||||
#define TRACE_SET_MASK _IO(TRACE_IOC_MAGIC, 5)
|
||||
|
||||
#define TRACE_USR_MAX_PARAMS 3
|
||||
typedef struct {
|
||||
unsigned int eventType;
|
||||
uintptr_t identity;
|
||||
uintptr_t params[TRACE_USR_MAX_PARAMS];
|
||||
} UsrEventInfo;
|
||||
|
||||
static void TraceUsage(void)
|
||||
{
|
||||
printf("\nUsage: ./trace [start] Start to trace events.\n");
|
||||
printf("\nUsage: ./trace [stop] Stop trace.\n");
|
||||
printf("\nUsage: ./trace [reset] Clear the trace record buffer.\n");
|
||||
printf("\nUsage: ./trace [dump 0/1] Format printf trace data,"
|
||||
"0/1 stands for whether to send data to studio for analysis.\n");
|
||||
printf("\nUsage: ./trace [mask num] Set trace filter event mask.\n");
|
||||
printf("\nUsage: ./trace [read nBytes] Read nBytes raw data from trace buffer.\n");
|
||||
printf("\nUsage: ./trace [write type id params..] Write a user event, no more than 3 parameters.\n");
|
||||
}
|
||||
|
||||
static void TraceRead(int fd, size_t size)
|
||||
{
|
||||
ssize_t i;
|
||||
ssize_t len;
|
||||
char *buffer = (char *)malloc(size);
|
||||
if (buffer == NULL) {
|
||||
printf("Read buffer malloc failed.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
len = read(fd, buffer, size);
|
||||
for (i = 0; i < len; i++) {
|
||||
printf("%02x ", buffer[i] & 0xFF);
|
||||
}
|
||||
printf("\n");
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
static void TraceWrite(int fd, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
UsrEventInfo info = {0};
|
||||
info.eventType = strtoul(argv[2], NULL, 0);
|
||||
info.identity = strtoul(argv[3], NULL, 0);
|
||||
int paramNum = (argc - 4) > TRACE_USR_MAX_PARAMS ? TRACE_USR_MAX_PARAMS : (argc - 4);
|
||||
|
||||
for (i = 0; i < paramNum; i++) {
|
||||
info.params[i] = strtoul(argv[4 + i], NULL, 0);
|
||||
}
|
||||
(void)write(fd, &info, sizeof(UsrEventInfo));
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int fd = open("/dev/trace", O_RDWR);
|
||||
if (fd == -1) {
|
||||
printf("Trace open failed.\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (argc == 1) {
|
||||
TraceUsage();
|
||||
} else if (argc == 2 && strcmp(argv[1], "start") == 0) {
|
||||
ioctl(fd, TRACE_START, NULL);
|
||||
} else if (argc == 2 && strcmp(argv[1], "stop") == 0) {
|
||||
ioctl(fd, TRACE_STOP, NULL);
|
||||
} else if (argc == 2 && strcmp(argv[1], "reset") == 0) {
|
||||
ioctl(fd, TRACE_RESET, NULL);
|
||||
} else if (argc == 3 && strcmp(argv[1], "mask") == 0) {
|
||||
size_t mask = strtoul(argv[2], NULL, 0);
|
||||
ioctl(fd, TRACE_SET_MASK, mask);
|
||||
} else if (argc == 3 && strcmp(argv[1], "dump") == 0) {
|
||||
size_t flag = strtoul(argv[2], NULL, 0);
|
||||
ioctl(fd, TRACE_DUMP, flag);
|
||||
} else if (argc == 3 && strcmp(argv[1], "read") == 0) {
|
||||
size_t size = strtoul(argv[2], NULL, 0);
|
||||
TraceRead(fd, size);
|
||||
} else if (argc >= 4 && strcmp(argv[1], "write") == 0) {
|
||||
TraceWrite(fd, argc, argv);
|
||||
} else {
|
||||
printf("Unsupported trace command.\n");
|
||||
TraceUsage();
|
||||
}
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
44
arch/BUILD.gn
Normal file
44
arch/BUILD.gn
Normal file
@@ -0,0 +1,44 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
group("arch") {
|
||||
deps = []
|
||||
if (defined(LOSCFG_ARCH_ARM)) {
|
||||
deps += [ "arm" ]
|
||||
}
|
||||
}
|
||||
|
||||
config("public") {
|
||||
configs = []
|
||||
if (defined(LOSCFG_ARCH_ARM)) {
|
||||
configs += [ "arm:public" ]
|
||||
}
|
||||
}
|
||||
0
arch/Kconfig
Executable file → Normal file
0
arch/Kconfig
Executable file → Normal file
40
arch/arm/BUILD.gn
Normal file
40
arch/arm/BUILD.gn
Normal file
@@ -0,0 +1,40 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
group("arm") {
|
||||
deps = [ "gic" ]
|
||||
deps += [ ARCH ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [ "include" ]
|
||||
configs = [ "$ARCH:public" ]
|
||||
}
|
||||
@@ -75,3 +75,29 @@ config ARCH_CORTEX_A7
|
||||
config ARCH_CPU
|
||||
string
|
||||
default "cortex-a7" if ARCH_CORTEX_A7
|
||||
|
||||
#
|
||||
# Supported GIC version
|
||||
#
|
||||
|
||||
choice
|
||||
prompt "GIC version"
|
||||
default ARCH_GIC_V2
|
||||
help
|
||||
Interrupt Controller.
|
||||
|
||||
config ARCH_GIC_V2
|
||||
bool "GIC Version 2"
|
||||
help
|
||||
This GIC(General Interrupt Controller) version 2 driver is compatatble with
|
||||
GIC version 1 and version 2.
|
||||
|
||||
config ARCH_GIC_V3
|
||||
bool "GIC Version 3"
|
||||
depends on ARCH_ARM_V8A || ARCH_ARM_V8R
|
||||
help
|
||||
General Interrupt Controller version 3.
|
||||
|
||||
endchoice
|
||||
|
||||
|
||||
|
||||
@@ -36,13 +36,16 @@ LOSCFG_ARCH_FPU_STRIP := $(subst $\",,$(LOSCFG_ARCH_FPU))
|
||||
LOSCFG_ARCH_FPU = $(LOSCFG_ARCH_FPU_STRIP)
|
||||
|
||||
ifeq ($(LOSCFG_ARCH_ARM_AARCH32), y)
|
||||
LITEOS_ARCH_ARM := arm
|
||||
ARCH := arm
|
||||
else ifeq ($(LOSCFG_ARCH_ARM_AARCH64), y)
|
||||
LITEOS_ARCH_ARM :=
|
||||
ARCH := aarch64
|
||||
endif
|
||||
|
||||
LITEOS_BASELIB += -l$(LOSCFG_ARCH_CPU)
|
||||
LIB_SUBDIRS += arch/arm/$(LITEOS_ARCH_ARM)
|
||||
LITEOS_BASELIB += -lgic
|
||||
|
||||
LIB_SUBDIRS += arch/arm/$(ARCH)
|
||||
LIB_SUBDIRS += arch/arm/gic
|
||||
|
||||
# CPU compile options
|
||||
ifeq ($(LOSCFG_ARCH_ARM_AARCH64), y)
|
||||
@@ -62,18 +65,15 @@ LITEOS_FPU_OPTS := -mfpu=$(LOSCFG_ARCH_FPU)
|
||||
LITEOS_GCCLIB := $(subst cortex-,,$(LOSCFG_ARCH_CPU))_softfp_$(LOSCFG_ARCH_FPU)
|
||||
endif
|
||||
|
||||
LITEOS_CORE_COPTS = $(LITEOS_CPU_OPTS) $(LITEOS_FLOAT_OPTS) $(LITEOS_FPU_OPTS)
|
||||
LITEOS_INTERWORK += $(LITEOS_CORE_COPTS)
|
||||
LITEOS_NODEBUG += $(LITEOS_CORE_COPTS)
|
||||
LITEOS_CORE_COPTS = $(or $(ARCH_CFLAGS),$(LITEOS_CPU_OPTS) $(LITEOS_FLOAT_OPTS) $(LITEOS_FPU_OPTS))
|
||||
LITEOS_ASOPTS += $(LITEOS_CPU_OPTS)
|
||||
LITEOS_CXXOPTS_BASE += $(LITEOS_CORE_COPTS)
|
||||
|
||||
ARCH_INCLUDE := -I $(LITEOSTOPDIR)/arch/arm/include \
|
||||
-I $(LITEOSTOPDIR)/arch/arm/$(LITEOS_ARCH_ARM)/include \
|
||||
-I $(LITEOSTOPDIR)/arch/arm/$(LITEOS_ARCH_ARM)/src/include
|
||||
-I $(LITEOSTOPDIR)/arch/arm/$(ARCH)/include \
|
||||
-I $(LITEOSTOPDIR)/arch/arm/$(ARCH)/src/include
|
||||
|
||||
LITEOS_PLATFORM_INCLUDE += $(ARCH_INCLUDE)
|
||||
LITEOS_CXXINCLUDE += $(ARCH_INCLUDE)
|
||||
|
||||
# expose FPU info to assembly code
|
||||
ifeq ($(LOSCFG_ARCH_FPU_DISABLE), y)
|
||||
@@ -83,17 +83,3 @@ else ifeq ($(LOSCFG_ARCH_FPU_VFP_D16), y)
|
||||
else ifeq ($(LOSCFG_ARCH_FPU_VFP_D32), y)
|
||||
LITEOS_CMACRO += -DLOSCFG_ARCH_FPU_VFP_D32
|
||||
endif
|
||||
|
||||
# extra definition for other module
|
||||
LITEOS_CPU_TYPE = $(LOSCFG_ARCH_CPU)
|
||||
LITEOS_ARM_ARCH := -march=$(subst $\",,$(LOSCFG_ARCH_ARM_VER))
|
||||
|
||||
# linux style macros
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7A) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7R) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7M) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8A) = -D__LINUX_ARM_ARCH__=8
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8R) = -D__LINUX_ARM_ARCH__=8
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8M) = -D__LINUX_ARM_ARCH__=8
|
||||
|
||||
AS_OBJS_LIBC_FLAGS += $(LINUX_ARCH_y)
|
||||
|
||||
90
arch/arm/arm/BUILD.gn
Normal file
90
arch/arm/arm/BUILD.gn
Normal file
@@ -0,0 +1,90 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
module_name = LOSCFG_ARCH_CPU
|
||||
kernel_module(module_name) {
|
||||
sources = [
|
||||
"src/arm_generic_timer.c",
|
||||
"src/clear_user.S",
|
||||
"src/hw_user_get.S",
|
||||
"src/hw_user_put.S",
|
||||
"src/jmp.S",
|
||||
"src/los_arch_mmu.c",
|
||||
"src/los_asid.c",
|
||||
"src/los_dispatch.S",
|
||||
"src/los_exc.c",
|
||||
"src/los_hw.c",
|
||||
"src/los_hw_exc.S",
|
||||
"src/los_hw_runstop.S",
|
||||
"src/los_hw_tick.c",
|
||||
"src/los_hwi.c",
|
||||
"src/strncpy_from_user.c",
|
||||
"src/strnlen_user.c",
|
||||
"src/user_copy.c",
|
||||
"src/smp.c",
|
||||
]
|
||||
|
||||
if (LOSCFG_ARCH_ARM_VER == "armv7-a") {
|
||||
sources += [ "src/armv7a/cache.S" ]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_KERNEL_SMP)) {
|
||||
sources += [ "src/startup/reset_vector_mp.S" ]
|
||||
} else {
|
||||
sources += [ "src/startup/reset_vector_up.S" ]
|
||||
}
|
||||
|
||||
include_dirs = [ "src/include" ]
|
||||
|
||||
if (defined(LOSCFG_GDB)) {
|
||||
configs += [ ":as_objs_libc_flags" ]
|
||||
}
|
||||
|
||||
public_configs = [ ":public" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [
|
||||
"include",
|
||||
"src/include",
|
||||
]
|
||||
}
|
||||
|
||||
config("as_objs_libc_flags") {
|
||||
defines = [ "__ASSEMBLY__" ]
|
||||
|
||||
# linux style macros
|
||||
if (defined(LOSCFG_ARCH_ARM_V7A) || defined(LOSCFG_ARCH_ARM_V7R) || defined(LOSCFG_ARCH_ARM_V7M)) {
|
||||
defines += [ "__LINUX_ARM_ARCH__=7" ]
|
||||
} else if (defined(LOSCFG_ARCH_ARM_V8A) || defined(LOSCFG_ARCH_ARM_V8R) || defined(LOSCFG_ARCH_ARM_V8M)) {
|
||||
defines += [ "__LINUX_ARM_ARCH__=8" ]
|
||||
}
|
||||
}
|
||||
12
arch/arm/arm/Makefile
Executable file → Normal file
12
arch/arm/arm/Makefile
Executable file → Normal file
@@ -38,7 +38,7 @@ LOCAL_INCLUDE := \
|
||||
-I $(LITEOSTOPDIR)/kernel/extended/dynload/include \
|
||||
-I $(LITEOSTOPDIR)/arch/arm/arm/include \
|
||||
|
||||
ifeq ($(LITEOS_ARM_ARCH), -march=armv7-a)
|
||||
ifeq ($(LOSCFG_ARCH_ARM_VER), "armv7-a")
|
||||
LOCAL_SRCS += $(wildcard src/armv7a/*.S)
|
||||
endif
|
||||
|
||||
@@ -50,6 +50,16 @@ endif
|
||||
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE) $(LITEOS_GCOV_OPTS)
|
||||
|
||||
AS_OBJS_LIBC_FLAGS = -D__ASSEMBLY__
|
||||
# linux style macros
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7A) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7R) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V7M) = -D__LINUX_ARM_ARCH__=7
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8A) = -D__LINUX_ARM_ARCH__=8
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8R) = -D__LINUX_ARM_ARCH__=8
|
||||
LINUX_ARCH_$(LOSCFG_ARCH_ARM_V8M) = -D__LINUX_ARM_ARCH__=8
|
||||
AS_OBJS_LIBC_FLAGS += $(LINUX_ARCH_y)
|
||||
|
||||
ifeq ($(LOSCFG_GDB), y)
|
||||
LOCAL_FLAGS += $(AS_OBJS_LIBC_FLAGS)
|
||||
endif
|
||||
|
||||
1
arch/arm/arm/include/arch_config.h
Executable file → Normal file
1
arch/arm/arm/include/arch_config.h
Executable file → Normal file
@@ -32,7 +32,6 @@
|
||||
#ifndef _ARCH_CONFIG_H
|
||||
#define _ARCH_CONFIG_H
|
||||
|
||||
#include "menuconfig.h"
|
||||
|
||||
#define CPSR_INT_DISABLE 0xC0 /* Disable both FIQ and IRQ */
|
||||
#define CPSR_IRQ_DISABLE 0x80 /* IRQ disabled when =1 */
|
||||
|
||||
4
arch/arm/arm/include/arm.h
Executable file → Normal file
4
arch/arm/arm/include/arm.h
Executable file → Normal file
@@ -36,10 +36,6 @@
|
||||
#define CPSR_MODE_USR 0x10
|
||||
#define CPSR_MODE_MASK 0x1f
|
||||
|
||||
#define DSB __asm__ volatile("dsb" ::: "memory")
|
||||
#define ISB __asm__ volatile("isb" ::: "memory")
|
||||
#define DMB __asm__ volatile("dmb" ::: "memory")
|
||||
|
||||
STATIC INLINE UINT32 OsArmReadSctlr(VOID)
|
||||
{
|
||||
UINT32 val;
|
||||
|
||||
50
arch/arm/arm/include/arm_user_clear.h
Normal file
50
arch/arm/arm/include/arm_user_clear.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _ARM_USER_CLEAR_H
|
||||
#define _ARM_USER_CLEAR_H
|
||||
|
||||
#include "los_typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
size_t _arm_clear_user(void *addr, size_t bytes);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _ARM_USER_CLEAR_H */
|
||||
0
arch/arm/arm/include/arm_user_copy.h
Executable file → Normal file
0
arch/arm/arm/include/arm_user_copy.h
Executable file → Normal file
0
arch/arm/arm/include/arm_user_get.h
Executable file → Normal file
0
arch/arm/arm/include/arm_user_get.h
Executable file → Normal file
0
arch/arm/arm/include/arm_user_put.h
Executable file → Normal file
0
arch/arm/arm/include/arm_user_put.h
Executable file → Normal file
@@ -45,7 +45,6 @@ extern VOID HalClockIrqClear(VOID);
|
||||
extern VOID HalClockInit(VOID);
|
||||
extern UINT64 HalClockGetCycles(VOID);
|
||||
extern VOID HalDelayUs(UINT32 usecs);
|
||||
extern UINT64 hi_sched_clock(VOID);
|
||||
extern UINT32 HalClockGetTickTimerCycles(VOID);
|
||||
extern VOID HalClockTickTimerReload(UINT64 cycles);
|
||||
|
||||
23
arch/arm/arm/include/los_hw_cpu.h
Executable file → Normal file
23
arch/arm/arm/include/los_hw_cpu.h
Executable file → Normal file
@@ -51,7 +51,10 @@ extern "C" {
|
||||
#define DSB __asm__ volatile("dsb" ::: "memory")
|
||||
#define DMB __asm__ volatile("dmb" ::: "memory")
|
||||
#define ISB __asm__ volatile("isb" ::: "memory")
|
||||
#define WFI __asm__ volatile("wfi" ::: "memory")
|
||||
#define BARRIER __asm__ volatile("":::"memory")
|
||||
#define WFE __asm__ volatile("wfe" ::: "memory")
|
||||
#define SEV __asm__ volatile("sev" ::: "memory")
|
||||
|
||||
#define ARM_SYSREG_READ(REG) \
|
||||
({ \
|
||||
@@ -144,7 +147,7 @@ STATIC INLINE VOID ArchCurrUserTaskSet(UINTPTR val)
|
||||
|
||||
STATIC INLINE UINT32 ArchCurrCpuid(VOID)
|
||||
{
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
return ARM_SYSREG_READ(MPIDR) & MPIDR_CPUID_MASK;
|
||||
#else
|
||||
return 0;
|
||||
@@ -188,6 +191,24 @@ STATIC INLINE UINT32 ArchIntUnlock(VOID)
|
||||
return intSave;
|
||||
}
|
||||
|
||||
STATIC INLINE VOID ArchIrqDisable(VOID)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cpsid i "
|
||||
:
|
||||
:
|
||||
: "memory", "cc");
|
||||
}
|
||||
|
||||
STATIC INLINE VOID ArchIrqEnable(VOID)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"cpsie i "
|
||||
:
|
||||
:
|
||||
: "memory", "cc");
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
STATIC INLINE UINT32 ArchIntLock(VOID)
|
||||
|
||||
0
arch/arm/arm/include/los_mmu_descriptor_v6.h
Executable file → Normal file
0
arch/arm/arm/include/los_mmu_descriptor_v6.h
Executable file → Normal file
@@ -37,7 +37,6 @@
|
||||
#define __LOS_TLB_V6_H__
|
||||
|
||||
#include "los_typedef.h"
|
||||
#include "menuconfig.h"
|
||||
#include "arm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
33
kernel/extended/include/los_trace_pri.h → arch/arm/arm/include/smp.h
Executable file → Normal file
33
kernel/extended/include/los_trace_pri.h → arch/arm/arm/include/smp.h
Executable file → Normal file
@@ -29,12 +29,10 @@
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef LOS_TRACE_PRI_H
|
||||
#define LOS_TRACE_PRI_H
|
||||
#ifndef _ARCH_SMP_H
|
||||
#define _ARCH_SMP_H
|
||||
|
||||
#include "los_trace.h"
|
||||
#include "los_spinlock.h"
|
||||
#include "los_seq_buf.h"
|
||||
#include "los_config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -42,25 +40,13 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef struct {
|
||||
TraceSwitch onOff;
|
||||
WriteHook inputHook;
|
||||
const CHAR *typeStr;
|
||||
} TraceHook;
|
||||
struct SmpOps {
|
||||
INT32 (*SmpCpuOn)(UINT32 cpuNum, UINTPTR startEntry); /* The startEntry is physical addr. */
|
||||
};
|
||||
|
||||
/*
|
||||
* |1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0|
|
||||
* | |
|
||||
* readIndex writeIndex
|
||||
*/
|
||||
typedef VOID (*ArchCpuStartFunc)(VOID *arg);
|
||||
|
||||
typedef struct {
|
||||
UINT8 *dataBuf;
|
||||
UINT32 bufLen;
|
||||
TraceSwitch onOff;
|
||||
UINT32 writeIndex;
|
||||
UINT32 readIndex;
|
||||
} TraceBufferCtl;
|
||||
VOID HalArchCpuOn(UINT32 cpuNum, ArchCpuStartFunc func, struct SmpOps *ops, VOID *arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
@@ -68,4 +54,5 @@ typedef struct {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* LOS_TRACE_PRI_H */
|
||||
#endif /* _ARCH_SMP_H */
|
||||
|
||||
2
platform/hw/arm/timer/arm_generic/arm_generic_timer.c → arch/arm/arm/src/arm_generic_timer.c
Executable file → Normal file
2
platform/hw/arm/timer/arm_generic/arm_generic_timer.c → arch/arm/arm/src/arm_generic_timer.c
Executable file → Normal file
@@ -162,7 +162,7 @@ VOID HalDelayUs(UINT32 usecs)
|
||||
}
|
||||
}
|
||||
|
||||
UINT64 hi_sched_clock(VOID)
|
||||
DEPRECATED UINT64 hi_sched_clock(VOID)
|
||||
{
|
||||
return LOS_CurrNanosec();
|
||||
}
|
||||
100
arch/arm/arm/src/clear_user.S
Normal file
100
arch/arm/arm/src/clear_user.S
Normal file
@@ -0,0 +1,100 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "asm.h"
|
||||
|
||||
.syntax unified
|
||||
.arm
|
||||
|
||||
// size_t _arm_clear_user(void *addr, size_t bytes)
|
||||
FUNCTION(_arm_clear_user)
|
||||
push {r0-r6, lr}
|
||||
cmp r1, #0
|
||||
beq .Lclear_user_return
|
||||
tst r0, #7
|
||||
beq .Lclear_user_aligned
|
||||
|
||||
.Lclear_user_byte:
|
||||
mov r2, #0
|
||||
0: strb r2, [r0], #1
|
||||
subs r1, r1, #1
|
||||
beq .Lclear_user_return
|
||||
tst r0, #7
|
||||
bne 0b
|
||||
|
||||
.Lclear_user_aligned:
|
||||
eor r3, r3
|
||||
eor r4, r4
|
||||
bics r2, r1, #15
|
||||
bne .Lclear_user_16bytes
|
||||
bics r2, r1, #7
|
||||
bne .Lclear_user_8bytes
|
||||
b .Lclear_user_remaining
|
||||
|
||||
.Lclear_user_16bytes:
|
||||
eor r5, r5
|
||||
eor r6, r6
|
||||
1: stmia r0!, {r3, r4, r5, r6}
|
||||
subs r2, r2, #16
|
||||
bne 1b
|
||||
ands r1, r1, #15
|
||||
beq .Lclear_user_return
|
||||
bics r2, r1, #7
|
||||
beq .Lclear_user_remaining
|
||||
|
||||
.Lclear_user_8bytes:
|
||||
2: stmia r0!, {r3, r4}
|
||||
ands r1, r1, #7
|
||||
beq .Lclear_user_return
|
||||
|
||||
.Lclear_user_remaining:
|
||||
mov r2, #0
|
||||
3: strb r2, [r0], #1
|
||||
subs r1, r1, #1
|
||||
bne 3b
|
||||
|
||||
.Lclear_user_return:
|
||||
pop {r0-r6, lr}
|
||||
mov r0, #0
|
||||
bx lr
|
||||
|
||||
.Lclear_user_err:
|
||||
pop {r0, r1}
|
||||
sub r0, r2, r0
|
||||
sub r0, r1, r0
|
||||
pop {r2-r6, lr}
|
||||
bx lr
|
||||
|
||||
.pushsection __exc_table, "a"
|
||||
.long 0b, .Lclear_user_err
|
||||
.long 1b, .Lclear_user_err
|
||||
.long 2b, .Lclear_user_err
|
||||
.long 3b, .Lclear_user_err
|
||||
.popsection
|
||||
0
arch/arm/arm/src/hw_user_get.S
Executable file → Normal file
0
arch/arm/arm/src/hw_user_get.S
Executable file → Normal file
0
arch/arm/arm/src/hw_user_put.S
Executable file → Normal file
0
arch/arm/arm/src/hw_user_put.S
Executable file → Normal file
0
arch/arm/arm/src/include/asm.h
Executable file → Normal file
0
arch/arm/arm/src/include/asm.h
Executable file → Normal file
@@ -40,11 +40,6 @@ extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
STATIC INLINE VOID OsSetCurrCpuSp(UINTPTR regSp)
|
||||
{
|
||||
__asm__ __volatile__("mov sp, %0" :: "r"(regSp));
|
||||
}
|
||||
|
||||
#define OS_SYSTEM_NORMAL 0
|
||||
#define OS_SYSTEM_EXC_CURR_CPU 1
|
||||
#define OS_SYSTEM_EXC_OTHER_CPU 2
|
||||
|
||||
57
arch/arm/arm/src/include/los_hw_pri.h
Executable file → Normal file
57
arch/arm/arm/src/include/los_hw_pri.h
Executable file → Normal file
@@ -34,8 +34,7 @@
|
||||
|
||||
#include "los_base.h"
|
||||
#include "los_hw.h"
|
||||
#include "los_process_pri.h"
|
||||
#include "los_signal.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
@@ -56,23 +55,44 @@ typedef struct {
|
||||
UINT32 regFPSCR; /* FPSCR */
|
||||
UINT32 regFPEXC; /* FPEXC */
|
||||
#endif
|
||||
UINT32 resved; /* It's stack 8 aligned */
|
||||
UINT32 regPSR;
|
||||
UINT32 R[GEN_REGS_NUM]; /* R0-R12 */
|
||||
UINT32 SP; /* R13 */
|
||||
UINT32 LR; /* R14 */
|
||||
UINT32 PC; /* R15 */
|
||||
UINT32 R4;
|
||||
UINT32 R5;
|
||||
UINT32 R6;
|
||||
UINT32 R7;
|
||||
UINT32 R8;
|
||||
UINT32 R9;
|
||||
UINT32 R10;
|
||||
UINT32 R11;
|
||||
|
||||
/* It has the same structure as IrqContext */
|
||||
UINT32 reserved2; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
|
||||
UINT32 reserved1; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
|
||||
UINT32 USP; /**< User mode sp register */
|
||||
UINT32 ULR; /**< User mode lr register */
|
||||
UINT32 R0;
|
||||
UINT32 R1;
|
||||
UINT32 R2;
|
||||
UINT32 R3;
|
||||
UINT32 R12;
|
||||
UINT32 LR;
|
||||
UINT32 PC;
|
||||
UINT32 regCPSR;
|
||||
} TaskContext;
|
||||
|
||||
typedef struct {
|
||||
#if !defined(LOSCFG_ARCH_FPU_DISABLE)
|
||||
UINT64 D[FP_REGS_NUM]; /* D0-D31 */
|
||||
UINT32 regFPSCR; /* FPSCR */
|
||||
UINT32 regFPEXC; /* FPEXC */
|
||||
#endif
|
||||
UINT32 resved;
|
||||
TASK_IRQ_CONTEXT
|
||||
} TaskIrqContext;
|
||||
UINT32 reserved2; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
|
||||
UINT32 reserved1; /**< Multiplexing registers, used in interrupts and system calls but with different meanings */
|
||||
UINT32 USP; /**< User mode sp register */
|
||||
UINT32 ULR; /**< User mode lr register */
|
||||
UINT32 R0;
|
||||
UINT32 R1;
|
||||
UINT32 R2;
|
||||
UINT32 R3;
|
||||
UINT32 R12;
|
||||
UINT32 LR;
|
||||
UINT32 PC;
|
||||
UINT32 regCPSR;
|
||||
} IrqContext;
|
||||
|
||||
/*
|
||||
* Description : task stack initialization
|
||||
@@ -82,8 +102,9 @@ typedef struct {
|
||||
* Return : pointer to the task context
|
||||
*/
|
||||
extern VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack, BOOL initFlag);
|
||||
extern VOID OsUserCloneParentStack(LosTaskCB *childTaskCB, LosTaskCB *parentTaskCB);
|
||||
extern VOID OsUserTaskStackInit(TaskContext *context, TSK_ENTRY_FUNC taskEntry, UINTPTR stack);
|
||||
extern VOID OsUserCloneParentStack(VOID *childStack, UINTPTR parentTopOfStask, UINT32 parentStackSize);
|
||||
extern VOID OsUserTaskStackInit(TaskContext *context, UINTPTR taskEntry, UINTPTR stack);
|
||||
extern VOID OsInitSignalContext(const VOID *sp, VOID *signalContext, UINTPTR sigHandler, UINT32 signo, UINT32 param);
|
||||
extern void arm_clean_cache_range(UINTPTR start, UINTPTR end);
|
||||
extern void arm_inv_cache_range(UINTPTR start, UINTPTR end);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ extern VOID OsIncHwiFormCnt(UINT32 index);
|
||||
extern UINT32 OsGetHwiFormCnt(UINT32 index);
|
||||
extern CHAR *OsGetHwiFormName(UINT32 index);
|
||||
extern VOID OsInterrupt(UINT32 intNum);
|
||||
extern VOID SyscallHandleInit(VOID);
|
||||
extern VOID OsSyscallHandleInit(VOID);
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
130
arch/arm/arm/src/los_arch_mmu.c
Executable file → Normal file
130
arch/arm/arm/src/los_arch_mmu.c
Executable file → Normal file
@@ -45,16 +45,13 @@
|
||||
#include "los_vm_boot.h"
|
||||
#include "los_mmu_descriptor_v6.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
|
||||
__attribute__((aligned(MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS))) \
|
||||
__attribute__((section(".bss.prebss.translation_table"))) UINT8 \
|
||||
g_firstPageTable[MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS];
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
__attribute__((aligned(MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS))) \
|
||||
__attribute__((section(".bss.prebss.translation_table"))) UINT8 \
|
||||
g_tempPageTable[MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS];
|
||||
@@ -70,6 +67,11 @@ STATIC INLINE PTE_T *OsGetPte2BasePtr(PTE_T pte1)
|
||||
return LOS_PaddrToKVaddr(pa);
|
||||
}
|
||||
|
||||
VADDR_T *OsGFirstTableGet(VOID)
|
||||
{
|
||||
return (VADDR_T *)g_firstPageTable;
|
||||
}
|
||||
|
||||
STATIC INLINE UINT32 OsUnmapL1Invalid(vaddr_t *vaddr, UINT32 *count)
|
||||
{
|
||||
UINT32 unmapCount;
|
||||
@@ -146,7 +148,6 @@ STATIC VOID OsCvtPte2AttsToFlags(PTE_T l1Entry, PTE_T l2Entry, UINT32 *flags)
|
||||
|
||||
STATIC VOID OsPutL2Table(const LosArchMmu *archMmu, UINT32 l1Index, paddr_t l2Paddr)
|
||||
{
|
||||
LosVmPage *vmPage = NULL;
|
||||
UINT32 index;
|
||||
PTE_T ttEntry;
|
||||
/* check if any l1 entry points to this l2 table */
|
||||
@@ -156,8 +157,9 @@ STATIC VOID OsPutL2Table(const LosArchMmu *archMmu, UINT32 l1Index, paddr_t l2Pa
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
/* we can free this l2 table */
|
||||
vmPage = LOS_VmPageGet(l2Paddr);
|
||||
LosVmPage *vmPage = LOS_VmPageGet(l2Paddr);
|
||||
if (vmPage == NULL) {
|
||||
LOS_Panic("bad page table paddr %#x\n", l2Paddr);
|
||||
return;
|
||||
@@ -165,6 +167,9 @@ STATIC VOID OsPutL2Table(const LosArchMmu *archMmu, UINT32 l1Index, paddr_t l2Pa
|
||||
|
||||
LOS_ListDelete(&vmPage->node);
|
||||
LOS_PhysPageFree(vmPage);
|
||||
#else
|
||||
(VOID)LOS_MemFree(OS_SYS_MEM_ADDR, LOS_PaddrToKVaddr(l2Paddr));
|
||||
#endif
|
||||
}
|
||||
|
||||
STATIC VOID OsTryUnmapL1PTE(const LosArchMmu *archMmu, vaddr_t vaddr, UINT32 scanIndex, UINT32 scanCount)
|
||||
@@ -213,7 +218,7 @@ STATIC UINT32 OsCvtSecCacheFlagsToMMUFlags(UINT32 flags)
|
||||
switch (flags & VM_MAP_REGION_FLAG_CACHE_MASK) {
|
||||
case VM_MAP_REGION_FLAG_CACHED:
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_TYPE_NORMAL_WRITE_BACK_ALLOCATE;
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
mmuFlags |= MMU_DESCRIPTOR_L1_SECTION_SHAREABLE;
|
||||
#endif
|
||||
break;
|
||||
@@ -370,13 +375,14 @@ STATIC UINT32 OsUnmapSection(LosArchMmu *archMmu, vaddr_t *vaddr, UINT32 *count)
|
||||
return MMU_DESCRIPTOR_L2_NUMBERS_PER_L1;
|
||||
}
|
||||
|
||||
|
||||
BOOL OsArchMmuInit(LosArchMmu *archMmu, VADDR_T *virtTtb)
|
||||
{
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
if (OsAllocAsid(&archMmu->asid) != LOS_OK) {
|
||||
VM_ERR("alloc arch mmu asid failed");
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
status_t retval = LOS_MuxInit(&archMmu->mtx, NULL);
|
||||
if (retval != LOS_OK) {
|
||||
@@ -480,7 +486,6 @@ STATIC STATUS_T OsGetL2Table(LosArchMmu *archMmu, UINT32 l1Index, paddr_t *ppa)
|
||||
UINT32 index;
|
||||
PTE_T ttEntry;
|
||||
VADDR_T *kvaddr = NULL;
|
||||
LosVmPage *vmPage = NULL;
|
||||
UINT32 l2Offset = (MMU_DESCRIPTOR_L2_SMALL_SIZE / MMU_DESCRIPTOR_L1_SMALL_L2_TABLES_PER_PAGE) *
|
||||
(l1Index & (MMU_DESCRIPTOR_L1_SMALL_L2_TABLES_PER_PAGE - 1));
|
||||
/* lookup an existing l2 page table */
|
||||
@@ -493,14 +498,22 @@ STATIC STATUS_T OsGetL2Table(LosArchMmu *archMmu, UINT32 l1Index, paddr_t *ppa)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
/* not found: allocate one (paddr) */
|
||||
vmPage = LOS_PhysPageAlloc();
|
||||
LosVmPage *vmPage = LOS_PhysPageAlloc();
|
||||
if (vmPage == NULL) {
|
||||
VM_ERR("have no memory to save l2 page");
|
||||
return LOS_ERRNO_VM_NO_MEMORY;
|
||||
}
|
||||
LOS_ListAdd(&archMmu->ptList, &vmPage->node);
|
||||
kvaddr = OsVmPageToVaddr(vmPage);
|
||||
#else
|
||||
kvaddr = LOS_MemAlloc(OS_SYS_MEM_ADDR, MMU_DESCRIPTOR_L2_SMALL_SIZE);
|
||||
if (kvaddr == NULL) {
|
||||
VM_ERR("have no memory to save l2 page");
|
||||
return LOS_ERRNO_VM_NO_MEMORY;
|
||||
}
|
||||
#endif
|
||||
(VOID)memset_s(kvaddr, MMU_DESCRIPTOR_L2_SMALL_SIZE, 0, MMU_DESCRIPTOR_L2_SMALL_SIZE);
|
||||
|
||||
/* get physical address */
|
||||
@@ -531,7 +544,7 @@ STATIC UINT32 OsCvtPte2CacheFlagsToMMUFlags(UINT32 flags)
|
||||
|
||||
switch (flags & VM_MAP_REGION_FLAG_CACHE_MASK) {
|
||||
case VM_MAP_REGION_FLAG_CACHED:
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_SHAREABLE;
|
||||
#endif
|
||||
mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_NORMAL_WRITE_BACK_ALLOCATE;
|
||||
@@ -751,29 +764,35 @@ VOID LOS_ArchMmuContextSwitch(LosArchMmu *archMmu)
|
||||
ttbcr |= MMU_DESCRIPTOR_TTBCR_PD0;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
/* from armv7a arm B3.10.4, we should do synchronization changes of ASID and TTBR. */
|
||||
OsArmWriteContextidr(LOS_GetKVmSpace()->archMmu.asid);
|
||||
ISB;
|
||||
#endif
|
||||
OsArmWriteTtbr0(ttbr);
|
||||
ISB;
|
||||
OsArmWriteTtbcr(ttbcr);
|
||||
ISB;
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
if (archMmu) {
|
||||
OsArmWriteContextidr(archMmu->asid);
|
||||
ISB;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
STATUS_T LOS_ArchMmuDestroy(LosArchMmu *archMmu)
|
||||
{
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
LosVmPage *page = NULL;
|
||||
/* free all of the pages allocated in archMmu->ptList */
|
||||
while ((page = LOS_ListRemoveHeadType(&archMmu->ptList, LosVmPage, node)) != NULL) {
|
||||
LOS_PhysPageFree(page);
|
||||
}
|
||||
|
||||
OsArmWriteTlbiasid(archMmu->asid);
|
||||
OsArmWriteTlbiasidis(archMmu->asid);
|
||||
OsFreeAsid(archMmu->asid);
|
||||
#endif
|
||||
(VOID)LOS_MuxDestroy(&archMmu->mtx);
|
||||
return LOS_OK;
|
||||
}
|
||||
@@ -806,38 +825,34 @@ STATIC VOID OsSwitchTmpTTB(VOID)
|
||||
ISB;
|
||||
}
|
||||
|
||||
VADDR_T *OsGFirstTableGet()
|
||||
{
|
||||
return (VADDR_T *)g_firstPageTable;
|
||||
}
|
||||
|
||||
STATIC VOID OsSetKSectionAttr(VOID)
|
||||
STATIC VOID OsSetKSectionAttr(UINTPTR virtAddr, BOOL uncached)
|
||||
{
|
||||
UINT32 offset = virtAddr - KERNEL_VMM_BASE;
|
||||
/* every section should be page aligned */
|
||||
UINTPTR textStart = (UINTPTR)&__text_start;
|
||||
UINTPTR textEnd = (UINTPTR)&__text_end;
|
||||
UINTPTR rodataStart = (UINTPTR)&__rodata_start;
|
||||
UINTPTR rodataEnd = (UINTPTR)&__rodata_end;
|
||||
UINTPTR ramDataStart = (UINTPTR)&__ram_data_start;
|
||||
UINTPTR bssEnd = (UINTPTR)&__bss_end;
|
||||
UINTPTR textStart = (UINTPTR)&__text_start + offset;
|
||||
UINTPTR textEnd = (UINTPTR)&__text_end + offset;
|
||||
UINTPTR rodataStart = (UINTPTR)&__rodata_start + offset;
|
||||
UINTPTR rodataEnd = (UINTPTR)&__rodata_end + offset;
|
||||
UINTPTR ramDataStart = (UINTPTR)&__ram_data_start + offset;
|
||||
UINTPTR bssEnd = (UINTPTR)&__bss_end + offset;
|
||||
UINT32 bssEndBoundary = ROUNDUP(bssEnd, MB);
|
||||
LosArchMmuInitMapping mmuKernelMappings[] = {
|
||||
{
|
||||
.phys = SYS_MEM_BASE + textStart - KERNEL_VMM_BASE,
|
||||
.phys = SYS_MEM_BASE + textStart - virtAddr,
|
||||
.virt = textStart,
|
||||
.size = ROUNDUP(textEnd - textStart, MMU_DESCRIPTOR_L2_SMALL_SIZE),
|
||||
.flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_EXECUTE,
|
||||
.name = "kernel_text"
|
||||
},
|
||||
{
|
||||
.phys = SYS_MEM_BASE + rodataStart - KERNEL_VMM_BASE,
|
||||
.phys = SYS_MEM_BASE + rodataStart - virtAddr,
|
||||
.virt = rodataStart,
|
||||
.size = ROUNDUP(rodataEnd - rodataStart, MMU_DESCRIPTOR_L2_SMALL_SIZE),
|
||||
.flags = VM_MAP_REGION_FLAG_PERM_READ,
|
||||
.name = "kernel_rodata"
|
||||
},
|
||||
{
|
||||
.phys = SYS_MEM_BASE + ramDataStart - KERNEL_VMM_BASE,
|
||||
.phys = SYS_MEM_BASE + ramDataStart - virtAddr,
|
||||
.virt = ramDataStart,
|
||||
.size = ROUNDUP(bssEndBoundary - ramDataStart, MMU_DESCRIPTOR_L2_SMALL_SIZE),
|
||||
.flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE,
|
||||
@@ -847,26 +862,29 @@ STATIC VOID OsSetKSectionAttr(VOID)
|
||||
LosVmSpace *kSpace = LOS_GetKVmSpace();
|
||||
status_t status;
|
||||
UINT32 length;
|
||||
paddr_t oldTtPhyBase;
|
||||
int i;
|
||||
LosArchMmuInitMapping *kernelMap = NULL;
|
||||
UINT32 kmallocLength;
|
||||
UINT32 flags;
|
||||
|
||||
/* use second-level mapping of default READ and WRITE */
|
||||
kSpace->archMmu.virtTtb = (PTE_T *)g_firstPageTable;
|
||||
kSpace->archMmu.physTtb = LOS_PaddrQuery(kSpace->archMmu.virtTtb);
|
||||
status = LOS_ArchMmuUnmap(&kSpace->archMmu, KERNEL_VMM_BASE,
|
||||
(bssEndBoundary - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT);
|
||||
if (status != ((bssEndBoundary - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
status = LOS_ArchMmuUnmap(&kSpace->archMmu, virtAddr,
|
||||
(bssEndBoundary - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT);
|
||||
if (status != ((bssEndBoundary - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
VM_ERR("unmap failed, status: %d", status);
|
||||
return;
|
||||
}
|
||||
|
||||
status = LOS_ArchMmuMap(&kSpace->archMmu, KERNEL_VMM_BASE, SYS_MEM_BASE,
|
||||
(textStart - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
|
||||
VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE |
|
||||
VM_MAP_REGION_FLAG_PERM_EXECUTE);
|
||||
if (status != ((textStart - KERNEL_VMM_BASE) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE | VM_MAP_REGION_FLAG_PERM_EXECUTE;
|
||||
if (uncached) {
|
||||
flags |= VM_MAP_REGION_FLAG_UNCACHED;
|
||||
}
|
||||
status = LOS_ArchMmuMap(&kSpace->archMmu, virtAddr, SYS_MEM_BASE,
|
||||
(textStart - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
|
||||
flags);
|
||||
if (status != ((textStart - virtAddr) >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
VM_ERR("mmap failed, status: %d", status);
|
||||
return;
|
||||
}
|
||||
@@ -874,6 +892,9 @@ STATIC VOID OsSetKSectionAttr(VOID)
|
||||
length = sizeof(mmuKernelMappings) / sizeof(LosArchMmuInitMapping);
|
||||
for (i = 0; i < length; i++) {
|
||||
kernelMap = &mmuKernelMappings[i];
|
||||
if (uncached) {
|
||||
kernelMap->flags |= VM_MAP_REGION_FLAG_UNCACHED;
|
||||
}
|
||||
status = LOS_ArchMmuMap(&kSpace->archMmu, kernelMap->virt, kernelMap->phys,
|
||||
kernelMap->size >> MMU_DESCRIPTOR_L2_SMALL_SHIFT, kernelMap->flags);
|
||||
if (status != (kernelMap->size >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
@@ -883,16 +904,29 @@ STATIC VOID OsSetKSectionAttr(VOID)
|
||||
LOS_VmSpaceReserve(kSpace, kernelMap->size, kernelMap->virt);
|
||||
}
|
||||
|
||||
kmallocLength = KERNEL_VMM_BASE + SYS_MEM_SIZE_DEFAULT - bssEndBoundary;
|
||||
kmallocLength = virtAddr + SYS_MEM_SIZE_DEFAULT - bssEndBoundary;
|
||||
flags = VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE;
|
||||
if (uncached) {
|
||||
flags |= VM_MAP_REGION_FLAG_UNCACHED;
|
||||
}
|
||||
status = LOS_ArchMmuMap(&kSpace->archMmu, bssEndBoundary,
|
||||
SYS_MEM_BASE + bssEndBoundary - KERNEL_VMM_BASE,
|
||||
kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
|
||||
VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE);
|
||||
SYS_MEM_BASE + bssEndBoundary - virtAddr,
|
||||
kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT,
|
||||
flags);
|
||||
if (status != (kmallocLength >> MMU_DESCRIPTOR_L2_SMALL_SHIFT)) {
|
||||
VM_ERR("mmap failed, status: %d", status);
|
||||
return;
|
||||
}
|
||||
LOS_VmSpaceReserve(kSpace, kmallocLength, bssEndBoundary);
|
||||
}
|
||||
|
||||
STATIC VOID OsKSectionNewAttrEnable(VOID)
|
||||
{
|
||||
LosVmSpace *kSpace = LOS_GetKVmSpace();
|
||||
paddr_t oldTtPhyBase;
|
||||
|
||||
kSpace->archMmu.virtTtb = (PTE_T *)g_firstPageTable;
|
||||
kSpace->archMmu.physTtb = LOS_PaddrQuery(kSpace->archMmu.virtTtb);
|
||||
|
||||
/* we need free tmp ttbase */
|
||||
oldTtPhyBase = OsArmReadTtbr0();
|
||||
@@ -926,14 +960,10 @@ VOID OsInitMappingStartUp(VOID)
|
||||
|
||||
OsSwitchTmpTTB();
|
||||
|
||||
OsSetKSectionAttr();
|
||||
|
||||
OsArchMmuInitPerCPU();
|
||||
OsSetKSectionAttr(KERNEL_VMM_BASE, FALSE);
|
||||
OsSetKSectionAttr(UNCACHED_VMM_BASE, TRUE);
|
||||
OsKSectionNewAttrEnable();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
@@ -39,11 +39,8 @@
|
||||
#include "los_spinlock.h"
|
||||
#include "los_mmu_descriptor_v6.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
|
||||
STATIC SPIN_LOCK_INIT(g_cpuAsidLock);
|
||||
STATIC UINTPTR g_asidPool[BITMAP_NUM_WORDS(1UL << MMU_ARM_ASID_BITS)];
|
||||
@@ -72,9 +69,5 @@ VOID OsFreeAsid(UINT32 asid)
|
||||
LOS_BitmapClrNBits(g_asidPool, asid, 1);
|
||||
LOS_SpinUnlockRestore(&g_cpuAsidLock, flags);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
147
arch/arm/arm/src/los_dispatch.S
Executable file → Normal file
147
arch/arm/arm/src/los_dispatch.S
Executable file → Normal file
@@ -32,6 +32,7 @@
|
||||
#include "asm.h"
|
||||
#include "arch_config.h"
|
||||
|
||||
.extern OsSaveSignalContext
|
||||
.extern OsSchedToUserReleaseLock
|
||||
.global OsTaskSchedule
|
||||
.global OsTaskContextLoad
|
||||
@@ -85,17 +86,16 @@
|
||||
*/
|
||||
OsTaskSchedule:
|
||||
MRS R2, CPSR
|
||||
STMFD SP!, {LR}
|
||||
STMFD SP!, {LR}
|
||||
/* jump sp */
|
||||
SUB SP, SP, #4
|
||||
|
||||
/* push r0-r12*/
|
||||
STMFD SP!, {R0-R12}
|
||||
STMFD SP!, {R2}
|
||||
STMFD SP!, {LR}
|
||||
STMFD SP!, {LR}
|
||||
STMFD SP!, {R12}
|
||||
|
||||
/* 8 bytes stack align */
|
||||
SUB SP, SP, #4
|
||||
/* jump R0 - R3 USP, ULR reserved */
|
||||
SUB SP, SP, #(8 * 4)
|
||||
|
||||
/* push R4 - R11*/
|
||||
STMFD SP!, {R4-R11}
|
||||
|
||||
/* save fpu registers */
|
||||
PUSH_FPU_REGS R2
|
||||
@@ -113,131 +113,88 @@ OsTaskContextLoad:
|
||||
/* restore fpu registers */
|
||||
POP_FPU_REGS R2
|
||||
|
||||
/* 8 bytes stack align */
|
||||
ADD SP, SP, #4
|
||||
|
||||
LDMFD SP!, {R0}
|
||||
MOV R4, R0
|
||||
AND R0, R0, #CPSR_MASK_MODE
|
||||
LDMFD SP!, {R4-R11}
|
||||
LDR R3, [SP, #(11 * 4)]
|
||||
AND R0, R3, #CPSR_MASK_MODE
|
||||
CMP R0, #CPSR_USER_MODE
|
||||
BNE OsKernelTaskLoad
|
||||
|
||||
MVN R2, #CPSR_INT_DISABLE
|
||||
AND R3, R3, R2
|
||||
STR R3, [SP, #(11 * 4)]
|
||||
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
/* 8 bytes stack align */
|
||||
SUB SP, SP, #4
|
||||
BL OsSchedToUserReleaseLock
|
||||
ADD SP, SP, #4
|
||||
#endif
|
||||
|
||||
MVN R3, #CPSR_INT_DISABLE
|
||||
AND R4, R4, R3
|
||||
MSR SPSR_cxsf, R4
|
||||
|
||||
/* restore r0-r12, lr */
|
||||
LDMFD SP!, {R0-R12}
|
||||
/* jump sp, reserved */
|
||||
ADD SP, SP, #(2 * 4)
|
||||
LDMFD SP, {R13, R14}^
|
||||
ADD SP, SP, #(2 * 4)
|
||||
LDMFD SP!, {PC}^
|
||||
LDMFD SP!, {R0-R3, R12, LR}
|
||||
RFEIA SP!
|
||||
|
||||
OsKernelTaskLoad:
|
||||
MSR SPSR_cxsf, R4
|
||||
/* restore r0-r12, lr */
|
||||
LDMFD SP!, {R0-R12}
|
||||
ADD SP, SP, #4
|
||||
LDMFD SP!, {LR, PC}^
|
||||
ADD SP, SP, #(4 * 4)
|
||||
LDMFD SP!, {R0-R3, R12, LR}
|
||||
RFEIA SP!
|
||||
|
||||
OsIrqHandler:
|
||||
SUB LR, LR, #4
|
||||
|
||||
/* push r0-r3 to irq stack */
|
||||
STMFD SP, {R0-R3}
|
||||
SUB R0, SP, #(4 * 4)
|
||||
MRS R1, SPSR
|
||||
MOV R2, LR
|
||||
|
||||
/* Save pc and cpsr to svc sp, ARMv6 and above support */
|
||||
SRSFD #0x13!
|
||||
/* disable irq, switch to svc mode */
|
||||
CPSID i, #0x13
|
||||
|
||||
/* push spsr and pc in svc stack */
|
||||
STMFD SP!, {R1, R2}
|
||||
STMFD SP, {LR}
|
||||
|
||||
AND R3, R1, #CPSR_MASK_MODE
|
||||
CMP R3, #CPSR_USER_MODE
|
||||
BNE OsIrqFromKernel
|
||||
|
||||
/* push user sp, lr in svc stack */
|
||||
STMFD SP!, {R0-R3, R12, LR}
|
||||
STMFD SP, {R13, R14}^
|
||||
|
||||
OsIrqFromKernel:
|
||||
/* from svc not need save sp and lr */
|
||||
SUB SP, SP, #(2 * 4)
|
||||
|
||||
/* pop r0-r3 form irq stack*/
|
||||
LDMFD R0, {R0-R3}
|
||||
|
||||
/* push caller saved regs as trashed regs in svc stack */
|
||||
STMFD SP!, {R0-R3, R12}
|
||||
|
||||
/* 8 bytes stack align */
|
||||
SUB SP, SP, #4
|
||||
SUB SP, SP, #(4 * 4)
|
||||
STR R4, [SP, #0]
|
||||
|
||||
/*
|
||||
* save fpu regs in case in case those been
|
||||
* altered in interrupt handlers.
|
||||
*/
|
||||
PUSH_FPU_REGS R0
|
||||
#ifdef LOSCFG_IRQ_USE_STANDALONE_STACK
|
||||
PUSH {R4}
|
||||
|
||||
MOV R4, SP
|
||||
EXC_SP_SET __svc_stack_top, OS_EXC_SVC_STACK_SIZE, R1, R2
|
||||
#endif
|
||||
|
||||
BLX HalIrqHandler
|
||||
|
||||
#ifdef LOSCFG_IRQ_USE_STANDALONE_STACK
|
||||
MOV SP, R4
|
||||
POP {R4}
|
||||
#endif
|
||||
|
||||
/* process pending signals */
|
||||
BL OsTaskProcSignal
|
||||
|
||||
BL OsSchedIrqEndCheckNeedSched
|
||||
|
||||
MOV R0,SP
|
||||
MOV R1,R7
|
||||
BL OsSaveSignalContextIrq
|
||||
BLX OsTaskProcSignal
|
||||
BLX OsSchedIrqEndCheckNeedSched
|
||||
|
||||
/* restore fpu regs */
|
||||
POP_FPU_REGS R0
|
||||
POP_FPU_REGS R0
|
||||
LDR R4, [SP, #0]
|
||||
|
||||
ADD SP, SP, #4
|
||||
|
||||
OsIrqContextRestore:
|
||||
LDR R0, [SP, #(4 * 7)]
|
||||
MSR SPSR_cxsf, R0
|
||||
AND R0, R0, #CPSR_MASK_MODE
|
||||
CMP R0, #CPSR_USER_MODE
|
||||
|
||||
LDMFD SP!, {R0-R3, R12}
|
||||
|
||||
BNE OsIrqContextRestoreToKernel
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
/* Obtain the CPSR to determine the mode the system is in when the interrupt is triggered */
|
||||
LDR R3, [SP, #(11 * 4)]
|
||||
AND R1, R3, #CPSR_MASK_MODE
|
||||
CMP R1, #CPSR_USER_MODE
|
||||
BNE 1f
|
||||
|
||||
MOV R0, SP
|
||||
STR R7, [SP, #0]
|
||||
/* sp - sizeof(IrqContext) */
|
||||
SUB SP, SP, #(12 * 4)
|
||||
MOV R1, SP
|
||||
BLX OsSaveSignalContext
|
||||
MOV SP, R0
|
||||
1:
|
||||
#endif
|
||||
ADD SP, SP, #(2 * 4)
|
||||
/* load user sp and lr, and jump cpsr */
|
||||
LDMFD SP, {R13, R14}^
|
||||
ADD SP, SP, #(3 * 4)
|
||||
|
||||
/* return to user mode */
|
||||
LDMFD SP!, {PC}^
|
||||
|
||||
OsIrqContextRestoreToKernel:
|
||||
/* svc mode not load sp */
|
||||
ADD SP, SP, #4
|
||||
LDMFD SP!, {LR}
|
||||
/* jump cpsr and return to svc mode */
|
||||
ADD SP, SP, #4
|
||||
LDMFD SP!, {PC}^
|
||||
ADD SP, SP, #(2 * 4)
|
||||
LDMFD SP!, {R0-R3, R12, LR}
|
||||
RFEIA SP!
|
||||
|
||||
FUNCTION(ArchSpinLock)
|
||||
mov r1, #1
|
||||
|
||||
304
arch/arm/arm/src/los_exc.c
Executable file → Normal file
304
arch/arm/arm/src/los_exc.c
Executable file → Normal file
@@ -34,14 +34,10 @@
|
||||
#include "los_printf_pri.h"
|
||||
#include "los_task_pri.h"
|
||||
#include "los_hw_pri.h"
|
||||
#ifdef LOSCFG_SHELL_EXCINFO
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
#include "los_excinfo_pri.h"
|
||||
#endif
|
||||
#ifdef LOSCFG_EXC_INTERACTION
|
||||
#include "los_exc_interaction_pri.h"
|
||||
#endif
|
||||
#include "los_sys_stack_pri.h"
|
||||
#include "los_stackinfo_pri.h"
|
||||
#ifdef LOSCFG_COREDUMP
|
||||
#include "los_coredump.h"
|
||||
#endif
|
||||
@@ -55,7 +51,9 @@
|
||||
#include "los_vm_phys.h"
|
||||
#include "los_vm_fault.h"
|
||||
#include "los_vm_common.h"
|
||||
#ifdef LOSCFG_KERNEL_DYNLOAD
|
||||
#include "los_load_elf.h"
|
||||
#endif
|
||||
#include "arm.h"
|
||||
#include "los_bitmap.h"
|
||||
#include "los_process_pri.h"
|
||||
@@ -63,12 +61,10 @@
|
||||
#ifdef LOSCFG_FS_VFS
|
||||
#include "console.h"
|
||||
#endif
|
||||
#ifdef LOSCFG_BLACKBOX
|
||||
#include "los_blackbox.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define INVALID_CPUID 0xFFFF
|
||||
#define OS_EXC_VMM_NO_REGION 0x0U
|
||||
@@ -81,7 +77,7 @@ VOID OsExcHook(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr);
|
||||
UINT32 g_curNestCount[LOSCFG_KERNEL_CORE_NUM] = { 0 };
|
||||
BOOL g_excFromUserMode[LOSCFG_KERNEL_CORE_NUM];
|
||||
STATIC EXC_PROC_FUNC g_excHook = (EXC_PROC_FUNC)OsExcHook;
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
STATIC SPIN_LOCK_INIT(g_excSerializerSpin);
|
||||
STATIC UINT32 g_currHandleExcPID = OS_INVALID_VALUE;
|
||||
STATIC UINT32 g_nextExcWaitCpu = INVALID_CPUID;
|
||||
@@ -107,11 +103,7 @@ STATIC UINT32 g_nextExcWaitCpu = INVALID_CPUID;
|
||||
(IS_ALIGNED((ptr), sizeof(CHAR *))))
|
||||
|
||||
STATIC const StackInfo g_excStack[] = {
|
||||
{ &__undef_stack, OS_EXC_UNDEF_STACK_SIZE, "udf_stack" },
|
||||
{ &__abt_stack, OS_EXC_ABT_STACK_SIZE, "abt_stack" },
|
||||
{ &__fiq_stack, OS_EXC_FIQ_STACK_SIZE, "fiq_stack" },
|
||||
{ &__svc_stack, OS_EXC_SVC_STACK_SIZE, "svc_stack" },
|
||||
{ &__irq_stack, OS_EXC_IRQ_STACK_SIZE, "irq_stack" },
|
||||
{ &__exc_stack, OS_EXC_STACK_SIZE, "exc_stack" }
|
||||
};
|
||||
|
||||
@@ -185,20 +177,32 @@ STATIC INT32 OsDecodeDataFSR(UINT32 regDFSR)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
UINT32 OsArmSharedPageFault(UINT32 excType, ExcContext *frame, UINT32 far, UINT32 fsr)
|
||||
{
|
||||
PRINT_INFO("page fault entry!!!\n");
|
||||
BOOL instruction_fault = FALSE;
|
||||
BOOL instructionFault = FALSE;
|
||||
UINT32 pfFlags = 0;
|
||||
UINT32 fsrFlag;
|
||||
BOOL write = FALSE;
|
||||
UINT32 ret;
|
||||
|
||||
PRINT_INFO("page fault entry!!!\n");
|
||||
if (OsGetSystemStatus() == OS_SYSTEM_EXC_CURR_CPU) {
|
||||
return LOS_ERRNO_VM_NOT_FOUND;
|
||||
}
|
||||
|
||||
#if defined(LOSCFG_KERNEL_SMP) && defined(LOSCFG_DEBUG_VERSION)
|
||||
BOOL irqEnable = !(LOS_SpinHeld(&g_taskSpin) && (OsPercpuGet()->taskLockCnt != 0));
|
||||
if (irqEnable) {
|
||||
ArchIrqEnable();
|
||||
} else {
|
||||
PrintExcInfo("[ERR][%s] may be held scheduler lock when entering [%s] on cpu [%u]\n",
|
||||
OsCurrTaskGet()->taskName, __FUNCTION__, ArchCurrCpuid());
|
||||
}
|
||||
#else
|
||||
ArchIrqEnable();
|
||||
#endif
|
||||
if (excType == OS_EXCEPT_PREFETCH_ABORT) {
|
||||
instruction_fault = TRUE;
|
||||
instructionFault = TRUE;
|
||||
} else {
|
||||
write = !!BIT_GET(fsr, WNR_BIT);
|
||||
}
|
||||
@@ -216,14 +220,28 @@ UINT32 OsArmSharedPageFault(UINT32 excType, ExcContext *frame, UINT32 far, UINT3
|
||||
BOOL user = (frame->regCPSR & CPSR_MODE_MASK) == CPSR_MODE_USR;
|
||||
pfFlags |= write ? VM_MAP_PF_FLAG_WRITE : 0;
|
||||
pfFlags |= user ? VM_MAP_PF_FLAG_USER : 0;
|
||||
pfFlags |= instruction_fault ? VM_MAP_PF_FLAG_INSTRUCTION : 0;
|
||||
pfFlags |= instructionFault ? VM_MAP_PF_FLAG_INSTRUCTION : 0;
|
||||
pfFlags |= VM_MAP_PF_FLAG_NOT_PRESENT;
|
||||
return OsVmPageFaultHandler(far, pfFlags, frame);
|
||||
OsSigIntLock();
|
||||
ret = OsVmPageFaultHandler(far, pfFlags, frame);
|
||||
OsSigIntUnlock();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return LOS_ERRNO_VM_NOT_FOUND;
|
||||
OsArmWriteTlbimvaais(ROUNDDOWN(far, PAGE_SIZE));
|
||||
ret = LOS_OK;
|
||||
break;
|
||||
}
|
||||
#if defined(LOSCFG_KERNEL_SMP) && defined(LOSCFG_DEBUG_VERSION)
|
||||
if (irqEnable) {
|
||||
ArchIrqDisable();
|
||||
}
|
||||
#else
|
||||
ArchIrqDisable();
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
STATIC VOID OsExcType(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr)
|
||||
{
|
||||
@@ -256,10 +274,11 @@ STATIC const CHAR *g_excTypeString[] = {
|
||||
"irq"
|
||||
};
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
STATIC VADDR_T OsGetTextRegionBase(LosVmMapRegion *region, LosProcessCB *runProcess)
|
||||
{
|
||||
struct file *curFilep = NULL;
|
||||
struct file *lastFilep = NULL;
|
||||
struct Vnode *curVnode = NULL;
|
||||
struct Vnode *lastVnode = NULL;
|
||||
LosVmMapRegion *curRegion = NULL;
|
||||
LosVmMapRegion *lastRegion = NULL;
|
||||
|
||||
@@ -278,46 +297,57 @@ STATIC VADDR_T OsGetTextRegionBase(LosVmMapRegion *region, LosProcessCB *runProc
|
||||
if ((lastRegion == NULL) || !LOS_IsRegionFileValid(lastRegion)) {
|
||||
goto DONE;
|
||||
}
|
||||
curFilep = curRegion->unTypeData.rf.file;
|
||||
lastFilep = lastRegion->unTypeData.rf.file;
|
||||
} while (!strcmp(curFilep->f_path, lastFilep->f_path));
|
||||
curVnode = curRegion->unTypeData.rf.vnode;
|
||||
lastVnode = lastRegion->unTypeData.rf.vnode;
|
||||
} while (curVnode == lastVnode);
|
||||
|
||||
DONE:
|
||||
#ifdef LOSCFG_KERNEL_DYNLOAD
|
||||
if (curRegion->range.base == EXEC_MMAP_BASE) {
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
return curRegion->range.base;
|
||||
}
|
||||
#endif
|
||||
|
||||
STATIC VOID OsExcSysInfo(UINT32 excType, const ExcContext *excBufAddr)
|
||||
{
|
||||
LosTaskCB *runTask = OsCurrTaskGet();
|
||||
LosProcessCB *runProcess = OsCurrProcessGet();
|
||||
LosVmMapRegion *region = NULL;
|
||||
|
||||
PrintExcInfo("excType: %s\n"
|
||||
"processName = %s\n"
|
||||
"processID = %u\n"
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
"process aspace = 0x%08x -> 0x%08x\n"
|
||||
#endif
|
||||
"taskName = %s\n"
|
||||
"taskID = %u\n",
|
||||
g_excTypeString[excType],
|
||||
runProcess->processName,
|
||||
runProcess->processID,
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
runProcess->vmSpace->base,
|
||||
runProcess->vmSpace->base + runProcess->vmSpace->size,
|
||||
#endif
|
||||
runTask->taskName,
|
||||
runTask->taskID);
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
if (OsProcessIsUserMode(runProcess)) {
|
||||
PrintExcInfo("task user stack = 0x%08x -> 0x%08x\n",
|
||||
runTask->userMapBase, runTask->userMapBase + runTask->userMapSize);
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
PrintExcInfo("task kernel stack = 0x%08x -> 0x%08x\n",
|
||||
runTask->topOfStack, runTask->topOfStack + runTask->stackSize);
|
||||
}
|
||||
|
||||
PrintExcInfo("pc = 0x%x ", excBufAddr->PC);
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
LosVmMapRegion *region = NULL;
|
||||
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
|
||||
if (LOS_IsUserAddress((vaddr_t)excBufAddr->PC)) {
|
||||
region = LOS_RegionFind(runProcess->vmSpace, (VADDR_T)excBufAddr->PC);
|
||||
@@ -334,7 +364,9 @@ STATIC VOID OsExcSysInfo(UINT32 excType, const ExcContext *excBufAddr)
|
||||
(VADDR_T)excBufAddr->ULR - OsGetTextRegionBase(region, runProcess));
|
||||
}
|
||||
PrintExcInfo("\nusp = 0x%x", excBufAddr->USP);
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
PrintExcInfo("\nklr = 0x%x\n"
|
||||
"ksp = 0x%x\n",
|
||||
excBufAddr->LR,
|
||||
@@ -386,6 +418,7 @@ EXC_PROC_FUNC OsExcRegHookGet(VOID)
|
||||
return g_excHook;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
STATIC VOID OsDumpExcVaddrRegion(LosVmSpace *space, LosVmMapRegion *region)
|
||||
{
|
||||
INT32 i, numPages, pageCount;
|
||||
@@ -471,6 +504,7 @@ STATIC VOID OsDumpProcessUsedMemNode(UINT16 vmmFalgs)
|
||||
OsDumpProcessUsedMemRegion(runProcess, runspace, vmmFalgs);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID OsDumpContextMem(const ExcContext *excBufAddr)
|
||||
{
|
||||
@@ -493,31 +527,31 @@ VOID OsDumpContextMem(const ExcContext *excBufAddr)
|
||||
}
|
||||
}
|
||||
|
||||
STATIC VOID OsExcRestore(UINTPTR taskStackPointer)
|
||||
STATIC VOID OsExcRestore(VOID)
|
||||
{
|
||||
UINT32 currCpuID = ArchCurrCpuid();
|
||||
|
||||
g_excFromUserMode[currCpuID] = FALSE;
|
||||
g_intCount[currCpuID] = 0;
|
||||
g_curNestCount[currCpuID] = 0;
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
OsPercpuGet()->excFlag = CPU_RUNNING;
|
||||
#endif
|
||||
OsPercpuGet()->taskLockCnt = 0;
|
||||
|
||||
OsSetCurrCpuSp(taskStackPointer);
|
||||
}
|
||||
|
||||
STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
|
||||
{
|
||||
UINT32 intSave;
|
||||
UINT32 currCpu = ArchCurrCpuid();
|
||||
LosTaskCB *runTask = OsCurrTaskGet();
|
||||
LosProcessCB *runProcess = OsCurrProcessGet();
|
||||
|
||||
if (g_excFromUserMode[ArchCurrCpuid()] == FALSE) {
|
||||
return;
|
||||
}
|
||||
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
LOS_SpinLock(&g_excSerializerSpin);
|
||||
if (g_nextExcWaitCpu != INVALID_CPUID) {
|
||||
g_currHandleExcCpuID = g_nextExcWaitCpu;
|
||||
@@ -532,21 +566,37 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
|
||||
#endif
|
||||
runProcess->processStatus &= ~OS_PROCESS_FLAG_EXIT;
|
||||
|
||||
OsExcRestore(excBufAddr->SP);
|
||||
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
#ifdef LOSCFG_FS_VFS
|
||||
OsWakeConsoleSendTask();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_SHELL_EXCINFO
|
||||
#ifdef LOSCFG_BLACKBOX
|
||||
BBoxNotifyError("USER_CRASH", MODULE_SYSTEM, "Crash in user", 0);
|
||||
#endif
|
||||
SCHEDULER_LOCK(intSave);
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
OsProcessExitCodeCoreDumpSet(runProcess);
|
||||
#endif
|
||||
OsProcessExitCodeSignalSet(runProcess, SIGUSR2);
|
||||
|
||||
/* kill user exc process */
|
||||
LOS_Exit(OS_PRO_EXIT_OK);
|
||||
/* An exception was raised by a task that is not the current main thread during the exit process of
|
||||
* the current process.
|
||||
*/
|
||||
if ((runProcess->processStatus & OS_PROCESS_FLAG_EXIT) && (runProcess->threadGroupID != runTask->taskID)) {
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
/* Exception handling All operations should be kept prior to that operation */
|
||||
OsExcRestore();
|
||||
OsTaskToExit(runTask, OS_PRO_EXIT_OK);
|
||||
} else {
|
||||
SCHEDULER_UNLOCK(intSave);
|
||||
|
||||
/* Exception handling All operations should be kept prior to that operation */
|
||||
OsExcRestore();
|
||||
/* kill user exc process */
|
||||
LOS_Exit(OS_PRO_EXIT_OK);
|
||||
}
|
||||
|
||||
/* User mode exception handling failed , which normally does not exist */
|
||||
g_curNestCount[currCpu]++;
|
||||
@@ -557,18 +607,17 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr)
|
||||
/* this function is used to validate fp or validate the checking range start and end. */
|
||||
STATIC INLINE BOOL IsValidFP(UINTPTR regFP, UINTPTR start, UINTPTR end, vaddr_t *vaddr)
|
||||
{
|
||||
LosProcessCB *runProcess = NULL;
|
||||
LosVmSpace *runspace = NULL;
|
||||
VADDR_T kvaddr = regFP;
|
||||
PADDR_T paddr;
|
||||
|
||||
if (!((regFP > start) && (regFP < end) && IS_ALIGNED(regFP, sizeof(CHAR *)))) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
PADDR_T paddr;
|
||||
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
|
||||
runProcess = OsCurrProcessGet();
|
||||
runspace = runProcess->vmSpace;
|
||||
LosProcessCB *runProcess = OsCurrProcessGet();
|
||||
LosVmSpace *runspace = runProcess->vmSpace;
|
||||
if (runspace == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -579,6 +628,7 @@ STATIC INLINE BOOL IsValidFP(UINTPTR regFP, UINTPTR start, UINTPTR end, vaddr_t
|
||||
|
||||
kvaddr = (PADDR_T)(UINTPTR)LOS_PaddrToKVaddr(paddr);
|
||||
}
|
||||
#endif
|
||||
if (vaddr != NULL) {
|
||||
*vaddr = kvaddr;
|
||||
}
|
||||
@@ -647,8 +697,10 @@ VOID BackTraceSub(UINTPTR regFP)
|
||||
UINTPTR stackStart, stackEnd;
|
||||
UINTPTR backFP = regFP;
|
||||
UINT32 count = 0;
|
||||
LosVmMapRegion *region = NULL;
|
||||
VADDR_T kvaddr;
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
LosProcessCB *runProcess = OsCurrProcessGet();
|
||||
#endif
|
||||
|
||||
if (FindSuitableStack(regFP, &stackStart, &stackEnd, &kvaddr) == FALSE) {
|
||||
PrintExcInfo("traceback error fp = 0x%x\n", regFP);
|
||||
@@ -669,20 +721,34 @@ VOID BackTraceSub(UINTPTR regFP)
|
||||
|
||||
while (IsValidFP(backFP, stackStart, stackEnd, &kvaddr) == TRUE) {
|
||||
tmpFP = backFP;
|
||||
#ifdef LOSCFG_COMPILER_CLANG_LLVM
|
||||
backFP = *(UINTPTR *)(UINTPTR)kvaddr;
|
||||
if (IsValidFP(tmpFP + POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
|
||||
PrintExcInfo("traceback backLR check failed, backLP: 0x%x\n", tmpFP + POINTER_SIZE);
|
||||
return;
|
||||
}
|
||||
backLR = *(UINTPTR *)(UINTPTR)kvaddr;
|
||||
#else
|
||||
backLR = *(UINTPTR *)(UINTPTR)kvaddr;
|
||||
if (IsValidFP(tmpFP - POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
|
||||
PrintExcInfo("traceback backFP check failed, backFP: 0x%x\n", tmpFP - POINTER_SIZE);
|
||||
return;
|
||||
}
|
||||
backFP = *(UINTPTR *)(UINTPTR)kvaddr;
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
LosVmMapRegion *region = NULL;
|
||||
if (LOS_IsUserAddress((VADDR_T)backLR) == TRUE) {
|
||||
region = LOS_RegionFind(OsCurrProcessGet()->vmSpace, (VADDR_T)backLR);
|
||||
region = LOS_RegionFind(runProcess->vmSpace, (VADDR_T)backLR);
|
||||
}
|
||||
if (region != NULL) {
|
||||
PrintExcInfo("traceback %u -- lr = 0x%x fp = 0x%x lr in %s --> 0x%x\n", count, backLR, backFP,
|
||||
OsGetRegionNameOrFilePath(region), backLR - region->range.base);
|
||||
OsGetRegionNameOrFilePath(region),
|
||||
backLR - OsGetTextRegionBase(region, runProcess));
|
||||
region = NULL;
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
PrintExcInfo("traceback %u -- lr = 0x%x fp = 0x%x\n", count, backLR, backFP);
|
||||
}
|
||||
count++;
|
||||
@@ -717,8 +783,9 @@ VOID OsExcHook(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr)
|
||||
#ifndef LOSCFG_DEBUG_VERSION
|
||||
if (g_excFromUserMode[ArchCurrCpuid()] != TRUE) {
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
OsDumpProcessUsedMemNode(OS_EXC_VMM_NO_REGION);
|
||||
|
||||
#endif
|
||||
OsExcStackInfo();
|
||||
#ifndef LOSCFG_DEBUG_VERSION
|
||||
}
|
||||
@@ -778,7 +845,7 @@ VOID OsTaskBackTrace(UINT32 taskID)
|
||||
}
|
||||
PRINTK("TaskName = %s\n", taskCB->taskName);
|
||||
PRINTK("TaskID = 0x%x\n", taskCB->taskID);
|
||||
BackTrace(((TaskContext *)(taskCB->stackPointer))->R[11]); /* R11 : FP */
|
||||
BackTrace(((TaskContext *)(taskCB->stackPointer))->R11); /* R11 : FP */
|
||||
}
|
||||
|
||||
VOID OsBackTrace(VOID)
|
||||
@@ -848,7 +915,7 @@ VOID OsDataAbortExcHandleEntry(ExcContext *excBufAddr)
|
||||
#endif /* __LINUX_ARM_ARCH__ */
|
||||
#endif /* LOSCFG_GDB */
|
||||
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
#define EXC_WAIT_INTER 50U
|
||||
#define EXC_WAIT_TIME 2000U
|
||||
|
||||
@@ -897,7 +964,6 @@ STATIC VOID WaitAllCpuStop(UINT32 cpuID)
|
||||
|
||||
STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuID)
|
||||
{
|
||||
OsProcessSuspendAllTask();
|
||||
while (1) {
|
||||
LOS_SpinLock(&g_excSerializerSpin);
|
||||
if ((g_currHandleExcCpuID == INVALID_CPUID) || (g_currHandleExcCpuID == currCpuID)) {
|
||||
@@ -915,7 +981,7 @@ STATIC VOID OsWaitOtherCoresHandleExcEnd(UINT32 currCpuID)
|
||||
}
|
||||
}
|
||||
|
||||
STATIC VOID OsCheckAllCpuStatus(UINTPTR taskStackPointer)
|
||||
STATIC VOID OsCheckAllCpuStatus(VOID)
|
||||
{
|
||||
UINT32 currCpuID = ArchCurrCpuid();
|
||||
UINT32 ret, target;
|
||||
@@ -924,28 +990,32 @@ STATIC VOID OsCheckAllCpuStatus(UINTPTR taskStackPointer)
|
||||
LOCKDEP_CLEAR_LOCKS();
|
||||
|
||||
LOS_SpinLock(&g_excSerializerSpin);
|
||||
/* Only the current nuclear anomaly */
|
||||
if (g_currHandleExcCpuID == INVALID_CPUID) {
|
||||
g_currHandleExcCpuID = currCpuID;
|
||||
g_currHandleExcPID = OsCurrProcessGet()->processID;
|
||||
LOS_SpinUnlock(&g_excSerializerSpin);
|
||||
#ifndef LOSCFG_SAVE_EXCINFO
|
||||
if (g_excFromUserMode[currCpuID] == FALSE) {
|
||||
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuID));
|
||||
HalIrqSendIpi(target, LOS_MP_IPI_HALT);
|
||||
}
|
||||
#endif
|
||||
} else if (g_excFromUserMode[currCpuID] == TRUE) {
|
||||
/* Both cores raise exceptions, and the current core is a user-mode exception.
|
||||
* Both cores are abnormal and come from the same process
|
||||
*/
|
||||
if (OsCurrProcessGet()->processID == g_currHandleExcPID) {
|
||||
LOS_SpinUnlock(&g_excSerializerSpin);
|
||||
OsExcRestore(taskStackPointer);
|
||||
while (1) {
|
||||
ret = LOS_TaskSuspend(OsCurrTaskGet()->taskID);
|
||||
PrintExcInfo("%s supend task :%u failed: 0x%x\n", __FUNCTION__, OsCurrTaskGet()->taskID, ret);
|
||||
}
|
||||
OsExcRestore();
|
||||
ret = LOS_TaskDelete(OsCurrTaskGet()->taskID);
|
||||
LOS_Panic("%s supend task :%u failed: 0x%x\n", __FUNCTION__, OsCurrTaskGet()->taskID, ret);
|
||||
}
|
||||
LOS_SpinUnlock(&g_excSerializerSpin);
|
||||
|
||||
OsWaitOtherCoresHandleExcEnd(currCpuID);
|
||||
} else {
|
||||
if (g_excFromUserMode[g_currHandleExcCpuID] == TRUE) {
|
||||
if ((g_currHandleExcCpuID < LOSCFG_KERNEL_CORE_NUM) && (g_excFromUserMode[g_currHandleExcCpuID] == TRUE)) {
|
||||
g_currHandleExcCpuID = currCpuID;
|
||||
LOS_SpinUnlock(&g_excSerializerSpin);
|
||||
target = (UINT32)(OS_MP_CPU_ALL & ~CPUID_TO_AFFI_MASK(currCpuID));
|
||||
@@ -955,30 +1025,26 @@ STATIC VOID OsCheckAllCpuStatus(UINTPTR taskStackPointer)
|
||||
while (1) {}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef LOSCFG_SAVE_EXCINFO
|
||||
/* use halt ipi to stop other active cores */
|
||||
if (g_excFromUserMode[ArchCurrCpuid()] == FALSE) {
|
||||
WaitAllCpuStop(currCpuID);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
STATIC VOID OsCheckCpuStatus(UINTPTR taskStackPointer)
|
||||
STATIC VOID OsCheckCpuStatus(VOID)
|
||||
{
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
OsCheckAllCpuStatus(taskStackPointer);
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
OsCheckAllCpuStatus();
|
||||
#else
|
||||
(VOID)taskStackPointer;
|
||||
g_currHandleExcCpuID = ArchCurrCpuid();
|
||||
#endif
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr)
|
||||
{
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
UINT16 runCount;
|
||||
#endif
|
||||
|
||||
if ((excBufAddr->regCPSR & CPSR_MASK_MODE) == CPSR_USER_MODE) {
|
||||
g_minAddr = USER_ASPACE_BASE;
|
||||
g_maxAddr = USER_ASPACE_BASE + USER_ASPACE_SIZE;
|
||||
@@ -989,25 +1055,9 @@ LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr)
|
||||
g_excFromUserMode[ArchCurrCpuid()] = FALSE;
|
||||
}
|
||||
|
||||
OsCheckCpuStatus(excBufAddr->SP);
|
||||
OsCheckCpuStatus();
|
||||
|
||||
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
|
||||
while (1) {
|
||||
OsProcessSuspendAllTask();
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
LOS_SpinLock(&g_taskSpin);
|
||||
runCount = OS_PROCESS_GET_RUNTASK_COUNT(OsCurrProcessGet()->processStatus);
|
||||
LOS_SpinUnlock(&g_taskSpin);
|
||||
if (runCount == 1) {
|
||||
break;
|
||||
}
|
||||
#else
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
#ifdef LOSCFG_FS_VFS
|
||||
/* Wait for the end of the Console task to avoid multicore printing code */
|
||||
OsWaitConsoleSendTaskPend(OsCurrTaskGet()->taskID);
|
||||
@@ -1017,26 +1067,45 @@ LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr)
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far)
|
||||
{
|
||||
#ifdef LOSCFG_DEBUG_VERSION
|
||||
LosVmSpace *space = NULL;
|
||||
VADDR_T vaddr;
|
||||
#ifdef LOSCFG_BLACKBOX
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
SetExcInfoIndex(0);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
/* You are not allowed to add any other print information before this exception information */
|
||||
if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) {
|
||||
#ifdef LOSCFG_DEBUG_VERSION
|
||||
vaddr = ROUNDDOWN(far, PAGE_SIZE);
|
||||
space = LOS_SpaceGet(vaddr);
|
||||
VADDR_T vaddr = ROUNDDOWN(far, PAGE_SIZE);
|
||||
LosVmSpace *space = LOS_SpaceGet(vaddr);
|
||||
if (space != NULL) {
|
||||
LOS_DumpMemRegion(vaddr);
|
||||
}
|
||||
#endif
|
||||
PrintExcInfo("##################excFrom: User!####################\n");
|
||||
} else {
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
PrintExcInfo("##################excFrom: kernel!###################\n");
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
STATIC VOID OsSysStateSave(UINT32 *intCount, UINT32 *lockCount)
|
||||
{
|
||||
*intCount = g_intCount[ArchCurrCpuid()];
|
||||
*lockCount = OsPercpuGet()->taskLockCnt;
|
||||
g_intCount[ArchCurrCpuid()] = 0;
|
||||
OsPercpuGet()->taskLockCnt = 0;
|
||||
}
|
||||
|
||||
STATIC VOID OsSysStateRestore(UINT32 intCount, UINT32 lockCount)
|
||||
{
|
||||
g_intCount[ArchCurrCpuid()] = intCount;
|
||||
OsPercpuGet()->taskLockCnt = lockCount;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Description : EXC handler entry
|
||||
* Input : excType --- exc type
|
||||
@@ -1044,6 +1113,11 @@ LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far)
|
||||
*/
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAddr, UINT32 far, UINT32 fsr)
|
||||
{
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
UINT32 intCount;
|
||||
UINT32 lockCount;
|
||||
#endif
|
||||
|
||||
/* Task scheduling is not allowed during exception handling */
|
||||
OsPercpuGet()->taskLockCnt++;
|
||||
|
||||
@@ -1053,22 +1127,24 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
|
||||
|
||||
OsPrintExcHead(far);
|
||||
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
OsAllCpuStatusOutput();
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_SHELL_EXCINFO
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
log_read_write_fn func = GetExcInfoRW();
|
||||
#endif
|
||||
|
||||
if (g_excHook != NULL) {
|
||||
if (g_curNestCount[ArchCurrCpuid()] == 1) {
|
||||
#ifdef LOSCFG_SHELL_EXCINFO
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
if (func != NULL) {
|
||||
#ifndef LOSCFG_BLACKBOX
|
||||
SetExcInfoIndex(0);
|
||||
g_intCount[ArchCurrCpuid()] = 0;
|
||||
#endif
|
||||
OsSysStateSave(&intCount, &lockCount);
|
||||
OsRecordExcInfoTime();
|
||||
g_intCount[ArchCurrCpuid()] = 1;
|
||||
OsSysStateRestore(intCount, lockCount);
|
||||
}
|
||||
#endif
|
||||
g_excHook(excType, excBufAddr, far, fsr);
|
||||
@@ -1076,18 +1152,15 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
|
||||
OsCallStackInfo();
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_SHELL_EXCINFO
|
||||
#ifdef LOSCFG_SAVE_EXCINFO
|
||||
if (func != NULL) {
|
||||
PrintExcInfo("Be sure flash space bigger than GetExcInfoIndex():0x%x\n", GetExcInfoIndex());
|
||||
g_intCount[ArchCurrCpuid()] = 0;
|
||||
OsSysStateSave(&intCount, &lockCount);
|
||||
func(GetRecordAddr(), GetRecordSpace(), 0, GetExcInfoBuf());
|
||||
g_intCount[ArchCurrCpuid()] = 1;
|
||||
OsSysStateRestore(intCount, lockCount);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#ifdef LOSCFG_EXC_INTERACTION
|
||||
OsExcInteractionTaskKeep();
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_SHELL_CMD_DEBUG
|
||||
SystemRebootFunc rebootHook = OsGetRebootHook();
|
||||
@@ -1097,6 +1170,9 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_BLACKBOX
|
||||
BBoxNotifyError(EVENT_PANIC, MODULE_SYSTEM, "Crash in kernel", 1);
|
||||
#endif
|
||||
while (1) {}
|
||||
}
|
||||
|
||||
@@ -1107,10 +1183,11 @@ __attribute__((noinline)) VOID LOS_Panic(const CHAR *fmt, ...)
|
||||
UartVprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
__asm__ __volatile__("swi 0");
|
||||
while (1);
|
||||
}
|
||||
|
||||
/* stack protector */
|
||||
UINT32 __stack_chk_guard = 0xd00a0dff;
|
||||
USED UINT32 __stack_chk_guard = 0xd00a0dff;
|
||||
|
||||
VOID __stack_chk_fail(VOID)
|
||||
{
|
||||
@@ -1142,7 +1219,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou
|
||||
framePtr = Get_Fp();
|
||||
while ((framePtr > stackStart) && (framePtr < stackEnd) && IS_ALIGNED(framePtr, sizeof(CHAR *))) {
|
||||
tmpFramePtr = framePtr;
|
||||
#ifdef LOSCFG_COMPILER_CLANG_LLVM
|
||||
linkReg = *(UINTPTR *)(tmpFramePtr + sizeof(UINTPTR));
|
||||
#else
|
||||
linkReg = *(UINTPTR *)framePtr;
|
||||
#endif
|
||||
if (index >= jumpCount) {
|
||||
LR[count++] = linkReg;
|
||||
if (count == recordCount) {
|
||||
@@ -1150,7 +1231,11 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou
|
||||
}
|
||||
}
|
||||
index++;
|
||||
#ifdef LOSCFG_COMPILER_CLANG_LLVM
|
||||
framePtr = *(UINTPTR *)framePtr;
|
||||
#else
|
||||
framePtr = *(UINTPTR *)(tmpFramePtr - sizeof(UINTPTR));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* if linkReg is not enough,clean up the last of the effective LR as the end. */
|
||||
@@ -1159,8 +1244,3 @@ VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCou
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
86
arch/arm/arm/src/los_hw.c
Executable file → Normal file
86
arch/arm/arm/src/los_hw.c
Executable file → Normal file
@@ -32,12 +32,6 @@
|
||||
#include "los_hw_pri.h"
|
||||
#include "los_task_pri.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* support cpu vendors */
|
||||
CpuVendor g_cpuTable[] = {
|
||||
/* armv7-a */
|
||||
@@ -77,13 +71,10 @@ VOID OsTaskEntrySetupLoopFrame(UINT32 arg0)
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOID *topStack, BOOL initFlag)
|
||||
{
|
||||
UINT32 index = 1;
|
||||
TaskContext *taskContext = NULL;
|
||||
|
||||
if (initFlag == TRUE) {
|
||||
OsStackInit(topStack, stackSize);
|
||||
}
|
||||
taskContext = (TaskContext *)(((UINTPTR)topStack + stackSize) - sizeof(TaskContext));
|
||||
TaskContext *taskContext = (TaskContext *)(((UINTPTR)topStack + stackSize) - sizeof(TaskContext));
|
||||
|
||||
/* initialize the task context */
|
||||
#ifdef LOSCFG_GDB
|
||||
@@ -92,22 +83,17 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOI
|
||||
taskContext->PC = (UINTPTR)OsTaskEntry;
|
||||
#endif
|
||||
taskContext->LR = (UINTPTR)OsTaskExit; /* LR should be kept, to distinguish it's THUMB or ARM instruction */
|
||||
taskContext->resved = 0x0;
|
||||
taskContext->R[0] = taskID; /* R0 */
|
||||
taskContext->R[index++] = 0x01010101; /* R1, 0x01010101 : reg initialed magic word */
|
||||
for (; index < GEN_REGS_NUM; index++) {
|
||||
taskContext->R[index] = taskContext->R[index - 1] + taskContext->R[1]; /* R2 - R12 */
|
||||
}
|
||||
taskContext->R0 = taskID; /* R0 */
|
||||
|
||||
#ifdef LOSCFG_INTERWORK_THUMB
|
||||
taskContext->regPSR = PSR_MODE_SVC_THUMB; /* CPSR (Enable IRQ and FIQ interrupts, THUMNB-mode) */
|
||||
#ifdef LOSCFG_THUMB
|
||||
taskContext->regCPSR = PSR_MODE_SVC_THUMB; /* CPSR (Enable IRQ and FIQ interrupts, THUMNB-mode) */
|
||||
#else
|
||||
taskContext->regPSR = PSR_MODE_SVC_ARM; /* CPSR (Enable IRQ and FIQ interrupts, ARM-mode) */
|
||||
taskContext->regCPSR = PSR_MODE_SVC_ARM; /* CPSR (Enable IRQ and FIQ interrupts, ARM-mode) */
|
||||
#endif
|
||||
|
||||
#if !defined(LOSCFG_ARCH_FPU_DISABLE)
|
||||
/* 0xAAA0000000000000LL : float reg initialed magic word */
|
||||
for (index = 0; index < FP_REGS_NUM; index++) {
|
||||
for (UINT32 index = 0; index < FP_REGS_NUM; index++) {
|
||||
taskContext->D[index] = 0xAAA0000000000000LL + index; /* D0 - D31 */
|
||||
}
|
||||
taskContext->regFPSCR = 0;
|
||||
@@ -117,58 +103,57 @@ LITE_OS_SEC_TEXT_INIT VOID *OsTaskStackInit(UINT32 taskID, UINT32 stackSize, VOI
|
||||
return (VOID *)taskContext;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT VOID OsUserCloneParentStack(LosTaskCB *childTaskCB, LosTaskCB *parentTaskCB)
|
||||
LITE_OS_SEC_TEXT VOID OsUserCloneParentStack(VOID *childStack, UINTPTR parentTopOfStack, UINT32 parentStackSize)
|
||||
{
|
||||
TaskContext *context = (TaskContext *)childTaskCB->stackPointer;
|
||||
VOID *cloneStack = (VOID *)(((UINTPTR)parentTaskCB->topOfStack + parentTaskCB->stackSize) - sizeof(TaskContext));
|
||||
LosTaskCB *task = OsCurrTaskGet();
|
||||
sig_cb *sigcb = &task->sig;
|
||||
VOID *cloneStack = NULL;
|
||||
|
||||
LOS_ASSERT(parentTaskCB->taskStatus & OS_TASK_STATUS_RUNNING);
|
||||
if (sigcb->sigContext != NULL) {
|
||||
cloneStack = (VOID *)((UINTPTR)sigcb->sigContext - sizeof(TaskContext));
|
||||
} else {
|
||||
cloneStack = (VOID *)(((UINTPTR)parentTopOfStack + parentStackSize) - sizeof(TaskContext));
|
||||
}
|
||||
|
||||
(VOID)memcpy_s(childTaskCB->stackPointer, sizeof(TaskContext), cloneStack, sizeof(TaskContext));
|
||||
context->R[0] = 0;
|
||||
(VOID)memcpy_s(childStack, sizeof(TaskContext), cloneStack, sizeof(TaskContext));
|
||||
((TaskContext *)childStack)->R0 = 0;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsUserTaskStackInit(TaskContext *context, TSK_ENTRY_FUNC taskEntry, UINTPTR stack)
|
||||
LITE_OS_SEC_TEXT_INIT VOID OsUserTaskStackInit(TaskContext *context, UINTPTR taskEntry, UINTPTR stack)
|
||||
{
|
||||
LOS_ASSERT(context != NULL);
|
||||
|
||||
#ifdef LOSCFG_INTERWORK_THUMB
|
||||
context->regPSR = PSR_MODE_USR_THUMB;
|
||||
#ifdef LOSCFG_THUMB
|
||||
context->regCPSR = PSR_MODE_USR_THUMB;
|
||||
#else
|
||||
context->regPSR = PSR_MODE_USR_ARM;
|
||||
context->regCPSR = PSR_MODE_USR_ARM;
|
||||
#endif
|
||||
context->R[0] = stack;
|
||||
context->SP = TRUNCATE(stack, LOSCFG_STACK_POINT_ALIGN_SIZE);
|
||||
context->LR = 0;
|
||||
context->R0 = stack;
|
||||
context->USP = TRUNCATE(stack, LOSCFG_STACK_POINT_ALIGN_SIZE);
|
||||
context->ULR = 0;
|
||||
context->PC = (UINTPTR)taskEntry;
|
||||
}
|
||||
|
||||
VOID Sev(VOID)
|
||||
VOID OsInitSignalContext(const VOID *sp, VOID *signalContext, UINTPTR sigHandler, UINT32 signo, UINT32 param)
|
||||
{
|
||||
__asm__ __volatile__ ("sev" : : : "memory");
|
||||
IrqContext *newSp = (IrqContext *)signalContext;
|
||||
(VOID)memcpy_s(signalContext, sizeof(IrqContext), sp, sizeof(IrqContext));
|
||||
newSp->PC = sigHandler;
|
||||
newSp->R0 = signo;
|
||||
newSp->R1 = param;
|
||||
}
|
||||
|
||||
VOID Wfe(VOID)
|
||||
{
|
||||
__asm__ __volatile__ ("wfe" : : : "memory");
|
||||
}
|
||||
|
||||
VOID Wfi(VOID)
|
||||
{
|
||||
__asm__ __volatile__ ("wfi" : : : "memory");
|
||||
}
|
||||
|
||||
VOID Dmb(VOID)
|
||||
DEPRECATED VOID Dmb(VOID)
|
||||
{
|
||||
__asm__ __volatile__ ("dmb" : : : "memory");
|
||||
}
|
||||
|
||||
VOID Dsb(VOID)
|
||||
DEPRECATED VOID Dsb(VOID)
|
||||
{
|
||||
__asm__ __volatile__("dsb" : : : "memory");
|
||||
}
|
||||
|
||||
VOID Isb(VOID)
|
||||
DEPRECATED VOID Isb(VOID)
|
||||
{
|
||||
__asm__ __volatile__("isb" : : : "memory");
|
||||
}
|
||||
@@ -192,8 +177,3 @@ VOID DCacheInvRange(UINT32 start, UINT32 end)
|
||||
arm_inv_cache_range(start, end);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
295
arch/arm/arm/src/los_hw_exc.S
Executable file → Normal file
295
arch/arm/arm/src/los_hw_exc.S
Executable file → Normal file
@@ -47,9 +47,10 @@
|
||||
.extern OsDataAbortExcHandleEntry
|
||||
#endif
|
||||
#endif
|
||||
.extern OsSaveSignalContext
|
||||
.extern OsRestorSignalContext
|
||||
.extern OsArmSharedPageFault
|
||||
.extern OsArmA32SyscallHandle
|
||||
.extern LOS_Exit
|
||||
|
||||
.global _osExceptFiqHdl
|
||||
.global _osExceptAddrAbortHdl
|
||||
@@ -63,7 +64,6 @@
|
||||
.global __stack_chk_guard_setup
|
||||
#endif
|
||||
|
||||
|
||||
.fpu vfpv4
|
||||
|
||||
.macro PUSH_FPU_REGS reg1
|
||||
@@ -173,67 +173,77 @@ _osExceptUndefInstrHdl:
|
||||
#ifdef LOSCFG_GDB
|
||||
GDB_HANDLE OsUndefIncExcHandleEntry
|
||||
#else
|
||||
@ LR offset to return from this exception: 0.
|
||||
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
|
||||
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
|
||||
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
|
||||
STMFD SP!, {R0-R3, R12, LR}
|
||||
STMFD SP, {R13, R14}^ @ push user sp and lr
|
||||
SUB SP, SP, #(2 * 4)
|
||||
MOV R2, #0
|
||||
MOV R3, #0
|
||||
STMFD SP!, {R2-R3} @ far and fsr fields, are 0 under this anomaly
|
||||
STMFD SP!, {R4-R11}
|
||||
|
||||
MOV R0, #OS_EXCEPT_UNDEF_INSTR @ Set exception ID to OS_EXCEPT_UNDEF_INSTR.
|
||||
|
||||
B _osExceptDispatch @ Branch to global exception handler.
|
||||
|
||||
#endif
|
||||
|
||||
@ Description: Software interrupt exception handler
|
||||
_osExceptSwiHdl:
|
||||
SUB SP, SP, #(4 * 16)
|
||||
STMIA SP, {R0-R12}
|
||||
MRS R3, SPSR
|
||||
MOV R4, LR
|
||||
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
|
||||
STMFD SP!, {R0-R3, R12, LR}
|
||||
STMFD SP, {R13, R14}^
|
||||
SUB SP, SP, #(4 * 4) @ push user sp and lr and jump reserved field
|
||||
STR R7, [SP, #0] @ Save system call number to reserved2 filed
|
||||
|
||||
AND R1, R3, #CPSR_MASK_MODE @ Interrupted mode
|
||||
CMP R1, #CPSR_USER_MODE @ User mode
|
||||
BNE OsKernelSVCHandler @ Branch if not user mode
|
||||
#ifdef LOSCFG_KERNEL_SYSCALL
|
||||
LDR R3, [SP, #(11 * 4)]
|
||||
AND R1, R3, #CPSR_MASK_MODE @ Interrupted mode
|
||||
CMP R1, #CPSR_USER_MODE @ User mode
|
||||
BNE _osKernelSVCHandler @ Branch if not user mode
|
||||
|
||||
@ we enter from user mode, we need get the values of USER mode r13(sp) and r14(lr).
|
||||
@ stmia with ^ will return the user mode registers (provided that r15 is not in the register list).
|
||||
CMP R7, #119 @ __NR_sigreturn
|
||||
BNE _osIsSyscall
|
||||
MOV R0, SP
|
||||
STMFD SP!, {R3} @ Save the CPSR
|
||||
ADD R3, SP, #(4 * 17) @ Offset to pc/cpsr storage
|
||||
STMFD R3!, {R4} @ Save the CPSR and r15(pc)
|
||||
STMFD R3, {R13, R14}^ @ Save user mode r13(sp) and r14(lr)
|
||||
SUB SP, SP, #4
|
||||
BLX OsRestorSignalContext
|
||||
MOV SP, R0
|
||||
B _osSyscallReturn
|
||||
|
||||
_osIsSyscall:
|
||||
STMFD SP!, {R4-R11}
|
||||
|
||||
PUSH_FPU_REGS R1
|
||||
|
||||
MOV FP, #0 @ Init frame pointer
|
||||
MOV R0, SP
|
||||
MOV FP, #0 @ Init frame pointer
|
||||
CPSIE I
|
||||
BLX OsArmA32SyscallHandle
|
||||
CPSID I
|
||||
|
||||
POP_FPU_REGS R1
|
||||
ADD SP, SP,#4
|
||||
LDMFD SP!, {R3} @ Fetch the return SPSR
|
||||
MSR SPSR_cxsf, R3 @ Set the return mode SPSR
|
||||
LDMFD SP!, {R4-R11}
|
||||
|
||||
@ we are leaving to user mode, we need to restore the values of USER mode r13(sp) and r14(lr).
|
||||
@ ldmia with ^ will return the user mode registers (provided that r15 is not in the register list)
|
||||
MOV R0, SP
|
||||
SUB SP, SP, #(12 * 4) @ sp - sizeof(IrqContext), reserved for signal
|
||||
MOV R1, SP
|
||||
BLX OsSaveSignalContext
|
||||
MOV SP, R0
|
||||
|
||||
LDMFD SP!, {R0-R12}
|
||||
_osSyscallReturn:
|
||||
LDR R7, [SP, #0]
|
||||
ADD SP, SP, #(2 * 4) @ jump reserved filed
|
||||
LDMFD SP, {R13, R14}^ @ Restore user mode R13/R14
|
||||
ADD SP, SP, #(2 * 4)
|
||||
LDMFD SP!, {PC}^ @ Return to user
|
||||
|
||||
OsKernelSVCHandler:
|
||||
ADD R0, SP, #(4 * 16)
|
||||
MOV R5, R0
|
||||
STMFD R0!, {R4} @ Store PC
|
||||
STMFD R0!, {R4}
|
||||
STMFD R0!, {R5}
|
||||
|
||||
STMFD SP!, {R3} @ Push task`s CPSR (i.e. exception SPSR).
|
||||
SUB SP, SP, #(4 * 2) @ user sp and lr
|
||||
LDMFD SP!, {R0-R3, R12, LR}
|
||||
RFEIA SP! @ Return to user
|
||||
|
||||
_osKernelSVCHandler:
|
||||
#endif
|
||||
MOV R0, #0
|
||||
STR R0, [SP, #0]
|
||||
STR R0, [SP, #4]
|
||||
STMFD SP!, {R4-R11}
|
||||
MOV R0, #OS_EXCEPT_SWI @ Set exception ID to OS_EXCEPT_SWI.
|
||||
|
||||
B _osExceptionSwi @ Branch to global exception handler.
|
||||
B _osExceptDispatch @ Branch to global exception handler.
|
||||
|
||||
@ Description: Prefectch abort exception handler
|
||||
_osExceptPrefetchAbortHdl:
|
||||
@@ -243,18 +253,37 @@ _osExceptPrefetchAbortHdl:
|
||||
#endif
|
||||
#else
|
||||
SUB LR, LR, #4 @ LR offset to return from this exception: -4.
|
||||
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
|
||||
MOV R5, LR
|
||||
MRS R1, SPSR
|
||||
|
||||
MOV R0, #OS_EXCEPT_PREFETCH_ABORT @ Set exception ID to OS_EXCEPT_PREFETCH_ABORT.
|
||||
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
|
||||
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
|
||||
STMFD SP!, {R0-R3, R12, LR}
|
||||
STMFD SP, {R13, R14}^
|
||||
SUB SP, SP, #(2 * 4)
|
||||
|
||||
AND R4, R1, #CPSR_MASK_MODE @ Interrupted mode
|
||||
CMP R4, #CPSR_USER_MODE @ User mode
|
||||
BEQ _osExcPageFault @ Branch if user mode
|
||||
MRC P15, 0, R2, C6, C0, 2
|
||||
MRC P15, 0, R3, C5, C0, 1
|
||||
STMFD SP!, {R2-R3} @ Save far and fsr
|
||||
STMFD SP!, {R4-R11}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
LDR R0, [SP, #(19 * 4)]
|
||||
AND R0, R0, #CPSR_MASK_MODE @ Interrupted mode
|
||||
CMP R0, #CPSR_USER_MODE @ User mode
|
||||
BNE _osKernelExceptPrefetchAbortHdl
|
||||
|
||||
MOV R1, SP
|
||||
PUSH_FPU_REGS R0
|
||||
|
||||
MOV R0, #OS_EXCEPT_PREFETCH_ABORT
|
||||
BLX OsArmSharedPageFault
|
||||
CMP R0, #0
|
||||
|
||||
POP_FPU_REGS R0
|
||||
BEQ _osExcPageFaultReturn
|
||||
#endif
|
||||
|
||||
_osKernelExceptPrefetchAbortHdl:
|
||||
MOV LR, R5
|
||||
MOV R0, #OS_EXCEPT_PREFETCH_ABORT
|
||||
B _osExceptDispatch @ Branch to global exception handler.
|
||||
#endif
|
||||
|
||||
@@ -266,117 +295,104 @@ _osExceptDataAbortHdl:
|
||||
#endif
|
||||
#else
|
||||
SUB LR, LR, #8 @ LR offset to return from this exception: -8.
|
||||
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
|
||||
MOV R5, LR
|
||||
MRS R1, SPSR
|
||||
|
||||
MOV R0, #OS_EXCEPT_DATA_ABORT @ Set exception ID to OS_EXCEPT_DATA_ABORT.
|
||||
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
|
||||
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
|
||||
STMFD SP!, {R0-R3, R12, LR}
|
||||
STMFD SP, {R13, R14}^
|
||||
SUB SP, SP, #(2 * 4)
|
||||
|
||||
B _osExcPageFault
|
||||
MRC P15, 0, R2, C6, C0, 0
|
||||
MRC P15, 0, R3, C5, C0, 0
|
||||
STMFD SP!, {R2-R3} @ Save far and fsr
|
||||
STMFD SP!, {R4-R11}
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
MOV R1, SP
|
||||
PUSH_FPU_REGS R0
|
||||
|
||||
MOV R0, #OS_EXCEPT_DATA_ABORT @ Set exception ID to OS_EXCEPT_DATA_ABORT.
|
||||
BLX OsArmSharedPageFault
|
||||
CMP R0, #0
|
||||
POP_FPU_REGS R0
|
||||
BEQ _osExcPageFaultReturn
|
||||
#endif
|
||||
|
||||
MOV R0, #OS_EXCEPT_DATA_ABORT
|
||||
B _osExceptDispatch
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
_osExcPageFaultReturn:
|
||||
LDMFD SP!, {R4-R11}
|
||||
|
||||
MOV R0, SP
|
||||
STR R7, [SP, #0]
|
||||
SUB SP, SP, #(12 * 4) @ sp - sizeof(IrqContext), reserved for signal
|
||||
MOV R1, SP
|
||||
BLX OsSaveSignalContext
|
||||
MOV SP, R0
|
||||
|
||||
ADD SP, SP, #(2 * 4)
|
||||
LDMFD SP, {R13, R14}^
|
||||
ADD SP, SP, #(2 * 4) @ Jump reserved fileds
|
||||
LDMFD SP!, {R0-R3, R12, LR}
|
||||
RFEIA SP!
|
||||
#endif
|
||||
|
||||
@ Description: Address abort exception handler
|
||||
_osExceptAddrAbortHdl:
|
||||
SUB LR, LR, #8 @ LR offset to return from this exception: -8.
|
||||
STMFD SP, {R0-R7} @ Push working registers, but don`t change SP.
|
||||
|
||||
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
|
||||
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
|
||||
STMFD SP!, {R0-R3, R12, LR}
|
||||
STMFD SP, {R13, R14}^
|
||||
SUB SP, SP, #(2 * 4)
|
||||
|
||||
MOV R2, #0
|
||||
MOV R3, #0
|
||||
STMFD SP!, {R2-R3} @ far and fsr fields, are 0 under this anomaly
|
||||
STMFD SP!, {R4-R11}
|
||||
|
||||
MOV R0, #OS_EXCEPT_ADDR_ABORT @ Set exception ID to OS_EXCEPT_ADDR_ABORT.
|
||||
|
||||
B _osExceptDispatch @ Branch to global exception handler.
|
||||
|
||||
@ Description: Fast interrupt request exception handler
|
||||
_osExceptFiqHdl:
|
||||
SUB LR, LR, #4 @ LR offset to return from this exception: -4.
|
||||
STMFD SP, {R0-R7} @ Push working registers.
|
||||
|
||||
MOV R0, #OS_EXCEPT_FIQ @ Set exception ID to OS_EXCEPT_FIQ.
|
||||
SRSFD #CPSR_SVC_MODE! @ Save pc and cpsr to svc sp, ARMv6 and above support
|
||||
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to svc mode, and disable all interrupt
|
||||
STMFD SP!, {R0-R3, R12, LR}
|
||||
STMFD SP, {R13, R14}^
|
||||
SUB SP, SP, #(2 * 4)
|
||||
|
||||
B _osExceptDispatch @ Branch to global exception handler.
|
||||
|
||||
_osExcPageFault:
|
||||
SUB R3, SP, #(8 * 4) @ Save the start address of working registers.
|
||||
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to SVC mode, and disable all interrupts
|
||||
MOV R2, SP
|
||||
STMFD SP!, {R5} @ Push original PC
|
||||
STMFD SP!, {LR} @ Push original svc LR
|
||||
STMFD SP!, {R2} @ Push original svc SP
|
||||
STMFD SP!, {R8-R12} @ Push original R12-R8,
|
||||
LDMFD R3!, {R4-R11} @ Move original R7-R0 from exception stack to original stack.
|
||||
MOV R2, #0
|
||||
MOV R3, #0
|
||||
STMFD SP!, {R2-R3} @ far and fsr fields, are 0 under this anomaly
|
||||
STMFD SP!, {R4-R11}
|
||||
STMFD SP!, {R1}
|
||||
SUB SP, SP, #8
|
||||
STMIA SP, {R13, R14}^ @ Save user mode r13(sp) and r14(lr)
|
||||
|
||||
MOV R4, SP
|
||||
BIC SP, SP, #7
|
||||
PUSH_FPU_REGS R1
|
||||
|
||||
CMP R0, #OS_EXCEPT_DATA_ABORT
|
||||
BNE 1f
|
||||
MRC P15, 0, R2, C6, C0, 0
|
||||
MRC P15, 0, R3, C5, C0, 0
|
||||
B 2f
|
||||
1: MRC P15, 0, R2, C6, C0, 2
|
||||
MRC P15, 0, R3, C5, C0, 1
|
||||
|
||||
2: MOV R1, R4
|
||||
MOV R5, R0
|
||||
MOV R8, R2
|
||||
MOV R9, R3
|
||||
CPSIE I
|
||||
BLX OsArmSharedPageFault
|
||||
CPSID I
|
||||
|
||||
POP_FPU_REGS R1
|
||||
MOV SP, R4
|
||||
CMP R0, #0
|
||||
BEQ _OsExcReturn
|
||||
|
||||
MOV R0, R5 @ exc type
|
||||
B _osExceptionSwi
|
||||
|
||||
@ Description: Exception handler
|
||||
@ Parameter : R0 Exception Type
|
||||
@ Regs Hold : R3 Exception`s CPSR
|
||||
_osExceptDispatch:
|
||||
MRS R2, SPSR @ Save CPSR before exception.
|
||||
MOV R1, LR @ Save PC before exception.
|
||||
SUB R3, SP, #(8 * 4) @ Save the start address of working registers.
|
||||
LDR R8, [SP, #(8 * 4)] @ Get far
|
||||
LDR R9, [SP, #(9 * 4)] @ Get fsr
|
||||
|
||||
MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) @ Switch to SVC mode, and disable all interrupts
|
||||
MOV R5, SP
|
||||
EXC_SP_SET __exc_stack_top, OS_EXC_STACK_SIZE, R6, R7
|
||||
ADD R2, SP, #(20 * 4) @ sp + sizeof(ExcContext), position of SVC stack before exception
|
||||
STR R2, [SP, #(8 * 4)] @ Save svc sp
|
||||
|
||||
STMFD SP!, {R1} @ Push Exception PC
|
||||
STMFD SP!, {LR} @ Push SVC LR
|
||||
STMFD SP!, {R5} @ Push SVC SP
|
||||
STMFD SP!, {R8-R12} @ Push original R12-R8,
|
||||
LDMFD R3!, {R4-R11} @ Move original R7-R0 from exception stack to original stack.
|
||||
STMFD SP!, {R4-R11}
|
||||
STMFD SP!, {R2} @ Push task`s CPSR (i.e. exception SPSR).
|
||||
MOV R1, SP
|
||||
|
||||
CMP R0, #OS_EXCEPT_DATA_ABORT
|
||||
BNE 1f
|
||||
MRC P15, 0, R8, C6, C0, 0
|
||||
MRC P15, 0, R9, C5, C0, 0
|
||||
B 3f
|
||||
1: CMP R0, #OS_EXCEPT_PREFETCH_ABORT
|
||||
BNE 2f
|
||||
MRC P15, 0, R8, C6, C0, 2
|
||||
MRC P15, 0, R9, C5, C0, 1
|
||||
B 3f
|
||||
2: MOV R8, #0
|
||||
MOV R9, #0
|
||||
|
||||
3: AND R2, R2, #CPSR_MASK_MODE
|
||||
#ifdef LOSCFG_KERNEL_VM
|
||||
LDR R2, [SP, #(19 * 4)] @ Get CPSR
|
||||
AND R2, R2, #CPSR_MASK_MODE @ Interrupted mode
|
||||
CMP R2, #CPSR_USER_MODE @ User mode
|
||||
BNE 4f
|
||||
STMFD SP, {R13, R14}^ @ save user mode sp and lr
|
||||
4:
|
||||
SUB SP, SP, #(4 * 2)
|
||||
BEQ _osExceptionGetSP
|
||||
#endif
|
||||
|
||||
_osExceptionSwi:
|
||||
MOV R1, SP @ The second argument to the exception
|
||||
EXC_SP_SET __exc_stack_top, OS_EXC_STACK_SIZE, R6, R7
|
||||
|
||||
MRC P15, 0, R4, C0, C0, 5
|
||||
AND R4, R4, #MPIDR_CPUID_MASK @ Get Current cpu id
|
||||
@@ -405,19 +421,4 @@ _osExceptionGetSP:
|
||||
LDR R5, =OsExcHandleEntry @ OsExcHandleEntry(UINT32 excType, ExcContext * excBufAddr)
|
||||
BX R5
|
||||
|
||||
_OsExcReturn:
|
||||
LDR R0, [SP, #(2 * 4)]
|
||||
AND R0, R0, #CPSR_MASK_MODE
|
||||
CMP R0, #CPSR_USER_MODE @ User mode
|
||||
BNE _OsExcReturnToKernel
|
||||
LDMFD SP, {R13, R14}^ @ load user mode sp and lr
|
||||
|
||||
_OsExcReturnToKernel:
|
||||
ADD SP, SP, #(2 * 4)
|
||||
LDMFD SP!, {R1}
|
||||
MSR SPSR_cxsf, R1 @ Set the return mode SPSR
|
||||
LDMFD SP!, {R0-R12}
|
||||
ADD SP, SP, #4
|
||||
LDMFD SP!, {LR, PC}^
|
||||
|
||||
.end
|
||||
|
||||
@@ -32,11 +32,6 @@
|
||||
#include "los_sys_pri.h"
|
||||
#include "los_hwi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
LITE_OS_SEC_TEXT_INIT UINT32 OsTickInit(UINT32 systemClock, UINT32 tickPerSecond)
|
||||
{
|
||||
@@ -65,10 +60,8 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_GetCpuCycle(UINT32 *highCnt, UINT32 *lowCnt)
|
||||
|
||||
LITE_OS_SEC_TEXT_MINOR UINT64 LOS_CurrNanosec(VOID)
|
||||
{
|
||||
DOUBLE nanos;
|
||||
|
||||
nanos = (DOUBLE)HalClockGetCycles() * OS_SYS_NS_PER_SECOND / g_sysClock;
|
||||
return (UINT64)nanos;
|
||||
UINT64 cycle = HalClockGetCycles();
|
||||
return (cycle / g_sysClock) * OS_SYS_NS_PER_SECOND + (cycle % g_sysClock) * OS_SYS_NS_PER_SECOND / g_sysClock;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_MINOR VOID LOS_Udelay(UINT32 usecs)
|
||||
@@ -81,8 +74,3 @@ LITE_OS_SEC_TEXT_MINOR VOID LOS_Mdelay(UINT32 msecs)
|
||||
HalDelayUs(msecs * 1000); /* 1000 : 1ms = 1000us */
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
@@ -36,12 +36,7 @@
|
||||
#include "los_cpup_pri.h"
|
||||
#endif
|
||||
#include "los_sched_pri.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
#include "los_hook.h"
|
||||
|
||||
/* spinlock for hwi module, only available on SMP mode */
|
||||
LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_hwiSpin);
|
||||
@@ -89,7 +84,7 @@ VOID OsInterrupt(UINT32 intNum)
|
||||
#ifdef LOSCFG_CPUP_INCLUDE_IRQ
|
||||
OsCpupIrqStart();
|
||||
#endif
|
||||
|
||||
OsHookCall(LOS_HOOK_TYPE_ISR_ENTER, intNum);
|
||||
hwiForm = (&g_hwiForm[intNum]);
|
||||
#ifndef LOSCFG_NO_SHARED_IRQ
|
||||
while (hwiForm->pstNext != NULL) {
|
||||
@@ -112,6 +107,7 @@ VOID OsInterrupt(UINT32 intNum)
|
||||
#endif
|
||||
++g_hwiFormCnt[intNum];
|
||||
|
||||
OsHookCall(LOS_HOOK_TYPE_ISR_EXIT, intNum);
|
||||
#ifdef LOSCFG_CPUP_INCLUDE_IRQ
|
||||
OsCpupIrqEnd(intNum);
|
||||
#endif
|
||||
@@ -352,8 +348,3 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_HwiDelete(HWI_HANDLE_T hwiNum, HwiIrqParam *irq
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
106
arch/arm/arm/src/smp.c
Normal file
106
arch/arm/arm/src/smp.c
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
*
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "smp.h"
|
||||
#include "arch_config.h"
|
||||
#include "los_base.h"
|
||||
#include "los_hw.h"
|
||||
#include "los_atomic.h"
|
||||
#include "los_arch_mmu.h"
|
||||
#include "los_init_pri.h"
|
||||
#include "gic_common.h"
|
||||
#include "los_task_pri.h"
|
||||
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
|
||||
extern VOID reset_vector(VOID);
|
||||
|
||||
struct OsCpuInit {
|
||||
ArchCpuStartFunc cpuStart;
|
||||
VOID *arg;
|
||||
Atomic initFlag;
|
||||
};
|
||||
|
||||
STATIC struct OsCpuInit g_cpuInit[CORE_NUM - 1] = {0};
|
||||
|
||||
VOID HalArchCpuOn(UINT32 cpuNum, ArchCpuStartFunc func, struct SmpOps *ops, VOID *arg)
|
||||
{
|
||||
struct OsCpuInit *cpuInit = &g_cpuInit[cpuNum - 1];
|
||||
UINTPTR startEntry = (UINTPTR)&reset_vector - KERNEL_VMM_BASE + SYS_MEM_BASE;
|
||||
INT32 ret = 0;
|
||||
|
||||
cpuInit->cpuStart = func;
|
||||
cpuInit->arg = arg;
|
||||
cpuInit->initFlag = 0;
|
||||
|
||||
DCacheFlushRange((UINTPTR)cpuInit, (UINTPTR)cpuInit + sizeof(struct OsCpuInit));
|
||||
|
||||
LOS_ASSERT(ops != NULL);
|
||||
|
||||
|
||||
ret = ops->SmpCpuOn(cpuNum, startEntry);
|
||||
if (ret < 0) {
|
||||
PRINT_ERR("cpu start failed, cpu num: %u, ret: %d\n", cpuNum, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
while (!LOS_AtomicRead(&cpuInit->initFlag)) {
|
||||
WFE;
|
||||
}
|
||||
}
|
||||
|
||||
VOID HalSecondaryCpuStart(VOID)
|
||||
{
|
||||
UINT32 cpuid = ArchCurrCpuid();
|
||||
struct OsCpuInit *cpuInit = &g_cpuInit[cpuid - 1];
|
||||
|
||||
OsCurrTaskSet(OsGetMainTask());
|
||||
|
||||
LOS_AtomicSet(&cpuInit->initFlag, 1);
|
||||
SEV;
|
||||
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
OsArchMmuInitPerCPU();
|
||||
#endif
|
||||
|
||||
/* store each core's hwid */
|
||||
CPU_MAP_SET(cpuid, OsHwIDGet());
|
||||
HalIrqInitPercpu();
|
||||
OsInitCall(LOS_INIT_LEVEL_ARCH);
|
||||
|
||||
cpuInit->cpuStart(cpuInit->arg);
|
||||
|
||||
while (1) {
|
||||
WFI;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
138
arch/arm/arm/src/startup/reset_vector_mp.S
Executable file → Normal file
138
arch/arm/arm/src/startup/reset_vector_mp.S
Executable file → Normal file
@@ -28,6 +28,7 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#define ASSEMBLY
|
||||
#include "arch_config.h"
|
||||
#include "los_vm_boot.h"
|
||||
@@ -37,17 +38,9 @@
|
||||
|
||||
|
||||
.global __exc_stack_top
|
||||
.global __irq_stack_top
|
||||
.global __fiq_stack_top
|
||||
.global __svc_stack_top
|
||||
.global __abt_stack_top
|
||||
.global __undef_stack_top
|
||||
.global __exc_stack
|
||||
.global __irq_stack
|
||||
.global __fiq_stack
|
||||
.global __svc_stack
|
||||
.global __abt_stack
|
||||
.global __undef_stack
|
||||
|
||||
.extern __bss_start
|
||||
.extern __bss_end
|
||||
@@ -62,10 +55,14 @@
|
||||
.extern __stack_chk_guard_setup
|
||||
.extern g_firstPageTable
|
||||
.extern g_mmuJumpPageTable
|
||||
.extern g_archMmuInitMapping
|
||||
.extern HalSecondaryCpuStart
|
||||
|
||||
.equ MPIDR_CPUID_MASK, 0xffU
|
||||
|
||||
.fpu vfpv4
|
||||
.fpu neon-vfpv4
|
||||
.syntax unified
|
||||
.arch armv7-a
|
||||
.arm
|
||||
|
||||
/* param0 is stack bottom, param1 is stack size, r12 hold cpu id */
|
||||
@@ -83,14 +80,6 @@
|
||||
bl excstack_magic
|
||||
.endm
|
||||
|
||||
/* param0 is physical address, param1 virtual address, param2 is sizes, param3 is flag */
|
||||
.macro PAGE_TABLE_SET param0, param1, param2, param3
|
||||
ldr r6, =\param0
|
||||
ldr r7, =\param1
|
||||
ldr r8, =\param2
|
||||
ldr r10, =\param3
|
||||
bl page_table_build
|
||||
.endm
|
||||
.code 32
|
||||
.section ".vectors","ax"
|
||||
|
||||
@@ -113,9 +102,9 @@ __exception_handlers:
|
||||
.global reset_vector
|
||||
.type reset_vector,function
|
||||
|
||||
#ifdef LOSCFG_QUICK_START
|
||||
#ifdef LOSCFG_BOOTENV_RAM
|
||||
__quickstart_args_start:
|
||||
.fill 512,1,0
|
||||
.fill LOSCFG_BOOTENV_RAMSIZE,1,0
|
||||
__quickstart_args_end:
|
||||
|
||||
.global OsGetArgsAddr
|
||||
@@ -182,19 +171,23 @@ reloc_img_to_bottom_loop:
|
||||
sub r11, r11, r12 /* r11: eventual address offset */
|
||||
|
||||
reloc_img_to_bottom_done:
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
ldr r4, =g_firstPageTable /* r4: physical address of translation table and clear it */
|
||||
add r4, r4, r11
|
||||
mov r0, r4
|
||||
mov r1, #0
|
||||
mov r2, #MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS
|
||||
bl memset
|
||||
|
||||
PAGE_TABLE_SET SYS_MEM_BASE, KERNEL_VMM_BASE, KERNEL_VMM_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS
|
||||
PAGE_TABLE_SET SYS_MEM_BASE, UNCACHED_VMM_BASE, UNCACHED_VMM_SIZE, MMU_INITIAL_MAP_NORMAL_NOCACHE
|
||||
PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_DEVICE_BASE, PERIPH_DEVICE_SIZE, MMU_INITIAL_MAP_DEVICE
|
||||
PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_CACHED_BASE, PERIPH_CACHED_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS
|
||||
PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_UNCACHED_BASE, PERIPH_UNCACHED_SIZE, MMU_INITIAL_MAP_STRONGLY_ORDERED
|
||||
bl memset_optimized /* optimized memset since r0 is 64-byte aligned */
|
||||
|
||||
ldr r5, =g_archMmuInitMapping
|
||||
add r5, r5, r11
|
||||
init_mmu_loop:
|
||||
ldmia r5!, {r6-r10} /* r6 = phys, r7 = virt, r8 = size, r9 = mmu_flags, r10 = name */
|
||||
cmp r8, 0 /* if size = 0, the mmu init done */
|
||||
beq init_mmu_done
|
||||
bl page_table_build
|
||||
b init_mmu_loop
|
||||
init_mmu_done:
|
||||
orr r8, r4, #MMU_TTBRx_FLAGS /* r8 = r4 and set cacheable attributes on translation walk */
|
||||
ldr r4, =g_mmuJumpPageTable /* r4: jump pagetable vaddr */
|
||||
add r4, r4, r11
|
||||
@@ -211,40 +204,17 @@ reloc_img_to_bottom_done:
|
||||
rsb r7, r11, r6, lsl #20 /* r7: va */
|
||||
str r12, [r4, r7, lsr #(20 - 2)] /* jumpTable[vaIndex] = pt entry */
|
||||
|
||||
bl _bootaddr_setup
|
||||
|
||||
bl mmu_setup /* set up the mmu */
|
||||
|
||||
#endif
|
||||
/* clear out the interrupt and exception stack and set magic num to check the overflow */
|
||||
ldr r0, =__undef_stack
|
||||
ldr r0, =__svc_stack
|
||||
ldr r1, =__exc_stack_top
|
||||
bl stack_init
|
||||
|
||||
STACK_MAGIC_SET __undef_stack, #OS_EXC_UNDEF_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
STACK_MAGIC_SET __abt_stack, #OS_EXC_ABT_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
STACK_MAGIC_SET __irq_stack, #OS_EXC_IRQ_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
STACK_MAGIC_SET __fiq_stack, #OS_EXC_FIQ_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
STACK_MAGIC_SET __svc_stack, #OS_EXC_SVC_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
STACK_MAGIC_SET __exc_stack, #OS_EXC_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
|
||||
warm_reset:
|
||||
/* initialize interrupt/exception environments */
|
||||
mov r0, #(CPSR_IRQ_DISABLE |CPSR_FIQ_DISABLE|CPSR_IRQ_MODE)
|
||||
msr cpsr, r0
|
||||
EXC_SP_SET __irq_stack_top, #OS_EXC_IRQ_STACK_SIZE
|
||||
|
||||
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_UNDEF_MODE)
|
||||
msr cpsr, r0
|
||||
EXC_SP_SET __undef_stack_top, #OS_EXC_UNDEF_STACK_SIZE
|
||||
|
||||
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_ABT_MODE)
|
||||
msr cpsr, r0
|
||||
EXC_SP_SET __abt_stack_top, #OS_EXC_ABT_STACK_SIZE
|
||||
|
||||
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_FIQ_MODE)
|
||||
msr cpsr, r0
|
||||
EXC_SP_SET __fiq_stack_top, #OS_EXC_FIQ_STACK_SIZE
|
||||
|
||||
/* initialize CPSR (machine state register) */
|
||||
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SVC_MODE)
|
||||
msr cpsr, r0
|
||||
@@ -292,7 +262,7 @@ clear_bss:
|
||||
|
||||
_start_hang:
|
||||
b _start_hang
|
||||
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
mmu_setup:
|
||||
mov r12, #0
|
||||
mcr p15, 0, r12, c8, c7, 0 /* Set c8 to control the TLB and set the mapping to invalid */
|
||||
@@ -328,7 +298,7 @@ mmu_setup:
|
||||
isb
|
||||
sub lr, r11 /* adjust lr with delta of physical address and virtual address */
|
||||
bx lr
|
||||
|
||||
#endif
|
||||
.code 32
|
||||
|
||||
.global reset_platform
|
||||
@@ -343,7 +313,9 @@ reset_platform:
|
||||
mov r0, #0
|
||||
mov pc, r0 // Jump to reset vector
|
||||
#endif
|
||||
|
||||
cpu_start:
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
ldr r4, =g_firstPageTable /* r4 = physical address of translation table and clear it */
|
||||
add r4, r4, r11
|
||||
orr r8, r4, #MMU_TTBRx_FLAGS
|
||||
@@ -354,7 +326,9 @@ cpu_start:
|
||||
add r4, r4, r11 /* r4 = tt_trampoline paddr */
|
||||
|
||||
bl mmu_setup
|
||||
bl secondary_cpu_start
|
||||
#endif
|
||||
|
||||
bl HalSecondaryCpuStart
|
||||
b .
|
||||
|
||||
secondary_cpu_init:
|
||||
@@ -392,10 +366,11 @@ sp_set:
|
||||
* r10: flags
|
||||
* r9 and r12 will be used as variable
|
||||
*/
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
page_table_build:
|
||||
mov r9, r6
|
||||
bfc r9, #20, #12 /* r9: pa % MB */
|
||||
add r8, r8, r9
|
||||
mov r10, r6
|
||||
bfc r10, #20, #12 /* r9: pa % MB */
|
||||
add r8, r8, r10
|
||||
add r8, r8, #(1 << 20)
|
||||
sub r8, r8, #1
|
||||
lsr r6, #20 /* r6 = physical address / MB */
|
||||
@@ -403,14 +378,14 @@ page_table_build:
|
||||
lsr r8, #20 /* r8 = roundup(size, MB) */
|
||||
|
||||
page_table_build_loop:
|
||||
orr r12, r10, r6, lsl #20 /* r12: flags | physAddr */
|
||||
orr r12, r9, r6, lsl #20 /* r12: flags | physAddr */
|
||||
str r12, [r4, r7, lsl #2] /* gPgTable[l1Index] = physAddr | flags */
|
||||
add r6, #1 /* physAddr+ */
|
||||
add r7, #1 /* l1Index++ */
|
||||
subs r8, #1 /* sizes-- */
|
||||
bne page_table_build_loop
|
||||
bx lr
|
||||
|
||||
#endif
|
||||
/*
|
||||
* init stack to initial value
|
||||
* r0 is stack mem start, r1 is stack mem end
|
||||
@@ -445,24 +420,19 @@ excstack_magic_loop:
|
||||
blt excstack_magic_loop
|
||||
bx lr
|
||||
|
||||
/*
|
||||
* 0xe51ff004 = "ldr pc, [pc, #-4]"
|
||||
* next addr value will be the real booting addr
|
||||
*/
|
||||
_bootaddr_setup:
|
||||
mov r0, #0
|
||||
ldr r1, =0xe51ff004
|
||||
str r1, [r0]
|
||||
|
||||
add r0, r0, #4
|
||||
ldr r1, =SYS_MEM_BASE
|
||||
str r1, [r0]
|
||||
|
||||
dsb
|
||||
isb
|
||||
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
memset_optimized:
|
||||
mov r3, r0
|
||||
vdup.8 q0, r1
|
||||
vmov q1, q0
|
||||
vmov q2, q0
|
||||
vmov q3, q0
|
||||
memset_optimized_loop:
|
||||
subs r2, #64
|
||||
vstmia r3!, {d0 - d7}
|
||||
bge memset_optimized_loop
|
||||
bx lr
|
||||
|
||||
#endif
|
||||
init_done:
|
||||
.long 0xDEADB00B
|
||||
|
||||
@@ -479,22 +449,6 @@ init_flag:
|
||||
.section ".int_stack", "wa", %nobits
|
||||
.align 3
|
||||
|
||||
__undef_stack:
|
||||
.space OS_EXC_UNDEF_STACK_SIZE * CORE_NUM
|
||||
__undef_stack_top:
|
||||
|
||||
__abt_stack:
|
||||
.space OS_EXC_ABT_STACK_SIZE * CORE_NUM
|
||||
__abt_stack_top:
|
||||
|
||||
__irq_stack:
|
||||
.space OS_EXC_IRQ_STACK_SIZE * CORE_NUM
|
||||
__irq_stack_top:
|
||||
|
||||
__fiq_stack:
|
||||
.space OS_EXC_FIQ_STACK_SIZE * CORE_NUM
|
||||
__fiq_stack_top:
|
||||
|
||||
__svc_stack:
|
||||
.space OS_EXC_SVC_STACK_SIZE * CORE_NUM
|
||||
__svc_stack_top:
|
||||
|
||||
132
arch/arm/arm/src/startup/reset_vector_up.S
Executable file → Normal file
132
arch/arm/arm/src/startup/reset_vector_up.S
Executable file → Normal file
@@ -38,17 +38,9 @@
|
||||
|
||||
|
||||
.global __exc_stack_top
|
||||
.global __irq_stack_top
|
||||
.global __fiq_stack_top
|
||||
.global __svc_stack_top
|
||||
.global __abt_stack_top
|
||||
.global __undef_stack_top
|
||||
.global __exc_stack
|
||||
.global __irq_stack
|
||||
.global __fiq_stack
|
||||
.global __svc_stack
|
||||
.global __abt_stack
|
||||
.global __undef_stack
|
||||
|
||||
.extern __bss_start
|
||||
.extern __bss_end
|
||||
@@ -62,10 +54,13 @@
|
||||
.extern __stack_chk_guard_setup
|
||||
.extern g_firstPageTable
|
||||
.extern g_mmuJumpPageTable
|
||||
.extern g_archMmuInitMapping
|
||||
|
||||
.equ MPIDR_CPUID_MASK, 0xffU
|
||||
|
||||
.fpu vfpv4
|
||||
.fpu neon-vfpv4
|
||||
.syntax unified
|
||||
.arch armv7-a
|
||||
.arm
|
||||
|
||||
/* param0 is stack bottom, param1 is stack size, r11 hold cpu id */
|
||||
@@ -83,14 +78,6 @@
|
||||
bl excstack_magic
|
||||
.endm
|
||||
|
||||
/* param0 is physical address, param1 virtual address, param2 is sizes, param3 is flag */
|
||||
.macro PAGE_TABLE_SET param0, param1, param2, param3
|
||||
ldr r6, =\param0
|
||||
ldr r7, =\param1
|
||||
ldr r8, =\param2
|
||||
ldr r10, =\param3
|
||||
bl page_table_build
|
||||
.endm
|
||||
.code 32
|
||||
.section ".vectors","ax"
|
||||
|
||||
@@ -159,20 +146,23 @@ reloc_img_to_bottom_loop:
|
||||
sub r11, r11, r12 /* r11: eventual address offset */
|
||||
|
||||
reloc_img_to_bottom_done:
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
ldr r4, =g_firstPageTable /* r4: physical address of translation table and clear it */
|
||||
add r4, r4, r11
|
||||
mov r0, r4
|
||||
mov r1, #0
|
||||
mov r2, #MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS
|
||||
bl memset
|
||||
|
||||
|
||||
PAGE_TABLE_SET SYS_MEM_BASE, KERNEL_VMM_BASE, KERNEL_VMM_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS
|
||||
PAGE_TABLE_SET SYS_MEM_BASE, UNCACHED_VMM_BASE, UNCACHED_VMM_SIZE, MMU_INITIAL_MAP_NORMAL_NOCACHE
|
||||
PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_DEVICE_BASE, PERIPH_DEVICE_SIZE, MMU_INITIAL_MAP_DEVICE
|
||||
PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_CACHED_BASE, PERIPH_CACHED_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS
|
||||
PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_UNCACHED_BASE, PERIPH_UNCACHED_SIZE, MMU_INITIAL_MAP_STRONGLY_ORDERED
|
||||
bl memset_optimized /* optimized memset since r0 is 64-byte aligned */
|
||||
|
||||
ldr r5, =g_archMmuInitMapping
|
||||
add r5, r5, r11
|
||||
init_mmu_loop:
|
||||
ldmia r5!, {r6-r10} /* r6 = phys, r7 = virt, r8 = size, r9 = mmu_flags, r10 = name */
|
||||
cmp r8, 0 /* if size = 0, the mmu init done */
|
||||
beq init_mmu_done
|
||||
bl page_table_build
|
||||
b init_mmu_loop
|
||||
init_mmu_done:
|
||||
orr r8, r4, #MMU_TTBRx_FLAGS /* r8 = r4 and set cacheable attributes on translation walk */
|
||||
ldr r4, =g_mmuJumpPageTable /* r4: jump pagetable vaddr */
|
||||
add r4, r4, r11
|
||||
@@ -190,7 +180,7 @@ reloc_img_to_bottom_done:
|
||||
str r12, [r4, r7, lsr #(20 - 2)] /* jumpTable[vaIndex] = pt entry */
|
||||
|
||||
bl mmu_setup /* set up the mmu */
|
||||
|
||||
#endif
|
||||
/* get cpuid and keep it in r11 */
|
||||
mrc p15, 0, r11, c0, c0, 5
|
||||
and r11, r11, #MPIDR_CPUID_MASK
|
||||
@@ -199,36 +189,15 @@ reloc_img_to_bottom_done:
|
||||
|
||||
excstatck_loop:
|
||||
/* clear out the interrupt and exception stack and set magic num to check the overflow */
|
||||
ldr r0, =__undef_stack
|
||||
ldr r0, =__svc_stack
|
||||
ldr r1, =__exc_stack_top
|
||||
bl stack_init
|
||||
|
||||
STACK_MAGIC_SET __undef_stack, #OS_EXC_UNDEF_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
STACK_MAGIC_SET __abt_stack, #OS_EXC_ABT_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
STACK_MAGIC_SET __irq_stack, #OS_EXC_IRQ_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
STACK_MAGIC_SET __fiq_stack, #OS_EXC_FIQ_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
STACK_MAGIC_SET __svc_stack, #OS_EXC_SVC_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
STACK_MAGIC_SET __exc_stack, #OS_EXC_STACK_SIZE, OS_STACK_MAGIC_WORD
|
||||
|
||||
excstatck_loop_done:
|
||||
warm_reset:
|
||||
/* initialize interrupt/exception environments */
|
||||
mov r0, #(CPSR_IRQ_DISABLE |CPSR_FIQ_DISABLE|CPSR_IRQ_MODE)
|
||||
msr cpsr, r0
|
||||
EXC_SP_SET __irq_stack_top, #OS_EXC_IRQ_STACK_SIZE
|
||||
|
||||
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_UNDEF_MODE)
|
||||
msr cpsr, r0
|
||||
EXC_SP_SET __undef_stack_top, #OS_EXC_UNDEF_STACK_SIZE
|
||||
|
||||
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_ABT_MODE)
|
||||
msr cpsr, r0
|
||||
EXC_SP_SET __abt_stack_top, #OS_EXC_ABT_STACK_SIZE
|
||||
|
||||
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_FIQ_MODE)
|
||||
msr cpsr, r0
|
||||
EXC_SP_SET __fiq_stack_top, #OS_EXC_FIQ_STACK_SIZE
|
||||
|
||||
/* initialize CPSR (machine state register) */
|
||||
mov r0, #(CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE|CPSR_SVC_MODE)
|
||||
msr cpsr, r0
|
||||
@@ -258,9 +227,6 @@ warm_reset:
|
||||
LDR r0, =__exception_handlers
|
||||
MCR p15, 0, r0, c12, c0, 0
|
||||
|
||||
cmp r11, #0
|
||||
bne cpu_start
|
||||
|
||||
clear_bss:
|
||||
ldr r0, =__bss_start
|
||||
ldr r2, =__bss_end
|
||||
@@ -285,6 +251,7 @@ clear_bss:
|
||||
_start_hang:
|
||||
b _start_hang
|
||||
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
mmu_setup:
|
||||
mov r12, #0
|
||||
mcr p15, 0, r12, c8, c7, 0 /* Set c8 to control the TLB and set the mapping to invalid */
|
||||
@@ -321,7 +288,7 @@ mmu_setup:
|
||||
|
||||
sub lr, r11 /* adjust lr with delta of physical address and virtual address */
|
||||
bx lr
|
||||
|
||||
#endif
|
||||
.code 32
|
||||
|
||||
.global reset_platform
|
||||
@@ -336,11 +303,6 @@ reset_platform:
|
||||
mov r0, #0
|
||||
mov pc, r0 // Jump to reset vector
|
||||
#endif
|
||||
cpu_start:
|
||||
bl secondary_cpu_start
|
||||
b .
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* set sp for current cpu
|
||||
@@ -360,10 +322,11 @@ sp_set:
|
||||
* r10: flags
|
||||
* r9 and r12 will be used as variable
|
||||
*/
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
page_table_build:
|
||||
mov r9, r6
|
||||
bfc r9, #20, #12 /* r9: pa % MB */
|
||||
add r8, r8, r9
|
||||
mov r10, r6
|
||||
bfc r10, #20, #12 /* r9: pa % MB */
|
||||
add r8, r8, r10
|
||||
add r8, r8, #(1 << 20)
|
||||
sub r8, r8, #1
|
||||
lsr r6, #20 /* r6 = physical address / MB */
|
||||
@@ -371,14 +334,14 @@ page_table_build:
|
||||
lsr r8, #20 /* r8 = roundup(size, MB) */
|
||||
|
||||
page_table_build_loop:
|
||||
orr r12, r10, r6, lsl #20 /* r12: flags | physAddr */
|
||||
orr r12, r9, r6, lsl #20 /* r12: flags | physAddr */
|
||||
str r12, [r4, r7, lsl #2] /* gPgTable[l1Index] = physAddr | flags */
|
||||
add r6, #1 /* physAddr+ */
|
||||
add r7, #1 /* l1Index++ */
|
||||
subs r8, #1 /* sizes-- */
|
||||
bne page_table_build_loop
|
||||
bx lr
|
||||
|
||||
#endif
|
||||
/*
|
||||
* init stack to initial value
|
||||
* r0 is stack mem start, r1 is stack mem end
|
||||
@@ -413,24 +376,19 @@ excstack_magic_loop:
|
||||
blt excstack_magic_loop
|
||||
bx lr
|
||||
|
||||
/*
|
||||
* 0xe51ff004 = "ldr pc, [pc, #-4]"
|
||||
* next addr value will be the real booting addr
|
||||
*/
|
||||
_bootaddr_setup:
|
||||
mov r0, #0
|
||||
ldr r1, =0xe51ff004
|
||||
str r1, [r0]
|
||||
|
||||
add r0, r0, #4
|
||||
ldr r1, =SYS_MEM_BASE
|
||||
str r1, [r0]
|
||||
|
||||
dsb
|
||||
isb
|
||||
|
||||
#ifdef LOSCFG_KERNEL_MMU
|
||||
memset_optimized:
|
||||
mov r3, r0
|
||||
vdup.8 q0, r1
|
||||
vmov q1, q0
|
||||
vmov q2, q0
|
||||
vmov q3, q0
|
||||
memset_optimized_loop:
|
||||
subs r2, #64
|
||||
vstmia r3!, {d0 - d7}
|
||||
bge memset_optimized_loop
|
||||
bx lr
|
||||
|
||||
#endif
|
||||
init_done:
|
||||
.long 0xDEADB00B
|
||||
|
||||
@@ -447,22 +405,6 @@ init_flag:
|
||||
.section ".int_stack", "wa", %nobits
|
||||
.align 3
|
||||
|
||||
__undef_stack:
|
||||
.space OS_EXC_UNDEF_STACK_SIZE * CORE_NUM
|
||||
__undef_stack_top:
|
||||
|
||||
__abt_stack:
|
||||
.space OS_EXC_ABT_STACK_SIZE * CORE_NUM
|
||||
__abt_stack_top:
|
||||
|
||||
__irq_stack:
|
||||
.space OS_EXC_IRQ_STACK_SIZE * CORE_NUM
|
||||
__irq_stack_top:
|
||||
|
||||
__fiq_stack:
|
||||
.space OS_EXC_FIQ_STACK_SIZE * CORE_NUM
|
||||
__fiq_stack_top:
|
||||
|
||||
__svc_stack:
|
||||
.space OS_EXC_SVC_STACK_SIZE * CORE_NUM
|
||||
__svc_stack_top:
|
||||
|
||||
12
arch/arm/arm/src/strncpy_from_user.c
Executable file → Normal file
12
arch/arm/arm/src/strncpy_from_user.c
Executable file → Normal file
@@ -33,11 +33,6 @@
|
||||
#include "los_user_get.h"
|
||||
#include "los_vm_map.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
INT32 LOS_StrncpyFromUser(CHAR *dst, const CHAR *src, INT32 count)
|
||||
{
|
||||
@@ -51,7 +46,7 @@ INT32 LOS_StrncpyFromUser(CHAR *dst, const CHAR *src, INT32 count)
|
||||
}
|
||||
|
||||
maxCount = (LOS_IsUserAddressRange((VADDR_T)(UINTPTR)src, (size_t)count)) ? \
|
||||
count : (USER_ASPACE_TOP_MAX - (UINTPTR)src);
|
||||
count : (INT32)(USER_ASPACE_TOP_MAX - (UINTPTR)src);
|
||||
|
||||
for (i = 0; i < maxCount; ++i) {
|
||||
if (LOS_GetUser(&character, src + offset) != LOS_OK) {
|
||||
@@ -67,8 +62,3 @@ INT32 LOS_StrncpyFromUser(CHAR *dst, const CHAR *src, INT32 count)
|
||||
return offset;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
10
arch/arm/arm/src/strnlen_user.c
Executable file → Normal file
10
arch/arm/arm/src/strnlen_user.c
Executable file → Normal file
@@ -33,11 +33,6 @@
|
||||
#include "los_user_get.h"
|
||||
#include "los_vm_map.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
INT32 LOS_StrnlenUser(const CHAR *src, INT32 count)
|
||||
{
|
||||
@@ -66,8 +61,3 @@ INT32 LOS_StrnlenUser(const CHAR *src, INT32 count)
|
||||
return count + 1;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
21
arch/arm/arm/src/user_copy.c
Executable file → Normal file
21
arch/arm/arm/src/user_copy.c
Executable file → Normal file
@@ -31,15 +31,11 @@
|
||||
|
||||
#include "user_copy.h"
|
||||
#include "arm_user_copy.h"
|
||||
#include "arm_user_clear.h"
|
||||
#include "securec.h"
|
||||
#include "los_memory.h"
|
||||
#include "los_vm_map.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
size_t arch_copy_from_user(void *dst, const void *src, size_t len)
|
||||
{
|
||||
@@ -101,22 +97,11 @@ INT32 LOS_UserMemClear(unsigned char *buf, UINT32 len)
|
||||
if (!LOS_IsUserAddressRange((vaddr_t)(UINTPTR)buf, len)) {
|
||||
(VOID)memset_s(buf, len, 0, len);
|
||||
} else {
|
||||
unsigned char *tmp = (unsigned char *)LOS_MemAlloc(OS_SYS_MEM_ADDR, len);
|
||||
if (tmp == NULL) {
|
||||
return -ENOMEM;
|
||||
if (_arm_clear_user(buf, len)) {
|
||||
return -EFAULT;
|
||||
}
|
||||
(VOID)memset_s(tmp, len, 0, len);
|
||||
if (_arm_user_copy(buf, tmp, len) != 0) {
|
||||
ret = -EFAULT;
|
||||
}
|
||||
LOS_MemFree(OS_SYS_MEM_ADDR, tmp);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
|
||||
41
arch/arm/gic/BUILD.gn
Normal file
41
arch/arm/gic/BUILD.gn
Normal file
@@ -0,0 +1,41 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
kernel_module(module_name) {
|
||||
sources = []
|
||||
|
||||
if (defined(LOSCFG_ARCH_GIC_V2)) {
|
||||
sources += [ "gic_v2.c" ]
|
||||
} else if (defined(LOSCFG_ARCH_GIC_V3)) {
|
||||
sources += [ "gic_v3.c" ]
|
||||
}
|
||||
}
|
||||
48
arch/arm/gic/Makefile
Normal file
48
arch/arm/gic/Makefile
Normal file
@@ -0,0 +1,48 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
include $(LITEOSTOPDIR)/config.mk
|
||||
|
||||
MODULE_NAME := $(notdir $(shell pwd))
|
||||
|
||||
# LOCAL_SRCS := $(wildcard *.c)
|
||||
|
||||
ifeq ($(LOSCFG_ARCH_GIC_V2), y)
|
||||
LOCAL_SRCS := gic_v2.c
|
||||
else ifeq ($(LOSCFG_ARCH_GIC_V3), y)
|
||||
LOCAL_SRCS := gic_v3.c
|
||||
endif
|
||||
|
||||
LOCAL_INCLUDE := \
|
||||
-I $(LITEOSTOPDIR)/kernel/base/include \
|
||||
-I $(LITEOSTOPDIR)/arch/arm/include \
|
||||
-I $(LITEOSTOPDIR)/arch/arm/arm/src/include \
|
||||
|
||||
LOCAL_FLAGS := $(LOCAL_INCLUDE)
|
||||
include $(MODULE)
|
||||
7
platform/hw/arm/interrupt/gic/gic_v2.c → arch/arm/gic/gic_v2.c
Executable file → Normal file
7
platform/hw/arm/interrupt/gic/gic_v2.c → arch/arm/gic/gic_v2.c
Executable file → Normal file
@@ -30,16 +30,17 @@
|
||||
*/
|
||||
|
||||
#include "gic_common.h"
|
||||
#include "los_hwi.h"
|
||||
#include "los_hwi_pri.h"
|
||||
#include "los_mp.h"
|
||||
|
||||
STATIC_ASSERT(OS_USER_HWI_MAX <= 1020, "hwi max is too large!");
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_BSP_GIC_V2
|
||||
#ifdef LOSCFG_ARCH_GIC_V2
|
||||
|
||||
STATIC UINT32 g_curIrqNum = 0;
|
||||
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
/*
|
||||
* filter description
|
||||
* 0b00: forward to the cpu interfaces specified in cpu_mask
|
||||
@@ -143,7 +144,7 @@ VOID HalIrqInit(VOID)
|
||||
/* enable gic distributor control */
|
||||
GIC_REG_32(GICD_CTLR) = 1;
|
||||
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
/* register inter-processor interrupt */
|
||||
(VOID)LOS_HwiCreate(LOS_MP_IPI_WAKEUP, 0xa0, 0, OsMpWakeHandler, 0);
|
||||
(VOID)LOS_HwiCreate(LOS_MP_IPI_SCHEDULE, 0xa0, 0, OsMpScheduleHandler, 0);
|
||||
7
platform/hw/arm/interrupt/gic/gic_v3.c → arch/arm/gic/gic_v3.c
Executable file → Normal file
7
platform/hw/arm/interrupt/gic/gic_v3.c → arch/arm/gic/gic_v3.c
Executable file → Normal file
@@ -32,10 +32,11 @@
|
||||
#include "gic_common.h"
|
||||
#include "gic_v3.h"
|
||||
#include "los_typedef.h"
|
||||
#include "los_hwi.h"
|
||||
#include "los_hwi_pri.h"
|
||||
#include "los_mp.h"
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_BSP_GIC_V3
|
||||
#ifdef LOSCFG_ARCH_GIC_V3
|
||||
|
||||
STATIC UINT32 g_curIrqNum = 0;
|
||||
|
||||
@@ -47,7 +48,7 @@ STATIC INLINE UINT64 MpidrToAffinity(UINT64 mpidr)
|
||||
(MPIDR_AFF_LEVEL(mpidr, 0)));
|
||||
}
|
||||
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
|
||||
STATIC UINT32 NextCpu(UINT32 cpu, UINT32 cpuMask)
|
||||
{
|
||||
@@ -398,7 +399,7 @@ VOID HalIrqInit(VOID)
|
||||
|
||||
HalIrqInitPercpu();
|
||||
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
/* register inter-processor interrupt */
|
||||
LOS_HwiCreate(LOS_MP_IPI_WAKEUP, 0xa0, 0, OsMpWakeHandler, 0);
|
||||
LOS_HwiCreate(LOS_MP_IPI_SCHEDULE, 0xa0, 0, OsMpScheduleHandler, 0);
|
||||
@@ -47,7 +47,7 @@ enum {
|
||||
#define GIC_REV_MASK 0xF0
|
||||
#define GIC_REV_OFFSET 0x4
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_BSP_GIC_V2
|
||||
#ifdef LOSCFG_ARCH_GIC_V2
|
||||
#define GICC_CTLR (GICC_OFFSET + 0x00) /* CPU Interface Control Register */
|
||||
#define GICC_PMR (GICC_OFFSET + 0x04) /* Interrupt Priority Mask Register */
|
||||
#define GICC_BPR (GICC_OFFSET + 0x08) /* Binary Point Register */
|
||||
@@ -76,7 +76,7 @@ enum {
|
||||
#define GICD_PIDR2V2 (GICD_OFFSET + 0xfe8)
|
||||
#define GICD_PIDR2V3 (GICD_OFFSET + 0xffe8)
|
||||
|
||||
#ifdef LOSCFG_PLATFORM_BSP_GIC_V3
|
||||
#ifdef LOSCFG_ARCH_GIC_V3
|
||||
#define GICD_IGRPMODR(n) (GICD_OFFSET + 0x0d00 + (n) * 4) /* Interrupt Group Mode Reisters */
|
||||
#define GICD_IROUTER(n) (GICD_OFFSET + 0x6000 + (n) * 8) /* Interrupt Rounter Reisters */
|
||||
#endif
|
||||
@@ -49,7 +49,7 @@ extern VOID HalIrqClear(UINT32 vector);
|
||||
extern CHAR *HalIrqVersion(VOID);
|
||||
extern UINT32 HalCurIrqGet(VOID);
|
||||
extern UINT32 HalIrqSetPrio(UINT32 vector, UINT8 priority);
|
||||
#if (LOSCFG_KERNEL_SMP == YES)
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
extern VOID HalIrqSendIpi(UINT32 target, UINT32 ipi);
|
||||
extern VOID HalIrqSetAffinity(UINT32 vector, UINT32 cpuMask);
|
||||
#endif
|
||||
0
arch/arm/include/in_cksum.h
Executable file → Normal file
0
arch/arm/include/in_cksum.h
Executable file → Normal file
29
arch/arm/include/los_exc.h
Executable file → Normal file
29
arch/arm/include/los_exc.h
Executable file → Normal file
@@ -63,26 +63,29 @@ typedef struct {
|
||||
UINT64 SPSR;
|
||||
} ExcContext;
|
||||
#else
|
||||
/* It has the same structure as TaskContext */
|
||||
typedef struct {
|
||||
UINT32 USP; /**< User mode stack pointer */
|
||||
UINT32 ULR; /**< User mode program returning address */
|
||||
UINT32 regCPSR; /**< Current program status register (CPSR) */
|
||||
UINT32 R4;
|
||||
UINT32 R5;
|
||||
UINT32 R6;
|
||||
UINT32 R7;
|
||||
UINT32 R8;
|
||||
UINT32 R9;
|
||||
UINT32 R10;
|
||||
UINT32 R11;
|
||||
|
||||
UINT32 SP; /**< svc sp */
|
||||
UINT32 reserved; /**< Reserved, multiplexing register */
|
||||
UINT32 USP;
|
||||
UINT32 ULR;
|
||||
UINT32 R0; /**< Register R0 */
|
||||
UINT32 R1; /**< Register R1 */
|
||||
UINT32 R2; /**< Register R2 */
|
||||
UINT32 R3; /**< Register R3 */
|
||||
UINT32 R4; /**< Register R4 */
|
||||
UINT32 R5; /**< Register R5 */
|
||||
UINT32 R6; /**< Register R6 */
|
||||
UINT32 R7; /**< Register R7 */
|
||||
UINT32 R8; /**< Register R8 */
|
||||
UINT32 R9; /**< Register R9 */
|
||||
UINT32 R10; /**< Register R10 */
|
||||
UINT32 R11; /**< Register R11 */
|
||||
UINT32 R12; /**< Register R12 */
|
||||
UINT32 SP; /**< Stack pointer */
|
||||
UINT32 LR; /**< Program returning address. */
|
||||
UINT32 PC; /**< PC pointer of the exceptional function */
|
||||
UINT32 regCPSR;
|
||||
} ExcContext;
|
||||
#endif
|
||||
|
||||
@@ -183,7 +186,7 @@ extern UINT32 LOS_ExcRegHook(EXC_PROC_FUNC excHook);
|
||||
* los_exc.h: the header file that contains the API declaration.
|
||||
* @see None.
|
||||
*/
|
||||
VOID LOS_Panic(const CHAR *fmt, ...);
|
||||
NORETURN VOID LOS_Panic(const CHAR *fmt, ...);
|
||||
|
||||
/**
|
||||
* @ingroup los_exc
|
||||
|
||||
128
arch/arm/include/los_hw.h
Executable file → Normal file
128
arch/arm/include/los_hw.h
Executable file → Normal file
@@ -77,134 +77,6 @@ extern UINT64 g_cpuMap[];
|
||||
#define CPU_MAP_GET(cpuid) g_cpuMap[(cpuid)]
|
||||
#define CPU_MAP_SET(cpuid, hwid) g_cpuMap[(cpuid)] = (hwid)
|
||||
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
* @brief Set Event.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to send an event to all cores within a muti-processor system.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>This API is not implemented.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval #None.
|
||||
*
|
||||
* @par Dependency:
|
||||
* los_hw.h: the header file that contains the API declaration.
|
||||
* @see wfe.
|
||||
*/
|
||||
extern VOID Sev(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
* @brief Wait for event.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to suspend execution until events occurs if the event register is not set.</li>
|
||||
* </ul>
|
||||
* @attention
|
||||
* <ul>
|
||||
* <li>This API is not implemented.</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval #None.
|
||||
*
|
||||
* @par Dependency:
|
||||
* los_hw.h: the header file that contains the API declaration.
|
||||
* @see sev.
|
||||
*/
|
||||
extern VOID Wfe(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
* @brief Wait for interrupt.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to suspend execution until interrupt or a debug request occurs.</li>
|
||||
* </ul>
|
||||
* @attention None.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval #None.
|
||||
*
|
||||
* @par Dependency:
|
||||
* los_hw.h: the header file that contains the API declaration.
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID Wfi(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
* @brief Data Memory Barrier.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used as a memory barrier</li>
|
||||
* </ul>
|
||||
* @attention None.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval #None.
|
||||
*
|
||||
* @par Dependency:
|
||||
* los_hw.h: the header file that contains the API declaration.
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID Dmb(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
* @brief Data Synchronization Barrier.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used as a special kind of memory barrier</li>
|
||||
* </ul>
|
||||
* @attention None.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval #None.
|
||||
*
|
||||
* @par Dependency:
|
||||
* los_hw.h: the header file that contains the API declaration.
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID Dsb(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
* @brief Instruction Synchronization Barrier.
|
||||
*
|
||||
* @par Description:
|
||||
* <ul>
|
||||
* <li>This API is used to flush the pipeline in the processor,
|
||||
* so that all instructions following the ISB are fetched from cache or memory,
|
||||
* after the instruction has been completed.</li>
|
||||
* </ul>
|
||||
* @attention None.
|
||||
*
|
||||
* @param None.
|
||||
*
|
||||
* @retval #None.
|
||||
*
|
||||
* @par Dependency:
|
||||
* los_hw.h: the header file that contains the API declaration.
|
||||
* @see None.
|
||||
*/
|
||||
extern VOID Isb(VOID);
|
||||
|
||||
/**
|
||||
* @ingroup los_hw
|
||||
* @brief Invalidate instruction cache.
|
||||
|
||||
0
arch/arm/include/los_hwi.h
Executable file → Normal file
0
arch/arm/include/los_hwi.h
Executable file → Normal file
0
arch/arm/include/los_strncpy_from_user.h
Executable file → Normal file
0
arch/arm/include/los_strncpy_from_user.h
Executable file → Normal file
0
arch/arm/include/los_strnlen_user.h
Executable file → Normal file
0
arch/arm/include/los_strnlen_user.h
Executable file → Normal file
@@ -44,19 +44,11 @@ extern "C" {
|
||||
extern UINTPTR __stack_startup;
|
||||
extern UINTPTR __stack_startup_top;
|
||||
#else
|
||||
extern UINTPTR __fiq_stack_top;
|
||||
extern UINTPTR __svc_stack_top;
|
||||
extern UINTPTR __abt_stack_top;
|
||||
extern UINTPTR __undef_stack_top;
|
||||
extern UINTPTR __exc_stack_top;
|
||||
extern UINTPTR __fiq_stack;
|
||||
extern UINTPTR __svc_stack;
|
||||
extern UINTPTR __abt_stack;
|
||||
extern UINTPTR __undef_stack;
|
||||
extern UINTPTR __exc_stack;
|
||||
#endif
|
||||
extern UINTPTR __irq_stack_top;
|
||||
extern UINTPTR __irq_stack;
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
|
||||
0
arch/arm/include/los_user_get.h
Executable file → Normal file
0
arch/arm/include/los_user_get.h
Executable file → Normal file
0
arch/arm/include/los_user_put.h
Executable file → Normal file
0
arch/arm/include/los_user_put.h
Executable file → Normal file
0
arch/arm/include/user_copy.h
Executable file → Normal file
0
arch/arm/include/user_copy.h
Executable file → Normal file
86
bsd/BUILD.gn
Normal file
86
bsd/BUILD.gn
Normal file
@@ -0,0 +1,86 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_COMPAT_BSD)
|
||||
module_name = "libbsd"
|
||||
kernel_module(module_name) {
|
||||
sources = [
|
||||
"kern/bus_if.c",
|
||||
"kern/device_if.c",
|
||||
"kern/kern_condvar.c",
|
||||
"kern/kern_timeout.c",
|
||||
"kern/subr_bus.c",
|
||||
"kern/subr_kobj.c",
|
||||
]
|
||||
|
||||
if (defined(LOSCFG_ARCH_ARM_AARCH32)) {
|
||||
sources += [
|
||||
"arm/autoconf.c",
|
||||
"arm/hw_user_copy.S",
|
||||
"arm/in_cksum.c",
|
||||
"arm/in_cksum_arm.S",
|
||||
"arm/nexus.c",
|
||||
]
|
||||
}
|
||||
|
||||
if (defined(LOSCFG_DRIVERS_RANDOM)) {
|
||||
sources += [
|
||||
"crypto/rijndael/rijndael-alg-fst.c",
|
||||
"crypto/rijndael/rijndael-api-fst.c",
|
||||
"crypto/sha2/sha256c.c",
|
||||
"dev/random/hash.c",
|
||||
"dev/random/yarrow.c",
|
||||
"libkern/explicit_bzero.c",
|
||||
]
|
||||
}
|
||||
|
||||
public_configs = [ ":public" ]
|
||||
}
|
||||
|
||||
group("bsd") {
|
||||
public_deps = [ ":$module_name" ]
|
||||
|
||||
deps = [
|
||||
"compat/linuxkpi",
|
||||
"dev/usb",
|
||||
]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [
|
||||
".",
|
||||
"kern",
|
||||
]
|
||||
configs = [
|
||||
"compat/linuxkpi:public",
|
||||
"dev/usb:public",
|
||||
]
|
||||
}
|
||||
8
bsd/Kconfig
Executable file → Normal file
8
bsd/Kconfig
Executable file → Normal file
@@ -1,6 +1,14 @@
|
||||
config COMPAT_BSD
|
||||
bool "Enable FreeBSD"
|
||||
default y
|
||||
select COMPAT_LINUXKPI
|
||||
|
||||
help
|
||||
Answer Y to enable LiteOS support FreeBSD.
|
||||
|
||||
config COMPAT_LINUXKPI
|
||||
bool "Enable linuxkpi" if COMPAT_BSD
|
||||
default y
|
||||
|
||||
help
|
||||
Answer Y to enable LiteOS support compatible layer for linuxkpi.
|
||||
|
||||
@@ -33,8 +33,8 @@ MODULE_NAME := $(notdir $(shell pwd))
|
||||
|
||||
LOCAL_SRCS := $(wildcard kern/*.c)
|
||||
|
||||
LOCAL_SRCS += $(wildcard $(LITEOS_ARCH_ARM)/*.c)
|
||||
LOCAL_SRCS += $(wildcard $(LITEOS_ARCH_ARM)/*.S)
|
||||
LOCAL_SRCS += $(wildcard $(ARCH)/*.c)
|
||||
LOCAL_SRCS += $(wildcard $(ARCH)/*.S)
|
||||
|
||||
ifeq ($(LOSCFG_DRIVERS_RANDOM), y)
|
||||
LOCAL_SRCS += $(wildcard crypto/rijndael/*.c) \
|
||||
|
||||
57
bsd/compat/linuxkpi/BUILD.gn
Normal file
57
bsd/compat/linuxkpi/BUILD.gn
Normal file
@@ -0,0 +1,57 @@
|
||||
# Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
|
||||
# Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without modification,
|
||||
# are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
# conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
# of conditions and the following disclaimer in the documentation and/or other materials
|
||||
# provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
# to endorse or promote products derived from this software without specific prior written
|
||||
# permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
import("//kernel/liteos_a/liteos.gni")
|
||||
|
||||
module_switch = defined(LOSCFG_COMPAT_BSD)
|
||||
module_name = get_path_info(rebase_path("."), "name")
|
||||
kernel_module(module_name) {
|
||||
sources = [
|
||||
"src/adp.c",
|
||||
"src/linux_completion.c",
|
||||
"src/linux_interrupt.c",
|
||||
"src/linux_sched.c",
|
||||
"src/linux_semaphore.c",
|
||||
"src/linux_timer.c",
|
||||
"src/linux_wakelock.c",
|
||||
"src/linux_workqueue.c",
|
||||
"src/prctl.c",
|
||||
"src/tzdst.c",
|
||||
]
|
||||
|
||||
if (defined(LOSCFG_HRTIMER_ENABLE)) {
|
||||
sources += [ "src/linux_hrtimer.c" ]
|
||||
}
|
||||
|
||||
public_configs = [ ":public" ]
|
||||
}
|
||||
|
||||
config("public") {
|
||||
include_dirs = [ "include" ]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user